Or:
SINGLE_QUOTED_STRING returns [string result]
: SQUOTE
val=((~SQUOTE)*) { $result = val.Text; }
SQUOTE
;
-----------------------------------------------------
Rob Aarnts
phone: +31 2356 14444
mobile: +31 6 5582 2856
fax: +31 8 4227 4444
-----------------------------------------------------
On 24 jul 2011 15:07 "Bart Kiers" <[email protected]> <[email protected]>
wrote:
> 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 <[email protected]>
> <[email protected]> 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-addr
> > ess>
> List: <http://www.antlr.org/mailman/listinfo/antlr-interest>
> Unsubscribe:
> <http://www.antlr.org/mailman/options/antlr-interest/your-email-addres
> s>
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.