Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ripper is missing EXPR_VALUE #5801

Closed
headius opened this issue Jul 26, 2019 · 7 comments

Comments

@headius
Copy link
Member

commented Jul 26, 2019

I'm working to get the fancy new IRB working and ran into this error:

[] ~/projects/irb $ jruby -Ilib -S irb
[/Users/headius/projects/jruby/lib/ruby/gems/shared/specifications/bundler-audit-1.0.0.gemspec] isn't a Gem::Specification (NilClass instead).
irb(main):001:1> def foo
irb(main):002:1>   puts NameError: uninitialized constant Ripper::EXPR_VALUE
Did you mean?  Ripper::EXPR_END
             const_missing at org/jruby/RubyModule.java:3811
          check_code_block at /Users/headius/projects/irb/lib/irb/ruby-lex.rb:281
               check_state at /Users/headius/projects/irb/lib/irb/ruby-lex.rb:104
                 set_input at /Users/headius/projects/irb/lib/irb/ruby-lex.rb:50
                each_index at org/jruby/RubyArray.java:1856
                 set_input at /Users/headius/projects/irb/lib/irb/ruby-lex.rb:48
                  rerender at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/reline-0.0.1/lib/reline/line_editor.rb:431
            inner_readline at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/reline-0.0.1/lib/reline.rb:304
                      each at org/jruby/RubyArray.java:1795
            inner_readline at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/reline-0.0.1/lib/reline.rb:302

This appears to be another state constant added to Ripper. I was unable to find when it was added.

This new IRB will be default in Ruby 2.7.

@headius headius added the core label Jul 26, 2019

@headius headius added this to the JRuby 9.3.0.0 milestone Jul 26, 2019

@headius

This comment has been minimized.

Copy link
Member Author

commented Jul 26, 2019

See ruby/irb#20 for a patch to make new IRB work. You can install it as a gem with gem install --pre irb but will have to apply that patch by hand.

@nobu

This comment has been minimized.

Copy link

commented Jul 26, 2019

@headius

This comment has been minimized.

Copy link
Member Author

commented Jul 26, 2019

@nobu Thank you!

@enebo

This comment has been minimized.

Copy link
Member

commented Jul 26, 2019

So the non-specific EXPRs (special convenience unions of states) were not there:

diff --git a/core/src/main/java/org/jruby/ext/ripper/RubyRipper.java b/core/src/main/java/org/jruby/ext/ripper/RubyRipper.java
index 761362e06b..02e5815385 100644
--- a/core/src/main/java/org/jruby/ext/ripper/RubyRipper.java
+++ b/core/src/main/java/org/jruby/ext/ripper/RubyRipper.java
@@ -429,6 +429,7 @@ public class RubyRipper extends RubyObject {
     // These are ordered in same order as LexerCommon.  Any changes to lex_state should update this.
     private static String[] lexStateNames = new String[] {
             "EXPR_BEG", "EXPR_END", "EXPR_ENDARG", "EXPR_ENDFN", "EXPR_ARG", "EXPR_CMDARG",
-            "EXPR_MID", "EXPR_FNAME", "EXPR_DOT", "EXPR_CLASS", "EXPR_LABEL", "EXPR_LABELED", "EXPR_FITEM"
+            "EXPR_MID", "EXPR_FNAME", "EXPR_DOT", "EXPR_CLASS", "EXPR_LABEL", "EXPR_LABELED",
+            "EXPR_FITEM", "EXPR_VALUE", "EXPR_BEG_ANY", "EXPR_ARG_ANY", "EXPR_END_ANY"
     };
 }

Unfortunately, I have to rewrite all this now because instead of using the actual value of EXPR_VALUE which is 8192 MRI uses EXPR_BEG for its value. I really don't get it but compat is compat :|

@enebo

This comment has been minimized.

Copy link
Member

commented Jul 26, 2019

Hmm the source shows it is EXPR_VALUE == EXPR_VALUE. I now wonder if our parsers have another difference...

@enebo

This comment has been minimized.

Copy link
Member

commented Jul 26, 2019

Doh. I should have read how those constants are setup...my mistake and simple to resolve.

@enebo enebo modified the milestones: JRuby 9.3.0.0, JRuby 9.2.8.0 Jul 26, 2019

@enebo

This comment has been minimized.

Copy link
Member

commented Jul 26, 2019

These values were actually added in 2.5.x so adding to 9.2.8.0.

@enebo enebo closed this in f493167 Jul 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.