Skip to content

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

@othiym23

Description

@othiym23

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] } } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions