Sha256: b563765cb29db8b6eea06cae9311378a066726d844f1fda12d69e9607850d3e4

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

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?) <TomlRB::TableArrayParser>
  end

  rule keygroup
    (space? '[' stripped_key ("." stripped_key)* ']' comment?) <TomlRB::KeygroupParser>
  end

  rule keyvalue
    (stripped_key '=' space? v:(toml_values) comment?) <TomlRB::KeyvalueParser>
  end

  rule inline_table
    (space? '{' (keyvalue (',' keyvalue)*)? space? '}' ) <TomlRB::InlineTableParser>
  end

  rule inline_table_array
    ("[" array_comments inline_table_array_elements space ","? array_comments "]" indent?) <TomlRB::InlineTableArrayParser>
  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

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
toml-rb-1.1.2 lib/toml-rb/grammars/document.citrus
toml-rb-hs-1.1.1 lib/toml-rb/grammars/document.citrus
toml-rb-1.1.1 lib/toml-rb/grammars/document.citrus
toml-rb-1.1.0 lib/toml-rb/grammars/document.citrus
toml-rb-1.0.0 lib/toml-rb/grammars/document.citrus