Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

PEG doesn't handle quoted key names per spec #21

Closed
othiym23 opened this issue Mar 21, 2015 · 2 comments
Closed

PEG doesn't handle quoted key names per spec #21

othiym23 opened this issue Mar 21, 2015 · 2 comments

Comments

@othiym23
Copy link

I'm sorry I keep coming up with these picayune edge cases, but these are all things I'm trying to handle in my TOML output stream, and the rules for TOML are considerably stricter than JSON in some ways, so I'm coming up with a bunch of output I can't round-trip through toml.

It's also possible that my reading of the spec is incorrect, although I think the way it deals with the quoted key with the dot in it is just wrong.

toml.parse('["the\\ key"]\n\none = "one"\ntwo = 2\nthree = false')
// => SyntaxError: Expected "]" but " " found.
toml.parse('[a."the\\ key"]\n\none = "one"\ntwo = 2\nthree = false')
// => SyntaxError: Expected "]" but " " found.
toml.parse('[a."the-key"]\n\none = "one"\ntwo = 2\nthree = false')
{ a: { '"the-key"': { one: 'one', two: 2, three: false } } }
toml.parse('[a."the.key"]\n\none = "one"\ntwo = 2\nthree = false')
{ a: { '"the': { 'key"': [Object] } } }
@BinaryMuse
Copy link
Owner

Sorry for the long delay on this. I've added support plus several test cases (including the ones above). It should be good to go in v2.3.0, released today.

@iarna
Copy link

iarna commented Jun 16, 2018

I'm... pretty sure this is contrary to the spec, I'll open a new issue…

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

No branches or pull requests

3 participants