summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2019-05-25 22:32:28 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2019-05-25 22:32:28 -0700
commitaaf6c678d272d4487179b7ae0b03990ac6b2aff5 (patch)
tree803a92aaf8a2b084a07a9c6d139a4ecc533c5829
parent52b09fcee1b170ad3be7d26b885b8a509c7ba006 (diff)
Handle keyword symbol in IRB::Color::SymbolState
-rw-r--r--lib/irb/color.rb2
-rw-r--r--test/irb/test_color.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/irb/color.rb b/lib/irb/color.rb
index 2439bc792e..51facaa476 100644
--- a/lib/irb/color.rb
+++ b/lib/irb/color.rb
@@ -136,7 +136,7 @@ module IRB # :nodoc:
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 eb30840bf1..3ba0c4c1ac 100644
--- a/test/irb/test_color.rb
+++ b/test/irb/test_color.rb
@@ -49,6 +49,7 @@ module TestIRB
"[__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}",