Hi guys,

I am a complete flex newbie, I'm just trying to get a really old program to
compile, so maybe I am missing something completely obvious here.

Any hints would be greatly appreciated.

I am using flex version 2.5.4, and I have #define YY_INPUT(buf, retval, maxlen)
 overwritten to (retval = eval_getinput(buf, maxlen)), which returns the
input one line at a time so that I can parse standard input without
consuming it all, in case that matters.

Now I want to parse something like "define foo X <stuff> X", where X can be
any character. My grammar is as follows:

A       [a-zA-Z_]
B       [a-zA-Z0-9_]

<A>define{WS}+          { BEGIN def; }
<def>{A}{B}*            { definition(yytext); BEGIN A; } 

However inside definition(), when I repeatedly call input() to get the rest
of the line, it returns "define foo bar"! (the parameter for definition is
correctly set to "foo")
Shouldn't "define" and "foo" have been consumed by now?

Is this a bug in flex, or am I doing something wrong?

Thanks in advance.

-- 
Have fun,                               "As the moment elapsed
Michael "mag" Grigoriev                We walked in slowmotion
[EMAIL PROTECTED]                               Denying the tide
http://www.luminal.org                 We'll find our devotion"

Attachment: pgpITPqZfoWUD.pgp
Description: PGP signature

_______________________________________________
Help-flex mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-flex

Reply via email to