[antlr-interest] separat lexer + parser grammars

Johannes Luber jaluber at gmx.de
Fri Feb 15 15:09:32 PST 2008


Oliver Kowalke schrieb:
> Hi,
> I want to sepparat lexer and parser into different files.
> I don't know where I've to put the tokens option.
> tokens
> {
>         WORKFLOW = 'workflow';
> }
> 
> If I put it into the lexer file I get:
> literals are illegal in lexer tokens{} section: 'workflow'
> 
> I I put it into the parser grammar I get:
> literal has no associated lexer rule: 'workflow'
> 
> Could you please give me an hint, please?
> 
> best regards,
> Oliver
> 
I believe you can't use "tokens {..}" in a lexer grammar. Use "WORKFLOW 
: 'workflow' ;" instead

Johannes


More information about the antlr-interest mailing list