1#pragma once
2
3#include <ostream>
4#include <Parsers/IAST.h>
5
6
7namespace DB
8{
9
10/** Takes a syntax tree and turns it back into text.
11 * In case of INSERT query, the data will be missing.
12 */
13void formatAST(const IAST & ast, std::ostream & s, bool hilite = true, bool one_line = false);
14
15String serializeAST(const IAST & ast, bool one_line = true);
16
17inline std::ostream & operator<<(std::ostream & os, const IAST & ast)
18{
19 formatAST(ast, os, false, true);
20 return os;
21}
22
23inline std::ostream & operator<<(std::ostream & os, const ASTPtr & ast)
24{
25 formatAST(*ast, os, false, true);
26 return os;
27}
28
29}
30