Hi Qiao, With Java as the target, you could do:
SINGLE_QUOTED_STRING @after { String s = getText(); setText(s.substring(1, s.length() - 1)); } : SQUOTE (~SQUOTE)* SQUOTE ; Regards, Bart. On Sun, Jul 24, 2011 at 2:43 PM, Mu Qiao <qiao...@gmail.com> wrote: > I have some token rules like: > SINGLE_QUOTED_STRING: SQUOTE (~SQUOTE)* SQUOTE; > I'd like to hide the first SQUOTE token and the last SQUOTE token from > the parser grammar. Is there any way to do that? I've tried the hidden > channel and the skip() method, but they work for the whole rule, not > just for the tokens I need to hide. > > -- > Best wishes, > Mu Qiao > GnuPG fingerprint: 92B1 B0C4 8D14 F8C4 EFA5 3ACC 30B3 0DE4 17B1 57E9 > > 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-inter...@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.