mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/irb] workaround for lack of tokens from Ripper.lex
* Fixes #38
905fb8e52e
This commit is contained in:
parent
422e2c7274
commit
cbf6a7f906
1 changed files with 5 additions and 2 deletions
|
@ -88,9 +88,12 @@ class RubyLex
|
|||
|
||||
def ripper_lex_without_warning(code)
|
||||
verbose, $VERBOSE = $VERBOSE, nil
|
||||
tokens = nil
|
||||
tokens = []
|
||||
self.class.compile_with_errors_suppressed(code) do |inner_code, line_no|
|
||||
tokens = Ripper.lex(inner_code, '-', line_no)
|
||||
lexer = Ripper::Lexer.new(inner_code, '-', line_no)
|
||||
until (ts = lexer.lex).empty?
|
||||
tokens.concat(ts)
|
||||
end
|
||||
end
|
||||
$VERBOSE = verbose
|
||||
tokens
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue