Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Handle syntax error in Ripper #2104

Merged
merged 1 commit into from
Oct 31, 2015
Merged

Conversation

yujinakayama
Copy link
Member

Ripper might fail to parse a Ruby source even if the current runtime parsed it properly, because some versions of JRuby have different implementation of runtime parser and Ripper parser.

jruby/jruby#2427

So we handle the syntax error in Ripper and fall back to the simple single line extraction in that case.


let(:line_number) do
1
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a merge blocker, but I think I'd prefer the let declarations were on one line:

let(:file_path) { "invalid_source.rb" }
let(:line_number) { 1 }

Why take up 7 lines when it can be 2?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recently I tend to use consistent block style in all contexts, though I won't insist.

@yujinakayama yujinakayama force-pushed the handle-syntax-error-in-ripper branch from 9aab631 to d439a70 Compare October 30, 2015 15:26
@myronmarston
Copy link
Member

LGTM. Merge when green!

@yujinakayama yujinakayama force-pushed the handle-syntax-error-in-ripper branch from d439a70 to 3ee6c88 Compare October 30, 2015 15:48
Ripper might fail to parse a Ruby source even if the current runtime
parsed it properly, because some versions of JRuby have different
implementation of runtime parser and Ripper parser.

jruby/jruby#2427

So we handle the syntax error in Ripper and fall back to the simple
single line extraction in that case.
@yujinakayama yujinakayama force-pushed the handle-syntax-error-in-ripper branch from 3ee6c88 to f00ec60 Compare October 30, 2015 23:44
yujinakayama added a commit that referenced this pull request Oct 31, 2015
@yujinakayama yujinakayama merged commit a8aed17 into master Oct 31, 2015
@yujinakayama yujinakayama deleted the handle-syntax-error-in-ripper branch October 31, 2015 00:03
MatheusRich pushed a commit to MatheusRich/rspec-core that referenced this pull request Oct 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants