ruby-changes:65395
From: Jeremy <ko1@a...>
Date: Fri, 5 Mar 2021 22:03:22 +0900 (JST)
Subject: [ruby-changes:65395] 2cc5827fdc (master): [ruby/irb] Do not continue line if last expression is an endless range
https://git.ruby-lang.org/ruby.git/commit/?id=2cc5827fdc From 2cc5827fdca97dbd1225a49a3114d28aa1cb2ef4 Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Wed, 3 Mar 2021 15:27:04 -0800 Subject: [ruby/irb] Do not continue line if last expression is an endless range Fixes [Bug #14824] https://github.com/ruby/irb/commit/63414f8465 --- lib/irb/ruby-lex.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index ce94797..f98d2a5 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -277,8 +277,9 @@ class RubyLex https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L277 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 -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/