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

anteusz at freemail.hu anteusz at freemail.hu
Sat May 8 10:15:40 PDT 2010


5/8/2010 6:44 PM keltezéssel, Jim Idle írta:
> 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
>    

C#.
I have a parser object..

myparser= new myparser(tokenStream);

How do I get to common token from there?


Marton



More information about the antlr-interest mailing list