Class: Spectre::Operators::SequentialOr
- Inherits:
-
Object
- Object
- Spectre::Operators::SequentialOr
- Includes:
- Op
- Defined in:
- lib/spectre/base/operators.rb
Overview
Takes the two Nodes it gets as parameters and tries to match them one after the other, but if one of the two does not match, it doesn’t matter SequentialOr.new p1, p2 is equal to p1 ** p2.
Instance Attribute Summary
Attributes included from Parser
Instance Method Summary collapse
Methods included from Op
Methods included from Parser
#backtrack, #create_match, from_POD, #pre_skip?, #to_p
Instance Method Details
#inspect ⇒ Object
72 73 74 |
# File 'lib/spectre/base/operators.rb', line 72 def inspect '(' + @node.left.inspect + ' ** ' + @node.right.inspect + ')' end |
#scan(iter) ⇒ Object
66 67 68 69 70 |
# File 'lib/spectre/base/operators.rb', line 66 def scan iter rep = ( @node.left.dup >> -@node.right.dup ) | @node.right.dup rep = @node.replace_with rep create_match iter, rep.parse(iter) end |