Class Citrus::NotPredicate

  1. lib/citrus.rb
Parent: Object

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

Methods

public class

  1. new

public instance

  1. exec
  2. rule

Included modules

  1. Nonterminal

Public class methods

new (rule='')
[show source]
      # File lib/citrus.rb, line 1036
1036:     def initialize(rule='')
1037:       super([rule])
1038:     end

Public instance methods

exec (input, events=[])

Returns an array of events for this rule on the given input.

[show source]
      # File lib/citrus.rb, line 1046
1046:     def exec(input, events=[])
1047:       unless input.test(rule)
1048:         events << self
1049:         events << CLOSE
1050:         events << 0
1051:       end
1052: 
1053:       events
1054:     end
rule ()

Returns the Rule object this rule uses to match.

[show source]
      # File lib/citrus.rb, line 1041
1041:     def rule
1042:       rules[0]
1043:     end