From 068d327595814a3448290eeba897fc37a8bb2dfb Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 29 May 2019 13:34:19 +0900 Subject: Colorize compile_error as same as on_parse_error --- lib/irb/color.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/irb/color.rb') diff --git a/lib/irb/color.rb b/lib/irb/color.rb index b53cc75035..b1f7c21743 100644 --- a/lib/irb/color.rb +++ b/lib/irb/color.rb @@ -56,7 +56,7 @@ module IRB # :nodoc: on_tstring_content: [[RED], ALL], on_tstring_end: [[RED], ALL], on_words_beg: [[RED], ALL], - on_parse_error: [[RED, REVERSE], ALL], + ERROR: [[RED, REVERSE], ALL], } rescue NameError # Give up highlighting Ripper-incompatible older Ruby @@ -67,7 +67,8 @@ module IRB # :nodoc: class Lexer < Ripper::Lexer if method_defined?(:token) def on_error(mesg) - @buf.push Elem.new([lineno(), column()], __callee__, token(), state()) + # :ERROR comes before other :on_ symbols + @buf.push Elem.new([lineno(), column()], :ERROR, token(), state()) end alias on_parse_error on_error alias compile_error on_error -- cgit v1.2.3