Class: KPeg::NotPredicate
Instance Attribute Summary collapse
-
#op ⇒ Object
readonly
Returns the value of attribute op.
Attributes inherited from Operator
Instance Method Summary collapse
- #==(obj) ⇒ Object
-
#initialize(op) ⇒ NotPredicate
constructor
A new instance of NotPredicate.
- #inspect ⇒ Object
- #match(x) ⇒ Object
Methods inherited from Operator
#detect_tags, #inspect_type, #prune_values, #set_action, #|
Constructor Details
#initialize(op) ⇒ NotPredicate
Returns a new instance of NotPredicate.
369 370 371 372 |
# File 'lib/kpeg/grammar.rb', line 369 def initialize(op) super() @op = op end |
Instance Attribute Details
#op ⇒ Object (readonly)
Returns the value of attribute op.
374 375 376 |
# File 'lib/kpeg/grammar.rb', line 374 def op @op end |
Instance Method Details
#==(obj) ⇒ Object
384 385 386 387 388 389 390 391 |
# File 'lib/kpeg/grammar.rb', line 384 def ==(obj) case obj when NotPredicate @op == obj.op else super end end |
#inspect ⇒ Object
393 394 395 |
# File 'lib/kpeg/grammar.rb', line 393 def inspect inspect_type "notp", @op.inspect end |
#match(x) ⇒ Object
376 377 378 379 380 381 382 |
# File 'lib/kpeg/grammar.rb', line 376 def match(x) pos = x.pos m = @op.match(x) x.pos = pos return m ? nil : MatchString.new(self, "") end |