[antlr-interest] reference tokens{} in other files

Michael LeBlanc Mike at LeBlanc-Engineering.com
Thu Nov 1 12:47:45 PDT 2007


Sorry.  To be more complete, I want to refer to DUMMY in another Java  
source file not built by ANTLR.  In earlier versions, ANTLR wrote an  
'interface' file which other classes could 'implement' to inherit the  
names.  Now for grammar foo.g it writes foo.tokens only, AFAIK.  Yes,  
it writes them into fooParser.java as
	public static final int DUMMY=28;
which forces me (I think) to refer to it as
	fooParser.DUMMY

On Nov 1, 2007, at 3:32 PM, Johannes Luber wrote:

> Michael LeBlanc wrote:
>> What is the usual way in v3 to reference the names from a grammar's
>> tokens{} construct in the target language?  That is, if I have a  
>> token
>> SOMETOKEN and my target is Java, how can I reference SOMETOKEN
>> unqualified in a hand written Java file?
>>
> AFAIK, it should suffice to call a token DUMMY in the target language
> also DUMMY.


More information about the antlr-interest mailing list