[antlr-interest] charVocabulary having no effect

Terence Parr parrt at cs.usfca.edu
Mon Dec 13 11:37:03 PST 2004


On Dec 13, 2004, at 6:16 AM, André Næss wrote:
> I'm struggling a bit with charVocabulary. After getting lot's of
> strange "unexpected character" errors I figured that this was a rather
> important option. I therefore added
>
>     charVocabulary = '\3'..'\377';

Yeah, that should be the default.  I think for 2.7.5 I'll do that.

> To my Lexer options.
>
> But I'm still getting unexpected char errors. I have a fairly simple

Is it because you have not included a rule to match those chars?  
Saying all ascii in the vocab means you must have a rule to handle any 
ascii char that comes in.  For example,  you have no rule for left 
bracket.  If that comes along, you'll get an unexpected char error.

> grammar with a non-greedy rule to match the contents of a specific
> portion. When the lexer encounters the char '=' in this portion it
> stops saying "unexpected character". If I then add this:
>
> POINTLESS : '=' ;
>
> The error goes away, but then it stops on some other char. This
> continues until I've added all the chars not listed in some rule in
> the lexer. So to be sure it seems I will have to explicitly list *all*
> the ASCII characters.

Well, yeah.  If you want it to ignore stuff you don't have rules for, 
just set filter=true. :)

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

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





More information about the antlr-interest mailing list