As far as I understood (respectively experienced), tokText is not always 
set. You probably want to do this:
char* tok_text = (token->getText(token) != NULL) ? 
token->getText(token)->chars : token->tokText.chars;

At least that's what I'm doing to get the same result as 
token.toString() in Java.


Hope that helps
Marco


Юрушкин Михаил wrote:
> there is following problem. I have made simple grammar, generated c. file 
> 
> But when I try to get "tokens text", the error is occured. here is a 
> code of getters:
> 
> #define getTokenText(token) string((char*)token->tokText.chars)
> #define getTokenInteger(token) atoi((char*)token->tokText.chars)
> 
> I think, that tokens aren't initialized correctly, but what I did wrong...
> 
> -- 
> 
> Написано в почтовом клиенте браузера Opera: http://www.opera.com/mail/
> 
> 
> ------------------------------------------------------------------------
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address


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 il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to