mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 14:47:55 +02:00
Fix compilation of the JEDI package. Old Delphi versions have {$WEAKPACKAGEUNIT} while newer ones also seem to allow {$WEAKPACKAGENUNIT ON}... :/ (analogous for DENYPACKAGEUNIT...)
scanner.pas, tscannerfile: + new method readoptionalstate which reads a state like readstate, but if it encounters the closing } then it returns the provided fallback state scandir.pas: + do_moduleflagswitch: new parameter optional that triggers the use of readoptionalstate instead of readstate * dir_weakpackageunit & dir_denypackageunit: the ON/OFF is optional git-svn-id: trunk@33515 -
This commit is contained in:
parent
7d8d0340b9
commit
d24065c529
@ -118,11 +118,14 @@ unit scandir;
|
||||
end;
|
||||
|
||||
|
||||
procedure do_moduleflagswitch(flag:cardinal);
|
||||
procedure do_moduleflagswitch(flag:cardinal;optional:boolean);
|
||||
var
|
||||
state : char;
|
||||
begin
|
||||
state:=current_scanner.readstate;
|
||||
if optional then
|
||||
state:=current_scanner.readoptionalstate('+')
|
||||
else
|
||||
state:=current_scanner.readstate;
|
||||
if state='-' then
|
||||
current_module.flags:=current_module.flags and not flag
|
||||
else
|
||||
@ -381,7 +384,7 @@ unit scandir;
|
||||
|
||||
procedure dir_denypackageunit;
|
||||
begin
|
||||
do_moduleflagswitch(uf_package_deny);
|
||||
do_moduleflagswitch(uf_package_deny,true);
|
||||
end;
|
||||
|
||||
procedure dir_description;
|
||||
@ -1584,7 +1587,9 @@ unit scandir;
|
||||
|
||||
procedure dir_weakpackageunit;
|
||||
begin
|
||||
do_moduleflagswitch(uf_package_weak);
|
||||
{ old Delphi versions seem to use merely $WEAKPACKAGEUNIT while newer
|
||||
Delphis have $WEAPACKAGEUNIT ON... :/ }
|
||||
do_moduleflagswitch(uf_package_weak, true);
|
||||
end;
|
||||
|
||||
procedure dir_writeableconst;
|
||||
|
@ -211,6 +211,7 @@ interface
|
||||
function readcomment:string;
|
||||
function readquotedstring:string;
|
||||
function readstate:char;
|
||||
function readoptionalstate(fallback:char):char;
|
||||
function readstatedefault:char;
|
||||
procedure skipspace;
|
||||
procedure skipuntildirective;
|
||||
@ -4222,6 +4223,37 @@ type
|
||||
end;
|
||||
|
||||
|
||||
function tscannerfile.readoptionalstate(fallback:char):char;
|
||||
var
|
||||
state : char;
|
||||
begin
|
||||
state:=' ';
|
||||
if c=' ' then
|
||||
begin
|
||||
current_scanner.skipspace;
|
||||
if c='}' then
|
||||
state:=fallback
|
||||
else
|
||||
begin
|
||||
current_scanner.readid;
|
||||
if pattern='ON' then
|
||||
state:='+'
|
||||
else
|
||||
if pattern='OFF' then
|
||||
state:='-';
|
||||
end;
|
||||
end
|
||||
else
|
||||
if c='}' then
|
||||
state:=fallback
|
||||
else
|
||||
state:=c;
|
||||
if not (state in ['+','-']) then
|
||||
Message(scan_e_wrong_switch_toggle);
|
||||
readoptionalstate:=state;
|
||||
end;
|
||||
|
||||
|
||||
function tscannerfile.readstatedefault:char;
|
||||
var
|
||||
state : char;
|
||||
|
Loading…
Reference in New Issue
Block a user