remove the parse code and fix the rest to work with the gem (from git for now)

This commit is contained in:
Torsten Ruger
2014-06-04 22:03:45 +03:00
parent e9d2724f62
commit 7cc4c6344c
45 changed files with 33 additions and 1708 deletions

View File

@ -1,26 +1,6 @@
module Ast
class FunctionExpression < Expression
attr_reader :name, :params, :body , :receiver
def initialize name, params, body , receiver = nil
@name = name.to_sym
@params = params
@body = body
@receiver = receiver
end
def attributes
[:name, :params, :body , :receiver]
end
def inspect
self.class.name + ".new(" + name.inspect + ", ["+
params.collect{|m| m.inspect }.join( ",") +"] , [" +
body.collect{|m| m.inspect }.join( ",") +"] ,"+ receiver.inspect + " )"
end
def to_s
ret = "def "
ret += "#{receiver}." if receiver
ret + "#{name}( " + params.join(",") + ") \n" + body.join("\n") + "end\n"
end
# attr_reader :name, :params, :body , :receiver
def compile context , into
raise "function does not compile into anything #{self}" if into
args = []
@ -67,6 +47,5 @@ module Ast
context.function = parent_function
function
end
end
end