[antlr-interest] Is a bug if multiple groups comments

Thomas Brandon tbrandonau at gmail.com
Wed Aug 15 05:04:39 PDT 2007


On 8/15/07, 向秦贤 <fyaoxy at gmail.com> wrote:
> Hi, given this grammar piece:
> begin
> /*******************************************
> * keywords refine
> ********************************************/
> //keySTRING:{input.LT(1).getText().equals("string");}WORD;
>
> /*******************************************
> * all lexer rulers
> ********************************************/
> end;
>
> antlr report "unexpected token ....
> /*******************************************
> * all lexer rulers
> ********************************************/
> "
> is this a bug?
> I think it is acceptable to allow this style.
ANTLR's grammar does not handle multiple javadoc comments per rule. As
your comments start with /** ANTLR is treating them as javadoc
comments and as there is no rule in between them this causes an error.
Changing them to "//********..." or to "/* *****..." should work.
This could perhaps be improved in the antlr grammar rewrite, putting
javadoc comments on their own channel.

Tom.
>
> --
> 致敬
> 向秦贤
>


More information about the antlr-interest mailing list