[antlr-interest] Re: amount of reserved keywords

Silvain Piree s.piree at enneya.com
Mon Jun 24 23:52:17 PDT 2002

> For ANTLR all words "NATURAL", ... are reserved 
> keywords and a statement "declare join cursor for ..." 
> (with 'join' as cursor name) will not be accepted, because 
> "JOIN" is a reserved keyword :(

Yes, that is indeed a problem I encounter myself a lot.

The easiest way to work around this, is to specify an
"identifier" rule, like:

    identifier: IDENTIFIER | keyword ;
    keyword: "NATURAL" | "JOIN" | ...... etc.

It's not ideal but it should work.

It would be nice if ANTLR had something like a "try-again-
as-identifier" construct ..... so this would be solved transparantly.




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

More information about the antlr-interest mailing list