[antlr-interest] Import problem
Terence Parr
parrt at cs.usfca.edu
Thu Aug 21 10:38:59 PDT 2008
You're importing B twice (via C).
Ter
On Aug 21, 2008, at 2:04 AM, Andrey Breslav wrote:
> Hello everybody.
>
> I've just switched to ANTLR 3.1 for its beautiful grammar reuse
> feature. But I'm stuck with the following problem.
> Having the following three grammar descriptions
>
> ---A.g
>
> grammar A;
>
> import B, C;
>
> superRule : TOKEN rule;
>
> ---End of A.g
>
> ---B.g
>
> lexer grammar B;
>
> TOKEN : 'x';
>
> ---End of B.g
>
> --C.g
>
> parser grammar C;
>
> import B;
>
> rule : TOKEN+;
>
> ---ENd of C.g
>
> I get the following errors from ANTLR:
>
> [java] ANTLR Parser Generator Version 3.1 (August 12, 2008)
> 1989-2008
> [java] error(103): B.g:5:0: parser rule rule not allowed in lexer
> [java] error(103): B.g:5:0: parser rule superRule not allowed in
> lexer
> [java] error(102): C.g:3:0: lexer rule TOKEN not allowed in parser
> [java] error(102): C.g:1:0: lexer rule Tokens not allowed in
> parser
> [java] Java Result: 1
>
> Looks like ANTLR thinks I've included B into C and vice versa . Is it
> a bug or I am doing something wrong?
>
> Thank you.
>
> --
> Best regards,
> Andrey
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
More information about the antlr-interest
mailing list