[antlr-interest] How to get position in bytes in the stream or string that is parsed?

Jim Idle jimi at temporal-wave.com
Sat May 8 09:44:44 PDT 2010


Java? C#? C?

You mean the position of a particular token? Look at the API for CommonToken. You will see methods such as getStartIndex. You can also use $tok.start and things like that in a grammar.


http://www.antlr.org/api/Java/classorg_1_1antlr_1_1runtime_1_1_common_token.html


Jim 

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of anteusz at freemail.hu
> Sent: Saturday, May 08, 2010 7:11 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] How to get position in bytes in the stream or
> string that is parsed?
> 
> Hi,
> How to get position in bytes in the stream or string that is parsed?
> Could someone tell me how to get that?
> 
> I read the faq where it was witten what had to be overridden.
> Is there a clear example somewhere?
> 
> Regards
> 
> Marton Papp
> 
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address





More information about the antlr-interest mailing list