Class: Spectre::Negations::NegatedZeroTokenParser

Inherits:
Operators::Negation show all
Includes:
Parser
Defined in:
lib/spectre/generic/negations.rb

Overview

Negates a Paser that returns only 0 length matches.

Instance Attribute Summary

Attributes included from Parser

#node

Instance Method Summary collapse

Methods included from Parser

#backtrack, #create_match, from_POD, #inspect, #pre_skip?, #to_p

Methods inherited from Operators::Negation

#inspect

Instance Method Details

#scan(iter) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/spectre/generic/negations.rb', line 56

def scan iter
    ret = @node.left.parse iter
    backtrack iter

    if ret then nil
    else Match.new 0, iter.empty
    end
end