summaryrefslogtreecommitdiff
path: root/ext/ripper/lib
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-30 21:49:08 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-30 21:54:38 +0900
commitb0e2b7a5ff0df14b3c8062c31ebb526a73a03763 (patch)
treedd63c4f8b8a4149c49979f34845c9693d9a0740c /ext/ripper/lib
parent279c8e14d4b079e5b70b0389b82893de42b75c50 (diff)
Include stack elements left after errors
Diffstat (limited to 'ext/ripper/lib')
-rw-r--r--ext/ripper/lib/ripper/lexer.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb
index d1d257582dc..696471a75d1 100644
--- a/ext/ripper/lib/ripper/lexer.rb
+++ b/ext/ripper/lib/ripper/lexer.rb
@@ -103,7 +103,7 @@ class Ripper
# parse the code and returns elements including errors.
def scan
- (parse() + errors).sort_by {|e| [*e.pos, (e.message ? -1 : 0)]}
+ (parse() + errors + @stack.flatten).uniq.sort_by {|e| [*e.pos, (e.message ? -1 : 0)]}
end
def parse