class OperatorNode
Public Class Methods
new(op, *args)
click to toggle source
# File lib/code_generator.rb, line 144 def initialize op, *args @value = op @children = args @expr1 = @children[0] @expr2 = @children[1] end
Public Instance Methods
column()
click to toggle source
# File lib/code_generator.rb, line 177 def column c1 = @expr1.column c2 = @expr1.column return c1 if c1 != 'base' return c2 if c2 != 'base' 'base' end
error_msg()
click to toggle source
# File lib/code_generator.rb, line 164 def error_msg case @value when :gteq then 'to be greater than or equal to' when :lteq then 'to be less than or equal to' when :neq then 'to not equal' when :eq then 'to be equal to' when :gt then 'to be greater than' when :lt then 'to be less than' when :plus then 'plus' when :match then 'to match' end end
gen()
click to toggle source
# File lib/code_generator.rb, line 185 def gen operation.gen end
operation()
click to toggle source
# File lib/code_generator.rb, line 151 def operation case @value when :gteq, :lteq, :neq, :eq, :gt, :lt ComparisonExpr.new @value, @expr1, @expr2 when :plus MathExpr.new @value, @expr1, @expr2 when :match MatchExpr.new @expr1, @expr2 when :and AndExpr.new @expr1, @expr2 end end