aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-05-27 02:55:37 +0900
committeraycabta <aycabta@gmail.com>2019-05-27 02:56:05 +0900
commit122679136820afc663b854567afd16e49eae5a96 (patch)
tree0853a357421d8dccb70652b7858c0be5cc16a946
parente50aa359de2a419c0a04eaee84a095f602e1ccb1 (diff)
downloadruby-122679136820afc663b854567afd16e49eae5a96.tar.gz
Support :@@cvar and : on colorize
-rw-r--r--lib/irb/color.rb2
-rw-r--r--test/irb/test_color.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/irb/color.rb b/lib/irb/color.rb
index 767a675bab..b0a275c5c7 100644
--- a/lib/irb/color.rb
+++ b/lib/irb/color.rb
@@ -140,7 +140,7 @@ module IRB # :nodoc:
case token
when :on_symbeg
@stack << true
- when :on_ident, :on_op, :on_const, :on_ivar, :on_kw
+ when :on_ident, :on_op, :on_const, :on_ivar, :on_cvar, :on_gvar, :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 f0f0f83aa6..98dfbb1e8a 100644
--- a/test/irb/test_color.rb
+++ b/test/irb/test_color.rb
@@ -60,7 +60,7 @@ module TestIRB
"begin\nrescue\nend" => "#{GREEN}begin#{CLEAR}\n#{GREEN}rescue#{CLEAR}\n#{GREEN}end#{CLEAR}",
"foo %w[bar]" => "foo #{RED}%w[#{CLEAR}#{RED}bar#{CLEAR}#{RED}]#{CLEAR}",
"foo %i[bar]" => "foo #{RED}%i[#{CLEAR}#{RED}bar#{CLEAR}#{RED}]#{CLEAR}",
- "foo :@bar, baz" => "foo #{YELLOW}:#{CLEAR}#{YELLOW}@bar#{CLEAR}, baz",
+ "foo :@bar, baz, :@@qux, :$quux" => "foo #{YELLOW}:#{CLEAR}#{YELLOW}@bar#{CLEAR}, baz, #{YELLOW}:#{CLEAR}#{YELLOW}@@qux#{CLEAR}, #{YELLOW}:#{CLEAR}#{YELLOW}$quux#{CLEAR}",
"`echo`" => "#{RED}`#{CLEAR}#{RED}echo#{CLEAR}#{RED}`#{CLEAR}",
"\t" => "\t", # not ^I
"foo(*%W(bar))" => "foo(*#{RED}%W(#{CLEAR}#{RED}bar#{CLEAR}#{RED})#{CLEAR})",