[antlr-interest] Import vocab from different directory

Chris Black chris at lotuscat.com
Fri Sep 16 13:17:43 PDT 2005


David Ray wrote:

> Is there a way to import a vocabulary from a different directory. I 
> have a tree parser that I'm using for code generation, but it needs to 
> reference the vocabulary of the parser which is in a different package.
>
> Thanks,
> Dave Ray
>
I do something similar with common lexers for CSV and TSV shared between 
more specific parsers and tree parsers in different directories. Since I 
use ant for building my antlr grammars, I just added a copy task into my 
parser targets that copies the *TokenTypes.txt from the common lexer dir 
into the parser dir before the parser antlr task. I realize this isn't 
exactly importing a vocab from a different directory, but it is a 
workaround that works fine for me.

Chris


More information about the antlr-interest mailing list