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

Question regarding mistake in the grammar #23

Closed
andraantariksa opened this issue May 6, 2020 · 0 comments
Closed

Question regarding mistake in the grammar #23

andraantariksa opened this issue May 6, 2020 · 0 comments

Comments

@andraantariksa
Copy link
Contributor

There are some flaw on the library that are not following the TOML grammar rule. I have add some test from the TOML example and it's failed

# Bare keys may only contain ASCII letters, ASCII digits, underscores, and dashes (A-Za-z0-9_-). Note that bare keys are allowed to be composed of only ASCII digits, e.g. 1234, but are always interpreted as strings.
it_parses "123abc_- = 123", { "123abc_-" => 123 }
it_parses "-_123abc = 123", { "-_123abc" => 123 }

# Since v0.5.0
# Dotted keys are a sequence of bare or quoted keys joined with a dot. This allows for grouping similar properties together:
it_parses "physical.color = \"orange\"", { "physical" => { "color" => "orange" } }
it_parses "site.\"google.com\" = true", { "site" => { "google.com" => true } }

it_parses %(
    [dog."tater.man"]
    type.name = "pug"
    ),
    {"dog" => {"tater" => {"man" => {"type" => {"name" => "pug"}}}} }

It appears that the lexer read 123abc_- as 2 token, 123 as a number and abc_
as a key. And for the -_123abc, because the key started with character -, the lexer then expect the token as a negative number. I'd like to make a pull request to fix this issue.

Can you give me some pointers to fix this? I'm thinking to recreate some parts of the lexer and parser.

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

1 participant