Re: : in the flow context for PyYAML and SnakeYAML

Kirill Simonov <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
On 08/25/2010 11:29 PM, William Spitzak wrote:
> 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!

And that's it?  Hardly a lot.

>
>>>      {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.

The problem is that according to your proposal, this should be 
interpreted as ["foo: bar"] instead.


Thanks,
Kirill

------------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.