Class: Peggy::Reference
- Defined in:
- lib/builder.rb,
lib/Copy of builder.rb
Overview
Match another production in the grammar.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
The name of the production to lookup and match.
Instance Method Summary collapse
-
#initialize(name = nil) ⇒ Reference
constructor
Init the name.
-
#match(parser, index) ⇒ Object
Match the entire production from the parser grammar.
- #to_s ⇒ Object
Methods inherited from Element
Constructor Details
#initialize(name = nil) ⇒ Reference
Init the name
164 165 166 |
# File 'lib/builder.rb', line 164 def initialize name=nil self.name = name end |
Instance Attribute Details
#name ⇒ Object
The name of the production to lookup and match.
161 162 163 |
# File 'lib/builder.rb', line 161 def name @name end |
Instance Method Details
#match(parser, index) ⇒ Object
Match the entire production from the parser grammar. If it matches the end index is returned. If not, NO_MATCH is returned.
175 176 177 178 |
# File 'lib/builder.rb', line 175 def match parser, index raise "reference name not set" unless name parser.match? name, index end |
#to_s ⇒ Object
180 181 182 |
# File 'lib/builder.rb', line 180 def to_s name end |