From f6381b752387863df12a5cb247086330db2b2d34 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Fri, 7 Sep 2018 17:48:19 -0500 Subject: [PATCH] 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. --- Scanner.pas | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Scanner.pas b/Scanner.pas index 3539b21..3d42c41 100644 --- a/Scanner.pas +++ b/Scanner.pas @@ -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