1#include <Parsers/ASTExpressionList.h>
2
3
4namespace DB
5{
6
7ASTPtr ASTExpressionList::clone() const
8{
9 auto clone = std::make_shared<ASTExpressionList>(*this);
10 clone->cloneChildren();
11 return clone;
12}
13
14void ASTExpressionList::formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
15{
16 for (ASTs::const_iterator it = children.begin(); it != children.end(); ++it)
17 {
18 if (it != children.begin())
19 {
20 if (separator)
21 settings.ostr << separator;
22 settings.ostr << ' ';
23 }
24
25 (*it)->formatImpl(settings, state, frame);
26 }
27}
28
29void ASTExpressionList::formatImplMultiline(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
30{
31 std::string indent_str = "\n" + std::string(4 * (frame.indent + 1), ' ');
32
33 ++frame.indent;
34 for (ASTs::const_iterator it = children.begin(); it != children.end(); ++it)
35 {
36 if (it != children.begin())
37 {
38 if (separator)
39 settings.ostr << separator;
40 settings.ostr << ' ';
41 }
42
43
44 if (children.size() > 1)
45 settings.ostr << indent_str;
46
47 (*it)->formatImpl(settings, state, frame);
48 }
49}
50
51}
52