[antlr-interest] custom TokenLabelType and EOF/Error tokens

Bob Frankel bios.bob.frankel at gmail.com
Wed Nov 11 17:35:26 PST 2009


as it turns out, my grammar has 'python-like' indentation which is 
handled in an 'IndentedTokenStream' class that already wraps a 
'CommonTokenStream'; i was able to interpolate my own EOF_TOKEN within....

at this point, everything is working just fine....

thanks for all of the help :-)



Gavin Lambert wrote:
> <div class="moz-text-flowed">At 17:34 11/11/2009, David-Sarah Hopwood 
> wrote:
> >On closer investigation, it seems that this problem is due to
> >CommonTokenStream using Token.EOF_TOKEN, which is hardcoded to a
> >CommonToken.
>
> It's probably not too surprising that CommonTokenStream expects to 
> have a stream of CommonTokens... :)
>
> Does deriving your custom token type from CommonToken sort out the 
> problem?  If so, then things are as I'd expect; if not, that might be 
> a codegen bug.
>
>
> </div>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091111/2e6a96e4/attachment.html 


More information about the antlr-interest mailing list