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

View File

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

View File

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

View File

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

View File

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