Re: Draft 2008-04-06
Oren Ben-Kiki <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <1207760305.5445.111.camel@nero> |
Hmmm. Seems like a bug somewhere. I'll look into it. Nice catch!
Thanks for doing my spec review for me :-)
Oren.
On Mon, 2008-04-07 at 14:21 -0400, Brad Baxter wrote:
> Hello all,
>
> I don't know if these qualify as omissions, bugs, or just
> misunderstandings
> on my part. I was attempting to track down why ypaste (terrific tool)
> was
> not accepting this document:
>
> ---
> -1
> ...
>
> The spec says,
>
> 7.3.3. Plain Style
> ...
> Plain scalars must not begin with most indicators, as this would cause
> ambiguity with other YAML constructs. However, the ":", "?" and "-"
> indicators may be used as the first character if followed by a
> non-space character, as this causes no ambiguity.
> ...
>
> So I expected the above document to be okay. I started to experiment
> with
> the three stated indicators. The streams below demonstrate what I've
> found
> so far.
>
> This first stream shows that the colon indicator ':' seems to work as
> the spec
> states, i.e., it may be the first character of a plain scalar if the
> following
> character is not whitespace.
>
> ---
> # scalar value ':v'
> - :v
> ---
> # scalar value ':v'
> k: :v
> ---
> # scalar key ':k'
> :k:
> ---
> # scalar value ':s'
> :s
> ...
>
> The next two streams show that the hyphen '-' and question mark '?'
> indicators work as the spec states unless (apparently) they appear as
> the first non-whitespace character, um, somewhere other than where
> they do work--it's not quite clear to me where that is. (Obviously,
> below they are the first character on the line, but the next example
> demonstrates another location.)
>
> ---
> # scalar value '-v'
> - -v
> ---
> # scalar value '-v'
> k: -v
> ---
> # fails: expected scalar key '-k'
> -k:
> ---
> # fails: expected scalar value '-s'
> -s
> ...
>
> ---
> # scalar value '?v'
> - ?v
> ---
> # scalar value '?v'
> k: ?v
> ---
> # fails: expected scalar key '?k'
> ?k:
> ---
> # fails: expected scalar value '?s'
> ?s
> ...
>
> The next stream shows another location where similarly ':' is accepted
> as
> the first character, but '-' and '?' are not.
>
> ---
> # simple sample, i.e., [{key: value}]
> - key: value
> ---
> # scalar key ':key', i.e., [{':key': value}]
> - :key: value
> ---
> # fails: expected scalar key '-key'
> - -key: value
> ---
> # fails: expected scalar key '?key'
> - ?key: value
> ...
>
>
> Regards,
>
> -- Brad
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone