[Ironruby-core] engine.ExecuteFile gives errors

Curt Hagenlocher curth at microsoft.com
Fri Jun 12 13:41:10 EDT 2009


Is it possible that you've saved the file as UTF-8 or Unicode?

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Mohammad Azam
Sent: Wednesday, June 10, 2009 9:55 AM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] engine.ExecuteFile gives errors

I am using the following code to execute a Ruby file from C# but it gives me the error:

 var runtime = IronRuby.Ruby.CreateRuntime();
            var engine = runtime.GetEngine("rb");

            engine.ExecuteFile("../../HelloWorld.rb");

And here is the error:

Unhandled Exception: Microsoft.Scripting.SyntaxErrorException: syntax error, une xpected END, expecting END_OF_FILE
   at Microsoft.Scripting.ErrorSink.Add(SourceUnit source, String message, Sourc eSpan span, Int32 errorCode, Severity severity)
   at Microsoft.Scripting.ErrorCounter.Add(SourceUnit source, String message, So urceSpan span, Int32 errorCode, Severity severity)
   at IronRuby.Compiler.Parser.ReportSyntaxError(String message)
   at IronRuby.Compiler.Parser.ErrorRecovery()
   at IronRuby.Compiler.Parser.Parse()
   at IronRuby.Compiler.Parser.Parse(SourceUnit sourceUnit, RubyCompilerOptions options, ErrorSink errorSink)
   at IronRuby.Runtime.RubyContext.ParseSourceCode[T](SourceUnit
sourceUnit, Rub
yCompilerOptions options, ErrorSink errorSink)
   at IronRuby.Runtime.RubyContext.CompileSourceCode(SourceUnit
sourceUnit, Comp
ilerOptions options, ErrorSink errorSink)
   at Microsoft.Scripting.SourceUnit.Compile(CompilerOptions options, ErrorSink
errorSink)

And here is the Ruby file:

class Person

def foo()
puts 'hello world'
end

end

person = Person.new()
person.foo()
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core



More information about the Ironruby-core mailing list