HELP needed from an experience lex-er
Andrew Klossner
andrew at orca.UUCP
Mon Jul 9 17:00:33 AEST 1984
[]
"I hacked up lex.yy.c by changing the definitions of "input()"
and "output(c)", as well as the function definiton of yylex(),
so that yylex now has the form yylex(string), where string gets
copied into extern char *instr. Output is placed in extern
char *outstr, which is returned. The net effect is that
yylex() can now be called as a subroutine from another
function, and returns outstr to that function. Fine and dandy.
"This works wonderfully on the first call... but on subsequent
calls the input string never gets parsed; the right part of
yylook() is never entered. Apparently, something is done to
lex.yy.c's external variables during parsing, and something
needs to be re-initialized before the second call will work
properly. If you know what it is, please let me know!"
You must execute the statement "NLSTATE;" upon each entry to yylex.
Put the following immediately in front of your first pattern, after the
first "%%":
%{
NLSTATE;
%}
-- Andrew Klossner (decvax!tektronix!orca!andrew) [UUCP]
(orca!andrew.tektronix at rand-relay) [ARPA]
More information about the Comp.unix.wizards
mailing list