Class: Baba::Expr::Binary

Inherits:
Object
  • Object
show all
Defined in:
lib/baba/expr.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, operator, right) ⇒ Binary

Returns a new instance of Binary.



18
19
20
# File 'lib/baba/expr.rb', line 18

def initialize(left, operator, right)
  @left = left; @operator = operator; @right = right
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



16
17
18
# File 'lib/baba/expr.rb', line 16

def left
  @left
end

#operatorObject (readonly)

Returns the value of attribute operator.



16
17
18
# File 'lib/baba/expr.rb', line 16

def operator
  @operator
end

#rightObject (readonly)

Returns the value of attribute right.



16
17
18
# File 'lib/baba/expr.rb', line 16

def right
  @right
end

Instance Method Details

#accept(visitor) ⇒ Object



22
23
24
# File 'lib/baba/expr.rb', line 22

def accept(visitor)
  visitor.visit_binary_expr(self)
end