* Replaced hacks with resetting 'c' to zero and decreasing inputpointer by boolean parameter to skipcomment and skipoldtpcomment. This parameter specifies whether first character of comment should be read.

- in_asm_string also rendered useless by r32828, removed.

git-svn-id: trunk@32836 -
This commit is contained in:
sergei 2016-01-03 17:07:15 +00:00
parent d4d4689914
commit f69f6336e9
4 changed files with 17 additions and 36 deletions

View File

@ -417,8 +417,7 @@ const
c:=current_scanner.asmgetchar;
if c='*' then
begin
scanner.c:=#0;{Signal skipoldtpcomment to reload a char }
current_scanner.skipoldtpcomment;
current_scanner.skipoldtpcomment(true);
GetToken;
end
else
@ -532,7 +531,7 @@ const
end;
'{' : begin
current_scanner.skipcomment;
current_scanner.skipcomment(true);
GetToken;
end;

View File

@ -574,7 +574,6 @@ unit raatt;
'''' : { char }
begin
current_scanner.in_asm_string:=true;
actasmpattern:='';
repeat
c:=current_scanner.asmgetchar;
@ -599,13 +598,11 @@ unit raatt;
until false;
actasmpattern:=EscapeToPascal(actasmpattern);
actasmtoken:=AS_STRING;
current_scanner.in_asm_string:=false;
exit;
end;
'"' : { string }
begin
current_scanner.in_asm_string:=true;
actasmpattern:='';
repeat
c:=current_scanner.asmgetchar;
@ -630,7 +627,6 @@ unit raatt;
until false;
actasmpattern:=EscapeToPascal(actasmpattern);
actasmtoken:=AS_STRING;
current_scanner.in_asm_string:=false;
exit;
end;
@ -671,12 +667,11 @@ unit raatt;
actasmtoken:=AS_LSBRACKET
else
begin
dec(current_scanner.inputpointer);
current_scanner.skipcomment;
current_scanner.skipcomment(false);
GetToken;
end;
{$else arm}
current_scanner.skipcomment;
current_scanner.skipcomment(true);
GetToken;
{$endif arm}
exit;
@ -743,8 +738,7 @@ unit raatt;
c:=current_scanner.asmgetchar;
if c='*' then
begin
scanner.c:=#0;{Signal skipoldtpcomment to reload a char }
current_scanner.skipoldtpcomment;
current_scanner.skipoldtpcomment(true);
GetToken;
end
else

View File

@ -139,7 +139,6 @@ interface
ignoredirectives : TFPHashList; { ignore directives, used to give warnings only once }
preprocstack : tpreprocstack;
replaystack : treplaystack;
in_asm_string : boolean;
preproc_pattern : string;
preproc_token : ttoken;
@ -215,9 +214,9 @@ interface
function readstatedefault:char;
procedure skipspace;
procedure skipuntildirective;
procedure skipcomment;
procedure skipcomment(read_first_char:boolean);
procedure skipdelphicomment;
procedure skipoldtpcomment;
procedure skipoldtpcomment(read_first_char:boolean);
procedure readtoken(allowrecordtoken:boolean);
function readpreproc:ttoken;
function asmgetchar:char;
@ -2649,7 +2648,6 @@ type
lasttoken:=NOTOKEN;
nexttoken:=NOTOKEN;
ignoredirectives:=TFPHashList.Create;
in_asm_string:=false;
end;
@ -4373,7 +4371,7 @@ type
end
else
begin
skipoldtpcomment;
skipoldtpcomment(false);
next_char_loaded:=true;
end;
end
@ -4410,10 +4408,11 @@ type
Comment Handling
****************************************************************************}
procedure tscannerfile.skipcomment;
procedure tscannerfile.skipcomment(read_first_char:boolean);
begin
current_commentstyle:=comment_tp;
readchar;
if read_first_char then
readchar;
inc_comment_level;
{ handle compiler switches }
if (c='$') then
@ -4458,7 +4457,7 @@ type
end;
procedure tscannerfile.skipoldtpcomment;
procedure tscannerfile.skipoldtpcomment(read_first_char:boolean);
var
found : longint;
begin
@ -4466,7 +4465,7 @@ type
inc_comment_level;
{ only load a char if last already processed,
was cause of bug1634 PM }
if c=#0 then
if read_first_char then
readchar;
{ this is now supported }
if (c='$') then
@ -4574,7 +4573,7 @@ type
repeat
case c of
'{' :
skipcomment;
skipcomment(true);
#26 :
begin
reload;
@ -4813,8 +4812,7 @@ type
case c of
'*' :
begin
c:=#0;{Signal skipoldtpcomment to reload a char }
skipoldtpcomment;
skipoldtpcomment(true);
readtoken(false);
exit;
end;
@ -5498,11 +5496,6 @@ exit_label:
function tscannerfile.asmgetchar : char;
begin
readchar;
if in_asm_string then
begin
asmgetchar:=c;
exit;
end;
repeat
case c of
#26 :

View File

@ -425,7 +425,6 @@ Unit Rax86int;
'''' : { string or character }
begin
actasmpattern:='';
current_scanner.in_asm_string:=true;
repeat
if c = '''' then
begin
@ -467,14 +466,12 @@ Unit Rax86int;
else
break; { end if }
until false;
current_scanner.in_asm_string:=false;
actasmtoken:=AS_STRING;
exit;
end;
'"' : { string or character }
begin
current_scanner.in_asm_string:=true;
actasmpattern:='';
repeat
if c = '"' then
@ -517,7 +514,6 @@ Unit Rax86int;
else
break; { end if }
until false;
current_scanner.in_asm_string:=false;
actasmtoken:=AS_STRING;
exit;
end;
@ -575,8 +571,7 @@ Unit Rax86int;
c:=current_scanner.asmgetchar;
if c='*' then
begin
scanner.c:=#0;{Signal skipoldtpcomment to reload a char }
current_scanner.skipoldtpcomment;
current_scanner.skipoldtpcomment(true);
GetToken;
end
else
@ -725,7 +720,7 @@ Unit Rax86int;
'{':
begin
current_scanner.skipcomment;
current_scanner.skipcomment(true);
GetToken;
end;