Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow question marks inside of plain scalars in flow collections #128

Open
perlpunk opened this issue Feb 3, 2018 · 1 comment
Open

Comments

@perlpunk
Copy link
Member

perlpunk commented Feb 3, 2018

See also yaml/libyaml#105

http://yaml.org/spec/1.1/#id907281
Question marks aren't mentioned as special inside of plain scalars here.
To be an indicator for an explicit key, it must be at the beginning and followed by a space or newline.

The following cases should be allowed:

[foo?bar]
[foo ? bar]

This would allow [ http://example/query?a=b ].

Even this one should be allowed, but it would potentially break existing code:

[?foo]
# same as
["?foo"]
# but currently parsed as
[? foo ]

The Spec:

The first plain character is further restricted to avoid most indicators as these
would cause ambiguity with various YAML structures. However, the first character
may be “-”, “?” or “:” provided it is followed by a non-space character.

[157] ns-plain-first-char(c) ::= ( ns-plain-char(c) - c-indicator )
                                 | ( ( “-” | “?” | “:” ) ns-plain-char(c) )
@ingydotnet
Copy link
Member

We should probably allow all of https://play.yaml.io/main/parser?input=LSBbZm9vP2Jhcl0KLSBbZm9vID8gYmFyXQotIFs_Zm9vIGJhcl0=
in libyaml and pyyaml

Even the breaking change as I can't see anyone actually depending on libyaml the way it currently is for [?foo]

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants