diff options
author | Nobuhiro IMAI <nov@yo.rim.or.jp> | 2020-11-19 23:19:08 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-11-20 11:44:57 +0900 |
commit | 1800f3fa5c29515113ecdcc5695e8a96f462b74c (patch) | |
tree | 91affdf983246ba6da885448e0c23b80eef1494b /ext/ripper | |
parent | 80d3f21994653186bc1bb2401b16cacebd8f9efb (diff) |
Ripper.{lex,tokenize} return full tokens even if syntax error
yet another implements [Feature #17276]
Diffstat (limited to 'ext/ripper')
-rw-r--r-- | ext/ripper/lib/ripper/lexer.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb index 052aa52de9..636a87fdb2 100644 --- a/ext/ripper/lib/ripper/lexer.rb +++ b/ext/ripper/lib/ripper/lexer.rb @@ -31,6 +31,10 @@ class Ripper raise SyntaxError, r.errors.map(&:message).join(' ;') end + until (tokens = r.tokenize).empty? + ret.concat(tokens) + end + ret end @@ -65,6 +69,10 @@ class Ripper raise SyntaxError, r.errors.map(&:message).join(' ;') end + until (tokens = r.lex).empty? + ret.concat(tokens) + end + ret end |