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
Closed

Ripper is missing EXPR_VALUE #5801

headius opened this issue Jul 26, 2019 · 7 comments
Assignees
Labels
Milestone

Comments

@headius
Copy link
Member

@headius headius 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
Copy link
Member Author

@headius headius 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.

Loading

@nobu
Copy link

@nobu nobu commented Jul 26, 2019

Loading

@headius
Copy link
Member Author

@headius headius commented Jul 26, 2019

@nobu Thank you!

Loading

@enebo
Copy link
Member

@enebo enebo 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 :|

Loading

@enebo
Copy link
Member

@enebo enebo commented Jul 26, 2019

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

Loading

@enebo
Copy link
Member

@enebo enebo commented Jul 26, 2019

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

Loading

@enebo enebo removed this from the JRuby 9.3.0.0 milestone Jul 26, 2019
@enebo enebo added this to the JRuby 9.2.8.0 milestone Jul 26, 2019
@enebo
Copy link
Member

@enebo enebo commented Jul 26, 2019

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

Loading

@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
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants