OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/json/json_parser.h" | 5 #include "base/json/json_parser.h" |
6 | 6 |
7 #include "base/float_util.h" | 7 #include "base/float_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 } | 421 } |
422 | 422 |
423 bool JSONParser::EatComment() { | 423 bool JSONParser::EatComment() { |
424 if (*pos_ != '/' || !CanConsume(1)) | 424 if (*pos_ != '/' || !CanConsume(1)) |
425 return false; | 425 return false; |
426 | 426 |
427 char next_char = *NextChar(); | 427 char next_char = *NextChar(); |
428 if (next_char == '/') { | 428 if (next_char == '/') { |
429 // Single line comment, read to newline. | 429 // Single line comment, read to newline. |
430 while (CanConsume(1)) { | 430 while (CanConsume(1)) { |
431 char next_char = *NextChar(); | 431 next_char = *NextChar(); |
432 if (next_char == '\n' || next_char == '\r') | 432 if (next_char == '\n' || next_char == '\r') |
433 return true; | 433 return true; |
434 } | 434 } |
435 } else if (next_char == '*') { | 435 } else if (next_char == '*') { |
436 char previous_char = '\0'; | 436 char previous_char = '\0'; |
437 // Block comment, read until end marker. | 437 // Block comment, read until end marker. |
438 while (CanConsume(1)) { | 438 while (CanConsume(1)) { |
439 next_char = *NextChar(); | 439 next_char = *NextChar(); |
440 if (previous_char == '*' && next_char == '/') { | 440 if (previous_char == '*' && next_char == '/') { |
441 // EatWhitespaceAndComments will inspect pos_, which will still be on | 441 // EatWhitespaceAndComments will inspect pos_, which will still be on |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 const std::string& description) { | 956 const std::string& description) { |
957 if (line || column) { | 957 if (line || column) { |
958 return StringPrintf("Line: %i, column: %i, %s", | 958 return StringPrintf("Line: %i, column: %i, %s", |
959 line, column, description.c_str()); | 959 line, column, description.c_str()); |
960 } | 960 } |
961 return description; | 961 return description; |
962 } | 962 } |
963 | 963 |
964 } // namespace internal | 964 } // namespace internal |
965 } // namespace base | 965 } // namespace base |
OLD | NEW |