Class: Keisan::AST::BitwiseLeftShift

Inherits:
BitwiseOperator show all
Defined in:
lib/keisan/ast/bitwise_left_shift.rb

Constant Summary

Constants inherited from Operator

Operator::ARITIES, Operator::ARITY_PRIORITY_ASSOCIATIVITY, Operator::ASSOCIATIVITIES, Operator::ASSOCIATIVITY_OF_PRIORITY, Operator::PRIORITIES

Instance Attribute Summary

Attributes inherited from Parent

#children

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Operator

#arity, arity, #associativity, associativity, associativity_of_priority, #evaluate_assignments, #initialize, priority, #priority, #symbol, #to_s, #value

Methods inherited from Parent

#==, #deep_dup, #freeze, #initialize, #is_constant?, #replace, #simplify, #traverse, #unbound_functions, #unbound_variables

Methods inherited from Node

#!, #%, #&, #*, #**, #+, #+@, #-, #-@, #/, #<, #<<, #<=, #>, #>=, #>>, #^, #and, #coerce, #contains_a?, #deep_dup, #differentiate, #differentiated, #equal, #evaluate_assignments, #evaluated, #false?, #is_constant?, #not_equal, #or, #replace, #replaced, #simplified, #simplify, #to_cell, #to_node, #traverse, #true?, #unbound_functions, #unbound_variables, #value, #well_defined?, #|, #~

Constructor Details

This class inherits a constructor from Keisan::AST::Operator

Class Method Details

.symbolObject



4
5
6
# File 'lib/keisan/ast/bitwise_left_shift.rb', line 4

def self.symbol
  :<<
end

Instance Method Details

#blank_valueObject



8
9
10
# File 'lib/keisan/ast/bitwise_left_shift.rb', line 8

def blank_value
  0
end

#evaluate(context = nil) ⇒ Object



12
13
14
# File 'lib/keisan/ast/bitwise_left_shift.rb', line 12

def evaluate(context = nil)
  children[1..-1].inject(children.first.evaluate(context)) {|total, child| total << child.evaluate(context)}
end