-
Notifications
You must be signed in to change notification settings - Fork 145
Commas seem optional in flow sequences - is this intended? #170
Copy link
Copy link
Open
Description
We noticed that:
new YamlReader("['a'b]").read();would parse without error, returning a list with 2 strings, "a" and "b".
Other parsers (pyyaml, SnakeYAML) fail on parsing this, due to expecting a comma between entries.
This YAML specification https://yaml.org/spec/1.2.2/#flow-sequences states:
Flow sequence content is denoted by surrounding “[” and “]” characters.
...
Sequence entries are separated by a “,” character.
I found it surpising that this library allowed it and thought it worth an issue for discussion.
Running a few more tests, it doesn't seem to always work - so I expect allowing the above is a subtle bug. e.g.
System.err.println(new YamlReader("['a'b]").read());
System.err.println(new YamlReader("[a b c d]").read());
System.err.println(new YamlReader("['a,b' c d]").read());
System.err.println(new YamlReader("['a'b'c'd]").read());outputs the following:
[a, b]
[a b c d]
[a,b, c d]
[a, b'c'd]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels