* changed yywrap into a procedure variable so it can be overriden

git-svn-id: trunk@10498 -
This commit is contained in:
florian 2008-03-16 21:40:22 +00:00
parent 5cc0477dfa
commit 989f5eb367
5 changed files with 188 additions and 178 deletions

View File

@ -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);

View File

@ -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);

View File

@ -66,7 +66,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);

View File

@ -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);

View File

@ -66,7 +66,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);