-
Notifications
You must be signed in to change notification settings - Fork 37
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
Key Group Arrays #22
Key Group Arrays #22
Conversation
I edited the rule(:key_value) so spaces are not required before and after the =. This way, "key=3" would pass.
I modified the Parslet rules to make everything ignore spaces. This way, `myArray=[1,2,3,4,5]` passes.
Spaces now ignored
In the TOML v0.2.0 specs, keygroups are now called tables.
In accordance with the TOML v0.2.0 specs, arrays of tables are now allowed. This commit satisfies that requirement.
Switching to "tables" would be too complicated.
here is what I have with example from toml github page [[fruit]]
name = "apple"
[fruit.physical]
color = "red"
shape = "round"
[[fruit.variety]]
name = "red delicious"
[[fruit.variety]]
name = "granny smith"
[[fruit]]
name = "banana"
[[fruit.variety]]
name = "plantain" TOML.load_file('1.toml')
RuntimeError: Unrecognized part: {:key_groups=>[{:key_group_name=>"fruit"@2, :keys=>[#<TOML::Key:0x00000001d831b8 @key="name", @value="apple">]}]}
from /tmp/toml/lib/toml/parser.rb:36:in `block in initialize'
from /tmp/toml/lib/toml/parser.rb:21:in `each'
from /tmp/toml/lib/toml/parser.rb:21:in `initialize'
from /tmp/toml/lib/toml.rb:24:in `new'
from /tmp/toml/lib/toml.rb:24:in `load_file'
from (irb):2
from /home/lessless/.rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>' |
That's because I've only written the Parslet rule, not the actual code that handles it. |
@88Alex Maybe you can add in "todo's" here with GitHub's checkbox list Markdown syntax, or throw a |
@parkr Thanks for the suggestion, now the transformer rule throws NotImplementedError. |
what about implementing parsing itself? ;) |
The TOML v0.2.0 spec, released recently, allows key group arrays with the syntax
[[key_group_array]]
.This pull request adds a Parslet rule for this. The transformation rule has not yet been implemented.