Re: Compiler error on wrong line



stuartleyland@xxxxxxxxx wrote:
I've just spent the best part of two hours trying to solve this problem
without joy. When I compile my project which has an error in it, the
compiler highlights the wrong line.
Wrong linebreaks.

I have tried to copy all of my units into Notepad and then back into
Delphi in order to clear up any loose line breaks/carriage returns but
to no avail.
Seems it didn't work.

I have uploaded my project to www.2312.co.uk/project.rar in case any
kind soul can spare some time to have a look at it and see what I'm
missing!
I wrote a little snippet to check for wrong linebreaks:

------------------------------------------
procedure TForm1.Button2Click(Sender: TObject);

const
path='F:\temp\debug_project\Design (27.2.06)\';

var
fs:tfilestream;
buffer:array of byte;
t:tsearchrec;
r:integer;
line:integer;
n,nn:integer;
s:string;

begin
r:=findfirst(path+'*.pas',faanyfile,t);
while r=0 do
begin
if (t.attr and fadirectory)=0 then
begin

fs:=TFileStream.create(path+t.name,fmOpenRead);
setlength(buffer,fs.size);
fs.read(buffer[0],fs.size);

line:=0;
for n:=1 to fs.size do
begin
if (buffer[n]=10) and (buffer[n-1]=13) then inc(line);

if ((buffer[n]=10) and (buffer[n-1]<>13)) or
((buffer[n]<>10) and (buffer[n-1]=13)) then
begin
memo1.lines.add(t.name);
memo1.lines.add('Error in Line : '+inttostr(line));
s:='';
for nn:=-20 to 20 do
if ((nn+n)>=0) and ((nn+n)<fs.size) then
if buffer[nn+n]<32 then s:=s+'#'+inttostr(buffer[nn+n])
else s:=s+chr(buffer[nn+n]);
memo1.lines.add('"'+S+'"');
end;
end;


end;
r:=findnext(t);
end;
findclose(t);
end;
--------------------------------

perhaps that helps.


.


Quantcast