Gabriel Petrovay wrote: > Hi all, > > Does anybody have any idea, a working solution or an example of how > could I convert the token positions from (line, column) pair to > absolute indexes in the input stream (indexStart, indexEnd) > > Or, are there any ways to do this from the lexer without hacking it > (change the Java code generation). I am thinking about helper > clases/functions to do this or if I can some tell the Lexer to use > some extended token (MyCommonToken) that somehow (I don't know yet > how) adds this functionality. This information is part of the standard CommonToken, but don't forget that in the lexer rules you are still forming some of this information, so some references are only good for fragment calls and so on. Look at the values of $start, $stop, $pos, etc.
For CommonToken itself you can use getStartIndex() and getStopIndex(), as you can see from the implementation of getText(). Jim List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
