|Lex and Start Conditions firstname.lastname@example.org (1991-01-24)|
|Re: Lex and Start Conditions email@example.com (1991-01-24)|
|Re: Lex and Start Conditions firstname.lastname@example.org (1991-01-24)|
|From:||email@example.com (Peter Moore)|
|Date:||Thu, 24 Jan 91 22:48:14 GMT|
In article <firstname.lastname@example.org>, email@example.com (Jonathan Eifrig) writes:
|> This works great, except that the automaton has to be started up in the
|> correct (meta) state (in this case, NORM). What is the best way to do this?
This (along with the documentation) are my two biggest complaints with lex.
Here is my solution (with minor flame intact).
* Lex has the misfeature that all unlabeled rules are
* always active. This makes interference between labeled
* and unlabeled rules a big problem. To overcome this,
* every rule is labeled, with the normal state being
* NORMAL_MODE. To get ourselves into NORMAL_MODE at the
* start, we use this rule that matches any character. It
* simply switches to NORMAL_MODE and pushes back the
* character that triggered it. Anytime after, this rule
* is shielded by .|\n rules in all the other modes.
NLSTATE; /* otherwise beginning of line rules won't work */
[Should work, but I still like exclusive start states in flex. -John]
Return to the
Search the comp.compilers archives again.