class Citrus::NotPredicate
A NotPredicate is a Nonterminal that contains a rule that must not match. Upon success an empty match is returned and no input is consumed. The Citrus notation is any expression preceded by an exclamation mark, e.g.:
!expr
Public Class Methods
new(rule='')
click to toggle source
Calls superclass method
Citrus::Nonterminal.new
# File lib/citrus.rb, line 1035 def initialize(rule='') super([rule]) end
Public Instance Methods
exec(input, events=[])
click to toggle source
Returns an array of events for this rule on the given input
.
# File lib/citrus.rb, line 1045 def exec(input, events=[]) unless input.test(rule) events << self events << CLOSE events << 0 end events end
rule()
click to toggle source
Returns the Rule object this rule uses to match.
# File lib/citrus.rb, line 1040 def rule rules[0] end