[antlr-interest] Re: XPath - identifiers are keywords

merrells merrells at sleepycat.com
Wed Jul 3 14:18:11 PDT 2002

--- In antlr-interest at y..., mzukowski at y... wrote:
> This is actually a difficult problem.  See
> http://www.jguru.com/faq/view.jsp?EID=140.  

Yeah, I saw that, but it looked horridly complex :-(

> If there aren't too many of the
> keywords that can be identifiers then you can handle it in the 
parser by
> getting rid of your COMMENT rule and testing for it in your 
parser.  Instead
> of testing for NCNAME, you would have a rule ncname, e.g.
> ncname: NCNAME | "comment";
> Then where you have ambiguities you disambiguate with a syntactic 
> whatever:
> 	("comment" LPAREN RPAREN)=> commentRule
> 	;

This is pretty much what Bob did in his Antlr grammar
for XPath. 

I think I'll have a crack at that, but i'm worried that
it's going to mess up the parser rules I have in place
at the moment.


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

More information about the antlr-interest mailing list