Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: tools/gn/parse_tree.cc

Issue 595753002: gn: handle continued suffix comments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-append-comment
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/parse_tree.h" 5 #include "tools/gn/parse_tree.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "tools/gn/functions.h" 11 #include "tools/gn/functions.h"
12 #include "tools/gn/operators.h" 12 #include "tools/gn/operators.h"
13 #include "tools/gn/scope.h" 13 #include "tools/gn/scope.h"
14 #include "tools/gn/string_utils.h" 14 #include "tools/gn/string_utils.h"
15 15
16 namespace { 16 namespace {
17 17
18 std::string IndentFor(int value) { 18 std::string IndentFor(int value) {
19 return std::string(value, ' '); 19 return std::string(value, ' ');
20 } 20 }
21 21
22 } // namespace 22 } // namespace
23 23
24 Comments::Comments() { 24 Comments::Comments() {
25 } 25 }
26 26
27 Comments::~Comments() { 27 Comments::~Comments() {
28 } 28 }
29 29
30 void Comments::ReverseSuffix() {
31 for (int i = 0, j = static_cast<int>(suffix_.size() - 1); i < j; ++i, --j)
32 std::swap(suffix_[i], suffix_[j]);
33 }
34
30 ParseNode::ParseNode() { 35 ParseNode::ParseNode() {
31 } 36 }
32 37
33 ParseNode::~ParseNode() { 38 ParseNode::~ParseNode() {
34 } 39 }
35 40
36 const AccessorNode* ParseNode::AsAccessor() const { return NULL; } 41 const AccessorNode* ParseNode::AsAccessor() const { return NULL; }
37 const BinaryOpNode* ParseNode::AsBinaryOp() const { return NULL; } 42 const BinaryOpNode* ParseNode::AsBinaryOp() const { return NULL; }
38 const BlockNode* ParseNode::AsBlock() const { return NULL; } 43 const BlockNode* ParseNode::AsBlock() const { return NULL; }
39 const ConditionNode* ParseNode::AsConditionNode() const { return NULL; } 44 const ConditionNode* ParseNode::AsConditionNode() const { return NULL; }
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 Err UnaryOpNode::MakeErrorDescribing(const std::string& msg, 561 Err UnaryOpNode::MakeErrorDescribing(const std::string& msg,
557 const std::string& help) const { 562 const std::string& help) const {
558 return Err(op_, msg, help); 563 return Err(op_, msg, help);
559 } 564 }
560 565
561 void UnaryOpNode::Print(std::ostream& out, int indent) const { 566 void UnaryOpNode::Print(std::ostream& out, int indent) const {
562 out << IndentFor(indent) << "UNARY(" << op_.value() << ")\n"; 567 out << IndentFor(indent) << "UNARY(" << op_.value() << ")\n";
563 PrintComments(out, indent); 568 PrintComments(out, indent);
564 operand_->Print(out, indent + 1); 569 operand_->Print(out, indent + 1);
565 } 570 }
OLDNEW
« no previous file with comments | « tools/gn/parse_tree.h ('k') | tools/gn/parser.cc » ('j') | tools/gn/parser_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698