Knowing exactly where on a line an error was discovered is extra helpful, and I recommend adding it. I'll even tell how. These changes are given in reverse order, bottom to top so a reference to a line number will remain the same after a change was made.
In scanner.pas, six changes.
- Insert the Following procedure of 4 lines starting at line 697:
function ScannerPos: Integer;
begin
Result := ScannerState.Position;
end;
-
After line 186 insert one line:
inc(ScannerState.Position);
-
Replace line 179
if ScannerState.ch = #10 then Inc(ScannerState.Line);
With the following five lines:
if ScannerState.ch = #10 then // End of line found '
begin
Inc(ScannerState.Line);
Scannerstate.Position := 0;
end;
-
After line 98 insert one line:
Position := 0;
-
After line 46 insert one line:
Position,
-
After line 29 insert one line:
function ScannerPos: Integer;
In file XDPW._PAS two changes:
- Line 72, replace one line:
Notice(ScannerFileName + ' (' + IntToStr(ScannerLine) + ') Error: ' + Msg)
with the following split line:
Notice(ScannerFileName + ' (' + IntToStr(ScannerLine) +
':' + IntToStr(ScannerPos) + ') Error: ' + Msg)
- Line 61 replace one line:
Notice(ScannerFileName + ' (' + IntToStr(ScannerLine) + ') Warning: ' + Msg)
with the following split line:
Notice(ScannerFileName + ' (' + IntToStr(ScannerLine) + '
':' + IntToStr(ScannerPos) + ') Warning: ' + Msg)
- Optional Change to Common.Pas, change line 14 from:
VERSION = '0.12';
to
VERSION = '0.13';
To confirm the change for anyone using it. I've compiled it and tried it and it's sweet, if you feed it a file with an error it now shows both line number and position on the line where the error was detected. I think it would be useful and I recommend its inclusion.
Paul.
Paul Robinson paul@paul-robinson.us
"The lessons of history teach us - if they teach us anything - that no one learns the lessons that history teaches us."
Knowing exactly where on a line an error was discovered is extra helpful, and I recommend adding it. I'll even tell how. These changes are given in reverse order, bottom to top so a reference to a line number will remain the same after a change was made.
In scanner.pas, six changes.
After line 186 insert one line:
inc(ScannerState.Position);Replace line 179
if ScannerState.ch = #10 then Inc(ScannerState.Line);With the following five lines:
After line 98 insert one line:
Position := 0;After line 46 insert one line:
Position,After line 29 insert one line:
function ScannerPos: Integer;In file XDPW._PAS two changes:
Notice(ScannerFileName + ' (' + IntToStr(ScannerLine) + ') Error: ' + Msg)with the following split line:
Notice(ScannerFileName + ' (' + IntToStr(ScannerLine) + ') Warning: ' + Msg)with the following split line:
VERSION = '0.12';to
VERSION = '0.13';To confirm the change for anyone using it. I've compiled it and tried it and it's sweet, if you feed it a file with an error it now shows both line number and position on the line where the error was detected. I think it would be useful and I recommend its inclusion.
Paul.
Paul Robinson paul@paul-robinson.us
"The lessons of history teach us - if they teach us anything - that no one learns the lessons that history teaches us."