[antlr-interest] Avoiding warnings without code bloat
Jim Idle
jimi at temporal-wave.com
Mon Jun 25 12:00:22 PDT 2007
Consult the examples for ways of doing this, you will find that the C
parser and Java parser are set up to handle this.
Jim
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of David Piepgrass
> Sent: Monday, June 25, 2007 11:48 AM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Avoiding warnings without code bloat
>
> I'm trying to match strings with escape sequences, so I tried this:
>
> // Strings
> SQ_STRING: '\''! (ESC_SEQ | ~'\'')* '\''!;
> DQ_STRING: '"'! (ESC_SEQ | ~'"' )* '"'!;
> fragment ESC_SEQ:
> | '\\r' {$text = "\r";}
> | '\\n' {$text = "\n";}
> | '\\t' {$text = "\t";}
> | '\\a' {$text = "\a";}
> | '\\b' {$text = "\b";}
> | '\\f' {$text = "\f";}
...
More information about the antlr-interest
mailing list