1 | #pragma once |
2 | |
3 | #include <ostream> |
4 | #include <Parsers/IAST.h> |
5 | |
6 | |
7 | namespace 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 | */ |
13 | void formatAST(const IAST & ast, std::ostream & s, bool hilite = true, bool one_line = false); |
14 | |
15 | String serializeAST(const IAST & ast, bool one_line = true); |
16 | |
17 | inline std::ostream & operator<<(std::ostream & os, const IAST & ast) |
18 | { |
19 | formatAST(ast, os, false, true); |
20 | return os; |
21 | } |
22 | |
23 | inline std::ostream & operator<<(std::ostream & os, const ASTPtr & ast) |
24 | { |
25 | formatAST(*ast, os, false, true); |
26 | return os; |
27 | } |
28 | |
29 | } |
30 | |