AW: [antlr-interest] caseSensitive for one rule

Wirth. Michael M.Wirth at seeburger.de
Wed Jul 16 06:25:01 PDT 2003


yes, this is a way, but the code I wrote is only an example.
My origin code is much longer an there are more than one parser,
which are all extended from one superparser. So I have to write
the if-statement with the comparision in every parser at every
match of a token :(

But when I have to do this I have to. 

Thanks for this quick answer.


> -----Ursprüngliche Nachricht-----
> Von: Ric Klaren [mailto:klaren at cs.utwente.nl]
> Gesendet: Mittwoch, 16. Juli 2003 15:18
> An: antlr-interest at yahoogroups.com
> Betreff: Re: [antlr-interest] caseSensitive for one rule
> 
> 
> On Wed, Jul 16, 2003 at 03:10:18PM +0200, Wirth. Michael wrote:
> > is there a way to set caseSensitive to false in one rule in 
> the parser?
> > Something like I wrote below.
> > I want that the "end", "End", "eNd", ... ist matched. Only 
> in this rule.
> > "start" should only be matched as "start", not as "Start".
> 
> In the parser I'd give you very little chance, since casesensitive is
> handled in the lexer. Feedback from parser to lexer is in 
> general a bad idea.
> 
> Nothing stops you though to look in the parser at the text 
> belonging to the
> start token and bombing out if it's not equal to "start". E.g. have
> casesensitive turned off all the time and...
> 
> > ruleOne : "start" ruleTwo ;
> 
> ruleOne: s:"start" 
> { if ( ! s.getText().equals("start") ) throw ... } ruleTwo
> 
> Cheers,
> 
> Ric
> --
> -----+++++****************************************************
> *+++++++++-------
>     ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 
> 4893722  ----
> -----+++++****************************************************
> *+++++++++-------
>   "I don't have anything against Java - it's the best damn 
> implementation
>               of UCSD Pascal ever released..." --- Larry Smith
> 
> 
>  
> 
> 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