[antlr-interest] error messages + treeParser with OR'ed root

Koen Segers KoenSegers at scarlet.be
Fri Mar 18 14:53:21 PST 2005


On Friday 18 March 2005 15:24, Monty Zukowski wrote:
> Koen Segers wrote:
> > Hi,
> >
> > I have 2 problems.
> >
> > First one is a problem with the treeParser.
> > In Parser I created an ast. In treeParser I walk this one.
> >
> > I have this in my walker:
> > parameterType=typeSpecifier (par:ID)
> >
> > If the ID isn't in the ast the error is:
> > <AST>: expecting ID, found '<empty tree>'
> >
> > how can I give the line number + column number?
>
> That's hard when you don't have a tree node to take it from.
>
> > Second problem has to do with an root in walker that is OR'ed.
> > #( (PLUS|MINUS|STAR|DIV) lType = expr rType = expr)
> > gives an error of unexpected token '('.
> >
> > Any idea how I can fix this?
>
> Currently ANTLR cannot have OR'd roots.  You'll have to do something like
>
> #(PLUS expr expr)
>
> | #(MINUS expr expr)
>

It's a pity...

> ...
>
> Monty

Thx!

-- 

Koen Segers

<koensegers at scarlet.be>
<http://eddyvite.dyndns.org>


More information about the antlr-interest mailing list