Re: : in the flow context for PyYAML and SnakeYAML
William Spitzak <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
Kirill Simonov wrote:
> On 08/25/2010 10:12 PM, William Spitzak wrote:
>> Kirill Simonov wrote:
>>
>>> By unquoted JSON, do you mean something like:
>>> {foo:"bar"}
>>
>> Yes, though
>> {foo: "bar"}
>> is probably a better example (note the space!)
>>
>>> This is definitely not a valid JSON and I'm certain most of the JSON
>>> parsers will fail to parse it.
>>
>> However there are a lot of pseudo-JSON parsers that *do* parse it,
>> including libyaml itself!
>
> A lot? Other than Javascript eval(), I'm not aware of any parser library
> that could parse it. Python's standard json.py module certainly cannot
> do it. Could you name some of the parsers, please?
libyaml!
>> {foo:http:baz: zoo}
>>
>> would be interpreted as:
>>
>> {"foo" : "http:baz: zoo")
>
> I see two problems with this definition.
>
> First, it complicates the YAML grammar even further by creating 3
> similar, but subtly different plain scalar styles. The YAML grammar is
> already complex enough, I'd prefer not to have it even more complex.
Fair enough.
> Second, it creates an ambiguity in the case:
> [foo:bar] (or even [foo: bar])
> which could be interpreted as
> ["foo:bar"]
> or as
> [{"foo": "bar"}]
> depending on whether you consider `foo: bar` a single value or a key:
> value pair.
A quick check shows that libyaml already accepts [foo: bar] and
interprets it as [{"foo": "bar"}] so this problem already exists and my
change would do nothing to make this harder or easier.
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d