Class: Rattler::Runtime::PackratParser
- Inherits:
-
RecursiveDescentParser
- Object
- Util::Node
- Parser
- RecursiveDescentParser
- Rattler::Runtime::PackratParser
- Defined in:
- lib/rattler/runtime/packrat_parser.rb
Overview
A PackratParser
is a recursive descent parser that memoizes the results of applying nonterminal rules so that each rule method is invoked at most once at a given parse position.
Direct Known Subclasses
Defined Under Namespace
Classes: MemoEntry
Instance Attribute Summary
Attributes inherited from Parser
Instance Method Summary collapse
-
#initialize(source, options = {}) ⇒ PackratParser
constructor
Create a new packrat parser to parse
source
.
Methods inherited from RecursiveDescentParser
#match, #method_missing, #respond_to?
Methods included from Grammar::GrammarDSL
Methods included from ParserHelper
Methods inherited from Parser
#fail, #fail!, #fail_parse, #failure, #failure?, #parse, #parse!, parse!, #parse_fully, #parse_fully!, parse_fully!, #pos, #pos=
Methods inherited from Util::Node
#==, #[], [], #attrs, #can_equal?, #child, #children, #each, #empty?, #eql?, #inspect, #method_missing, #name, #respond_to?, #same_contents?, #to_graphviz, #with_attrs, #with_attrs!, #with_children
Constructor Details
#initialize(source, options = {}) ⇒ PackratParser
Create a new packrat parser to parse source
.
25 26 27 28 |
# File 'lib/rattler/runtime/packrat_parser.rb', line 25 def initialize(source, ={}) super @memo = Hash.new {|h, rule_name| h[rule_name] = {} } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rattler::Runtime::RecursiveDescentParser