I've got a problem where I need some communication back from Bison to Flex (in this case, I need Flex to return two different tokens for the same input, depending on context).

The procedure is something like:

1 - parser determines context and sets global flag for lexer

2 - lexer checks flag, reads a name, and returns a token depending on the flag

In general, this doesn't work because of Bison's lookahead - as often as not, the lexer has already returned a token before Bison has set the flag.

Is there a general solution to this problem? 'yyclearin' is no good; it just over-writes 'yychar'. YYBACKUP doesn't help, either, because you can't use it if there's already something in yychar. Ideally, I need to check if there's anything in yychar, and then push it back somehow.

Any ideas?

Thanks -

Evan



_______________________________________________
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to