A ButPredicate is a Nonterminal that consumes all characters until its rule matches. It must match at least one character in order to succeed. The Citrus notation is any expression preceded by a tilde, e.g.:
~expr
Included modules
Constants
DOT_RULE | = | Rule.for(DOT) |
Public class methods
new
(rule='')
[show source]
# File lib/citrus.rb, line 1073 1073: def initialize(rule='') 1074: super([rule]) 1075: 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 1083 1083: def exec(input, events=[]) 1084: length = 0 1085: 1086: until input.test(rule) 1087: len = input.exec(DOT_RULE)[-1] 1088: break unless len 1089: length += len 1090: end 1091: 1092: if length > 0 1093: events << self 1094: events << CLOSE 1095: events << length 1096: end 1097: 1098: events 1099: end
rule
()
Returns the Rule object this rule uses to match.
[show source]
# File lib/citrus.rb, line 1078 1078: def rule 1079: rules[0] 1080: end