File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
tools/zetasql-formatter/example_tests_formatted Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -50,16 +50,19 @@ std::string Unparse(const ASTNode* node) {
5050
5151std::string UnparseWithComments (const ASTNode* node, std::deque<std::pair<std::string,
5252 ParseLocationPoint>>& parse_tokens) {
53- std::string unparsed_ ;
54- parser::Unparser unparser (&unparsed_ );
53+ std::string unparsed ;
54+ parser::Unparser unparser (&unparsed );
5555 // Print comments by visitors and pop.
5656 node->Accept (&unparser, &parse_tokens);
5757 // Emit left comments in parse_tokens.
5858 for (const auto & parse_token : parse_tokens) {
5959 unparser.print (parse_token.first );
6060 }
6161 unparser.FlushLine ();
62- return unparsed_;
62+ while (unparsed.back () == ' \n ' && unparsed.at (unparsed.size () - 2 ) == ' \n ' ) {
63+ unparsed.pop_back ();
64+ }
65+ return unparsed;
6366}
6467
6568namespace parser {
Original file line number Diff line number Diff line change 88 fuga
99 ON hoge .hoge = fuga .fuga ;
1010-- comment3
11-
You can’t perform that action at this time.
0 commit comments