Class: KPeg::AndPredicate
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) ⇒ AndPredicate
constructor
A new instance of AndPredicate.
- #inspect ⇒ Object
- #match(x) ⇒ Object
Methods inherited from Operator
#detect_tags, #inspect_type, #prune_values, #set_action, #|
Constructor Details
#initialize(op) ⇒ AndPredicate
Returns a new instance of AndPredicate.
329 330 331 332 |
# File 'lib/kpeg/grammar.rb', line 329 def initialize(op) super() @op = op end |
Instance Attribute Details
#op ⇒ Object (readonly)
Returns the value of attribute op.
334 335 336 |
# File 'lib/kpeg/grammar.rb', line 334 def op @op end |
Instance Method Details
#==(obj) ⇒ Object
344 345 346 347 348 349 350 351 |
# File 'lib/kpeg/grammar.rb', line 344 def ==(obj) case obj when AndPredicate @op == obj.op else super end end |
#inspect ⇒ Object
353 354 355 |
# File 'lib/kpeg/grammar.rb', line 353 def inspect inspect_type "andp", @op.inspect end |
#match(x) ⇒ Object
336 337 338 339 340 341 342 |
# File 'lib/kpeg/grammar.rb', line 336 def match(x) pos = x.pos m = @op.match(x) x.pos = pos return m ? MatchString.new(self, "") : nil end |