[antlr-interest] basic question

mzukowski at bco.com mzukowski at bco.com
Wed Jan 23 09:58:25 PST 2002


Actually the problem is that antlr only uses characters that it knows you
are using, and '.' wasn't one of them.  The best thing to do is to use the
charVocabulary option in your lexer,
http://www.antlr.org/doc/options.html#charVocabulary.

8-bit Ascii would be:
options { charVocabulary = '\3'..'\377'; }

Monty

> -----Original Message-----
> From: gidadoifiok [mailto:gidadoifiok at yahoo.com]
> Sent: Wednesday, January 23, 2002 9:40 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] basic question
> 
> 
> I'm very new to antlr (and lexing/parsing).  I wanted
> to define a rule for a quote-string.
> 
> I tried:
> 
>     STRING_LITERAL_SINGLE_QUOTE
> 	:	'\''! ( ~'\'' )* '\''!
> 	;
> 
> However, I kept getting errors that it did not like the
> '.' in the example below:
> 
>    'good.stuff'
> 
> So I changed the rule to:
> 
>     STRING_LITERAL_SINGLE_QUOTE
> 	:	'\''! ( '.' | ~'\'' )* '\''!
> 	;
> 
> Now it works fine.  Perhaps ~'\' does not include '.'?
> I'm trying to get a grasp on all the rules, any help
> or pointers to doc is greatly appreciated.
> 
> Thanks,
> Gidado
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/ 



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list