help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting bison to ignore tokens... sometimes!


From: Evan Lavelle
Subject: Re: Getting bison to ignore tokens... sometimes!
Date: Tue, 31 May 2011 16:37:42 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10

If your parser knows that it's dealing with a statement, you could try lexical feedback (look up "lexical tie-ins" in the bison docs, and google "scanner feedback" or "lexical feedback"). The parser sets a flag to tell the lexer that it's inside a statement, and the lexer then returns the NL when the flag is set, and discards it otherwise.

I've never had much luck with this, because the lookahead can make it difficult - the lexer might already have decided what to do before the parser tells it. Still, might work for you.

-Evan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]