Indicate errors at correct positions when the source line contains tabs.

Previously, the error markers would generally be misaligned in this case, because a tab would expand to no spaces (in ORCA/Shell) or multiple spaces (in most other environments), but the error-printing code would use a single space to try to line up with it.

The solution adopted is just to print tabs in the error lines at the positions where they occur in the source lines. The actual amount of space displayed will depend on the console being used, but in any case it should line up correctly with the source line.
This commit is contained in:
Stephen Heumann 2018-09-07 17:48:19 -05:00
parent d33ac61af3
commit f6381b7523

View File

@ -489,8 +489,17 @@ if list or (numErr <> 0) then begin
for i := 1 to numErr do {write any errors}
with errors[i] do begin
if line = lineNumber then begin
for cl := 1 to col+4 do
write(' ');
if lineNumber >= 10000 then
write(' ');
cp := firstPtr;
for cl := 1 to col-1 do begin
if cp^ = HT then
write(chr(HT))
else
write(' ');
cp := pointer(ord4(cp) + 1);
end; {for}
write('^ ');
end {if}
else