mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 22:09:32 +02:00
* line numbering is now only done when #10, #10#13 is really parsed
instead of when it is the next character
This commit is contained in:
parent
f44380e4a9
commit
517c5de6aa
@ -1889,7 +1889,7 @@ Begin
|
|||||||
{ setup label linked list }
|
{ setup label linked list }
|
||||||
LocalLabelList:=TLocalLabelList.Create;
|
LocalLabelList:=TLocalLabelList.Create;
|
||||||
{ start tokenizer }
|
{ start tokenizer }
|
||||||
c:=current_scanner.asmgetchar;
|
c:=current_scanner.asmgetcharstart;
|
||||||
gettoken;
|
gettoken;
|
||||||
{ main loop }
|
{ main loop }
|
||||||
repeat
|
repeat
|
||||||
@ -2119,7 +2119,11 @@ finalization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.56 2003-10-29 16:47:18 peter
|
Revision 1.57 2003-11-10 19:08:32 peter
|
||||||
|
* line numbering is now only done when #10, #10#13 is really parsed
|
||||||
|
instead of when it is the next character
|
||||||
|
|
||||||
|
Revision 1.56 2003/10/29 16:47:18 peter
|
||||||
* fix field offset in reference
|
* fix field offset in reference
|
||||||
|
|
||||||
Revision 1.55 2003/10/26 13:37:22 florian
|
Revision 1.55 2003/10/26 13:37:22 florian
|
||||||
|
@ -1866,7 +1866,7 @@ Begin
|
|||||||
{ setup label linked list }
|
{ setup label linked list }
|
||||||
LocalLabelList:=TLocalLabelList.Create;
|
LocalLabelList:=TLocalLabelList.Create;
|
||||||
{ start tokenizer }
|
{ start tokenizer }
|
||||||
c:=current_scanner.asmgetchar;
|
c:=current_scanner.asmgetcharstart;
|
||||||
gettoken;
|
gettoken;
|
||||||
{ main loop }
|
{ main loop }
|
||||||
repeat
|
repeat
|
||||||
@ -1971,7 +1971,11 @@ finalization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.63 2003-10-30 19:59:00 peter
|
Revision 1.64 2003-11-10 19:08:32 peter
|
||||||
|
* line numbering is now only done when #10, #10#13 is really parsed
|
||||||
|
instead of when it is the next character
|
||||||
|
|
||||||
|
Revision 1.63 2003/10/30 19:59:00 peter
|
||||||
* support scalefactor for opr_local
|
* support scalefactor for opr_local
|
||||||
* support reference with opr_local set, fixes tw2631
|
* support reference with opr_local set, fixes tw2631
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ interface
|
|||||||
max_macro_nesting=16;
|
max_macro_nesting=16;
|
||||||
maxmacrolen=16*1024;
|
maxmacrolen=16*1024;
|
||||||
preprocbufsize=32*1024;
|
preprocbufsize=32*1024;
|
||||||
Newline = #10;
|
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -151,6 +150,7 @@ interface
|
|||||||
procedure skipoldtpcomment;
|
procedure skipoldtpcomment;
|
||||||
procedure readtoken;
|
procedure readtoken;
|
||||||
function readpreproc:ttoken;
|
function readpreproc:ttoken;
|
||||||
|
function asmgetcharstart : char;
|
||||||
function asmgetchar:char;
|
function asmgetchar:char;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -603,6 +603,8 @@ implementation
|
|||||||
dec(bracketcount);
|
dec(bracketcount);
|
||||||
'{' :
|
'{' :
|
||||||
inc(bracketcount);
|
inc(bracketcount);
|
||||||
|
#10,#13 :
|
||||||
|
current_scanner.linebreak;
|
||||||
#26 :
|
#26 :
|
||||||
current_scanner.end_of_file;
|
current_scanner.end_of_file;
|
||||||
end;
|
end;
|
||||||
@ -838,10 +840,8 @@ implementation
|
|||||||
if current_scanner.inputfilecount<max_include_nesting then
|
if current_scanner.inputfilecount<max_include_nesting then
|
||||||
begin
|
begin
|
||||||
inc(current_scanner.inputfilecount);
|
inc(current_scanner.inputfilecount);
|
||||||
{ save old postion and decrease linebreak }
|
{ we need to reread the current char }
|
||||||
if c=newline then
|
dec(current_scanner.inputpointer);
|
||||||
dec(current_scanner.line_no);
|
|
||||||
dec(longint(current_scanner.inputpointer));
|
|
||||||
{ shutdown current file }
|
{ shutdown current file }
|
||||||
current_scanner.tempcloseinputfile;
|
current_scanner.tempcloseinputfile;
|
||||||
{ load new file }
|
{ load new file }
|
||||||
@ -852,12 +852,6 @@ implementation
|
|||||||
Message1(scan_f_cannot_open_includefile,hs);
|
Message1(scan_f_cannot_open_includefile,hs);
|
||||||
Message1(scan_t_start_include_file,current_scanner.inputfile.path^+current_scanner.inputfile.name^);
|
Message1(scan_t_start_include_file,current_scanner.inputfile.path^+current_scanner.inputfile.name^);
|
||||||
current_scanner.reload;
|
current_scanner.reload;
|
||||||
{ process first read char }
|
|
||||||
case c of
|
|
||||||
#26 : current_scanner.reload;
|
|
||||||
#10,
|
|
||||||
#13 : current_scanner.linebreak;
|
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Message(scan_f_include_deep_ten);
|
Message(scan_f_include_deep_ten);
|
||||||
@ -1009,12 +1003,6 @@ implementation
|
|||||||
if not openinputfile then
|
if not openinputfile then
|
||||||
Message1(scan_f_cannot_open_input,inputfile.name^);
|
Message1(scan_f_cannot_open_input,inputfile.name^);
|
||||||
reload;
|
reload;
|
||||||
{ process first read char }
|
|
||||||
case c of
|
|
||||||
#26 : reload;
|
|
||||||
#10,
|
|
||||||
#13 : linebreak;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1197,7 +1185,7 @@ implementation
|
|||||||
(inputpointer-inputbuffer<bufsize) then
|
(inputpointer-inputbuffer<bufsize) then
|
||||||
begin
|
begin
|
||||||
c:=' ';
|
c:=' ';
|
||||||
inc(longint(inputpointer));
|
inc(inputpointer);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{ can we read more from this file ? }
|
{ can we read more from this file ? }
|
||||||
@ -1235,7 +1223,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
{ load next char }
|
{ load next char }
|
||||||
c:=inputpointer^;
|
c:=inputpointer^;
|
||||||
inc(longint(inputpointer));
|
inc(inputpointer);
|
||||||
until c<>#0; { if also end, then reload again }
|
until c<>#0; { if also end, then reload again }
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1245,10 +1233,8 @@ implementation
|
|||||||
var
|
var
|
||||||
hp : tinputfile;
|
hp : tinputfile;
|
||||||
begin
|
begin
|
||||||
{ save old postion and decrease linebreak }
|
{ save old postion }
|
||||||
if c=newline then
|
dec(inputpointer);
|
||||||
dec(line_no);
|
|
||||||
dec(longint(inputpointer));
|
|
||||||
tempcloseinputfile;
|
tempcloseinputfile;
|
||||||
{ create macro 'file' }
|
{ create macro 'file' }
|
||||||
{ use special name to dispose after !! }
|
{ use special name to dispose after !! }
|
||||||
@ -1269,7 +1255,7 @@ implementation
|
|||||||
lasttokenpos:=0;
|
lasttokenpos:=0;
|
||||||
{ load new c }
|
{ load new c }
|
||||||
c:=inputpointer^;
|
c:=inputpointer^;
|
||||||
inc(longint(inputpointer));
|
inc(inputpointer);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1320,27 +1306,28 @@ implementation
|
|||||||
with inputfile do
|
with inputfile do
|
||||||
begin
|
begin
|
||||||
if (byte(inputpointer^)=0) and not(endoffile) then
|
if (byte(inputpointer^)=0) and not(endoffile) then
|
||||||
begin
|
begin
|
||||||
cur:=c;
|
cur:=c;
|
||||||
reload;
|
reload;
|
||||||
if byte(cur)+byte(c)<>23 then
|
if byte(cur)+byte(c)<>23 then
|
||||||
dec(longint(inputpointer));
|
dec(inputpointer);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ Fix linebreak to be only newline (=#10) for all types of linebreaks }
|
{ Support all combination of #10 and #13 as line break }
|
||||||
if (byte(inputpointer^)+byte(c)=23) then
|
if (byte(inputpointer^)+byte(c)=23) then
|
||||||
inc(longint(inputpointer));
|
inc(inputpointer);
|
||||||
end;
|
end;
|
||||||
c:=newline;
|
{ Always return #10 as line break }
|
||||||
{ increase line counters }
|
c:=#10;
|
||||||
|
{ increase line counters }
|
||||||
lastlinepos:=bufstart+(inputpointer-inputbuffer);
|
lastlinepos:=bufstart+(inputpointer-inputbuffer);
|
||||||
inc(line_no);
|
inc(line_no);
|
||||||
{ update linebuffer }
|
{ update linebuffer }
|
||||||
if cs_asm_source in aktglobalswitches then
|
if cs_asm_source in aktglobalswitches then
|
||||||
inputfile.setline(line_no,lastlinepos);
|
inputfile.setline(line_no,lastlinepos);
|
||||||
{ update for status and call the show status routine,
|
{ update for status and call the show status routine,
|
||||||
but don't touch aktfilepos ! }
|
but don't touch aktfilepos ! }
|
||||||
oldaktfilepos:=aktfilepos;
|
oldaktfilepos:=aktfilepos;
|
||||||
oldtokenpos:=akttokenpos;
|
oldtokenpos:=akttokenpos;
|
||||||
gettokenpos; { update for v_status }
|
gettokenpos; { update for v_status }
|
||||||
@ -1357,9 +1344,9 @@ implementation
|
|||||||
s : string;
|
s : string;
|
||||||
begin
|
begin
|
||||||
if c in [#32..#255] then
|
if c in [#32..#255] then
|
||||||
s:=''''+c+''''
|
s:=''''+c+''''
|
||||||
else
|
else
|
||||||
s:='#'+tostr(ord(c));
|
s:='#'+tostr(ord(c));
|
||||||
Message2(scan_f_illegal_char,s,'$'+hexstr(ord(c),2));
|
Message2(scan_f_illegal_char,s,'$'+hexstr(ord(c),2));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1558,14 +1545,9 @@ implementation
|
|||||||
begin
|
begin
|
||||||
c:=inputpointer^;
|
c:=inputpointer^;
|
||||||
if c=#0 then
|
if c=#0 then
|
||||||
reload
|
reload
|
||||||
else
|
else
|
||||||
inc(longint(inputpointer));
|
inc(inputpointer);
|
||||||
case c of
|
|
||||||
#26 : reload;
|
|
||||||
#10,
|
|
||||||
#13 : linebreak;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1576,40 +1558,34 @@ implementation
|
|||||||
i:=0;
|
i:=0;
|
||||||
repeat
|
repeat
|
||||||
case c of
|
case c of
|
||||||
'_',
|
'_',
|
||||||
'0'..'9',
|
'0'..'9',
|
||||||
'A'..'Z' : begin
|
'A'..'Z' :
|
||||||
if i<255 then
|
begin
|
||||||
begin
|
if i<255 then
|
||||||
inc(i);
|
begin
|
||||||
orgpattern[i]:=c;
|
inc(i);
|
||||||
pattern[i]:=c;
|
orgpattern[i]:=c;
|
||||||
end;
|
pattern[i]:=c;
|
||||||
c:=inputpointer^;
|
end;
|
||||||
inc(longint(inputpointer));
|
c:=inputpointer^;
|
||||||
end;
|
inc(inputpointer);
|
||||||
'a'..'z' : begin
|
end;
|
||||||
if i<255 then
|
'a'..'z' :
|
||||||
begin
|
begin
|
||||||
inc(i);
|
if i<255 then
|
||||||
orgpattern[i]:=c;
|
begin
|
||||||
pattern[i]:=chr(ord(c)-32)
|
inc(i);
|
||||||
end;
|
orgpattern[i]:=c;
|
||||||
c:=inputpointer^;
|
pattern[i]:=chr(ord(c)-32)
|
||||||
inc(longint(inputpointer));
|
end;
|
||||||
end;
|
c:=inputpointer^;
|
||||||
#0 : reload;
|
inc(inputpointer);
|
||||||
#26 : begin
|
end;
|
||||||
reload;
|
#0 :
|
||||||
if c=#26 then
|
reload;
|
||||||
break;
|
else
|
||||||
end;
|
break;
|
||||||
#13,#10 : begin
|
|
||||||
linebreak;
|
|
||||||
break;
|
|
||||||
end;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
end;
|
end;
|
||||||
until false;
|
until false;
|
||||||
orgpattern[0]:=chr(i);
|
orgpattern[0]:=chr(i);
|
||||||
@ -1623,29 +1599,32 @@ implementation
|
|||||||
i : longint;
|
i : longint;
|
||||||
begin
|
begin
|
||||||
case c of
|
case c of
|
||||||
'%' : begin
|
'%' :
|
||||||
readchar;
|
begin
|
||||||
base:=2;
|
readchar;
|
||||||
pattern[1]:='%';
|
base:=2;
|
||||||
i:=1;
|
pattern[1]:='%';
|
||||||
end;
|
i:=1;
|
||||||
'&' : begin
|
end;
|
||||||
readchar;
|
'&' :
|
||||||
base:=8;
|
begin
|
||||||
pattern[1]:='&';
|
readchar;
|
||||||
i:=1;
|
base:=8;
|
||||||
end;
|
pattern[1]:='&';
|
||||||
'$' : begin
|
i:=1;
|
||||||
readchar;
|
end;
|
||||||
base:=16;
|
'$' :
|
||||||
pattern[1]:='$';
|
begin
|
||||||
i:=1;
|
readchar;
|
||||||
end;
|
base:=16;
|
||||||
else
|
pattern[1]:='$';
|
||||||
begin
|
i:=1;
|
||||||
base:=10;
|
end;
|
||||||
i:=0;
|
else
|
||||||
end;
|
begin
|
||||||
|
base:=10;
|
||||||
|
i:=0;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
while ((base>=10) and (c in ['0'..'9'])) or
|
while ((base>=10) and (c in ['0'..'9'])) or
|
||||||
((base=16) and (c in ['A'..'F','a'..'f'])) or
|
((base=16) and (c in ['A'..'F','a'..'f'])) or
|
||||||
@ -1657,19 +1636,8 @@ implementation
|
|||||||
inc(i);
|
inc(i);
|
||||||
pattern[i]:=c;
|
pattern[i]:=c;
|
||||||
end;
|
end;
|
||||||
{ get next char }
|
readchar;
|
||||||
c:=inputpointer^;
|
|
||||||
if c=#0 then
|
|
||||||
reload
|
|
||||||
else
|
|
||||||
inc(longint(inputpointer));
|
|
||||||
end;
|
end;
|
||||||
{ was the next char a linebreak ? }
|
|
||||||
case c of
|
|
||||||
#26 : reload;
|
|
||||||
#10,
|
|
||||||
#13 : linebreak;
|
|
||||||
end;
|
|
||||||
pattern[0]:=chr(i);
|
pattern[0]:=chr(i);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1699,69 +1667,71 @@ implementation
|
|||||||
i:=0;
|
i:=0;
|
||||||
repeat
|
repeat
|
||||||
case c of
|
case c of
|
||||||
'{' :
|
'{' :
|
||||||
if aktcommentstyle=comment_tp then
|
|
||||||
inc_comment_level;
|
|
||||||
'}' :
|
|
||||||
if aktcommentstyle=comment_tp then
|
|
||||||
begin
|
begin
|
||||||
readchar;
|
if aktcommentstyle=comment_tp then
|
||||||
dec_comment_level;
|
inc_comment_level;
|
||||||
if comment_level=0 then
|
|
||||||
break
|
|
||||||
else
|
|
||||||
continue;
|
|
||||||
end;
|
end;
|
||||||
'*' :
|
'}' :
|
||||||
if aktcommentstyle=comment_oldtp then
|
|
||||||
begin
|
begin
|
||||||
readchar;
|
if aktcommentstyle=comment_tp then
|
||||||
if c=')' then
|
begin
|
||||||
begin
|
readchar;
|
||||||
readchar;
|
dec_comment_level;
|
||||||
dec_comment_level;
|
if comment_level=0 then
|
||||||
break;
|
break
|
||||||
end
|
else
|
||||||
else
|
continue;
|
||||||
{ Add both characters !!}
|
end;
|
||||||
if (i<255) then
|
|
||||||
begin
|
|
||||||
inc(i);
|
|
||||||
readcomment[i]:='*';
|
|
||||||
if (i<255) then
|
|
||||||
begin
|
|
||||||
inc(i);
|
|
||||||
readcomment[i]:='*';
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
{ Not old TP comment, so add...}
|
|
||||||
begin
|
|
||||||
if (i<255) then
|
|
||||||
begin
|
|
||||||
inc(i);
|
|
||||||
readcomment[i]:='*';
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
#26 :
|
'*' :
|
||||||
|
begin
|
||||||
|
if aktcommentstyle=comment_oldtp then
|
||||||
|
begin
|
||||||
|
readchar;
|
||||||
|
if c=')' then
|
||||||
|
begin
|
||||||
|
readchar;
|
||||||
|
dec_comment_level;
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
{ Add both characters !!}
|
||||||
|
if (i<255) then
|
||||||
|
begin
|
||||||
|
inc(i);
|
||||||
|
readcomment[i]:='*';
|
||||||
|
if (i<255) then
|
||||||
|
begin
|
||||||
|
inc(i);
|
||||||
|
readcomment[i]:='*';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
{ Not old TP comment, so add...}
|
||||||
|
begin
|
||||||
|
if (i<255) then
|
||||||
|
begin
|
||||||
|
inc(i);
|
||||||
|
readcomment[i]:='*';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
#10,#13 :
|
||||||
|
linebreak;
|
||||||
|
#26 :
|
||||||
end_of_file;
|
end_of_file;
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if (i<255) then
|
if (i<255) then
|
||||||
begin
|
begin
|
||||||
inc(i);
|
inc(i);
|
||||||
readcomment[i]:=c;
|
readcomment[i]:=c;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
c:=inputpointer^;
|
readchar;
|
||||||
if c=#0 then
|
|
||||||
reload
|
|
||||||
else
|
|
||||||
inc(longint(inputpointer));
|
|
||||||
if c in [#10,#13] then
|
|
||||||
linebreak;
|
|
||||||
until false;
|
until false;
|
||||||
readcomment[0]:=chr(i);
|
readcomment[0]:=chr(i);
|
||||||
end;
|
end;
|
||||||
@ -1792,21 +1762,25 @@ implementation
|
|||||||
|
|
||||||
procedure tscannerfile.skipspace;
|
procedure tscannerfile.skipspace;
|
||||||
begin
|
begin
|
||||||
while c in [' ',#9..#13] do
|
repeat
|
||||||
begin
|
case c of
|
||||||
c:=inputpointer^;
|
|
||||||
if c=#0 then
|
|
||||||
reload
|
|
||||||
else
|
|
||||||
inc(longint(inputpointer));
|
|
||||||
case c of
|
|
||||||
#26 :
|
#26 :
|
||||||
reload;
|
begin
|
||||||
|
reload;
|
||||||
|
if (c=#26) and not assigned(inputfile.next) then
|
||||||
|
break;
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
#10,
|
#10,
|
||||||
#13 :
|
#13 :
|
||||||
linebreak;
|
linebreak;
|
||||||
end;
|
#9,#11,#12,' ' :
|
||||||
end;
|
;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
readchar;
|
||||||
|
until false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1823,8 +1797,16 @@ implementation
|
|||||||
oldcommentstyle:=aktcommentstyle;
|
oldcommentstyle:=aktcommentstyle;
|
||||||
repeat
|
repeat
|
||||||
case c of
|
case c of
|
||||||
|
#10,
|
||||||
|
#13 :
|
||||||
|
linebreak;
|
||||||
#26 :
|
#26 :
|
||||||
end_of_file;
|
begin
|
||||||
|
reload;
|
||||||
|
if (c=#26) and not assigned(inputfile.next) then
|
||||||
|
end_of_file;
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
'{' :
|
'{' :
|
||||||
begin
|
begin
|
||||||
if not(m_nested_comment in aktmodeswitches) or
|
if not(m_nested_comment in aktmodeswitches) or
|
||||||
@ -1872,7 +1854,7 @@ implementation
|
|||||||
case c of
|
case c of
|
||||||
#26 :
|
#26 :
|
||||||
end_of_file;
|
end_of_file;
|
||||||
newline :
|
#10,#13 :
|
||||||
break;
|
break;
|
||||||
'''' :
|
'''' :
|
||||||
begin
|
begin
|
||||||
@ -1905,9 +1887,8 @@ implementation
|
|||||||
skipoldtpcomment;
|
skipoldtpcomment;
|
||||||
aktcommentstyle:=oldcommentstyle;
|
aktcommentstyle:=oldcommentstyle;
|
||||||
end;
|
end;
|
||||||
end
|
end;
|
||||||
else
|
next_char_loaded:=true;
|
||||||
next_char_loaded:=true;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
found:=0;
|
found:=0;
|
||||||
@ -1921,9 +1902,8 @@ implementation
|
|||||||
begin
|
begin
|
||||||
skipdelphicomment;
|
skipdelphicomment;
|
||||||
aktcommentstyle:=oldcommentstyle;
|
aktcommentstyle:=oldcommentstyle;
|
||||||
end
|
end;
|
||||||
else
|
next_char_loaded:=true;
|
||||||
next_char_loaded:=true;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
found:=0;
|
found:=0;
|
||||||
@ -1934,18 +1914,7 @@ implementation
|
|||||||
if next_char_loaded then
|
if next_char_loaded then
|
||||||
next_char_loaded:=false
|
next_char_loaded:=false
|
||||||
else
|
else
|
||||||
begin
|
readchar;
|
||||||
c:=inputpointer^;
|
|
||||||
if c=#0 then
|
|
||||||
reload
|
|
||||||
else
|
|
||||||
inc(longint(inputpointer));
|
|
||||||
case c of
|
|
||||||
#26 : reload;
|
|
||||||
#10,
|
|
||||||
#13 : linebreak;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
until (found=2);
|
until (found=2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1966,20 +1935,21 @@ implementation
|
|||||||
while (comment_level>0) do
|
while (comment_level>0) do
|
||||||
begin
|
begin
|
||||||
case c of
|
case c of
|
||||||
'{' : inc_comment_level;
|
'{' :
|
||||||
'}' : dec_comment_level;
|
inc_comment_level;
|
||||||
#26 : end_of_file;
|
'}' :
|
||||||
end;
|
dec_comment_level;
|
||||||
c:=inputpointer^;
|
#10,#13 :
|
||||||
if c=#0 then
|
linebreak;
|
||||||
reload
|
#26 :
|
||||||
else
|
begin
|
||||||
inc(longint(inputpointer));
|
reload;
|
||||||
case c of
|
if (c=#26) and not assigned(inputfile.next) then
|
||||||
#26 : reload;
|
end_of_file;
|
||||||
#10,
|
continue;
|
||||||
#13 : linebreak;
|
end;
|
||||||
end;
|
end;
|
||||||
|
readchar;
|
||||||
end;
|
end;
|
||||||
aktcommentstyle:=comment_none;
|
aktcommentstyle:=comment_none;
|
||||||
end;
|
end;
|
||||||
@ -1994,8 +1964,8 @@ implementation
|
|||||||
if c='$' then
|
if c='$' then
|
||||||
Message(scan_e_wrong_styled_switch);
|
Message(scan_e_wrong_styled_switch);
|
||||||
{ skip comment }
|
{ skip comment }
|
||||||
while not (c in [newline,#26]) do
|
while not (c in [#10,#13,#26]) do
|
||||||
readchar;
|
readchar;
|
||||||
dec_comment_level;
|
dec_comment_level;
|
||||||
aktcommentstyle:=comment_none;
|
aktcommentstyle:=comment_none;
|
||||||
end;
|
end;
|
||||||
@ -2021,7 +1991,14 @@ implementation
|
|||||||
repeat
|
repeat
|
||||||
case c of
|
case c of
|
||||||
#26 :
|
#26 :
|
||||||
end_of_file;
|
begin
|
||||||
|
reload;
|
||||||
|
if (c=#26) and not assigned(inputfile.next) then
|
||||||
|
end_of_file;
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
|
#10,#13 :
|
||||||
|
linebreak;
|
||||||
'*' :
|
'*' :
|
||||||
begin
|
begin
|
||||||
if found=3 then
|
if found=3 then
|
||||||
@ -2053,16 +2030,7 @@ implementation
|
|||||||
found:=0;
|
found:=0;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
c:=inputpointer^;
|
readchar;
|
||||||
if c=#0 then
|
|
||||||
reload
|
|
||||||
else
|
|
||||||
inc(longint(inputpointer));
|
|
||||||
case c of
|
|
||||||
#26 : reload;
|
|
||||||
#10,
|
|
||||||
#13 : linebreak;
|
|
||||||
end;
|
|
||||||
until (found=2);
|
until (found=2);
|
||||||
end;
|
end;
|
||||||
aktcommentstyle:=comment_none;
|
aktcommentstyle:=comment_none;
|
||||||
@ -2105,6 +2073,12 @@ implementation
|
|||||||
case c of
|
case c of
|
||||||
'{' :
|
'{' :
|
||||||
skipcomment;
|
skipcomment;
|
||||||
|
#26 :
|
||||||
|
begin
|
||||||
|
reload;
|
||||||
|
if (c=#26) and not assigned(inputfile.next) then
|
||||||
|
break;
|
||||||
|
end;
|
||||||
' ',#9..#13 :
|
' ',#9..#13 :
|
||||||
begin
|
begin
|
||||||
{$ifdef PREPROCWRITE}
|
{$ifdef PREPROCWRITE}
|
||||||
@ -2125,7 +2099,7 @@ implementation
|
|||||||
|
|
||||||
{ Save current token position, for EOF its already loaded }
|
{ Save current token position, for EOF its already loaded }
|
||||||
if c<>#26 then
|
if c<>#26 then
|
||||||
gettokenpos;
|
gettokenpos;
|
||||||
|
|
||||||
{ Check first for a identifier/keyword, this is 20+% faster (PFV) }
|
{ Check first for a identifier/keyword, this is 20+% faster (PFV) }
|
||||||
if c in ['A'..'Z','a'..'z','_'] then
|
if c in ['A'..'Z','a'..'z','_'] then
|
||||||
@ -2173,14 +2147,7 @@ implementation
|
|||||||
mac.fileinfo.line,mac.fileinfo.fileindex);
|
mac.fileinfo.line,mac.fileinfo.fileindex);
|
||||||
{ handle empty macros }
|
{ handle empty macros }
|
||||||
if c=#0 then
|
if c=#0 then
|
||||||
begin
|
reload;
|
||||||
reload;
|
|
||||||
case c of
|
|
||||||
#26 : reload;
|
|
||||||
#10,
|
|
||||||
#13 : linebreak;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
readtoken;
|
readtoken;
|
||||||
{ that's all folks }
|
{ that's all folks }
|
||||||
dec(yylexcount);
|
dec(yylexcount);
|
||||||
@ -2558,7 +2525,7 @@ implementation
|
|||||||
case c of
|
case c of
|
||||||
#26 :
|
#26 :
|
||||||
end_of_file;
|
end_of_file;
|
||||||
newline :
|
#10,#13 :
|
||||||
Message(scan_f_string_exceeds_line);
|
Message(scan_f_string_exceeds_line);
|
||||||
'''' :
|
'''' :
|
||||||
begin
|
begin
|
||||||
@ -2785,6 +2752,15 @@ exit_label:
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tscannerfile.asmgetcharstart : char;
|
||||||
|
begin
|
||||||
|
{ return first the character already
|
||||||
|
available in c }
|
||||||
|
lastasmgetchar:=c;
|
||||||
|
result:=asmgetchar;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tscannerfile.asmgetchar : char;
|
function tscannerfile.asmgetchar : char;
|
||||||
begin
|
begin
|
||||||
if lastasmgetchar<>#0 then
|
if lastasmgetchar<>#0 then
|
||||||
@ -2807,6 +2783,19 @@ exit_label:
|
|||||||
'{' :
|
'{' :
|
||||||
skipcomment;
|
skipcomment;
|
||||||
{$endif arm}
|
{$endif arm}
|
||||||
|
#10,#13 :
|
||||||
|
begin
|
||||||
|
linebreak;
|
||||||
|
asmgetchar:=c;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
#26 :
|
||||||
|
begin
|
||||||
|
reload;
|
||||||
|
if (c=#26) and not assigned(inputfile.next) then
|
||||||
|
end_of_file;
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
'/' :
|
'/' :
|
||||||
begin
|
begin
|
||||||
readchar;
|
readchar;
|
||||||
@ -2906,7 +2895,11 @@ exit_label:
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.63 2003-10-29 21:02:51 peter
|
Revision 1.64 2003-11-10 19:08:32 peter
|
||||||
|
* line numbering is now only done when #10, #10#13 is really parsed
|
||||||
|
instead of when it is the next character
|
||||||
|
|
||||||
|
Revision 1.63 2003/10/29 21:02:51 peter
|
||||||
* set ms_compiled after the program/unit is parsed
|
* set ms_compiled after the program/unit is parsed
|
||||||
* check for ms_compiled before checking preproc matches
|
* check for ms_compiled before checking preproc matches
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ interface
|
|||||||
if assigned(current_procinfo.procdef.funcretsym) and
|
if assigned(current_procinfo.procdef.funcretsym) and
|
||||||
is_fpu(current_procinfo.procdef.rettype.def) then
|
is_fpu(current_procinfo.procdef.rettype.def) then
|
||||||
tvarsym(current_procinfo.procdef.funcretsym).varstate:=vs_assigned;
|
tvarsym(current_procinfo.procdef.funcretsym).varstate:=vs_assigned;
|
||||||
c:=current_scanner.asmgetchar;
|
c:=current_scanner.asmgetcharstart;
|
||||||
code:=TAAsmoutput.Create;
|
code:=TAAsmoutput.Create;
|
||||||
while not(ende) do
|
while not(ende) do
|
||||||
begin
|
begin
|
||||||
@ -343,7 +343,11 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.10 2003-10-01 20:34:51 peter
|
Revision 1.11 2003-11-10 19:08:32 peter
|
||||||
|
* line numbering is now only done when #10, #10#13 is really parsed
|
||||||
|
instead of when it is the next character
|
||||||
|
|
||||||
|
Revision 1.10 2003/10/01 20:34:51 peter
|
||||||
* procinfo unit contains tprocinfo
|
* procinfo unit contains tprocinfo
|
||||||
* cginfo renamed to cgbase
|
* cginfo renamed to cgbase
|
||||||
* moved cgmessage to verbose
|
* moved cgmessage to verbose
|
||||||
|
Loading…
Reference in New Issue
Block a user