[antlr-interest] How to ignore TOKEN in a String

Hiten R antlr3 at gmail.com
Tue Mar 22 19:25:19 PDT 2011


John/All

TOKEN solved the problem you mentioned but I am still stuck with the
original issue.

It still barfs when it encounters reserved word 'funny' in a sentence
[debugged it] and that leads to unsuccessful transfer of value to String aa.


Do you have any suggestion?

Thanks
Hitender

//grammar
@init {
  String aa;
}

funnyT=TOKEN { aa = $funnyT.text; }

//generated code
funnyT=(Token)match(input,TOKEN,FOLLOW_TOKEN_in_acl472);
String aa = (funnyT!=null?funnyT.getText():null);


More information about the antlr-interest mailing list