diff options
author | Jeremy Evans <[email protected]> | 2021-03-03 15:27:04 -0800 |
---|---|---|
committer | git <[email protected]> | 2021-03-05 22:03:05 +0900 |
commit | 2cc5827fdca97dbd1225a49a3114d28aa1cb2ef4 (patch) | |
tree | ad8d4038919076b38dd39f8fdc0c647c7f32a006 /lib | |
parent | 45b3a5f7de90773868c948f3a542f4aeeb8403fc (diff) |
[ruby/irb] Do not continue line if last expression is an endless range
Fixes [Bug #14824]
https://github.com/ruby/irb/commit/63414f8465
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb/ruby-lex.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index ce94797dad..f98d2a581b 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -277,8 +277,9 @@ class RubyLex return true elsif tokens.size >= 1 and tokens[-1][1] == :on_heredoc_end # "EOH\n" return false - elsif tokens.size >= 2 and defined?(Ripper::EXPR_BEG) and tokens[-2][3].anybits?(Ripper::EXPR_BEG | Ripper::EXPR_FNAME) + elsif tokens.size >= 2 and defined?(Ripper::EXPR_BEG) and tokens[-2][3].anybits?(Ripper::EXPR_BEG | Ripper::EXPR_FNAME) and tokens[-2][2] !~ /\A\.\.\.?\z/ # end of literal except for regexp + # endless range at end of line is not a continue return true end false |