Hello, I'm trying to record the offset of the start of a token, relative to the beginning of the input buffer. My program passes a (char *) buffer to ANTLR and then runs a simple grammar that builds a data structure containing the element types and pointer to their position in the text buffer. The problem is I can't find a way to get the true character offset from ANTLR in order to set the pointer. Below it prints out the results of most of the values for the ANTLR3_COMMON_TOKEN for the very first token. The two subsequent values are the data member and the address of the character buffer. I would expect start, getStartIndex and input->data to be the same but they are different. How can I find the offset of a token, in terms of the number of characters from the start of the stream?
Thanks charPosition : -1 getCharPositionInLine : -1 getLine : 1 getStartIndex : 23213648 getStopIndex : 23213653 getTokenIndex : 0 index : 0 line : 1 lineStart : 23213648 start : 23213648 stop : 23213653 (pANTLR3_INPUT_STREAM)input->data 23217928 (uint8_t*)dataBuffer 23213624 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.
