lib/toml-rb/grammars/document.citrus in toml-rb-1.1.2 vs lib/toml-rb/grammars/document.citrus in toml-rb-2.0.0
- old
+ new
@@ -1,34 +1,46 @@
grammar TomlRB::Document
include TomlRB::Primitive
include TomlRB::Arrays
rule document
- (comment | table_array | keygroup | keyvalue | line_break)*
+ (comment | table_array | table | keyvalue | line_break)*
end
rule table_array
- (space? '[[' stripped_key ("." stripped_key)* ']]' comment?) <TomlRB::TableArrayParser>
+ (space? '[[' stripped_key ']]' comment?) <TomlRB::TableArrayParser>
end
- rule keygroup
- (space? '[' stripped_key ("." stripped_key)* ']' comment?) <TomlRB::KeygroupParser>
+ rule table
+ (space? '[' stripped_key ']' comment?) <TomlRB::TableParser>
end
rule keyvalue
(stripped_key '=' space? v:(toml_values) comment?) <TomlRB::KeyvalueParser>
end
rule inline_table
- (space? '{' (keyvalue (',' keyvalue)*)? space? '}' ) <TomlRB::InlineTableParser>
+ (space? '{' (keyvalue? (',' keyvalue)*)? space? '}' ) <TomlRB::InlineTableParser>
end
rule inline_table_array
- ("[" array_comments inline_table_array_elements space ","? array_comments "]" indent?) <TomlRB::InlineTableArrayParser>
+ (inline_table (space "," array_comments inline_table)*) {
+ captures[:inline_table].map(&:value).map(&:value)
+ }
end
- rule inline_table_array_elements
- (inline_table (space "," array_comments inline_table)*)
+ rule array
+ ("[" array_comments (array_elements)? space ","? array_comments "]" indent?) <TomlRB::ArrayParser>
+ end
+
+ rule array_elements
+ inline_table_array | float_array | string_array | array_array | integer_array | datetime_array | bool_array
+ end
+
+ rule array_array
+ (array (space "," array_comments array)*) {
+ captures[:array].map(&:value)
+ }
end
rule toml_values
primitive | inline_table | array | inline_table_array
end