ruby-changes:55855
From: Takashi <ko1@a...>
Date: Mon, 27 May 2019 02:23:33 +0900 (JST)
Subject: [ruby-changes:55855] Takashi Kokubun: e50aa359de (trunk): Make the imaginary color on IRB close to pry
https://git.ruby-lang.org/ruby.git/commit/?id=e50aa359de From e50aa359de2a419c0a04eaee84a095f602e1ccb1 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Sun, 26 May 2019 10:22:57 -0700 Subject: Make the imaginary color on IRB close to pry and sorted the token names alphabetically. diff --git a/lib/irb/color.rb b/lib/irb/color.rb index 852d184..767a675 100644 --- a/lib/irb/color.rb +++ b/lib/irb/color.rb @@ -20,25 +20,27 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/color.rb#L20 } begin + # Following pry's colors where possible, but sometimes having a compromise like making + # backtick and regexp as red (string's color, because they're sharing tokens). TOKEN_SEQ_EXPRS = { - on_backtick: [[RED], [Ripper::EXPR_BEG]], on_CHAR: [[BLUE, BOLD], [Ripper::EXPR_END]], + on_backtick: [[RED], [Ripper::EXPR_BEG]], on_const: [[BLUE, BOLD, UNDERLINE], [Ripper::EXPR_ARG, Ripper::EXPR_CMDARG, Ripper::EXPR_ENDFN]], on_embexpr_beg: [[RED], [Ripper::EXPR_BEG, Ripper::EXPR_END, Ripper::EXPR_CMDARG, Ripper::EXPR_FNAME, Ripper::EXPR_ARG]], on_embexpr_end: [[RED], [Ripper::EXPR_BEG, Ripper::EXPR_END, Ripper::EXPR_CMDARG, Ripper::EXPR_ENDFN, Ripper::EXPR_ARG]], on_embvar: [[RED], [Ripper::EXPR_BEG]], + on_float: [[MAGENTA, BOLD], [Ripper::EXPR_END]], on_heredoc_beg: [[RED], [Ripper::EXPR_BEG]], on_heredoc_end: [[RED], [Ripper::EXPR_BEG]], on_ident: [[BLUE, BOLD], [Ripper::EXPR_ENDFN]], + on_imaginary: [[BLUE, BOLD], [Ripper::EXPR_END]], on_int: [[BLUE, BOLD], [Ripper::EXPR_END]], - on_rational: [[BLUE, BOLD], [Ripper::EXPR_END]], - on_float: [[MAGENTA, BOLD], [Ripper::EXPR_END]], - on_imaginary: [[MAGENTA, BOLD], [Ripper::EXPR_END]], on_kw: [[GREEN], [Ripper::EXPR_ARG, Ripper::EXPR_CLASS, Ripper::EXPR_BEG, Ripper::EXPR_END, Ripper::EXPR_FNAME, Ripper::EXPR_MID]], on_label: [[MAGENTA], [Ripper::EXPR_LABELED]], on_label_end: [[RED], [Ripper::EXPR_BEG]], - on_qwords_beg: [[RED], [Ripper::EXPR_BEG, Ripper::EXPR_CMDARG]], on_qsymbols_beg: [[RED], [Ripper::EXPR_BEG, Ripper::EXPR_CMDARG]], + on_qwords_beg: [[RED], [Ripper::EXPR_BEG, Ripper::EXPR_CMDARG]], + on_rational: [[BLUE, BOLD], [Ripper::EXPR_END]], on_regexp_beg: [[RED, BOLD], [Ripper::EXPR_BEG]], on_regexp_end: [[RED, BOLD], [Ripper::EXPR_BEG]], on_symbeg: [[YELLOW], [Ripper::EXPR_FNAME]], diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb index 3d0eee7..f0f0f83 100644 --- a/test/irb/test_color.rb +++ b/test/irb/test_color.rb @@ -26,7 +26,7 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_color.rb#L26 "1" => "#{BLUE}#{BOLD}1#{CLEAR}", "2.3" => "#{MAGENTA}#{BOLD}2.3#{CLEAR}", "7r" => "#{BLUE}#{BOLD}7r#{CLEAR}", - "8i" => "#{MAGENTA}#{BOLD}8i#{CLEAR}", + "8i" => "#{BLUE}#{BOLD}8i#{CLEAR}", "['foo', :bar]" => "[#{RED}'#{CLEAR}#{RED}foo#{CLEAR}#{RED}'#{CLEAR}, #{YELLOW}:#{CLEAR}#{YELLOW}bar#{CLEAR}]", "class A; end" => "#{GREEN}class#{CLEAR} #{BLUE}#{BOLD}#{UNDERLINE}A#{CLEAR}; #{GREEN}end#{CLEAR}", "def self.foo; bar; end" => "#{GREEN}def#{CLEAR} #{CYAN}#{BOLD}self#{CLEAR}.#{BLUE}#{BOLD}foo#{CLEAR}; bar; #{GREEN}end#{CLEAR}", -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/