//Listener class ClassListener extends EnkelBaseListener<ClassDeclaration> {
private Class parsedClass;
@Override public void enterClassDeclaration(@NotNull EnkelParser.ClassDeclarationContext ctx) { String className = ctx.className().getText(); //do some other stuff parsedClass = new Class(className,methods); }
public Class getParsedClass() { return parsedClass; } }
1 2 3 4 5 6 7 8 9 10
//Visitor public class ClassVisitor extends EnkelBaseVisitor<ClassDeclaration> {
@Override public ClassDeclaration visitClassDeclaration(@NotNull EnkelParser.ClassDeclarationContext ctx) { String name = ctx.className().getText(); //do some other stuff return new ClassDeclaration(name, methods); } }