public static void main(String[] args) throws IOException, InterruptedException { try { Namespace ns = parse(args); long startTime = System.currentTimeMillis(); TranslationUnit tu = ParseHelper.parse(new File(ns.getString("shader"))); long endTime = System.currentTimeMillis(); prettyPrintShader(ns, tu); System.err.println("Time for parsing: " + (endTime - startTime)); } catch (Throwable exception) { exception.printStackTrace(); System.exit(1); } }
private static void prettyPrintShader(Namespace ns, TranslationUnit tu) throws FileNotFoundException { try (PrintStream stream = new PrintStream(new FileOutputStream(new File(ns.getString("output"))))) { if (getGlslVersion(ns) != null) { throw new RuntimeException(); //Helper.emitDefines(stream, new ShadingLanguageVersion(getGlslVersion(ns), false), // false); } PrettyPrinterVisitor ppv = new PrettyPrinterVisitor(stream); ppv.visit(tu); } }