Posted By:
Monty_Zukowski
Posted On:
Friday, March 29, 2002 05:34 AM
Sounds like you need to share token type values for certain tokens. You can edit the YourLexerTokenTypes.txt file and then use the 'import' option in the lexer to read that file. Make the values whatever you want, I don't think ANTLR will complain.
Alternately you can write your own little parser which does nothing but assign a type based on what it is. So for instance:
primitiveTypes: ("int" | "float" )
{ ##.setType(2); }
It'll take a little more tweaking than that because I don't know exactly how you interface with your editor's API, but you get the idea.