[antlr-interest] Aggressive vs. Lazy Buffering in ANTLR
Kay Roepke
kroepke at classdump.org
Tue Dec 19 08:32:28 PST 2006
On 19. Dec 2006, at 16:59 , Foolish Ewe wrote:
> However, I tried making a simple input method that uses Lazy
> buffering (i.e. reads characters
> on demand extending the buffer). This lazy input stream no longer
> blocks on the constructor,
> however, now I've noticed that the CommonTokenStream constructor
> appears to block.
What do you do in your input stream's constructor? The
CommonTokenStream constructors shouldn't block,
they just set the members.
> It appears to be blocking in fillBuffer, but I don't see an
> explicit call in the constructor.
fillBuffer is invoked on the first call to LT. Maybe you're seeing
that? Though it doesn't sound
likely based on what you described...
> The impact of this is that it negates the interactive support that
> the lazy buffering of my
> home-grown input stream class, so I'd like to fix it.
>
> Is there a lazy buffering (buffer as input becomes available/on
> demand) variant of TokenStream
> support or have I made some error?
No there's nothing like that in the standard distribution. Could you
post some code?
cheers,
-k
--
Kay Röpke
http://classdump.org/
More information about the antlr-interest
mailing list