I have this grammar:
foo : bar EOF;
bar : 'hello';
The listener interface, which ANTLR generates, contains these four methods:
public void enterFoo(final FooParser.LicenseContext ctx);
public void exitFoo(final FooParser.LicenseContext ctx);
public void enterBar(final FooParser.LicenseContext ctx);
public void exitBar(final FooParser.LicenseContext ctx);
Two of them are not needed for me: exitFoo()
and enterBar()
. Is it possible to tell ANTLR somehow to NOT generate them in the interface? I would actually prefer to find a way to somehow tell the grammar which grammar rules need those enter/exit methods, and all others would be ignored. Is it possible?
您不能抑制任何这些方法的生成,因为在为每个解析步骤触发侦听器时,解析器希望它们在那里。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.