use of org.apache.asterix.lang.common.visitor.QueryPrintVisitor in project asterixdb by apache.
the class SqlppAstPrintUtil method print.
/**
* Prints the AST of a list of top-level language statements.
*
* @param statements
* a list of statements of a query
* @param output
* a writer for printing strings.
* @throws CompilationException
*/
public static void print(List<Statement> statements, PrintWriter output) throws CompilationException {
QueryPrintVisitor visitor = astPrintVisitorFactory.createLangVisitor(output);
for (Statement statement : statements) {
statement.accept(visitor, 0);
}
output.flush();
}
use of org.apache.asterix.lang.common.visitor.QueryPrintVisitor in project asterixdb by apache.
the class SqlppAstPrintUtil method toString.
/**
* @param exprs
* a list of language expression.
* @return an AST 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);
QueryPrintVisitor visitor = astPrintVisitorFactory.createLangVisitor(output);
for (ILangExpression expr : exprs) {
expr.accept(visitor, 0);
}
output.close();
return bos.toString();
}
use of org.apache.asterix.lang.common.visitor.QueryPrintVisitor in project asterixdb by apache.
the class SqlppAstPrintUtil method print.
/**
* Prints the AST (abstract syntax tree) 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 {
QueryPrintVisitor visitor = astPrintVisitorFactory.createLangVisitor(output);
expr.accept(visitor, 0);
output.flush();
}
Aggregations