Search in sources :

Example 1 with STWriter

use of org.stringtemplate.v4.STWriter in project antlr4 by tunnelvisionlabs.

the class CodeGenerator method write.

public void write(ST code, String fileName) {
    try {
        @SuppressWarnings("unused") long start = System.currentTimeMillis();
        Writer w = tool.getOutputFileWriter(g, fileName);
        STWriter wr = new AutoIndentWriter(w);
        wr.setLineWidth(lineWidth);
        code.write(wr);
        w.close();
        @SuppressWarnings("unused") long stop = System.currentTimeMillis();
    } catch (IOException ioe) {
        tool.errMgr.toolError(ErrorType.CANNOT_WRITE_FILE, ioe, fileName);
    }
}
Also used : AutoIndentWriter(org.stringtemplate.v4.AutoIndentWriter) IOException(java.io.IOException) STWriter(org.stringtemplate.v4.STWriter) AutoIndentWriter(org.stringtemplate.v4.AutoIndentWriter) Writer(java.io.Writer) STWriter(org.stringtemplate.v4.STWriter)

Example 2 with STWriter

use of org.stringtemplate.v4.STWriter in project antlr4 by antlr.

the class CodeGenerator method write.

public void write(ST code, String fileName) {
    try {
        // long start = System.currentTimeMillis();
        Writer w = tool.getOutputFileWriter(g, fileName);
        STWriter wr = new AutoIndentWriter(w);
        wr.setLineWidth(lineWidth);
        code.write(wr);
        w.close();
    // long stop = System.currentTimeMillis();
    } catch (IOException ioe) {
        tool.errMgr.toolError(ErrorType.CANNOT_WRITE_FILE, ioe, fileName);
    }
}
Also used : AutoIndentWriter(org.stringtemplate.v4.AutoIndentWriter) IOException(java.io.IOException) STWriter(org.stringtemplate.v4.STWriter) AutoIndentWriter(org.stringtemplate.v4.AutoIndentWriter) Writer(java.io.Writer) STWriter(org.stringtemplate.v4.STWriter)

Aggregations

IOException (java.io.IOException)2 Writer (java.io.Writer)2 AutoIndentWriter (org.stringtemplate.v4.AutoIndentWriter)2 STWriter (org.stringtemplate.v4.STWriter)2