class Yadriggy::Eval
abstract evaluator (using visitor pattern)
Public Instance Methods
array(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 85 def array(expr) raise NotImplementedError.new('array') end
array_ref(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 125 def array_ref(expr) raise NotImplementedError.new('array') end
array_ref_field(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 129 def array_ref_field(expr) array_ref(expr) end
assign(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 117 def assign(expr) if expr.left.is_a?(Array) || expr.right.is_a?(Array) raise NotImplementedError.new('multiple assignment') else binary(expr) end end
astree(expr)
click to toggle source
A root.
# File lib/yadriggy/eval.rb, line 19 def astree(expr) evaluate(expr.tree) end
being_end(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 173 def being_end(expr) raise NotImplementedError.new('begin_end') end
binary(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 109 def binary(expr) raise NotImplementedError.new('binary') end
block(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 165 def block(expr) raise NotImplementedError.new('block') end
break_out(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 157 def break_out(expr) raise NotImplementedError.new('break_out') end
call(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 137 def call(expr) raise NotImplementedError.new('call') end
class_def(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 191 def class_def(expr) raise NotImplementedError.new('class_def') end
command(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 141 def command(expr) call(expr) end
conditional(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 145 def conditional(expr) raise NotImplementedError.new('conditional') end
const(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 43 def const(expr) name(expr) end
const_path_field(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 101 def const_path_field(expr) const_path_ref(expr) end
const_path_ref(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 97 def const_path_ref(expr) raise NotImplementedError.new('const_path_ref') end
define(expr)
click to toggle source
def
# File lib/yadriggy/eval.rb, line 179 def define(expr) raise NotImplementedError.new('define') end
dots(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 113 def dots(expr) binary(expr) end
evaluate(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 8 def evaluate(expr) if expr.nil? nil_value(nil) else expr.accept(self) end self end
exprs(expr)
click to toggle source
expressions, or progn in Lisp.
# File lib/yadriggy/eval.rb, line 77 def exprs(expr) raise NotImplementedError.new('exprs') end
for_loop(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 153 def for_loop(expr) raise NotImplementedError.new('for_loop') end
global_variable(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 55 def global_variable(expr) name(expr) end
hash(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 133 def hash(expr) raise NotImplementedError.new('hash') end
identifier(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 35 def identifier(expr) identifier_or_call(expr) end
identifier_or_call(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 31 def identifier_or_call(expr) name(expr) end
instance_variable(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 59 def instance_variable(expr) name(expr) end
label(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 47 def label(expr) name(expr) end
lambda_expr(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 169 def lambda_expr(expr) block(expr) end
loop(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 149 def loop(expr) raise NotImplementedError.new('loop') end
module_def(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 187 def module_def(expr) raise NotImplementedError.new('module_def') end
name(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 27 def name(expr) raise NotImplementedError.new('name') end
nil_value(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 23 def nil_value(expr) raise NotImplementedError.new('nil_value') end
number(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 71 def number(expr) raise NotImplementedError.new('number') end
paren(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 81 def paren(expr) raise NotImplementedError.new('paren') end
program(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 199 def program(expr) raise NotImplementedError.new('program') end
rescue_end(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 183 def rescue_end(expr) raise NotImplementedError.new('rescue_end') end
reserved(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 39 def reserved(expr) name(expr) end
return_values(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 161 def return_values(expr) raise NotImplementedError.new('return_values') end
singular_class_def(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 195 def singular_class_def(expr) raise NotImplementedError.new('singular_class_def') end
string_interpolation(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 89 def string_interpolation(expr) raise NotImplementedError.new('string_interpolation') end
string_literal(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 93 def string_literal(expr) raise NotImplementedError.new('string_literal') end
super_method(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 67 def super_method(expr) raise NotImplementedError.new('super_method') end
symbol(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 51 def symbol(expr) raise NotImplementedError.new('symbol') end
unary(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 105 def unary(expr) raise NotImplementedError.new('unary') end
variable_call(expr)
click to toggle source
# File lib/yadriggy/eval.rb, line 63 def variable_call(expr) identifier_or_call(expr) end