On Thu, 2007-05-10 at 13:59 -0700, Burt Harris wrote:
> The ypaste tool at http://dev.yaml.org is great. One experiment I tried:
> !foo !bar
> One: two
> Results surprise me, it seems to have parsed !foo and !bar both as properties
> of the mapping. I didn't think that was allowed under the current rules.
It isn't. I skipped the detailed productions there when I first did the
syntax - did list-of-property instead of (tag anchor?)|(anchor tag?) -
and forgot about fixing it before I uploaded everything. My bad, I'll
> I was expecting !bar to be tied One, rather than the mapping,
Actually... IMVHO this should be simply illegal (see below).
> which is what
> happened if I moved !bar to the next line:
> !bar One: two
Yes, here '!foo' applies to the mapping, and '!bar' to 'One', as one would expect.
> Finally, and most surprisingly, if I put it all on one line, I get an error:
> !foo !bar One: two
Hmmm. Interesting. I'll have to look into that!
A note about properties in general - the latest version of the spec
allows properties to be on a separate line from the node, e.g.:
It turns out this leads to all sort of ambiguities - take for example
So, to defuse this, the YamlReference productions insists that the
properties will be on the same line as the node so the above would
assign !foo to the mapping. To associate !foo with 'bar' you'd need to
!foo bar: baz
FWIW, for most of the time we worked on the spec we did not allow a line
break between a node's property and its content, and none of the
examples in the spec have the properties on a separate line. I'm not
certain what is the current status of the implementations though. So...
feedback on this is welcome!
I was going to cover this in the release notes for an updated spec,
compatible with the corrected productions, which I hope to put a solid
day's work on this weekend, but the issue already came up, we might as
well talk about it now.