ruby-changes:58699
From: Takashi <ko1@a...>
Date: Mon, 11 Nov 2019 06:55:08 +0900 (JST)
Subject: [ruby-changes:58699] fcd9bc28e3 (master): qsymbols and symbols should be colored as Symbol
https://git.ruby-lang.org/ruby.git/commit/?id=fcd9bc28e3 From fcd9bc28e3d7d301bcdf6eea8ffa25c0c3ec184f Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Sun, 10 Nov 2019 13:54:44 -0800 Subject: qsymbols and symbols should be colored as Symbol diff --git a/lib/irb/color.rb b/lib/irb/color.rb index 92bbd9e..3ce628f 100644 --- a/lib/irb/color.rb +++ b/lib/irb/color.rb @@ -205,7 +205,7 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/color.rb#L205 def scan_token(token) prev_state = @stack.last case token - when :on_symbeg + when :on_symbeg, :on_symbols_beg, :on_qsymbols_beg @stack << true when :on_ident, :on_op, :on_const, :on_ivar, :on_cvar, :on_gvar, :on_kw if @stack.last # Pop only when it's Symbol diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb index 6446c0a..3ced640 100644 --- a/test/irb/test_color.rb +++ b/test/irb/test_color.rb @@ -43,8 +43,8 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_color.rb#L43 "%w[a b]" => "#{RED}#{BOLD}%w[#{CLEAR}#{RED}a#{CLEAR} #{RED}b#{CLEAR}#{RED}#{BOLD}]#{CLEAR}", "%W[a b]" => "#{RED}#{BOLD}%W[#{CLEAR}#{RED}a#{CLEAR} #{RED}b#{CLEAR}#{RED}#{BOLD}]#{CLEAR}", "%s[a b]" => "#{YELLOW}%s[#{CLEAR}#{YELLOW}a b#{CLEAR}#{YELLOW}]#{CLEAR}", - "%i[c d]" => "#{RED}#{BOLD}%i[#{CLEAR}#{RED}c#{CLEAR} #{RED}d#{CLEAR}#{RED}#{BOLD}]#{CLEAR}", - "%I[c d]" => "#{RED}#{BOLD}%I[#{CLEAR}#{RED}c#{CLEAR} #{RED}d#{CLEAR}#{RED}#{BOLD}]#{CLEAR}", + "%i[c d]" => "#{YELLOW}%i[#{CLEAR}#{YELLOW}c#{CLEAR}#{YELLOW} #{CLEAR}#{YELLOW}d#{CLEAR}#{YELLOW}]#{CLEAR}", + "%I[c d]" => "#{YELLOW}%I[#{CLEAR}#{YELLOW}c#{CLEAR}#{YELLOW} #{CLEAR}#{YELLOW}d#{CLEAR}#{YELLOW}]#{CLEAR}", "{'a': 1}" => "{#{RED}#{BOLD}'#{CLEAR}#{RED}a#{CLEAR}#{RED}#{BOLD}':#{CLEAR} #{BLUE}#{BOLD}1#{CLEAR}}", ":Struct" => "#{YELLOW}:#{CLEAR}#{YELLOW}Struct#{CLEAR}", '"#{}"' => "#{RED}#{BOLD}\"#{CLEAR}#{RED}\#{#{CLEAR}#{RED}}#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}", @@ -61,7 +61,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_color.rb#L61 'URI.parse "#{}"' => "#{BLUE}#{BOLD}#{UNDERLINE}URI#{CLEAR}.parse #{RED}#{BOLD}\"#{CLEAR}#{RED}\#{#{CLEAR}#{RED}}#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}", "begin\nrescue\nend" => "#{GREEN}begin#{CLEAR}\n#{GREEN}rescue#{CLEAR}\n#{GREEN}end#{CLEAR}", "foo %w[bar]" => "foo #{RED}#{BOLD}%w[#{CLEAR}#{RED}bar#{CLEAR}#{RED}#{BOLD}]#{CLEAR}", - "foo %i[bar]" => "foo #{RED}#{BOLD}%i[#{CLEAR}#{RED}bar#{CLEAR}#{RED}#{BOLD}]#{CLEAR}", + "foo %i[bar]" => "foo #{YELLOW}%i[#{CLEAR}#{YELLOW}bar#{CLEAR}#{YELLOW}]#{CLEAR}", "foo :@bar, baz, :@@qux, :$quux" => "foo #{YELLOW}:#{CLEAR}#{YELLOW}@bar#{CLEAR}, baz, #{YELLOW}:#{CLEAR}#{YELLOW}@@qux#{CLEAR}, #{YELLOW}:#{CLEAR}#{YELLOW}$quux#{CLEAR}", "`echo`" => "#{RED}#{BOLD}`#{CLEAR}#{RED}echo#{CLEAR}#{RED}#{BOLD}`#{CLEAR}", "\t" => "\t", # not ^I -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/