[antlr-interest] How to force a TreeWalker to match exactly?

Martin Probst mail at martin-probst.com
Mon Mar 20 11:14:35 PST 2006


Hi,

you might get around it by specifying an optional error rule, e.g.

fooRule: #(A B C)

gets

fooRule: #(A #(B error) #(C error) error)

error: ( . { throw new ... } )?

So every rule allows for another (virtual) child of any token type, and
throws an error if it encounters one. However I admit having to write
that everywhere sucks.

Martin

PS: what's your project at the HPI?



More information about the antlr-interest mailing list