[antlr-interest] Advanced matching in Tree Parsers

Martin Probst mail at martin-probst.com
Thu Apr 14 07:11:30 PDT 2005


Hi all,
I have a problem with tree parsers. I'm trying to match tree fragments in a
tree parser. The problem is, we use a special AST node type which carries
lots of payload, and I have to match on that payload in many cases. I'd like
to use a semantic predicate within a syntactic predicate, but this doesn't
seem to work:

E.g.
expr:
	( #( ROOT f:FIRST { #f.myfield.equals(something) }? . ) ) => #( ROOT
FIRST . )
	| ...
	;

This does not give an error, but it also doesn't assign anything to #f and
consequently results in a null pointer exception. Is there a way to achieve
what I want?

Regards,
Martin



More information about the antlr-interest mailing list