[antlr-interest] QUESTION on: How do I handle abbreviated keywords?

Ben Gillis wbgillis at gmail.com
Fri Oct 31 18:00:14 PDT 2008


see http://www.antlr.org/wiki/pages/viewpage.action?pageId=1802308.

It's not clear to me the connection between the tokens block (and its auto-gen'd code), and this statement in the 
above URL:

"might simply consult an IDictionary<string,int> map of all keywords (incl abbreviations). "

The tokens block ends up in a string array named tokenNames (CSharp2 target).  My tokens keywords are mixed with other entries related to the grammar definition.

Am I supposed to write an initialization routine that builds a dictionary?  If so, I have to filter through the auto-gen'd tokenNames making sure to enter only my keywords, otherwise I'll get false hits in my CheckKeywordsTable routine.  Somehow, this doesn't seem quite right, ???


Regards,
Ben




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081031/b6e93f1b/attachment.html 


More information about the antlr-interest mailing list