-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
TOML Parser cannot parse inline arrays of inline tables #6394
Comments
Hi @mythmon , the current implementation of Deno std TOML parser is actually quite un-recursive, so you can expect to hit more errors especially with recursive values, such as However if you are looking for a workaround, you can import this TOML parser from import toml from "https://dev.jspm.io/toml"
console.log(toml.parse(`
points = [ { x = 1, y = 2, z = 3 },
{ x = 7, y = 8, z = 9 },
{ x = 2, y = 4, z = 8 } ]
`)) |
I'd be interested in taking a stab at this issue! |
@rfaulhaber I'll recommend porting https://github.com/BinaryMuse/toml-node to |
Actually I had a question with regards to porting that library. The parser in that library is generated through PEG.js. Should the PEG setup should also be ported? i.e. have some kind of build step to generate the resulting parser from the grammar? Or should I look for another solution? |
@rfaulhaber perhaps you can try rolling out a custom lexer and parser. |
@wongjiahau I just might! |
@rfaulhaber are you working on this? |
Unfortunately no not so much, been busy. |
Are you cool with me grabbing it? |
Go for it! |
@JayHelton are you actively working on this issue? If not, me and 2 other uni students have an assignment that require us to contribute to an open source project. We would gladly give it a go! |
You can grab it! I have not made anything substantial |
In the TOML spec, there is an example of an inline-defined array of inline-defined tables at the end of the "Array of Tables" section:
However this example cannot be parsed with the TOML parser in the stdlib:
$ deno run test.ts Compile file:///workspaces/flags/test.ts error: Uncaught SyntaxError: Unexpected token '=' at Parser._parseData (https://deno.land/std/encoding/toml.ts:261:17) at Parser._processDeclaration (https://deno.land/std/encoding/toml.ts:190:24) at Parser._parseLines (https://deno.land/std/encoding/toml.ts:340:25) at Parser.parse (https://deno.land/std/encoding/toml.ts:389:10) at parse (https://deno.land/std/encoding/toml.ts:569:33) at file:///workspaces/flags/test.ts:3:13
This example works on other TOML parsers, such as this online one.
I am using Deno 1.1.1.
The text was updated successfully, but these errors were encountered: