alexbeletsky / toml-js

TOML parser implementation (node.js + browser)
23 stars 9 forks source link

Parsing an array of tables errors #4

Open jamesjwarren opened 6 years ago

jamesjwarren commented 6 years ago

Doesn't seem to support toml's array-of-tables.

Parsing this structure returns an error:

[[resources]]
name = "Article"

[[resources]]
name = "Post"
Error: "[resources" is overriding existing value
toml.js:40
    at addGroup (./node_modules/toml-js/lib/amd/toml.js:40:1)
    at parseGroup (./node_modules/toml-js/lib/amd/toml.js:26:1)
    at parseLine (./node_modules/toml-js/lib/amd/toml.js:140:1)
    at ./node_modules/toml-js/lib/amd/toml.js:167:1
    at Array.forEach (<anonymous>)
    at parse (./node_modules/toml-js/lib/amd/toml.js:165:1)
    at Object.startParser [as parse] (./node_modules/toml-js/lib/amd/toml.js:218:1)
    at ./src/App.js:36:1
    at <anonymous>
aloisdg commented 6 years ago

online demo of the problem

alexbeletsky commented 6 years ago

@jamesjwarren @aloisdg you are right guys, the time I implemented this toml did have that feature, or I missed it somehow.

Does anyone want to submit a PR to support that?