[antlr-interest] Problem with multiple treeparser ...

Gavin Lambert antlr at mirality.co.nz
Thu Oct 16 03:44:00 PDT 2008


At 09:51 16/10/2008, LdK ^^ wrote:
>i don't know if there are some difference but i work with the 
>version 2.7.6 of antlr (my school version)
>and i'm sur that i can put the parser and treeparser in the same 
>grammar file

Oh, right.  You didn't say that before :)  The default now is to 
assume ANTLR v3 unless otherwise specified, and you can't do that 
in v3.

>NEXT FILE :
>
>{import java.util.*;}
>class XHTMLNewTreeParser extends TreeParser;
>
>options    {
>         buildAST = true;
>
>     }

When you have a tree parser in a separate file like this, you need 
to specify the importVocab option, so that it knows how to find 
the token definitions.

// in the parser
options {
   exportVocab = XHTML;
}

// in the tree parser
options {
   importVocab = XHTML;
}



More information about the antlr-interest mailing list