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:
> Hi William,
> 
> If you take a look at the function yaml_parser_scan_plain_scalar, lines 
> 3424-3433, you'll see:
> 
> /* Check for 'x:x' in the flow context. TODO: Fix the test "spec-08-13". */
> 
> if (parser->flow_level
>         && CHECK(parser->buffer, ':')
>         && !IS_BLANKZ_AT(parser->buffer, 1)) {
>     yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
>             start_mark, "found unexpected ':'");
>     goto error;
> }
> 
> This condition is only checked in the flow context and it produces an 
> error if there is a colon followed by a non-whitespace character. 

You are right, my compiled version has that line commented out, as I had 
to fix it to read some JSON text. My personal opinion is that this MUST 
be changed. I had to fix it to read JSON output and I can't be the only 
one. There are VAST amounts of "unquoted" JSON out there, probably the 
majority! If YAML has any intention of being JSON-compatible it must fix 
this.

I have unfortunatly drifted away from YAML. I am using my patched 
version of the parser, but am not using any code for emitting it. 
Instead I wrote a much faster one which outputs YAML with "flow" turned 
on all the time, and with the ability to put newlines between the "flow" 
items. I quote everything containing any characters other than 
alphanumeric, period, underscore, +, or -.

I am increasingly of the belief that a correct format would be more like 
JSON with optional quoting, with the addition of "type" and the addition 
of cross-references. Currently I am persuing this, though I am following 
the YAML discussion in case something interesting comes up.


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