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 #include "tools/gn/standard_out.h" | 5 #include "tools/gn/standard_out.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 size_t chars_to_highlight = line.find(':'); | 172 size_t chars_to_highlight = line.find(':'); |
173 if (chars_to_highlight == std::string::npos) | 173 if (chars_to_highlight == std::string::npos) |
174 chars_to_highlight = line.size(); | 174 chars_to_highlight = line.size(); |
175 OutputString(line.substr(0, chars_to_highlight), DECORATION_YELLOW); | 175 OutputString(line.substr(0, chars_to_highlight), DECORATION_YELLOW); |
176 OutputString(line.substr(chars_to_highlight) + "\n"); | 176 OutputString(line.substr(chars_to_highlight) + "\n"); |
177 continue; | 177 continue; |
178 } | 178 } |
179 | 179 |
180 // Check for a comment. | 180 // Check for a comment. |
181 TextDecoration dec = DECORATION_NONE; | 181 TextDecoration dec = DECORATION_NONE; |
182 for (size_t char_i = 0; char_i < line.size(); char_i++) { | 182 for (const auto& elem : line) { |
183 if (line[char_i] == '#') { | 183 if (elem == '#') { |
184 // Got a comment, draw dimmed. | 184 // Got a comment, draw dimmed. |
185 dec = DECORATION_DIM; | 185 dec = DECORATION_DIM; |
186 break; | 186 break; |
187 } else if (line[char_i] != ' ') { | 187 } else if (elem != ' ') { |
188 break; | 188 break; |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 OutputString(line + "\n", dec); | 192 OutputString(line + "\n", dec); |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
OLD | NEW |