[antlr-interest] $TOKEN.pos absolute location

Jim Idle jimi at temporal-wave.com
Wed Dec 19 08:40:56 PST 2007


In the other targets this is just the .start element. I would think it 
is the same for objc.

Jim

> -----Original Message-----
> From: Basil Shkara [mailto:bshkara at gmail.com]
> Sent: Wednesday, December 19, 2007 3:34 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] $TOKEN.pos absolute location
> 
> 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