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