1 package polyglot.frontend; 2 3 import polyglot.ast.*; 4 import polyglot.frontend.*; 5 import polyglot.types.*; 6 import polyglot.util.*; 7 import polyglot.visit.*; 8 import polyglot.types.Package; 9 10 import java.io.*; 11 import java.util.*; 12 13 14 public class PrettyPrintPass extends AbstractPass 15 { 16 protected Job job; 17 protected PrettyPrinter pp; 18 protected CodeWriter w; 19 20 24 public PrettyPrintPass(Pass.ID id, Job job, CodeWriter w, PrettyPrinter pp) { 25 super(id); 26 this.job = job; 27 this.pp = pp; 28 this.w = w; 29 } 30 31 public boolean run() { 32 Node ast = job.ast(); 33 34 if (ast == null) { 35 w.write("<<<< null AST >>>>"); 36 } 37 else { 38 pp.printAst(ast, w); 39 } 40 41 return true; 42 } 43 } 44 | Popular Tags |