mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-24 20:11:27 +02:00
* store scanner directive stack when starting compilation of another module
* reset scanner directive stack position when starting new compilation, resolves #13998 git-svn-id: trunk@13285 -
This commit is contained in:
parent
ac550782dc
commit
f342e825ab
@ -86,6 +86,7 @@ implementation
|
||||
pattern:='';
|
||||
orgpattern:='';
|
||||
current_scanner:=nil;
|
||||
switchesstatestackpos:=0;
|
||||
|
||||
{ register all nodes and tais }
|
||||
registernodes;
|
||||
@ -280,6 +281,8 @@ implementation
|
||||
oldcurrent_procinfo : tprocinfo;
|
||||
old_settings : tsettings;
|
||||
oldsourcecodepage : tcodepagestring;
|
||||
old_switchesstatestack : tswitchesstatestack;
|
||||
old_switchesstatestackpos : Integer;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -300,11 +303,13 @@ implementation
|
||||
with olddata^ do
|
||||
begin
|
||||
old_current_module:=current_module;
|
||||
{ save symtable state }
|
||||
|
||||
{ save symtable state }
|
||||
oldsymtablestack:=symtablestack;
|
||||
oldmacrosymtablestack:=macrosymtablestack;
|
||||
oldcurrent_procinfo:=current_procinfo;
|
||||
{ save scanner state }
|
||||
|
||||
{ save scanner state }
|
||||
oldc:=c;
|
||||
oldpattern:=pattern;
|
||||
oldorgpattern:=orgpattern;
|
||||
@ -312,14 +317,19 @@ implementation
|
||||
oldidtoken:=idtoken;
|
||||
old_block_type:=block_type;
|
||||
oldtokenpos:=current_tokenpos;
|
||||
{ save cg }
|
||||
old_switchesstatestack:=switchesstatestack;
|
||||
old_switchesstatestackpos:=switchesstatestackpos;
|
||||
|
||||
{ save cg }
|
||||
oldparse_only:=parse_only;
|
||||
{ save akt... state }
|
||||
{ handle the postponed case first }
|
||||
|
||||
{ save akt... state }
|
||||
{ handle the postponed case first }
|
||||
flushpendingswitchesstate;
|
||||
oldcurrent_filepos:=current_filepos;
|
||||
old_settings:=current_settings;
|
||||
end;
|
||||
|
||||
{ reset parser, a previous fatal error could have left these variables in an unreliable state, this is
|
||||
important for the IDE }
|
||||
afterassignment:=false;
|
||||
@ -457,8 +467,12 @@ implementation
|
||||
idtoken:=oldidtoken;
|
||||
current_tokenpos:=oldtokenpos;
|
||||
block_type:=old_block_type;
|
||||
switchesstatestack:=old_switchesstatestack;
|
||||
switchesstatestackpos:=old_switchesstatestackpos;
|
||||
|
||||
{ restore cg }
|
||||
parse_only:=oldparse_only;
|
||||
|
||||
{ restore symtable state }
|
||||
symtablestack:=oldsymtablestack;
|
||||
macrosymtablestack:=oldmacrosymtablestack;
|
||||
|
||||
@ -23,22 +23,10 @@ unit scandir;
|
||||
|
||||
{$i fpcdefs.inc}
|
||||
|
||||
interface
|
||||
|
||||
|
||||
procedure InitScannerDirectives;
|
||||
|
||||
implementation
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils,
|
||||
cutils,cfileutl,
|
||||
globtype,globals,systems,widestr,cpuinfo,
|
||||
verbose,comphook,ppu,
|
||||
scanner,switches,
|
||||
fmodule,
|
||||
symconst,symtable,
|
||||
rabase;
|
||||
globtype;
|
||||
|
||||
const
|
||||
switchesstatestackmax = 20;
|
||||
@ -49,10 +37,27 @@ implementation
|
||||
verbosity: longint;
|
||||
end;
|
||||
|
||||
type
|
||||
tswitchesstatestack = array[0..switchesstatestackmax] of tsavedswitchesstate;
|
||||
|
||||
var
|
||||
switchesstatestack: array[0..switchesstatestackmax] of tsavedswitchesstate;
|
||||
switchesstatestack:tswitchesstatestack;
|
||||
switchesstatestackpos: Integer;
|
||||
|
||||
procedure InitScannerDirectives;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
SysUtils,
|
||||
cutils,cfileutl,
|
||||
globals,systems,widestr,cpuinfo,
|
||||
verbose,comphook,ppu,
|
||||
scanner,switches,
|
||||
fmodule,
|
||||
symconst,symtable,
|
||||
rabase;
|
||||
|
||||
{*****************************************************************************
|
||||
Helpers
|
||||
*****************************************************************************}
|
||||
@ -1405,6 +1410,4 @@ implementation
|
||||
AddDirective('Z4',directive_all, @dir_z4);
|
||||
end;
|
||||
|
||||
begin
|
||||
switchesstatestackpos:= 0;
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user