Class: Seaquel::AST::BinOp
- Inherits:
-
Object
- Object
- Seaquel::AST::BinOp
- 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
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#op ⇒ Object
readonly
Returns the value of attribute op.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Instance Method Summary collapse
-
#initialize(op, left, right) ⇒ BinOp
constructor
A new instance of BinOp.
- #inspect ⇒ Object
- #visit(visitor) ⇒ Object
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
#left ⇒ Object (readonly)
Returns the value of attribute left.
7 8 9 |
# File 'lib/seaquel/ast/bin_op.rb', line 7 def left @left end |
#op ⇒ Object (readonly)
Returns the value of attribute op.
7 8 9 |
# File 'lib/seaquel/ast/bin_op.rb', line 7 def op @op end |
#right ⇒ Object (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
#inspect ⇒ Object
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 |