Class: PEG::Or

Inherits:
Sequence show all
Defined in:
lib/peg.rb

Instance Attribute Summary

Attributes inherited from Rule

#children

Instance Method Summary collapse

Methods inherited from Sequence

#_inspect

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

#match(text) ⇒ Object



101
102
103
104
105
106
107
# File 'lib/peg.rb', line 101

def match(text)
  @children.each do |child|
    node = child.match(text)
    return result(node.text, [node]) if node
  end
  nil
end