Skip to content

Commit

Permalink
Colorize imaginary and rational literals
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed May 26, 2019
1 parent 23270f6 commit 4f2a7b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/irb/color.rb
Expand Up @@ -31,7 +31,9 @@ module Color
on_heredoc_end: [[RED], [Ripper::EXPR_BEG]],
on_ident: [[BLUE, BOLD], [Ripper::EXPR_ENDFN]],
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]],
Expand Down
2 changes: 2 additions & 0 deletions test/irb/test_color.rb
Expand Up @@ -25,6 +25,8 @@ def test_colorize_code
{
"1" => "#{BLUE}#{BOLD}1#{CLEAR}",
"2.3" => "#{MAGENTA}#{BOLD}2.3#{CLEAR}",
"7r" => "#{BLUE}#{BOLD}7r#{CLEAR}",
"8i" => "#{MAGENTA}#{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}",
Expand Down

0 comments on commit 4f2a7b8

Please sign in to comment.