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 <stdio.h> | 5 #include <stdio.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 namespace commands { | 30 namespace commands { |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 const char kSwitchList[] = "list"; | 34 const char kSwitchList[] = "list"; |
35 const char kSwitchShort[] = "short"; | 35 const char kSwitchShort[] = "short"; |
36 | 36 |
37 bool DoesLineBeginWithComment(const base::StringPiece& line) { | 37 bool DoesLineBeginWithComment(const base::StringPiece& line) { |
38 // Skip whitespace. | 38 // Skip whitespace. |
39 size_t i = 0; | 39 size_t i = 0; |
40 while (i < line.size() && IsAsciiWhitespace(line[i])) | 40 while (i < line.size() && base::IsAsciiWhitespace(line[i])) |
41 i++; | 41 i++; |
42 | 42 |
43 return i < line.size() && line[i] == '#'; | 43 return i < line.size() && line[i] == '#'; |
44 } | 44 } |
45 | 45 |
46 // Returns the offset of the beginning of the line identified by |offset|. | 46 // Returns the offset of the beginning of the line identified by |offset|. |
47 size_t BackUpToLineBegin(const std::string& data, size_t offset) { | 47 size_t BackUpToLineBegin(const std::string& data, size_t offset) { |
48 // Degenerate case of an empty line. Below we'll try to return the | 48 // Degenerate case of an empty line. Below we'll try to return the |
49 // character after the newline, but that will be incorrect in this case. | 49 // character after the newline, but that will be incorrect in this case. |
50 if (offset == 0 || Tokenizer::IsNewline(data, offset)) | 50 if (offset == 0 || Tokenizer::IsNewline(data, offset)) |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 "Or see \"gn help args\" for more variants.").PrintToStdout(); | 339 "Or see \"gn help args\" for more variants.").PrintToStdout(); |
340 return 1; | 340 return 1; |
341 } | 341 } |
342 | 342 |
343 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kSwitchList)) | 343 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kSwitchList)) |
344 return ListArgs(args[0]); | 344 return ListArgs(args[0]); |
345 return EditArgsFile(args[0]); | 345 return EditArgsFile(args[0]); |
346 } | 346 } |
347 | 347 |
348 } // namespace commands | 348 } // namespace commands |
OLD | NEW |