mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-24 02:19:24 +02:00
* changed yywrap into a procedure variable so it can be overriden
git-svn-id: trunk@10498 -
This commit is contained in:
parent
5cc0477dfa
commit
989f5eb367
utils
@ -115,7 +115,10 @@ procedure start ( state : Integer );
|
||||
file. In particular, yywrap may arrange for more input and return false
|
||||
in which case the yylex routine resumes lexical analysis. *)
|
||||
|
||||
function yywrap : Boolean;
|
||||
type
|
||||
yywrap_t = function (): Boolean;
|
||||
var
|
||||
yywrap: yywrap_t;
|
||||
(* The default yywrap routine supplied here closes input and output files
|
||||
and returns true (causing yylex to terminate). *)
|
||||
|
||||
@ -305,10 +308,11 @@ procedure start ( state : Integer );
|
||||
|
||||
(* yywrap: *)
|
||||
|
||||
function yywrap : Boolean;
|
||||
function lexlib_yywrap : Boolean;
|
||||
begin
|
||||
close(yyinput); close(yyoutput);
|
||||
yywrap := true;
|
||||
close(yyinput);
|
||||
close(yyoutput);
|
||||
lexlib_yywrap := true;
|
||||
end(*yywrap*);
|
||||
|
||||
(* Internal routines: *)
|
||||
@ -401,6 +405,7 @@ procedure yyclear;
|
||||
end(*yyclear*);
|
||||
|
||||
begin
|
||||
yywrap := @lexlib_yywrap;
|
||||
assign(yyinput, '');
|
||||
assign(yyoutput, '');
|
||||
reset(yyinput);
|
||||
|
@ -641,7 +641,7 @@ begin
|
||||
end
|
||||
else skip_until_eol;
|
||||
8:
|
||||
|
||||
|
||||
if NotInCPlusBlock then
|
||||
begin
|
||||
(* handle pre- and postfixes *)
|
||||
@ -657,7 +657,7 @@ begin
|
||||
else
|
||||
skip_until_eol;
|
||||
9:
|
||||
|
||||
|
||||
if NotInCPlusBlock then
|
||||
begin
|
||||
return(NUMBER);
|
||||
@ -859,41 +859,41 @@ begin
|
||||
49:
|
||||
if NotInCPlusBlock then return(VOID) else skip_until_eol;
|
||||
50:
|
||||
|
||||
|
||||
begin
|
||||
if not stripinfo then
|
||||
writeln(outfile,'{ C++ extern C conditionnal removed }');
|
||||
end;
|
||||
51:
|
||||
|
||||
|
||||
begin
|
||||
if not stripinfo then
|
||||
writeln(outfile,'{ C++ extern C conditionnal removed }');
|
||||
end;
|
||||
52:
|
||||
|
||||
|
||||
begin
|
||||
if not stripinfo then
|
||||
writeln(outfile,'{ C++ end of extern C conditionnal removed }');
|
||||
end;
|
||||
53:
|
||||
|
||||
|
||||
begin
|
||||
if not stripinfo then
|
||||
writeln(outfile,'{ C++ end of extern C conditionnal removed }');
|
||||
end;
|
||||
54:
|
||||
|
||||
|
||||
begin
|
||||
Inc(cplusblocklevel);
|
||||
end;
|
||||
55:
|
||||
|
||||
|
||||
begin
|
||||
Inc(cplusblocklevel);
|
||||
end;
|
||||
56:
|
||||
|
||||
|
||||
begin
|
||||
if cplusblocklevel > 0 then
|
||||
Inc(cplusblocklevel)
|
||||
@ -5924,7 +5924,7 @@ action:
|
||||
yyaction(yyrule);
|
||||
if yyreject then goto action;
|
||||
end
|
||||
else if not yydefault and yywrap then
|
||||
else if not yydefault and yywrap() then
|
||||
begin
|
||||
yyclear;
|
||||
return(0);
|
||||
|
@ -1,80 +1,80 @@
|
||||
|
||||
(* lexical analyzer template (TP Lex V3.0), V1.0 3-2-91 AG *)
|
||||
|
||||
(* global definitions: *)
|
||||
%%
|
||||
|
||||
function yylex : Integer;
|
||||
|
||||
procedure yyaction ( yyruleno : Integer );
|
||||
(* local definitions: *)
|
||||
%%
|
||||
begin
|
||||
(* actions: *)
|
||||
case yyruleno of
|
||||
%%
|
||||
end;
|
||||
end(*yyaction*);
|
||||
|
||||
(* DFA table: *)
|
||||
%%
|
||||
|
||||
var yyn : Integer;
|
||||
|
||||
label start, scan, action;
|
||||
|
||||
begin
|
||||
|
||||
start:
|
||||
|
||||
(* initialize: *)
|
||||
|
||||
yynew;
|
||||
|
||||
scan:
|
||||
|
||||
(* mark positions and matches: *)
|
||||
|
||||
for yyn := yykl[yystate] to yykh[yystate] do yymark(yyk[yyn]);
|
||||
for yyn := yymh[yystate] downto yyml[yystate] do yymatch(yym[yyn]);
|
||||
|
||||
if yytl[yystate]>yyth[yystate] then goto action; (* dead state *)
|
||||
|
||||
(* get next character: *)
|
||||
|
||||
yyscan;
|
||||
|
||||
(* determine action: *)
|
||||
|
||||
yyn := yytl[yystate];
|
||||
while (yyn<=yyth[yystate]) and not (yyactchar in yyt[yyn].cc) do inc(yyn);
|
||||
if yyn>yyth[yystate] then goto action;
|
||||
(* no transition on yyactchar in this state *)
|
||||
|
||||
(* switch to new state: *)
|
||||
|
||||
yystate := yyt[yyn].s;
|
||||
|
||||
goto scan;
|
||||
|
||||
action:
|
||||
|
||||
(* execute action: *)
|
||||
|
||||
if yyfind(yyrule) then
|
||||
begin
|
||||
yyaction(yyrule);
|
||||
if yyreject then goto action;
|
||||
end
|
||||
else if not yydefault and yywrap then
|
||||
begin
|
||||
yyclear;
|
||||
return(0);
|
||||
end;
|
||||
|
||||
if not yydone then goto start;
|
||||
|
||||
yylex := yyretval;
|
||||
|
||||
end(*yylex*);
|
||||
|
||||
|
||||
(* lexical analyzer template (TP Lex V3.0), V1.0 3-2-91 AG *)
|
||||
|
||||
(* global definitions: *)
|
||||
%%
|
||||
|
||||
function yylex : Integer;
|
||||
|
||||
procedure yyaction ( yyruleno : Integer );
|
||||
(* local definitions: *)
|
||||
%%
|
||||
begin
|
||||
(* actions: *)
|
||||
case yyruleno of
|
||||
%%
|
||||
end;
|
||||
end(*yyaction*);
|
||||
|
||||
(* DFA table: *)
|
||||
%%
|
||||
|
||||
var yyn : Integer;
|
||||
|
||||
label start, scan, action;
|
||||
|
||||
begin
|
||||
|
||||
start:
|
||||
|
||||
(* initialize: *)
|
||||
|
||||
yynew;
|
||||
|
||||
scan:
|
||||
|
||||
(* mark positions and matches: *)
|
||||
|
||||
for yyn := yykl[yystate] to yykh[yystate] do yymark(yyk[yyn]);
|
||||
for yyn := yymh[yystate] downto yyml[yystate] do yymatch(yym[yyn]);
|
||||
|
||||
if yytl[yystate]>yyth[yystate] then goto action; (* dead state *)
|
||||
|
||||
(* get next character: *)
|
||||
|
||||
yyscan;
|
||||
|
||||
(* determine action: *)
|
||||
|
||||
yyn := yytl[yystate];
|
||||
while (yyn<=yyth[yystate]) and not (yyactchar in yyt[yyn].cc) do inc(yyn);
|
||||
if yyn>yyth[yystate] then goto action;
|
||||
(* no transition on yyactchar in this state *)
|
||||
|
||||
(* switch to new state: *)
|
||||
|
||||
yystate := yyt[yyn].s;
|
||||
|
||||
goto scan;
|
||||
|
||||
action:
|
||||
|
||||
(* execute action: *)
|
||||
|
||||
if yyfind(yyrule) then
|
||||
begin
|
||||
yyaction(yyrule);
|
||||
if yyreject then goto action;
|
||||
end
|
||||
else if not yydefault and yywrap() then
|
||||
begin
|
||||
yyclear;
|
||||
return(0);
|
||||
end;
|
||||
|
||||
if not yydone then goto start;
|
||||
|
||||
yylex := yyretval;
|
||||
|
||||
end(*yylex*);
|
||||
|
||||
|
@ -117,7 +117,10 @@ procedure start ( state : Integer );
|
||||
file. In particular, yywrap may arrange for more input and return false
|
||||
in which case the yylex routine resumes lexical analysis. *)
|
||||
|
||||
function yywrap : Boolean;
|
||||
type
|
||||
yywrap_t = function (): Boolean;
|
||||
var
|
||||
yywrap: yywrap_t;
|
||||
(* The default yywrap routine supplied here closes input and output files
|
||||
and returns true (causing yylex to terminate). *)
|
||||
|
||||
@ -305,10 +308,11 @@ procedure start ( state : Integer );
|
||||
|
||||
(* yywrap: *)
|
||||
|
||||
function yywrap : Boolean;
|
||||
function lexlib_yywrap : Boolean;
|
||||
begin
|
||||
close(yyinput); close(yyoutput);
|
||||
yywrap := true;
|
||||
close(yyinput);
|
||||
close(yyoutput);
|
||||
lexlib_yywrap := true;
|
||||
end(*yywrap*);
|
||||
|
||||
(* Internal routines: *)
|
||||
@ -401,6 +405,7 @@ procedure yyclear;
|
||||
end(*yyclear*);
|
||||
|
||||
begin
|
||||
yywrap := @lexlib_yywrap;
|
||||
assign(yyinput, '');
|
||||
assign(yyoutput, '');
|
||||
reset(yyinput); rewrite(yyoutput);
|
||||
|
@ -1,80 +1,80 @@
|
||||
|
||||
(* lexical analyzer template (TP Lex V3.0), V1.0 3-2-91 AG *)
|
||||
|
||||
(* global definitions: *)
|
||||
%%
|
||||
|
||||
function yylex : Integer;
|
||||
|
||||
procedure yyaction ( yyruleno : Integer );
|
||||
(* local definitions: *)
|
||||
%%
|
||||
begin
|
||||
(* actions: *)
|
||||
case yyruleno of
|
||||
%%
|
||||
end;
|
||||
end(*yyaction*);
|
||||
|
||||
(* DFA table: *)
|
||||
%%
|
||||
|
||||
var yyn : Integer;
|
||||
|
||||
label start, scan, action;
|
||||
|
||||
begin
|
||||
|
||||
start:
|
||||
|
||||
(* initialize: *)
|
||||
|
||||
yynew;
|
||||
|
||||
scan:
|
||||
|
||||
(* mark positions and matches: *)
|
||||
|
||||
for yyn := yykl[yystate] to yykh[yystate] do yymark(yyk[yyn]);
|
||||
for yyn := yymh[yystate] downto yyml[yystate] do yymatch(yym[yyn]);
|
||||
|
||||
if yytl[yystate]>yyth[yystate] then goto action; (* dead state *)
|
||||
|
||||
(* get next character: *)
|
||||
|
||||
yyscan;
|
||||
|
||||
(* determine action: *)
|
||||
|
||||
yyn := yytl[yystate];
|
||||
while (yyn<=yyth[yystate]) and not (yyactchar in yyt[yyn].cc) do inc(yyn);
|
||||
if yyn>yyth[yystate] then goto action;
|
||||
(* no transition on yyactchar in this state *)
|
||||
|
||||
(* switch to new state: *)
|
||||
|
||||
yystate := yyt[yyn].s;
|
||||
|
||||
goto scan;
|
||||
|
||||
action:
|
||||
|
||||
(* execute action: *)
|
||||
|
||||
if yyfind(yyrule) then
|
||||
begin
|
||||
yyaction(yyrule);
|
||||
if yyreject then goto action;
|
||||
end
|
||||
else if not yydefault and yywrap then
|
||||
begin
|
||||
yyclear;
|
||||
return(0);
|
||||
end;
|
||||
|
||||
if not yydone then goto start;
|
||||
|
||||
yylex := yyretval;
|
||||
|
||||
end(*yylex*);
|
||||
|
||||
|
||||
(* lexical analyzer template (TP Lex V3.0), V1.0 3-2-91 AG *)
|
||||
|
||||
(* global definitions: *)
|
||||
%%
|
||||
|
||||
function yylex : Integer;
|
||||
|
||||
procedure yyaction ( yyruleno : Integer );
|
||||
(* local definitions: *)
|
||||
%%
|
||||
begin
|
||||
(* actions: *)
|
||||
case yyruleno of
|
||||
%%
|
||||
end;
|
||||
end(*yyaction*);
|
||||
|
||||
(* DFA table: *)
|
||||
%%
|
||||
|
||||
var yyn : Integer;
|
||||
|
||||
label start, scan, action;
|
||||
|
||||
begin
|
||||
|
||||
start:
|
||||
|
||||
(* initialize: *)
|
||||
|
||||
yynew;
|
||||
|
||||
scan:
|
||||
|
||||
(* mark positions and matches: *)
|
||||
|
||||
for yyn := yykl[yystate] to yykh[yystate] do yymark(yyk[yyn]);
|
||||
for yyn := yymh[yystate] downto yyml[yystate] do yymatch(yym[yyn]);
|
||||
|
||||
if yytl[yystate]>yyth[yystate] then goto action; (* dead state *)
|
||||
|
||||
(* get next character: *)
|
||||
|
||||
yyscan;
|
||||
|
||||
(* determine action: *)
|
||||
|
||||
yyn := yytl[yystate];
|
||||
while (yyn<=yyth[yystate]) and not (yyactchar in yyt[yyn].cc) do inc(yyn);
|
||||
if yyn>yyth[yystate] then goto action;
|
||||
(* no transition on yyactchar in this state *)
|
||||
|
||||
(* switch to new state: *)
|
||||
|
||||
yystate := yyt[yyn].s;
|
||||
|
||||
goto scan;
|
||||
|
||||
action:
|
||||
|
||||
(* execute action: *)
|
||||
|
||||
if yyfind(yyrule) then
|
||||
begin
|
||||
yyaction(yyrule);
|
||||
if yyreject then goto action;
|
||||
end
|
||||
else if not yydefault and yywrap() then
|
||||
begin
|
||||
yyclear;
|
||||
return(0);
|
||||
end;
|
||||
|
||||
if not yydone then goto start;
|
||||
|
||||
yylex := yyretval;
|
||||
|
||||
end(*yylex*);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user