Class: PEG::Sequence
- Inherits:
-
Rule
- Object
- ValueObject
- Rule
- PEG::Sequence
- Defined in:
- lib/peg.rb
Instance Attribute Summary
Attributes inherited from Rule
Instance Method Summary collapse
Methods inherited from Rule
#initialize, #inspect, #name, #parse, #result
Methods inherited from ValueObject
Constructor Details
This class inherits a constructor from PEG::Rule
Instance Method Details
#_inspect ⇒ Object
95 96 97 |
# File 'lib/peg.rb', line 95 def _inspect @children.map(&:inspect).join(', ') end |
#match(text) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/peg.rb', line 78 def match(text) text_ = String.new(text) len = 0 children = [] @children.each do |child| node = child.match(text_) if node == nil return nil else children << node text_ = text_.slice node.text.length..text_.length len += node.text.length end end result(text.slice(0...len), children) end |