[antlr-interest] Re: caseSensitive question?

micheal_jor open.zone at virgin.net
Fri Apr 9 10:43:55 PDT 2004


--- In antlr-interest at yahoogroups.com, ronald.petty at m... wrote:
> When I try to match "Dim" this doesn't work, however if I try "dim" it 
> works.  Is there something besides caseSensitive to set?  Is my 
> charVocabulary or something interferring? 

You need to set caseSentiveLiterals too.

When you say "it doesn't work", what happens exactly?. It helps to
post the input (not too lengthy) and the output messages in addition
to the grammar.

Do you plan on contributing this grammar to ANTLR's grammars library
with a license that isn't more restrictive than BSD?

> options {
> }
> 
> class VB6Lexer extends Lexer;
> 
> options {
>         exportVocab=VB6;
>         charVocabulary='\3'..'\377'; //Latin, need to figure out
Japanese 
> charat
> er sets for UNICODE, you can do non continuous ranges

Why Japanese?. In any case, I don't think VB6 did UNICODE.

>         caseSensitive=false;
> 
> }
> 
> tokens {
>         DIM     = "dim";
>         FUNCTION        = "function";
>         SUB     = "sub";
> }
> 
> WS
>         :       ' '
>         |       '\t'
>         |       '\r' '\n'
>         |       '\n'
>         ;

You might want to separate NEWLINE from other WHITESPACE. You usually
need to call newline() at a minimum after snarfing a newline char so
that your tokens have the correct line number info.

> 
> SEMI    :       ','
>         ;
> 
> ID
>         options {
>                 testLiterals=true;
>                 paraphrase = "an identifier";
> 
>         }
>         :       ('a'..'z') ('a'..'z'|'0'..'9'|'_'|'.')*
>         ;
> 
> SL_COMMENT
>         :       "'" (~('\r'|'\n'))* (("\r\n")=>'\r''\n'|'\n')
>         ;
> 
>
**************************************************************************************
> This communication is intended solely for the addressee and is
> confidential. If you are not the intended recipient, any disclosure, 
> copying, distribution or any action taken or omitted to be taken in
> reliance on it, is prohibited and may be unlawful. Unless indicated
> to the contrary: it does not constitute professional advice or 
> opinions upon which reliance may be made by the addressee or any
> other party, and it should be considered to be a work in progress.
>
**************************************************************************************



 
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