Fix for showing lines in parser errors.
This commit is contained in:
parent
7749f4abce
commit
55f116124c
|
@ -151,18 +151,17 @@ end
|
||||||
|
|
||||||
# Show up to 5 lines before and after the offending line (if they exist).
|
# Show up to 5 lines before and after the offending line (if they exist).
|
||||||
(-5..5).each do |offset|
|
(-5..5).each do |offset|
|
||||||
line = @lines[index + offset]
|
line = @lines[index + offset]
|
||||||
|
number = @line + offset
|
||||||
if line
|
|
||||||
number = @line + offset
|
|
||||||
|
|
||||||
|
if line and number > 0
|
||||||
if offset == 0
|
if offset == 0
|
||||||
prefix = '=> '
|
prefix = '=> '
|
||||||
else
|
else
|
||||||
prefix = ' '
|
prefix = ' '
|
||||||
end
|
end
|
||||||
|
|
||||||
lines << "#{prefix}#{number}: #{line}"
|
lines << "#{prefix}#{number}: #{line.strip}\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue