[antlr-interest] Is tokenVocab an Option for Parser Grammars?

titech at metaorb.com titech at metaorb.com
Fri Aug 8 16:22:18 PDT 2008


Jim,


>> On Fri, 2008-08-08 at 13:23 -0700, titech at metaorb.com wrote:

>>>   
>From the docs I've seen, it seems that the tokenVocab option should
work in a parser grammar, but this doesn't seem to work in 3.1b2.

>> 
>> You don't need it for a combined grammar, but you DO need 
it for a separate parser grammar and lexer grammar.
>>
>> Jim


If that's the case, then this might be a bug, because, as far as I can tell, it doesn't work with 3.1b2--unless I'm just using the wrong syntax.

Here's what I've got:

Parse.g:
        parser grammar dsn_hdr;

        options
        {
          tokenVocab=Lex;
        }
       
       /* Parser Rules */


Lex.g:
        lexer grammar Lex;


        /* Lexer Rules */


Of course this all works if I copy the lexer rules to the parser.  Is this the correct syntax? 



Regards,
--Mike


Mike 
Allbright
DLP 
Products
Texas Instruments, 
Inc.


More information about the antlr-interest mailing list