Return line no in SyntaxError when parsing Regexp #4056

Closed
cburgmer opened this Issue Aug 9, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@cburgmer

cburgmer commented Aug 9, 2016

Expected Behavior

Return line number the way Ruby does:

$ ruby --version
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]
$ echo "/1(/" | ruby
-:1: end pattern with unmatched parenthesis: /1(/

Actual Behavior

Does not follow the general SyntaxError fashion with a line number for Regex parse errors:

$ jruby.exe --version
jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f Java HotSpot(TM) 64-Bit Server VM 25.51-b03 on 1.8.0_51-b16 [mswin32-x86_64]
$ echo "/1(/" | jruby.exe
SyntaxError: (RegexpError) end pattern with unmatched parenthesis: /1(/

Compare to

$ echo "(" | jruby.exe
SyntaxError: -:1: syntax error, unexpected end-of-file

Reasoning

We parse user provided Ruby code via eval and extract line numbers from errors to report back.

@enebo enebo added this to the JRuby 9.1.3.0 milestone Aug 9, 2016

@enebo enebo added the parser label Aug 9, 2016

@enebo enebo closed this in 41e4b34 Aug 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment