[antlr-interest] handling abbreviated keywords in ANTLR

shaun at ebi.ac.uk shaun at ebi.ac.uk
Mon Jul 9 04:39:53 PDT 2007


Thank you Michael for the suggestion.

I was hoping there may be a programmatic alternative (I should have
mentioned) to defining in the grammar each and every keyword alternative.

I now see from some archived posts (ANTLR 2) suggestions of over-riding
testLiterals method and programmatically checking the 'current' token
against a hash.

Does anybody have an example of how to provide this functionality in ANTLR
3 (other than defining each alternative)?

The author of this archived post hints at a solution:

http://www.antlr.org/pipermail/antlr-interest/2005-November/014547.html

Unfortunately the link he provides is dead:

http://antlr.org/doc/lexer.html#Keywords_and_literals

Thank you,

Shaun



More information about the antlr-interest mailing list