diff --git a/lib/register/builtin/object.rb b/lib/register/builtin/object.rb index dc4551e3..62f056be 100644 --- a/lib/register/builtin/object.rb +++ b/lib/register/builtin/object.rb @@ -17,7 +17,7 @@ module Register # return is stored in return_value # (this method returns a new method off course, like all builtin) def get_internal_word context - compiler = Soml::Compiler.new.create_method(:Object , :get_internal_word , {:Integer => :index}).init_method + compiler = Soml::Compiler.new.create_method(:Object , :get_internal_word , {:index => :Integer}).init_method source = "get_internal_word" #Load self by "calling" on_name me = compiler.process( s(:name , :self) ) @@ -35,7 +35,7 @@ module Register # no return def set_internal_word context compiler = Soml::Compiler.new.create_method(:Object , :set_internal_word , - {:Integer => :index, :Object => :value} ).init_method + {:index => :Integer, :value => :Object} ).init_method source = "set_internal_word" #Load self by "calling" on_name me = compiler.process( s(:name , :self) ) diff --git a/lib/register/machine.rb b/lib/register/machine.rb index b9102239..87777007 100644 --- a/lib/register/machine.rb +++ b/lib/register/machine.rb @@ -70,7 +70,7 @@ module Register end def parse_and_compile bytes - syntax = Parser::Salama.new.parse_with_debug(bytes) + syntax = Parser::Salama.new.parse_with_debug(bytes, reporter: Parslet::ErrorReporter::Deepest.new) parts = Parser::Transform.new.apply(syntax) #puts parts.inspect Soml.compile( parts ) diff --git a/lib/soml/compiler.rb b/lib/soml/compiler.rb index b4abfb10..afffdd25 100644 --- a/lib/soml/compiler.rb +++ b/lib/soml/compiler.rb @@ -68,11 +68,12 @@ module Soml @clazz = clazz raise "create_method #{method_name}.#{method_name.class}" unless method_name.is_a? Symbol arguments = [] - args.each do | arg , name | - unless arg.is_a? Parfait::Variable - arg = Parfait::Variable.new arg , name.to_sym + if( args.is_a? Array) + arguments = args + else + args.each do | name , type | + arguments << Parfait::Variable.new( type , name.to_sym) end - arguments << arg end @method = clazz.create_instance_method( method_name , Parfait.new_list(arguments)) self diff --git a/test/register/interpreter/helper.rb b/test/register/interpreter/helper.rb index 1b9a32d6..23af1b44 100644 --- a/test/register/interpreter/helper.rb +++ b/test/register/interpreter/helper.rb @@ -5,7 +5,7 @@ module Ticker def setup machine = Register.machine.boot - syntax = Parser::Salama.new.parse_with_debug(@string_input) + syntax = Parser::Salama.new.parse_with_debug(@string_input, reporter: Parslet::ErrorReporter::Deepest.new) parts = Parser::Transform.new.apply(syntax) #puts parts.inspect Soml.compile( parts ) diff --git a/test/soml/expressions/helper.rb b/test/soml/expressions/helper.rb index 3e2ae662..455a4add 100644 --- a/test/soml/expressions/helper.rb +++ b/test/soml/expressions/helper.rb @@ -19,7 +19,7 @@ module ExpressionHelper machine.boot unless machine.booted parser = Parser::Salama.new parser = parser.send @root - syntax = parser.parse_with_debug(@string_input) + syntax = parser.parse_with_debug(@string_input, reporter: Parslet::ErrorReporter::Deepest.new) parts = Parser::Transform.new.apply(syntax) #puts parts.inspect compiler = Soml::Compiler.new diff --git a/test/test_runner.rb b/test/test_runner.rb index 40ae9770..c35f3ed4 100644 --- a/test/test_runner.rb +++ b/test/test_runner.rb @@ -21,7 +21,7 @@ class TestRunner < MiniTest::Test string = File.read(file) parser = Parser::Salama.new object_space = Register::Program.new "Arm" - syntax = parser.parse_with_debug(string) + syntax = parser.parse_with_debug(string, reporter: Parslet::ErrorReporter::Deepest.new) assert syntax parts = Parser::Transform.new.apply(syntax) # file is a list of statements, all but the last must be a function