ruby-changes:55844
From: Takashi <ko1@a...>
Date: Sun, 26 May 2019 14:32:46 +0900 (JST)
Subject: [ruby-changes:55844] Takashi Kokubun: aaf6c678d2 (trunk): Handle keyword symbol in IRB::Color::SymbolState
https://git.ruby-lang.org/ruby.git/commit/?id=aaf6c678d2 From aaf6c678d272d4487179b7ae0b03990ac6b2aff5 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Sat, 25 May 2019 22:32:28 -0700 Subject: Handle keyword symbol in IRB::Color::SymbolState diff --git a/lib/irb/color.rb b/lib/irb/color.rb index 2439bc7..51facaa 100644 --- a/lib/irb/color.rb +++ b/lib/irb/color.rb @@ -136,7 +136,7 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/color.rb#L136 case token when :on_symbeg @stack << true - when :on_ident, :on_op, :on_const, :on_ivar + when :on_ident, :on_op, :on_const, :on_ivar, :on_kw if @stack.last # Pop only when it's Symbol @stack.pop return prev_state diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb index eb30840..3ba0c4c 100644 --- a/test/irb/test_color.rb +++ b/test/irb/test_color.rb @@ -49,6 +49,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_color.rb#L49 "[__FILE__, __LINE__]" => "[#{CYAN}#{BOLD}__FILE__#{CLEAR}, #{CYAN}#{BOLD}__LINE__#{CLEAR}]", ":self" => "#{YELLOW}:#{CLEAR}#{YELLOW}self#{CLEAR}", ":class" => "#{YELLOW}:#{CLEAR}#{YELLOW}class#{CLEAR}", + "[:end, 2]" => "[#{YELLOW}:#{CLEAR}#{YELLOW}end#{CLEAR}, #{BLUE}#{BOLD}2#{CLEAR}]", "[:>, 3]" => "[#{YELLOW}:#{CLEAR}#{YELLOW}>#{CLEAR}, #{BLUE}#{BOLD}3#{CLEAR}]", ":Hello ? world : nil" => "#{YELLOW}:#{CLEAR}#{YELLOW}Hello#{CLEAR} ? world : #{CYAN}#{BOLD}nil#{CLEAR}", 'raise "foo#{bar}baz"' => "raise #{RED}\"#{CLEAR}#{RED}foo#{CLEAR}#{RED}\#{#{CLEAR}bar#{RED}}#{CLEAR}#{RED}baz#{CLEAR}#{RED}\"#{CLEAR}", -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/