mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 03:29:33 +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
@ -115,7 +115,10 @@ procedure start ( state : Integer );
|
|||||||
file. In particular, yywrap may arrange for more input and return false
|
file. In particular, yywrap may arrange for more input and return false
|
||||||
in which case the yylex routine resumes lexical analysis. *)
|
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
|
(* The default yywrap routine supplied here closes input and output files
|
||||||
and returns true (causing yylex to terminate). *)
|
and returns true (causing yylex to terminate). *)
|
||||||
|
|
||||||
@ -305,10 +308,11 @@ procedure start ( state : Integer );
|
|||||||
|
|
||||||
(* yywrap: *)
|
(* yywrap: *)
|
||||||
|
|
||||||
function yywrap : Boolean;
|
function lexlib_yywrap : Boolean;
|
||||||
begin
|
begin
|
||||||
close(yyinput); close(yyoutput);
|
close(yyinput);
|
||||||
yywrap := true;
|
close(yyoutput);
|
||||||
|
lexlib_yywrap := true;
|
||||||
end(*yywrap*);
|
end(*yywrap*);
|
||||||
|
|
||||||
(* Internal routines: *)
|
(* Internal routines: *)
|
||||||
@ -401,6 +405,7 @@ procedure yyclear;
|
|||||||
end(*yyclear*);
|
end(*yyclear*);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
yywrap := @lexlib_yywrap;
|
||||||
assign(yyinput, '');
|
assign(yyinput, '');
|
||||||
assign(yyoutput, '');
|
assign(yyoutput, '');
|
||||||
reset(yyinput);
|
reset(yyinput);
|
||||||
|
@ -5924,7 +5924,7 @@ action:
|
|||||||
yyaction(yyrule);
|
yyaction(yyrule);
|
||||||
if yyreject then goto action;
|
if yyreject then goto action;
|
||||||
end
|
end
|
||||||
else if not yydefault and yywrap then
|
else if not yydefault and yywrap() then
|
||||||
begin
|
begin
|
||||||
yyclear;
|
yyclear;
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -66,7 +66,7 @@ action:
|
|||||||
yyaction(yyrule);
|
yyaction(yyrule);
|
||||||
if yyreject then goto action;
|
if yyreject then goto action;
|
||||||
end
|
end
|
||||||
else if not yydefault and yywrap then
|
else if not yydefault and yywrap() then
|
||||||
begin
|
begin
|
||||||
yyclear;
|
yyclear;
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -117,7 +117,10 @@ procedure start ( state : Integer );
|
|||||||
file. In particular, yywrap may arrange for more input and return false
|
file. In particular, yywrap may arrange for more input and return false
|
||||||
in which case the yylex routine resumes lexical analysis. *)
|
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
|
(* The default yywrap routine supplied here closes input and output files
|
||||||
and returns true (causing yylex to terminate). *)
|
and returns true (causing yylex to terminate). *)
|
||||||
|
|
||||||
@ -305,10 +308,11 @@ procedure start ( state : Integer );
|
|||||||
|
|
||||||
(* yywrap: *)
|
(* yywrap: *)
|
||||||
|
|
||||||
function yywrap : Boolean;
|
function lexlib_yywrap : Boolean;
|
||||||
begin
|
begin
|
||||||
close(yyinput); close(yyoutput);
|
close(yyinput);
|
||||||
yywrap := true;
|
close(yyoutput);
|
||||||
|
lexlib_yywrap := true;
|
||||||
end(*yywrap*);
|
end(*yywrap*);
|
||||||
|
|
||||||
(* Internal routines: *)
|
(* Internal routines: *)
|
||||||
@ -401,6 +405,7 @@ procedure yyclear;
|
|||||||
end(*yyclear*);
|
end(*yyclear*);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
yywrap := @lexlib_yywrap;
|
||||||
assign(yyinput, '');
|
assign(yyinput, '');
|
||||||
assign(yyoutput, '');
|
assign(yyoutput, '');
|
||||||
reset(yyinput); rewrite(yyoutput);
|
reset(yyinput); rewrite(yyoutput);
|
||||||
|
@ -66,7 +66,7 @@ action:
|
|||||||
yyaction(yyrule);
|
yyaction(yyrule);
|
||||||
if yyreject then goto action;
|
if yyreject then goto action;
|
||||||
end
|
end
|
||||||
else if not yydefault and yywrap then
|
else if not yydefault and yywrap() then
|
||||||
begin
|
begin
|
||||||
yyclear;
|
yyclear;
|
||||||
return(0);
|
return(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user