Add support for integer bare keys
abirmkj opened this issue · comments
The TOML spec v0.4.0 allows using integers as bare keys when defining key-value pairs.
However, Nett throws an exception when parsing the following line from a sample TOML file:
1234 = "bare key value"
FYI
I worked around this by modifying Line #10 in the file KeyProduction.cs
:
Original:
if (tokens.TryExpect(TokenType.BareKey)) { return tokens.Consume().value; }
Modified:
if (tokens.TryExpect(TokenType.BareKey) || tokens.TryExpect(TokenType.Integer)) { return tokens.Consume().value; }
Thanks for reporting this issue.
This is something I forgot to implement (The bare key matcher has a comment that says the parser needs to handle that case... but the parser simply doesn't... )
The fix you provided is the correct way to fix it. I will extend your fix with a unit test and commit it.