[antlr-interest] problem with TreeParser grammar -> <AST>:0:0: expecting ), found ', '

Gabriel Radu gabriel.adrian.radu at googlemail.com
Wed Dec 21 02:50:33 PST 2005


Try this construct instead
strlist : LPAREN STRING ( COMMA  STRING )* RPAREN;


On 21/12/05, Oliver.Kowalke at infineon.com <Oliver.Kowalke at infineon.com> wrote:
> I've tested it with antlr-2.7.4.:
> If I parse "otype in ('abc')" it works.
> If I try to parse "otype in ('abc','efg')" I get this error:
>
> <AST>:0:0: expecting ), found ','
>
> It seams that the rule
>
> strlist : LPAREN ( STRING COMMA )* STRING RPAREN;
>
> used in
>
> expression : #(IN OTYPE strlist)
>
> in the tree walker doesn't fit. Why? How to fix?
> Oliver
>
>
> >> Hello,
> >> I don't know why the tree parser grammar doesn't work if I try to
> >> parse
> >> " otype in ('abc','efg') ":
> >>
> >> <AST>: unexpected AST node: 'abc'
> >>
> >> Could please help me?
> >
> >That seems weird.  Have you printed out the tree to verify you are
> >tree parsing what you think you are?  Is there a token type mismatch
> >somehow?
>


More information about the antlr-interest mailing list