Re: Compiler error on wrong line
- From: Andreas Koch <nospam@xxxxxxxxxxxxxxx>
- Date: Mon, 27 Feb 2006 17:35:39 +0100
stuartleyland@xxxxxxxxx wrote:
I've just spent the best part of two hours trying to solve this problemWrong linebreaks.
without joy. When I compile my project which has an error in it, the
compiler highlights the wrong line.
I have tried to copy all of my units into Notepad and then back intoSeems it didn't work.
Delphi in order to clear up any loose line breaks/carriage returns but
to no avail.
I have uploaded my project to www.2312.co.uk/project.rar in case anyI wrote a little snippet to check for wrong linebreaks:
kind soul can spare some time to have a look at it and see what I'm
missing!
------------------------------------------
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.
.
- Follow-Ups:
- Re: Compiler error on wrong line
- From: Maarten Wiltink
- Re: Compiler error on wrong line
- From: Andreas Koch
- Re: Compiler error on wrong line
- References:
- Compiler error on wrong line
- From: stuartleyland
- Compiler error on wrong line
- Prev by Date: Re: BDS2006 exe sizes
- Next by Date: Re: Compiler error on wrong line
- Previous by thread: Compiler error on wrong line
- Next by thread: Re: Compiler error on wrong line
- Index(es):