Exemplo n.º 1
0
 private void printAST(ASTNode<?> ast, int level) {
   if (ast != null) {
     printTab(level);
     System.out.println(level + ":" + ast.getClass().getName() + "@" + ast.getId());
     int n = ast.getNumChild();
     for (int i = 0; i < n; i++) printAST(ast.getChild(i), level + 1);
   }
 }
Exemplo n.º 2
0
 private void initOutStreamEtc() throws Exception {
   if (!destDir.exists()) {
     System.err.println("Destination directory " + destDir.getAbsolutePath() + " does not exist!");
     System.exit(1);
   }
   if (!destDir.canWrite()) {
     System.err.println(
         "Destination directory " + destDir.getAbsolutePath() + " cannot be written to!");
     System.exit(1);
   }
   if (verbose) printAST(model, 0);
   outFile = new File(destDir, outFilename);
   // destDir and outFilename are initialized either in the constructor or in parseArgs,
   // which is called from parse
   outStream = new PrintStream(new BufferedOutputStream(new FileOutputStream(outFile)));
 }