mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 14:11:58 +00:00
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
|
#include <Parsers/ASTExpressionList.h>
|
||
|
|
||
|
|
||
|
namespace DB
|
||
|
{
|
||
|
|
||
|
ASTPtr ASTExpressionList::clone() const
|
||
|
{
|
||
|
const auto res = std::make_shared<ASTExpressionList>(*this);
|
||
|
res->children.clear();
|
||
|
|
||
|
for (const auto & child : children)
|
||
|
res->children.emplace_back(child->clone());
|
||
|
|
||
|
return res;
|
||
|
}
|
||
|
|
||
|
void ASTExpressionList::formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
|
||
|
{
|
||
|
for (ASTs::const_iterator it = children.begin(); it != children.end(); ++it)
|
||
|
{
|
||
|
if (it != children.begin())
|
||
|
settings.ostr << ", ";
|
||
|
|
||
|
(*it)->formatImpl(settings, state, frame);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ASTExpressionList::formatImplMultiline(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
|
||
|
{
|
||
|
std::string indent_str = "\n" + std::string(4 * (frame.indent + 1), ' ');
|
||
|
|
||
|
++frame.indent;
|
||
|
for (ASTs::const_iterator it = children.begin(); it != children.end(); ++it)
|
||
|
{
|
||
|
if (it != children.begin())
|
||
|
settings.ostr << ", ";
|
||
|
|
||
|
if (children.size() > 1)
|
||
|
settings.ostr << indent_str;
|
||
|
|
||
|
(*it)->formatImpl(settings, state, frame);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|