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.
359 360 361 362 |
# File 'lib/kpeg/grammar.rb', line 359 def initialize(op) super() @op = op end |
Instance Attribute Details
#op ⇒ Object (readonly)
Returns the value of attribute op.
364 365 366 |
# File 'lib/kpeg/grammar.rb', line 364 def op @op end |
Instance Method Details
#==(obj) ⇒ Object
374 375 376 377 378 379 380 381 |
# File 'lib/kpeg/grammar.rb', line 374 def ==(obj) case obj when NotPredicate @op == obj.op else super end end |
#inspect ⇒ Object
383 384 385 |
# File 'lib/kpeg/grammar.rb', line 383 def inspect inspect_type "notp", @op.inspect end |
#match(x) ⇒ Object
366 367 368 369 370 371 372 |
# File 'lib/kpeg/grammar.rb', line 366 def match(x) pos = x.pos m = @op.match(x) x.pos = pos return m ? nil : MatchString.new(self, "") end |