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.
339 340 341 342 |
# File 'lib/kpeg/grammar.rb', line 339 def initialize(op) super() @op = op end |
Instance Attribute Details
#op ⇒ Object (readonly)
Returns the value of attribute op.
344 345 346 |
# File 'lib/kpeg/grammar.rb', line 344 def op @op end |
Instance Method Details
#==(obj) ⇒ Object
354 355 356 357 358 359 360 361 |
# File 'lib/kpeg/grammar.rb', line 354 def ==(obj) case obj when AndPredicate @op == obj.op else super end end |
#inspect ⇒ Object
363 364 365 |
# File 'lib/kpeg/grammar.rb', line 363 def inspect inspect_type "andp", @op.inspect end |
#match(x) ⇒ Object
346 347 348 349 350 351 352 |
# File 'lib/kpeg/grammar.rb', line 346 def match(x) pos = x.pos m = @op.match(x) x.pos = pos return m ? MatchString.new(self, "") : nil end |