Class: Spectre::Operators::List
- Inherits:
-
Object
- Object
- Spectre::Operators::List
- Includes:
- Op
- Defined in:
- lib/spectre/base/operators.rb
Overview
Matches a list of tokens matched by the first Node, separated by tokens matched by the second Node. The first Node must not match the second. List.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
334 335 336 |
# File 'lib/spectre/base/operators.rb', line 334 def inspect "(#{@node.left.inspect} % #{@node.right.inspect})" end |
#scan(iter) ⇒ Object
328 329 330 331 332 |
# File 'lib/spectre/base/operators.rb', line 328 def scan iter rep = @node.left.dup >> ( @node.right.dup >> @node.left.dup ).* rep = @node.replace_with rep create_match iter, rep.parse(iter) end |