class Keisan::AST::ConstantLiteral
Public Instance Methods
!()
click to toggle source
# File lib/keisan/ast/constant_literal.rb, line 70 def ! raise Keisan::Exceptions::InvalidExpression.new("Cannot take logical not of #{self.class}") end
%(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 62 def %(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot modulo #{self.class} and #{other.class}") else super end end
&(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 94 def &(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot bitwise and #{self.class} and #{other.class}") else super end end
*(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 46 def *(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot multiply #{self.class} and #{other.class}") else super end end
**(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 86 def **(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot exponentiate #{self.class} and #{other.class}") else super end end
+(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 30 def +(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot add #{self.class} to #{other.class}") else super end end
+@()
click to toggle source
# File lib/keisan/ast/constant_literal.rb, line 78 def +@ raise Keisan::Exceptions::InvalidExpression.new("Cannot take unary plus of #{self.class}") end
-(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 38 def -(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot subtract #{self.class} from #{other.class}") else super end end
-@()
click to toggle source
# File lib/keisan/ast/constant_literal.rb, line 82 def -@ raise Keisan::Exceptions::InvalidExpression.new("Cannot take unary minus of #{self.class}") end
/(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 54 def /(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot divide #{self.class} and #{other.class}") else super end end
<(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 150 def <(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot compute #{self.class} < #{other.class}") else super end end
<<(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 118 def <<(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot bitwise left shift #{self.class} and #{other.class}") else super end end
<=(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 158 def <=(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot compute #{self.class} <= #{other.class}") else super end end
==(other)
click to toggle source
# File lib/keisan/ast/constant_literal.rb, line 8 def ==(other) case other when ConstantLiteral value == other.value else false end end
>(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 134 def >(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot compute #{self.class} > #{other.class}") else super end end
>=(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 142 def >=(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot compute #{self.class} >= #{other.class}") else super end end
>>(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 126 def >>(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot bitwise right shift #{self.class} and #{other.class}") else super end end
^(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 102 def ^(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot bitwise xor #{self.class} and #{other.class}") else super end end
and(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 174 def and(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot logical and #{self.class} and #{other.class}") else super end end
equal(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 166 def equal(other) other.is_constant? ? Boolean.new(false) : super end
evaluate(context = nil)
click to toggle source
# File lib/keisan/ast/constant_literal.rb, line 4 def evaluate(context = nil) self end
is_constant?()
click to toggle source
# File lib/keisan/ast/constant_literal.rb, line 26 def is_constant? true end
not_equal(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 170 def not_equal(other) other.is_constant? ? Boolean.new(true) : super end
or(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 182 def or(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot logical or #{self.class} and #{other.class}") else super end end
to_s()
click to toggle source
# File lib/keisan/ast/constant_literal.rb, line 17 def to_s case value when Rational "(#{value.to_s})" else value.to_s end end
|(other)
click to toggle source
Calls superclass method
# File lib/keisan/ast/constant_literal.rb, line 110 def |(other) if other.is_constant? raise Keisan::Exceptions::InvalidExpression.new("Cannot bitwise or #{self.class} and #{other.class}") else super end end
~()
click to toggle source
# File lib/keisan/ast/constant_literal.rb, line 74 def ~ raise Keisan::Exceptions::InvalidExpression.new("Cannot take bitwise not of #{self.class}") end