Search in sources :

Example 1 with SqlppFormatPrintVisitor

use of org.apache.asterix.lang.sqlpp.visitor.SqlppFormatPrintVisitor in project asterixdb by apache.

the class SqlppFormatPrintUtil method print.

/**
     * Prints the formatted output of an ILangExpression.
     *
     * @param expr
     *            the language expression.
     * @param output
     *            a writer for printing strings.
     * @throws CompilationException
     */
public static void print(ILangExpression expr, PrintWriter output) throws CompilationException {
    SqlppFormatPrintVisitor visitor = new SqlppFormatPrintVisitor(output);
    expr.accept(visitor, 0);
}
Also used : SqlppFormatPrintVisitor(org.apache.asterix.lang.sqlpp.visitor.SqlppFormatPrintVisitor)

Example 2 with SqlppFormatPrintVisitor

use of org.apache.asterix.lang.sqlpp.visitor.SqlppFormatPrintVisitor in project asterixdb by apache.

the class SqlppFormatPrintUtil method toString.

/**
     * @param exprs
     *            a list of language expression.
     * @return a formatted string of the input language expressions.
     * @throws CompilationException
     */
public static String toString(List<ILangExpression> exprs) throws CompilationException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    PrintWriter output = new PrintWriter(bos);
    SqlppFormatPrintVisitor visitor = new SqlppFormatPrintVisitor(output);
    for (ILangExpression expr : exprs) {
        expr.accept(visitor, 0);
    }
    output.close();
    return bos.toString();
}
Also used : SqlppFormatPrintVisitor(org.apache.asterix.lang.sqlpp.visitor.SqlppFormatPrintVisitor) ILangExpression(org.apache.asterix.lang.common.base.ILangExpression) ByteArrayOutputStream(java.io.ByteArrayOutputStream) PrintWriter(java.io.PrintWriter)

Aggregations

SqlppFormatPrintVisitor (org.apache.asterix.lang.sqlpp.visitor.SqlppFormatPrintVisitor)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintWriter (java.io.PrintWriter)1 ILangExpression (org.apache.asterix.lang.common.base.ILangExpression)1