A
Andrea C. Granata
Hi there,
I think i just found a bug on ruby_parser gem on ruby 1.9.1
This is my code:
# encoding: utf-8
require 'rubygems'
require 'ruby_parser'
parser = RubyParser.new
text =<<EOF
# encoding: utf-8
#àè
puts "text"
# '
EOF
out = parser.process(text)
puts out.inspect
When I run the code on ruby 1.9.1p376 (2009-12-07 revision 26041)
[i386-darwin10.2.0] i get this error:
bash-3.2$ ruby test_parser.rb
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_lexer.rb:381:in
`rb_compile_error': Invalid char "'" in expression. near line 5: "#"
(SyntaxError)
from
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_lexer.rb:1222:in
`block in yylex'
from
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_lexer.rb:635:in
`loop'
from
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_lexer.rb:635:in
`yylex'
from
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_lexer.rb:54:in
`advance'
from
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_parser_extras.rb:712:in
`next_token'
from
/Users/andreag/.rvm/ruby-1.9.1-p376/lib/ruby/1.9.1/racc/parser.rb:99:in
`_racc_do_parse_c'
from
/Users/andreag/.rvm/ruby-1.9.1-p376/lib/ruby/1.9.1/racc/parser.rb:99:in
`do_parse'
from
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_parser_extras.rb:749:in
`process'
from test_parser.rb:14:in `<main>'
On ruby 1.8.7 (2008-08-11 patchlevel 72) and on jruby 1.4.0 (ruby
1.9.2dev trunk 24787) the output is:
scall, nil, uts, sarglist, sstr, "text"))) as expected.
Did I miss something or this is a real bug?
Ciao,
Andrea.
I think i just found a bug on ruby_parser gem on ruby 1.9.1
This is my code:
# encoding: utf-8
require 'rubygems'
require 'ruby_parser'
parser = RubyParser.new
text =<<EOF
# encoding: utf-8
#àè
puts "text"
# '
EOF
out = parser.process(text)
puts out.inspect
When I run the code on ruby 1.9.1p376 (2009-12-07 revision 26041)
[i386-darwin10.2.0] i get this error:
bash-3.2$ ruby test_parser.rb
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_lexer.rb:381:in
`rb_compile_error': Invalid char "'" in expression. near line 5: "#"
(SyntaxError)
from
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_lexer.rb:1222:in
`block in yylex'
from
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_lexer.rb:635:in
`loop'
from
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_lexer.rb:635:in
`yylex'
from
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_lexer.rb:54:in
`advance'
from
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_parser_extras.rb:712:in
`next_token'
from
/Users/andreag/.rvm/ruby-1.9.1-p376/lib/ruby/1.9.1/racc/parser.rb:99:in
`_racc_do_parse_c'
from
/Users/andreag/.rvm/ruby-1.9.1-p376/lib/ruby/1.9.1/racc/parser.rb:99:in
`do_parse'
from
/Users/andreag/.rvm/gems/ruby/1.9.1/gems/ruby_parser-2.0.4/lib/ruby_parser_extras.rb:749:in
`process'
from test_parser.rb:14:in `<main>'
On ruby 1.8.7 (2008-08-11 patchlevel 72) and on jruby 1.4.0 (ruby
1.9.2dev trunk 24787) the output is:
scall, nil, uts, sarglist, sstr, "text"))) as expected.
Did I miss something or this is a real bug?
Ciao,
Andrea.