@@ -0,0 +1,2434 @@
+package com.poco.PoCoCompiler;%0A%0Aimport com.poco.PoCoParser.PoCoParser;%0Aimport com.poco.PoCoParser.PoCoParserBaseVisitor;%0Aimport com.poco.Extractor.Closure;%0Aimport com.poco.Extractor.VarTypeVal;%0Aimport org.antlr.v4.runtime.misc.NotNull;%0A%0A/**%0A * Created by caoyan on 11/7/14.%0A */%0Apublic class ExtractClosure extends PoCoParserBaseVisitor%3CVoid%3E %7B%0A%0A    private Closure closure;%0A%0A    public Closure getClosure() %7B%0A        return closure;%0A    %7D%0A%0A    public void setClosure(Closure closure) %7B%0A        this.closure = closure;%0A    %7D%0A%0A    public ExtractClosure(Closure closure) %7B%0A        this.closure = closure;%0A    %7D%0A%0A    /**%0A     * Generates code for class representing a PoCo policy. This is the first visit method called.%0A     *%0A     * @param ctx%0A     * @return%0A     */%0A    @Override%0A    public Void visitPocopol(@NotNull PoCoParser.PocopolContext ctx) %7B%0A        visitChildren(ctx);%0A        return null;%0A    %7D%0A%0A    @Override%0A    public Void visitVardecls(@NotNull PoCoParser.VardeclsContext ctx) %7B%0A        if (ctx.vardecl() != null) %7B%0A            //now only deal with single policy, need add parents in future%0A            closure = new Closure();%0A            visitChildren(ctx);%0A        %7D%0A        return null;%0A    %7D%0A%0A    @Override%0A    public Void visitVardecl(@NotNull PoCoParser.VardeclContext ctx) %7B%0A        if (ctx.id() != null) %7B%0A            VarTypeVal varTyCal;%0A            if (ctx.RETYPE() != null) %7B%0A                varTyCal = new VarTypeVal(VarTypeVal.ClosureType.RE_TYPE, null, null);%0A            %7D else %7B%0A                varTyCal = new VarTypeVal(VarTypeVal.ClosureType.SRE_TYPE, null, null);%0A            %7D%0A            closure.addClosure(ctx.id().getText(), varTyCal);%0A        %7D%0A%0A        return null;%0A    %7D%0A%0A    @Override%0A    public Void visitMacrodecls(@NotNull PoCoParser.MacrodeclsContext ctx) %7B%0A        if (ctx.macrodecl() != null) %7B%0A            if (closure == null)%0A                closure = new Closure();%0A            visitChildren(ctx);%0A        %7D%0A        return null;%0A    %7D%0A%0A    @Override%0A    public Void visitMacrodecl(@NotNull PoCoParser.MacrodeclContext ctx) %7B%0A%0A        VarTypeVal varTyCal;%0A%0A        if (ctx.RETYPE() != null) %7B%0A            varTyCal = new VarTypeVal(VarTypeVal.ClosureType.RE_TYPE, ctx.re(), null);%0A        %7D else %7B%0A            varTyCal = new VarTypeVal(VarTypeVal.ClosureType.SRE_TYPE, null, ctx.sre());%0A        %7D%0A        closure.addClosure(ctx.id().getText(), varTyCal);%0A%0A        return null;%0A    %7D%0A%0A%7D%0A

Add ExtractClosure class