[antlr-interest] caseSensitive for one rule

Ric Klaren klaren at cs.utwente.nl
Wed Jul 16 06:18:06 PDT 2003

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


    ---- 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/ 

More information about the antlr-interest mailing list