[antlr-interest] lexical filters in v4?

Peter Boughton boughtonp at gmail.com
Fri Jan 20 19:02:44 PST 2012


It doesn't seem like v4 supports lexical filters?

Using the example here: http://www.antlr.org/wiki/display/ANTLR3/Lexical+filters

The generated code is:

	System.out.println("found var
"+(_localctx.name!=null?_localctx.name.getText():null));

Which caused the Java error:

	"name cannot be resolved or is not a field"


I need to be able to match a closing tag against an opening tag (which
may have assorted nested tags), which means I need some way to extract
a tagname during the opening rule, and check against it in the closing
rule.

Any recommendations for how to handle that?


More information about the antlr-interest mailing list