ClickHouse/src/Parsers/formatAST.h

30 lines
607 B
C++
Raw Normal View History

2011-09-04 05:14:52 +00:00
#pragma once
2010-06-28 13:44:42 +00:00
#include <ostream>
#include <Parsers/IAST.h>
2010-06-28 13:44:42 +00:00
namespace DB
{
2017-05-27 17:29:55 +00:00
/** Takes a syntax tree and turns it back into text.
* In case of INSERT query, the data will be missing.
2010-06-28 13:44:42 +00:00
*/
2017-12-01 18:36:55 +00:00
void formatAST(const IAST & ast, std::ostream & s, bool hilite = true, bool one_line = false);
2010-06-28 13:44:42 +00:00
String serializeAST(const IAST & ast, bool one_line = true);
inline std::ostream & operator<<(std::ostream & os, const IAST & ast)
{
formatAST(ast, os, false, true);
return os;
}
inline std::ostream & operator<<(std::ostream & os, const ASTPtr & ast)
{
formatAST(*ast, os, false, true);
return os;
}
2014-10-01 16:38:04 +00:00
2010-06-28 13:44:42 +00:00
}