[antlr-interest] ANTLR modification

Prashant Deva prashant.deva at gmail.com
Sat Oct 22 22:21:13 PDT 2005


The general way to get anything included is to talk with the 'supreme
dictator' of antlr Terence Parr ;-)

Though i doubt this would be included. I know a lot of people who have had a
need for this, including myself but we have had to to with implementing this
ourselves.

PRASHANT


On 10/23/05, Jim Crafton <jim.crafton at gmail.com> wrote:
>
> I have made a small modification to the ANTL Token, CommonToken, and
> CharScanner classes. The changes make it possible to for a Token (and
> an AST node as well) to have an offset assigned to it that represents
> the offset from the beginning of the character stream. I have a need
> for this, and I added and thought others might find it useful as well.
>
> The changes include added a virtual getOffset/setOffset method to the
> Token class, and re-implementing these in the CommonToken class. The
> CharScanner class has a new member var "offset" that is initially set
> to 0 in it's constructor(s) and then incremented for each call of the
> consume() method. This is member is then used when the CharScanner
> creates a new Token in the makeToken() method. The Token is then
> assigned this value by calling the Token's setOffset() method.
>
> Would there be any interest in having this merged into the general
> ANTLR codebase? If so, what's the best way to submit this?
>
> Thanks
>
> Jim Crafton
>



--
Prashant Deva
Creator, ANTLR Studio,www.antlrstudio.com <http://www.antlrstudio.com>
Founder, Placid Systems, www.placidsystems.com<http://www.placidsystems.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20051023/3f9963f2/attachment.html


More information about the antlr-interest mailing list