summaryrefslogtreecommitdiff
path: root/ext/ripper
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-11-26 20:14:34 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-11-26 20:14:34 +0900
commitf5ca3ff4dbcf5c140a77d1de5ff3fe3eed2d558d (patch)
tree90502c577b4d049a90c7343b1c5ea761a6a97052 /ext/ripper
parent1df3896382a8e2ed86e2edbb5ba80424da0ab5b9 (diff)
Store all kinds of syntax errors [Bug #17345]
Diffstat (limited to 'ext/ripper')
-rw-r--r--ext/ripper/lib/ripper/lexer.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb
index 287bd4fdb6b..9ada47927b0 100644
--- a/ext/ripper/lib/ripper/lexer.rb
+++ b/ext/ripper/lib/ripper/lexer.rb
@@ -191,7 +191,9 @@ class Ripper
def on_error(mesg)
@errors.push Elem.new([lineno(), column()], __callee__, token(), state(), mesg)
end
- alias on_parse_error on_error
+ PARSER_EVENTS.grep(/_error\z/) do |e|
+ alias_method "on_#{e}", :on_error
+ end
alias compile_error on_error
(SCANNER_EVENTS.map {|event|:"on_#{event}"} - private_instance_methods(false)).each do |event|