[antlr-interest] $TOKEN.pos absolute location

Basil Shkara bshkara at gmail.com
Wed Dec 19 03:33:59 PST 2007


Hi,

Using $TOKEN.pos gives you the position relative to $TOKEN's line.  Is  
there an easy way of receiving the position relative to all characters  
occurring beforehand?

So rather than receiving pos=43, line=2 - is it possible to receive  
pos=80, assuming that there are 79 characters before $TOKEN?

I am currently using the ObjC target and am using a lot of messy  
instance variables to count every token as it is parsed by my parser.   
There must another way!  :)

Regards,
Basil.


More information about the antlr-interest mailing list