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

Colorize imaginary and rational literals

This commit is contained in:
Nobuyoshi Nakada 2019-05-26 23:44:57 +09:00
parent 23270f6fee
commit 4f2a7b8001
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 4 additions and 0 deletions

View file

@ -31,7 +31,9 @@ module IRB # :nodoc:
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]],

View file

@ -25,6 +25,8 @@ module TestIRB
{
"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}",