[前][次][番号順一覧][スレッド一覧]

ruby-changes:55859

From: Takashi <ko1@a...>
Date: Mon, 27 May 2019 03:32:52 +0900 (JST)
Subject: [ruby-changes:55859] Takashi Kokubun: 64ee8900c8 (trunk): Highlight global variable on IRB

https://git.ruby-lang.org/ruby.git/commit/?id=64ee8900c8

From 64ee8900c89444692c6a51f0153869cb634bb086 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Sun, 26 May 2019 11:32:23 -0700
Subject: Highlight global variable on IRB


diff --git a/lib/irb/color.rb b/lib/irb/color.rb
index da8791b..de91f29 100644
--- a/lib/irb/color.rb
+++ b/lib/irb/color.rb
@@ -30,12 +30,13 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/color.rb#L30
       TOKEN_SEQ_EXPRS = {
         on_CHAR:            [[BLUE, BOLD],            ALL],
         on_backtick:        [[RED],                   ALL],
-        on_const:           [[BLUE, BOLD, UNDERLINE], ALL],
         on_comment:         [[BLUE, BOLD],            ALL],
+        on_const:           [[BLUE, BOLD, UNDERLINE], ALL],
         on_embexpr_beg:     [[RED],                   ALL],
         on_embexpr_end:     [[RED],                   ALL],
         on_embvar:          [[RED],                   ALL],
         on_float:           [[MAGENTA, BOLD],         ALL],
+        on_gvar:            [[GREEN, BOLD],           ALL],
         on_heredoc_beg:     [[RED],                   ALL],
         on_heredoc_end:     [[RED],                   ALL],
         on_ident:           [[BLUE, BOLD],            Ripper::EXPR_ENDFN],
diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb
index 577c737..4342a7c 100644
--- a/test/irb/test_color.rb
+++ b/test/irb/test_color.rb
@@ -64,6 +64,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_color.rb#L64
         "`echo`" => "#{RED}`#{CLEAR}#{RED}echo#{CLEAR}#{RED}`#{CLEAR}",
         "\t" => "\t", # not ^I
         "foo(*%W(bar))" => "foo(*#{RED}%W(#{CLEAR}#{RED}bar#{CLEAR}#{RED})#{CLEAR})",
+        "$stdout" => "#{GREEN}#{BOLD}$stdout#{CLEAR}",
       }.each do |code, result|
         actual = with_term { IRB::Color.colorize_code(code) }
         assert_equal(result, actual, "Case: colorize_code(#{code.dump})\nResult: #{humanized_literal(actual)}")
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]