From: "Shot (Piotr Szotkowski)" Date: 2009-11-16T00:55:12+09:00 Subject: Re: Ruby Inline over two times slower under 1.9 than under 1.8? --mxv5cy4qt+RJ9ypb Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Roger Pack: >>> here's a working example (well worked once upon a time). >>> http://betterlogic.com/roger/?p=3D1849 >>>> RubyParser.new.parse(File.read 'hello.rb') >> NoMethodError: undefined method `clear' for nil:NilClass > Hmm. Maybe a bug in ruby parser? Argh, sorry, I mis-pasted. The problem is with RubyToRubyC#process. With just ruby2c 1.0.0.7: >> RubyParser.new.parse(File.read 'hello.rb') =3D> s(:class, :Hello, =E2=80=A6 >> RubyToRubyC.new.process(RubyParser.new.parse(File.read 'hello.rb')) =3D> "// class Hello < =E2=80=A6 With also RubyToC 1.0.0.5: >> RubyParser.new.parse(File.read 'hello.rb') =3D> s(:class, :Hello, =E2=80=A6 >> RubyToRubyC.new.process(RubyParser.new.parse(File.read 'hello.rb')) NoMethodError: undefined method `clear' for nil:NilClass from /home/shot/opt/ruby-1.8.7-svn/lib/ruby/gems/1.8/gems/ruby_parser-2.0= =2E4/lib/ruby_parser_extras.rb:938:in `reset' Apparently, =E2=80=98require 'ruby_to_ruby_c'=E2=80=99 pulls in RubyToC=E2= =80=99s ruby_to_ruby_c.rb (rather than ruby2c=E2=80=99s =E2=80=93 wich makes sense, as R comes before r when sorting), and it=E2=80=99s the one that can=E2=80= =99t handle the same Sexp. > So RubyToC 1.0.0.5 only works with an older > version of ruby_parser, is that right? I get the above with ruby_parser 2.0.0 as well. With ruby_parse 1.0.0 I get >> RubyToAnsiC.new.process(RubyParser.new.parse(File.read 'hello.rb')) NoMethodError: undefined method `[]' for nil:NilClass from /home/shot/opt/ruby-1.8.7-svn/lib/ruby/gems/1.8/gems/ruby_parser-1.0= =2E0/lib/ruby_lexer.rb:2510:in `dynamic?' from /home/shot/opt/ruby-1.8.7-svn/lib/ruby/gems/1.8/gems/ruby_parser-1.0= =2E0/lib/ruby_lexer.rb:191:in `gettable' from lib/ruby_parser.y:1429:in `_reduce_426' from /home/shot/opt/ruby-1.8.7-svn/lib/ruby/1.8/racc/parser.rb:331:in `__= send__' from /home/shot/opt/ruby-1.8.7-svn/lib/ruby/1.8/racc/parser.rb:331:in `_r= acc_do_reduce' (Note: I=E2=80=99m not that fluent yet with all the RubyToRubyC vs. RubyToA= nsiC details, so my reasoning might be very flawed above. Do let me know if you want me to test anything specific; all I can say for sure is that ruby2c 1.0.0.7 works with ruby_parser 2.0.4=E2=80=99s output.) =E2=80=94 Shot --=20 Founding member of the Hyphenation Society, a grassroots-based, not-for-profit, locally-owned-and-operated, cooperatively-managed, modern-American-English-usage-improvement association. [Rick Moen] --mxv5cy4qt+RJ9ypb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAksAJFkACgkQi/mCfdEo8UraMgCeLh2B/QhX9BPnemzTeRtD9b83 c9AAoMYYD7Drw3wdU+3v16aj/vj9Ab2n =wZ2g -----END PGP SIGNATURE----- --mxv5cy4qt+RJ9ypb--