Module: Lutaml::Lml::Grammar::Concerns::Primitives

Includes:
Parslet
Included in:
Lutaml::Lml::Grammar::Core
Defined in:
lib/lutaml/lml/grammar/concerns/primitives.rb

Instance Method Summary collapse

Instance Method Details

#any_quoted(label) ⇒ Object

A string in either quote style. Delimiters must match, so "a' stays a parse error.



29
30
31
# File 'lib/lutaml/lml/grammar/concerns/primitives.rb', line 29

def any_quoted(label)
  quoted('"', label) | quoted("'", label)
end

#quoted(char, label) ⇒ Object

Body of a string delimited by char, captured as label.



23
24
25
# File 'lib/lutaml/lml/grammar/concerns/primitives.rb', line 23

def quoted(char, label)
  str(char) >> (str(char).absent? >> any).repeat.as(label) >> str(char)
end