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

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Mohammad Azam
Sent: Wednesday, June 10, 2009 9:55 AM
To: [email protected]
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
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to