Class: Pegarus::Product

Inherits:
BinaryOp show all
Defined in:
lib/pegarus/ast/product.rb

Instance Attribute Summary

Attributes inherited from BinaryOp

#first, #second

Instance Method Summary collapse

Methods inherited from Pattern

#*, #+, #+@, #-, #-@, #/, engine, #graph, #match, select_engine

Constructor Details

#initialize(first, second) ⇒ Product

Returns a new instance of Product.



3
4
5
6
# File 'lib/pegarus/ast/product.rb', line 3

def initialize(first, second)
  @first = Pegarus.pattern first
  @second = Type.coerce_to second, Integer, :to_int
end

Instance Method Details

#visit(visitor) ⇒ Object



8
9
10
# File 'lib/pegarus/ast/product.rb', line 8

def visit(visitor)
  visitor.product self
end