Skip to content

Commit 905fb8e

Browse files
committed
workaround for lack of tokens from Ripper.lex
* Fixes #38
1 parent af40849 commit 905fb8e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/irb/ruby-lex.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@ def set_prompt(p = nil, &block)
8888

8989
def ripper_lex_without_warning(code)
9090
verbose, $VERBOSE = $VERBOSE, nil
91-
tokens = nil
91+
tokens = []
9292
self.class.compile_with_errors_suppressed(code) do |inner_code, line_no|
93-
tokens = Ripper.lex(inner_code, '-', line_no)
93+
lexer = Ripper::Lexer.new(inner_code, '-', line_no)
94+
until (ts = lexer.lex).empty?
95+
tokens.concat(ts)
96+
end
9497
end
9598
$VERBOSE = verbose
9699
tokens

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy