OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_reader.h" | 5 #include "base/json/json_reader.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/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 json_pos_ += token.length; | 274 json_pos_ += token.length; |
275 token = ParseToken(); | 275 token = ParseToken(); |
276 if (token.type != Token::OBJECT_PAIR_SEPARATOR) | 276 if (token.type != Token::OBJECT_PAIR_SEPARATOR) |
277 return NULL; | 277 return NULL; |
278 | 278 |
279 json_pos_ += token.length; | 279 json_pos_ += token.length; |
280 token = ParseToken(); | 280 token = ParseToken(); |
281 Value* dict_value = BuildValue(false); | 281 Value* dict_value = BuildValue(false); |
282 if (!dict_value) | 282 if (!dict_value) |
283 return NULL; | 283 return NULL; |
284 static_cast<DictionaryValue*>(node.get())->Set(dict_key, dict_value); | 284 static_cast<DictionaryValue*>(node.get())->SetWithoutPathExpansion( |
| 285 dict_key, dict_value); |
285 | 286 |
286 // After a key/value pair, we expect a comma or the end of the | 287 // After a key/value pair, we expect a comma or the end of the |
287 // object. | 288 // object. |
288 token = ParseToken(); | 289 token = ParseToken(); |
289 if (token.type == Token::LIST_SEPARATOR) { | 290 if (token.type == Token::LIST_SEPARATOR) { |
290 json_pos_ += token.length; | 291 json_pos_ += token.length; |
291 token = ParseToken(); | 292 token = ParseToken(); |
292 // Trailing commas are invalid according to the JSON RFC, but some | 293 // Trailing commas are invalid according to the JSON RFC, but some |
293 // consumers need the parsing leniency, so handle accordingly. | 294 // consumers need the parsing leniency, so handle accordingly. |
294 if (token.type == Token::OBJECT_END) { | 295 if (token.type == Token::OBJECT_END) { |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 column_number = 1; | 634 column_number = 1; |
634 } else { | 635 } else { |
635 ++column_number; | 636 ++column_number; |
636 } | 637 } |
637 } | 638 } |
638 | 639 |
639 error_message_ = FormatErrorMessage(line_number, column_number, description); | 640 error_message_ = FormatErrorMessage(line_number, column_number, description); |
640 } | 641 } |
641 | 642 |
642 } // namespace base | 643 } // namespace base |
OLD | NEW |