How to change parent class in ANTLR-3?

By default, the parser generated using ANTLR-3 continues from org.antlr.runtime.Parser. How can I extend my own class instead?

+4
source share
1 answer

You can do this using the superClass parameter in your grammar:

 grammar G; options { superClass = YourCustomClass; } parse : ... ; 

which will generate:

 public class GParser extends YourCustomClass { // ... } 
+4
source

Source: https://habr.com/ru/post/1307165/


All Articles