Re: Draft 2008-04-06
"Brad Baxter" <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
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
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core