OLD | NEW |
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 #ifndef TOOLS_GN_PARSE_TREE_H_ | 5 #ifndef TOOLS_GN_PARSE_TREE_H_ |
6 #define TOOLS_GN_PARSE_TREE_H_ | 6 #define TOOLS_GN_PARSE_TREE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 const std::vector<Token>& before() const { return before_; } | 33 const std::vector<Token>& before() const { return before_; } |
34 void append_before(Token c) { | 34 void append_before(Token c) { |
35 before_.push_back(c); | 35 before_.push_back(c); |
36 } | 36 } |
37 | 37 |
38 const std::vector<Token>& suffix() const { return suffix_; } | 38 const std::vector<Token>& suffix() const { return suffix_; } |
39 void append_suffix(Token c) { | 39 void append_suffix(Token c) { |
40 suffix_.push_back(c); | 40 suffix_.push_back(c); |
41 } | 41 } |
| 42 // Reverse the order of the suffix comments. When walking the tree in |
| 43 // post-order we append suffix comments in reverse order, so this fixes them |
| 44 // up. |
| 45 void ReverseSuffix(); |
42 | 46 |
43 const std::vector<Token>& after() const { return after_; } | 47 const std::vector<Token>& after() const { return after_; } |
44 void append_after(Token c) { | 48 void append_after(Token c) { |
45 after_.push_back(c); | 49 after_.push_back(c); |
46 } | 50 } |
47 | 51 |
48 private: | 52 private: |
49 // Whole line comments before the expression. | 53 // Whole line comments before the expression. |
50 std::vector<Token> before_; | 54 std::vector<Token> before_; |
51 | 55 |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 } | 432 } |
429 | 433 |
430 private: | 434 private: |
431 Token op_; | 435 Token op_; |
432 scoped_ptr<ParseNode> operand_; | 436 scoped_ptr<ParseNode> operand_; |
433 | 437 |
434 DISALLOW_COPY_AND_ASSIGN(UnaryOpNode); | 438 DISALLOW_COPY_AND_ASSIGN(UnaryOpNode); |
435 }; | 439 }; |
436 | 440 |
437 #endif // TOOLS_GN_PARSE_TREE_H_ | 441 #endif // TOOLS_GN_PARSE_TREE_H_ |
OLD | NEW |