[antlr-interest] Lazy load of CommonTokenStream??

Kay Röpke kroepke at classdump.org
Mon Aug 18 05:36:58 PDT 2008


Hi!

On Aug 18, 2008, at 2:31 PM, Martin Probst wrote:

> You might also consider looking back behind the start of the stream  
> as an error in the user of the interface. That is, while we do need  
> an EOF token to signal that the end of the stream was reached,  
> consumers of the token/char stream will always know that there is  
> nothing before 0, so requesting that is a programming error, and  
> should result in a runtime exception. It doesn't make sense anyways,  
> so why bother and create a specific return value for that?


I see your argument and kinda concur. At the same time, I could  
imagine client code looking backwards in the stream without even  
looking at the index (only incrementing the distance to look back to).  
For that purpose it would be helpful to get some kind of non- 
exceptional notification that the "end", or rather beginning, of the  
stream has been reached.

cheers,
-k
-- 
Kay Röpke
http://classdump.org/








More information about the antlr-interest mailing list