[antlr-interest] Is tokenVocab an Option for Parser Grammars?
Johannes Luber
jaluber at gmx.de
Mon Aug 11 10:32:33 PDT 2008
titech at metaorb.com schrieb:
> Jim,
> Is it possible to use a combined grammar and “import” some of the lexer rules—I’ve got a common subset of rules that I’d have to copy over and over, but I’d hate to have to make lexer rules for every literal.
> Thanks,
> --Mike
Maybe one can import lexer grammars in lexer grammars?
Johannes
> Mike Allbright
> DLP Products
> Texas Instruments, Inc.
>> On Sun, 2008-08-10 at 15:11 -0700, titech at metaorb.com wrote:
>> I retested with the simple grammar files below. The combined grammar works fine,
>> but the separate parse file causes an error regarding the literals (error text
>> below). Do separate parse files require that all literals have associated lexer
>> rules?
>>
>> Yeah - you can't use literals in the parser unless you are using a combined grammar. My advice to you is
>> not to use literals in the parser, at least not when starting out, as it can greatly confuse you as to where the
>> literals are being matched (it is always in the lexer).
>>
>> Jim
>
>
More information about the antlr-interest
mailing list