Fix for showing lines in parser errors.

This commit is contained in:
Yorick Peterse 2014-03-21 00:16:20 +01:00
parent 7749f4abce
commit 55f116124c
1 changed files with 4 additions and 5 deletions

View File

@ -151,18 +151,17 @@ end
# Show up to 5 lines before and after the offending line (if they exist).
(-5..5).each do |offset|
line = @lines[index + offset]
if line
number = @line + offset
line = @lines[index + offset]
number = @line + offset
if line and number > 0
if offset == 0
prefix = '=> '
else
prefix = ' '
end
lines << "#{prefix}#{number}: #{line}"
lines << "#{prefix}#{number}: #{line.strip}\n"
end
end