Example 6.23 and 6.24 in YAML 1.2 spec dated 2009-07-21

Osamu TAKEUCHI <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Dear the YAML spec writers,

Regarding to the YAML 1.2 spec dated 2009-07-21:

I struggled for long time to reproduce example 6.23 and 6.24. 
because the rule for s-l+block-collection(n,c) requires 
intra-rule rewinding to accept them.

For instance, when s-l+block-collection(-1,block-in) try matching
to the input of the example 6.23, at first "!!str &a1" is reduced
by ( s-separate(n+1,c) c-ns-properties(n+1,c) )? and then 
s-l-comments fails to match. Usually, this results in the whole 
s-l+block-collection(n,c) fails to match. Here, however, it 
must also try the case "!!str &a1" is *skipped* by 
( s-separate(n+1,c) c-ns-properties(n+1,c) )? , in order to 
successfully accept the example by following l+block-mapping(-1).

I think it is clearer to have separated rules for the block 
collection with properties and that without properties.
The following is my suggestion.

s-l+block-collection(n,c) ::= s-l+block-collection-with-properties(n,c)
                            | s-l+block-collection-without-properties(n,c)

s-l+block-collection-with-properties(n,c) ::= 
             ( s-separate(n+1,c) c-ns-properties(n+1,c) )?
             s-l-comments
             s-l+block-collection-without-properties(n,c)

s-l+block-collection-without-properties(n,c) ::= 
                   l+block-sequence(seq-spaces(n,c)) 
                 | l+block-mapping(n) 

Osamu Takeuchi

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
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.