jm / toml

Parse TOML. Like a bawss.
MIT License
151 stars 37 forks source link

parsing fails on empty multiline arrays #21

Open strcrzy opened 11 years ago

strcrzy commented 11 years ago

hi, i'm writing an example/default config with comments in toml, and it seems to choke your parser. i'm using toml 0.0.4.

[example]
  empty_array = [] # works
  empty_multi_line_array = [
           # fails
  ]

The exception i get is:

Failed to match sequence (ALL_SPACE (KEY_GROUP / KEY_VALUE / COMMENT_LINE){0, } ALL_SPACE) at line 2 char 3.
`- Extra input after last repetition at line 2 char 3.
   `- Failed to match [ \t\r\n] at line 2 char 3.

i believe it is valid TOML, per the spec: "Arrays can also be multiline. So in addition to ignoring whitespace, arrays also ignore newlines between the brackets. Terminating commas are ok before the closing bracket."

i'm interested in digging into the parser/grammar myself and making a PR, but before I did I just wanted to make sure this was a valid issue and that you would be interested in a fix

dirk commented 10 years ago

I'm unable to reproduce with this gem at git @bd0b566333f1caad2f62ae57057be8f0707c1856. This may be a bug in version 0.0.4.