Skip to content

Commit

Permalink
Reflect behavior changes to argument name
Browse files Browse the repository at this point in the history
0c459af changed the meaning of
`detect_compile_error`, and this commit lets it follow the change.
  • Loading branch information
k0kubun committed Jun 3, 2019
1 parent fc7b4c7 commit 9987f45
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/irb/color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def colorize_code(code, complete: true)
colored = +''
length = 0

scan(code, detect_compile_error: complete) do |token, str, expr|
scan(code, allow_last_error: !complete) do |token, str, expr|
in_symbol = symbol_state.scan_token(token)
str.each_line do |line|
line = Reline::Unicode.escape_for_print(line)
Expand All @@ -132,12 +132,12 @@ def colorize_code(code, complete: true)

private

def scan(code, detect_compile_error:)
def scan(code, allow_last_error:)
pos = [1, 0]

Ripper::Lexer.new(code).scan.each do |elem|
str = elem.tok
next if !detect_compile_error and elem.message&.end_with?("meets end of file")
next if allow_last_error and elem.message&.end_with?('meets end of file')
next if ([elem.pos[0], elem.pos[1] + str.bytesize] <=> pos) <= 0

str.each_line do |line|
Expand Down

0 comments on commit 9987f45

Please sign in to comment.