| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import "dart:typed_data"; |
| 6 |
| 5 // JSON conversion. | 7 // JSON conversion. |
| 6 | 8 |
| 7 patch _parseJson(String json, reviver(var key, var value)) { | 9 patch _parseJson(String json, reviver(var key, var value)) { |
| 8 _BuildJsonListener listener; | 10 _BuildJsonListener listener; |
| 9 if (reviver == null) { | 11 if (reviver == null) { |
| 10 listener = new _BuildJsonListener(); | 12 listener = new _BuildJsonListener(); |
| 11 } else { | 13 } else { |
| 12 listener = new _ReviverJsonListener(reviver); | 14 listener = new _ReviverJsonListener(reviver); |
| 13 } | 15 } |
| 14 new _JsonParser(json, listener).parse(); | 16 new _JsonParser(json, listener).parse(); |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 String slice; | 549 String slice; |
| 548 int sliceEnd = position + 20; | 550 int sliceEnd = position + 20; |
| 549 if (sliceEnd > source.length) { | 551 if (sliceEnd > source.length) { |
| 550 slice = "'${source.substring(position)}'"; | 552 slice = "'${source.substring(position)}'"; |
| 551 } else { | 553 } else { |
| 552 slice = "'${source.substring(position, sliceEnd)}...'"; | 554 slice = "'${source.substring(position, sliceEnd)}...'"; |
| 553 } | 555 } |
| 554 throw new FormatException("Unexpected character at $position: $slice"); | 556 throw new FormatException("Unexpected character at $position: $slice"); |
| 555 } | 557 } |
| 556 } | 558 } |
| 559 |
| 560 // UTF-8 conversion. |
| 561 |
| 562 patch class _Utf8Encoder { |
| 563 /* patch */ static List<int> _createBuffer(int size) => new Uint8List(size); |
| 564 } |
| OLD | NEW |