| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 398 |
| 399 void JSONParser::EatWhitespaceAndComments() { | 399 void JSONParser::EatWhitespaceAndComments() { |
| 400 while (pos_ < end_pos_) { | 400 while (pos_ < end_pos_) { |
| 401 switch (*pos_) { | 401 switch (*pos_) { |
| 402 case '\r': | 402 case '\r': |
| 403 case '\n': | 403 case '\n': |
| 404 index_last_line_ = index_; | 404 index_last_line_ = index_; |
| 405 // Don't increment line_number_ twice for "\r\n". | 405 // Don't increment line_number_ twice for "\r\n". |
| 406 if (!(*pos_ == '\n' && pos_ > start_pos_ && *(pos_ - 1) == '\r')) | 406 if (!(*pos_ == '\n' && pos_ > start_pos_ && *(pos_ - 1) == '\r')) |
| 407 ++line_number_; | 407 ++line_number_; |
| 408 // Fall through. | 408 FALLTHROUGH_INTENDED; |
| 409 case ' ': | 409 case ' ': |
| 410 case '\t': | 410 case '\t': |
| 411 NextChar(); | 411 NextChar(); |
| 412 break; | 412 break; |
| 413 case '/': | 413 case '/': |
| 414 if (!EatComment()) | 414 if (!EatComment()) |
| 415 return; | 415 return; |
| 416 break; | 416 break; |
| 417 default: | 417 default: |
| 418 return; | 418 return; |
| (...skipping 537 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 |