Class: Seaquel::AST::BinOp

Inherits:
Object
  • Object
show all
Defined in:
lib/seaquel/ast/bin_op.rb

Overview

A binary statement as in left=right. This class can be visited.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(op, left, right) ⇒ BinOp

Returns a new instance of BinOp.



9
10
11
# File 'lib/seaquel/ast/bin_op.rb', line 9

def initialize op, left, right
  @op, @left, @right = op, left, right
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



7
8
9
# File 'lib/seaquel/ast/bin_op.rb', line 7

def left
  @left
end

#opObject (readonly)

Returns the value of attribute op.



7
8
9
# File 'lib/seaquel/ast/bin_op.rb', line 7

def op
  @op
end

#rightObject (readonly)

Returns the value of attribute right.



7
8
9
# File 'lib/seaquel/ast/bin_op.rb', line 7

def right
  @right
end

Instance Method Details

#inspectObject



17
18
19
# File 'lib/seaquel/ast/bin_op.rb', line 17

def inspect 
  "(" + ['bin_op', op.inspect, left.inspect, right.inspect].join(' ') + ")"
end

#visit(visitor) ⇒ Object



13
14
15
# File 'lib/seaquel/ast/bin_op.rb', line 13

def visit visitor
  visitor.visit_binop(op, left, right)
end