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 doesn't handle private def with nested block #4882

Closed
grddev opened this Issue Dec 4, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@grddev
Contributor

grddev commented Dec 4, 2017

In JRuby 9.1.14.0 (and current master), the following command prints nil, whereas for MRI it prints a large S-expression.

ruby -rripper -e "p Ripper.sexp('class C; private def m; a.e do; end; end; end')"

If I remove private or a. the same S-expression is returned from MRI and JRuby. If I change the block to use { ... } or add paranthesis around the def m; ...; end it also works.

Loading the code into JRuby works just fine, but parsing it with Ripper does not.

This seems related to the issue #4663, but the syntax is just slightly different.

@enebo enebo added this to the JRuby 9.1.15.0 milestone Dec 5, 2017

@enebo enebo added the parser label Dec 5, 2017

enebo added a commit that referenced this issue Dec 6, 2017

Fixes #4882. Ripper doesn't handle private def with nested block....a…
…nd others.

While slowly figuring out a single-line change which fixed this issue I also
noticed several other mismatches between the two parsers.  Hopefully, at this
point, they are identical.

I also deleted a emacs turd.

RubyParser.y appears to be changed but they were minor whitespace differences
with Ripper.  I tried to make these two files a little bit easier to diff.

@enebo enebo closed this Dec 6, 2017

enebo added a commit that referenced this issue Dec 6, 2017

Fixes another regression from fix of #4882. In this case we would loo…
…k for

duplicated variables in higher level production f_opt and f_block_opt but now
that check is done at the actual variable itself.

enebo added a commit that referenced this issue Dec 12, 2017

Fixes #4882. Ripper doesn't handle private def with nested block....a…
…nd others.

While slowly figuring out a single-line change which fixed this issue I also
noticed several other mismatches between the two parsers.  Hopefully, at this
point, they are identical.

I also deleted a emacs turd.

RubyParser.y appears to be changed but they were minor whitespace differences
with Ripper.  I tried to make these two files a little bit easier to diff.

enebo added a commit that referenced this issue Dec 12, 2017

Fixes another regression from fix of #4882. In this case we would loo…
…k for

duplicated variables in higher level production f_opt and f_block_opt but now
that check is done at the actual variable itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment