1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Handle keyword symbol in IRB::Color::SymbolState

This commit is contained in:
Takashi Kokubun 2019-05-25 22:32:28 -07:00
parent 52b09fcee1
commit aaf6c678d2
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD
2 changed files with 2 additions and 1 deletions

View file

@ -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

View file

@ -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}",