| 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 <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 268 |
| 269 JSONReader::JsonParseError JSONParser::error_code() const { | 269 JSONReader::JsonParseError JSONParser::error_code() const { |
| 270 return error_code_; | 270 return error_code_; |
| 271 } | 271 } |
| 272 | 272 |
| 273 std::string JSONParser::GetErrorMessage() const { | 273 std::string JSONParser::GetErrorMessage() const { |
| 274 return FormatErrorMessage(error_line_, error_column_, | 274 return FormatErrorMessage(error_line_, error_column_, |
| 275 JSONReader::ErrorCodeToString(error_code_)); | 275 JSONReader::ErrorCodeToString(error_code_)); |
| 276 } | 276 } |
| 277 | 277 |
| 278 int JSONParser::error_line() const { |
| 279 return error_line_; |
| 280 } |
| 281 |
| 282 int JSONParser::error_column() const { |
| 283 return error_column_; |
| 284 } |
| 285 |
| 278 // StringBuilder /////////////////////////////////////////////////////////////// | 286 // StringBuilder /////////////////////////////////////////////////////////////// |
| 279 | 287 |
| 280 JSONParser::StringBuilder::StringBuilder() | 288 JSONParser::StringBuilder::StringBuilder() |
| 281 : pos_(NULL), | 289 : pos_(NULL), |
| 282 length_(0), | 290 length_(0), |
| 283 string_(NULL) { | 291 string_(NULL) { |
| 284 } | 292 } |
| 285 | 293 |
| 286 JSONParser::StringBuilder::StringBuilder(const char* pos) | 294 JSONParser::StringBuilder::StringBuilder(const char* pos) |
| 287 : pos_(pos), | 295 : pos_(pos), |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 const std::string& description) { | 974 const std::string& description) { |
| 967 if (line || column) { | 975 if (line || column) { |
| 968 return StringPrintf("Line: %i, column: %i, %s", | 976 return StringPrintf("Line: %i, column: %i, %s", |
| 969 line, column, description.c_str()); | 977 line, column, description.c_str()); |
| 970 } | 978 } |
| 971 return description; | 979 return description; |
| 972 } | 980 } |
| 973 | 981 |
| 974 } // namespace internal | 982 } // namespace internal |
| 975 } // namespace base | 983 } // namespace base |
| OLD | NEW |