diff options
author | zhvv117 <[email protected]> | 2024-12-04 12:40:18 +0300 |
---|---|---|
committer | zhvv117 <[email protected]> | 2024-12-04 13:00:39 +0300 |
commit | 2e229c177b8e374062c3fd82fca76cccec5ec16e (patch) | |
tree | d35b8072ad46bb4ac96f5a9576ee0fe75ad9c614 /yql/essentials/sql/v1/format/sql_format.cpp | |
parent | aefea967d5f49fd714d0cd3d6083014d2c610a29 (diff) |
change EVALUATE IF and EVALUATE FOR formatting
commit_hash:435092fd6b4de1e8a0df445829d40475c5c4a166
Diffstat (limited to 'yql/essentials/sql/v1/format/sql_format.cpp')
-rw-r--r-- | yql/essentials/sql/v1/format/sql_format.cpp | 50 |
1 files changed, 6 insertions, 44 deletions
diff --git a/yql/essentials/sql/v1/format/sql_format.cpp b/yql/essentials/sql/v1/format/sql_format.cpp index 7422b37a938..bb8d20b9a00 100644 --- a/yql/essentials/sql/v1/format/sql_format.cpp +++ b/yql/essentials/sql/v1/format/sql_format.cpp @@ -1166,10 +1166,11 @@ private: } void VisitDo(const TRule_do_stmt& msg) { - NewLine(); VisitKeyword(msg.GetToken1()); switch (msg.GetBlock2().Alt_case()) { case TRule_do_stmt_TBlock2::kAlt1: { // CALL + PushCurrentIndent(); + NewLine(); const auto& alt = msg.GetBlock2().GetAlt1().GetRule_call_action1(); Visit(alt.GetBlock1()); AfterInvokeExpr = true; @@ -1177,8 +1178,9 @@ private: if (alt.HasBlock3()) { Visit(alt.GetBlock3()); } - Visit(alt.GetToken4()); + PopCurrentIndent(); + NewLine(); break; } case TRule_do_stmt_TBlock2::kAlt2: { // INLINE @@ -1222,52 +1224,12 @@ private: void VisitIf(const TRule_if_stmt& msg) { NewLine(); - if (msg.HasBlock1()) { - Visit(msg.GetBlock1()); - } - - Visit(msg.GetToken2()); - Visit(msg.GetRule_expr3()); - NewLine(); - PushCurrentIndent(); - Visit(msg.GetRule_do_stmt4()); - PopCurrentIndent(); - if (msg.HasBlock5()) { - NewLine(); - Visit(msg.GetBlock5().GetToken1()); - NewLine(); - PushCurrentIndent(); - Visit(msg.GetBlock5().GetRule_do_stmt2()); - PopCurrentIndent(); - } + VisitAllFields(TRule_if_stmt::GetDescriptor(), msg); } void VisitFor(const TRule_for_stmt& msg) { NewLine(); - if (msg.HasBlock1()) { - Visit(msg.GetBlock1()); - } - - if (msg.HasBlock2()) { - Visit(msg.GetBlock2()); - } - - Visit(msg.GetToken3()); - Visit(msg.GetRule_bind_parameter4()); - Visit(msg.GetToken5()); - Visit(msg.GetRule_expr6()); - NewLine(); - PushCurrentIndent(); - Visit(msg.GetRule_do_stmt7()); - PopCurrentIndent(); - if (msg.HasBlock8()) { - NewLine(); - Visit(msg.GetBlock8().GetToken1()); - NewLine(); - PushCurrentIndent(); - Visit(msg.GetBlock8().GetRule_do_stmt2()); - PopCurrentIndent(); - } + VisitAllFields(TRule_for_stmt::GetDescriptor(), msg); } void VisitValues(const TRule_values_stmt& msg) { |