Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 (Tek) 9/26/83; site orca.UUCP Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!houxm!houxz!vax135!cornell!uw-beaver!tektronix!orca!andrew From: andrew@orca.UUCP (Andrew Klossner) Newsgroups: net.unix-wizards Subject: Re: HELP needed from an experience lex-er Message-ID: <930@orca.UUCP> Date: Mon, 9-Jul-84 03:00:33 EDT Article-I.D.: orca.930 Posted: Mon Jul 9 03:00:33 1984 Date-Received: Tue, 10-Jul-84 07:17:29 EDT References: <238@cubsvax.UUCP> Organization: Tektronix, Wilsonville OR Lines: 27 [] "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@rand-relay) [ARPA]