grammar TomlRB::Document include TomlRB::Primitive include TomlRB::Arrays rule document (comment | table_array | keygroup | keyvalue | line_break)* end rule table_array (space? '[[' stripped_key ("." stripped_key)* ']]' comment?) end rule keygroup (space? '[' stripped_key ("." stripped_key)* ']' comment?) end rule keyvalue (stripped_key '=' space? v:(toml_values) comment?) end rule inline_table (space? '{' (keyvalue (',' keyvalue)*)? space? '}' ) end rule inline_table_array ("[" array_comments inline_table_array_elements space ","? array_comments "]" indent?) end rule inline_table_array_elements (inline_table (space "," array_comments inline_table)*) end rule toml_values primitive | inline_table | array | inline_table_array end rule stripped_key (space? key space?) { captures[:key].first.value } end end