Class: GhostWheel::Expression::Alternation
- Inherits:
-
GhostWheel::Expression
- Object
- GhostWheel::Expression
- GhostWheel::Expression::Alternation
- Defined in:
- lib/ghost_wheel/expression/alternation.rb
Instance Attribute Summary collapse
-
#expressions ⇒ Object
readonly
Returns the value of attribute expressions.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(*expressions) ⇒ Alternation
constructor
A new instance of Alternation.
- #uncached_parse(scanner, cache) ⇒ Object
Methods inherited from GhostWheel::Expression
Constructor Details
#initialize(*expressions) ⇒ Alternation
Returns a new instance of Alternation.
6 7 8 |
# File 'lib/ghost_wheel/expression/alternation.rb', line 6 def initialize(*expressions) @expressions = expressions end |
Instance Attribute Details
#expressions ⇒ Object (readonly)
Returns the value of attribute expressions.
10 11 12 |
# File 'lib/ghost_wheel/expression/alternation.rb', line 10 def expressions @expressions end |
Instance Method Details
#==(other) ⇒ Object
20 21 22 |
# File 'lib/ghost_wheel/expression/alternation.rb', line 20 def ==(other) super and @expressions == other.expressions end |
#uncached_parse(scanner, cache) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/ghost_wheel/expression/alternation.rb', line 12 def uncached_parse(scanner, cache) @expressions.each do |expression| result = expression.parse(scanner, cache) return result unless result.is_a? FailedParseResult end FailedParseResult.instance end |