add scope and kwbegin
scope is just a list of statements
This commit is contained in:
@ -13,8 +13,10 @@ require_relative "vool/method_statement"
|
||||
require_relative "vool/while_statement"
|
||||
require_relative "vool/if_statement"
|
||||
require_relative "vool/return_statement"
|
||||
require_relative "vool/return_statement"
|
||||
require_relative "vool/statements"
|
||||
require_relative "vool/send_statement"
|
||||
require_relative "vool/operator_expression"
|
||||
require_relative "vool/variables"
|
||||
|
||||
require_relative "vool/compiler"
|
||||
|
@ -8,7 +8,7 @@ module Vool
|
||||
|
||||
# default to error, so non implemented stuff shows early
|
||||
def handler_missing(node)
|
||||
raise "Not implemented #{node.type}"
|
||||
raise "Not implemented #{node.type} #{node}"
|
||||
end
|
||||
|
||||
def on_class( statement )
|
||||
@ -69,6 +69,9 @@ module Vool
|
||||
def on_dsym
|
||||
raise "Not implemented dynamix symbols (with interpolation)"
|
||||
end
|
||||
def on_kwbegin expression
|
||||
ScopeStatement.new process_all( expression.children )
|
||||
end
|
||||
|
||||
# Array + Hashes
|
||||
def on_array expression
|
||||
@ -86,6 +89,7 @@ module Vool
|
||||
|
||||
#Variables
|
||||
def on_lvasgn expression
|
||||
puts "EXP #{expression}"
|
||||
name = expression.children[0]
|
||||
value = process(expression.children[1])
|
||||
LocalAssignment.new(name,value)
|
||||
@ -144,6 +148,7 @@ module Vool
|
||||
end
|
||||
|
||||
def on_send statement
|
||||
puts "SEND #{statement}"
|
||||
kids = statement.children.dup
|
||||
receiver = kids.shift
|
||||
name = kids.shift
|
||||
|
@ -1,5 +1,11 @@
|
||||
module Vool
|
||||
class Statements < Statement
|
||||
attr_accessor :statements
|
||||
def initialize(statements)
|
||||
@statements = statements
|
||||
end
|
||||
end
|
||||
|
||||
class ScopeStatement < Statements
|
||||
end
|
||||
end
|
||||
|
12
lib/vool/variables.rb
Normal file
12
lib/vool/variables.rb
Normal file
@ -0,0 +1,12 @@
|
||||
module Vool
|
||||
module Named
|
||||
attr_accessor :name
|
||||
def initialize name
|
||||
@name = name
|
||||
end
|
||||
end
|
||||
|
||||
class LocalVariable < Statement
|
||||
include Named
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user