|
From: | Evan Lavelle |
Subject: | Lexical feedback and lookahead |
Date: | Tue, 19 Jul 2005 14:19:49 +0100 |
User-agent: | Mozilla Thunderbird 1.0.2 (Windows/20050317) |
The procedure is something like: 1 - parser determines context and sets global flag for lexer2 - 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
[Prev in Thread] | Current Thread | [Next in Thread] |