ClickHouse/dbms/src/Parsers/formatAST.h

23 lines
652 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 <Core/NamesAndTypes.h>
#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
*/
void formatAST(const IAST & ast, std::ostream & s, size_t indent = 0, bool hilite = true, bool one_line = false);
2010-06-28 13:44:42 +00:00
String formatColumnsForCreateQuery(NamesAndTypesList & columns);
2014-10-01 16:38:04 +00:00
inline std::ostream & operator<<(std::ostream & os, const IAST & ast) { return formatAST(ast, os, 0, false, true), os; }
inline std::ostream & operator<<(std::ostream & os, const ASTPtr & ast) { return formatAST(*ast, os, 0, false, true), os; }
2010-06-28 13:44:42 +00:00
}