Marpa::Parser
Inherits Reference < Object
Constructors
new
SourceInstance methods
build_meta_grammar(actions)
Sourcecompile(grammar : String)
Convenience method to expose internals of grammar, lexer, symbols, rules, etc.
Accepts grammar as BNF, and returns a builder object that can be used the same
as before:
parser = Marpa::Parser.new
grammar = <<-'END_BNF'
:start ::= A
A ::= a
a ~ 'a'
END_BNF
input = "a"
grammar = parser.compile(grammar)
parser.parse(input, grammar) # => ["a"]
discard
Sourcediscard=(discard : Array(String))
Sourcediscards
Sourcediscards=(discards : Array(Tuple(String, String)))
Sourceexpected
Sourceexpected=(expected : Array(String))
Sourcegrammar
Sourcegrammar=(grammar : LibMarpa::MarpaGrammar)
Sourceinput
Sourceinput=(input : String)
Sourcelexemes
Sourcelexemes=(lexemes : Hash(Int32, Hash(String, String)))
Sourcelexer
Sourcelexer=(lexer : Hash(String, Regex))
Sourcematches
Sourcematches=(matches : Array(Tuple(String, String)))
Sourceparse(input : String, grammar : String, actions : Actions = Actions.new, events : Events = Events.new)
Parse input given grammar in BNF format.
Accepts optional actions that can be used to perform semantics
on given rules.
On successful parse, returns the parse tree
parse(input : String, builder : Builder, actions : Actions = Actions.new, events : Events = Events.new)
Internal method used to parse the given input given computed grammar,
Notated here as builder
position
Sourceposition=(position : Int32)
Sourcerecce
Sourcerecce=(recce : LibMarpa::MarpaRecognizer)
Sourcerules
Sourcerules=(rules : Hash(Int32, Hash(String, String)))
Sourcesymbols
Sourcesymbols=(symbols : Hash(String, Int32))
Sourcevalues
Sourcevalues=(values : Hash(Int32, String))
Source