[antlr-interest] error messages + treeParser with OR'ed root
monty at codetransform.com
Fri Mar 18 06:24:34 PST 2005
Koen Segers wrote:
> 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)
More information about the antlr-interest