Fix for showing lines in parser errors.

This commit is contained in:
Yorick Peterse committed 2014-03-21 00:16:20 +01:00
1 parent 7749f4abce
commit 55f116124c
1 file changed
+4 -5
+4 -5
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