OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// Decode a lax JSON encoded text, that is, JSON with Dart-like comments and | 5 /// Decode a lax JSON encoded text, that is, JSON with Dart-like comments and |
6 /// trailing commas. | 6 /// trailing commas. |
7 /// | 7 /// |
8 /// This is used together with `load.dart` and `save.dart` to allow for an easy | 8 /// This is used together with `load.dart` and `save.dart` to allow for an easy |
9 /// editing of a human-readable source-map file. | 9 /// editing of a human-readable source-map file. |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 static final int LEFT_BRACE = '{'.codeUnits.single; | 30 static final int LEFT_BRACE = '{'.codeUnits.single; |
31 static final int RIGHT_BRACE = '}'.codeUnits.single; | 31 static final int RIGHT_BRACE = '}'.codeUnits.single; |
32 static final int LEFT_BRACKET = '['.codeUnits.single; | 32 static final int LEFT_BRACKET = '['.codeUnits.single; |
33 static final int RIGHT_BRACKET = ']'.codeUnits.single; | 33 static final int RIGHT_BRACKET = ']'.codeUnits.single; |
34 static final int T = 't'.codeUnits.single; | 34 static final int T = 't'.codeUnits.single; |
35 static final List<int> TRUE = 'true'.codeUnits; | 35 static final List<int> TRUE = 'true'.codeUnits; |
36 static final int F = 'f'.codeUnits.single; | 36 static final int F = 'f'.codeUnits.single; |
37 static final List<int> FALSE = 'false'.codeUnits; | 37 static final List<int> FALSE = 'false'.codeUnits; |
38 static final int N = 'n'.codeUnits.single; | 38 static final int N = 'n'.codeUnits.single; |
39 static final List<int> NULL = 'null'.codeUnits; | 39 static final List<int> NULL = 'null'.codeUnits; |
40 static final int _0 = '0'.codeUnits.single; | |
41 static final int _9 = '9'.codeUnits.single; | |
42 static final int B = 'b'.codeUnits.single; | 40 static final int B = 'b'.codeUnits.single; |
43 static final int R = 'r'.codeUnits.single; | 41 static final int R = 'r'.codeUnits.single; |
44 static final int U = 'u'.codeUnits.single; | 42 static final int U = 'u'.codeUnits.single; |
45 | 43 |
46 final List<int> codeUnits; | 44 final List<int> codeUnits; |
47 final int length; | 45 final int length; |
48 int position = 0; | 46 int position = 0; |
49 | 47 |
50 _Decoder(String text) | 48 _Decoder(String text) |
51 : codeUnits = text.codeUnits, | 49 : codeUnits = text.codeUnits, |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 285 |
288 num _decodeNumber() { | 286 num _decodeNumber() { |
289 throw new UnsupportedError('_decodeNumber'); | 287 throw new UnsupportedError('_decodeNumber'); |
290 } | 288 } |
291 | 289 |
292 void _fail() { | 290 void _fail() { |
293 throw new ArgumentError("Unexpected value: " | 291 throw new ArgumentError("Unexpected value: " |
294 "'${new String.fromCharCodes(codeUnits, position)}'."); | 292 "'${new String.fromCharCodes(codeUnits, position)}'."); |
295 } | 293 } |
296 } | 294 } |
OLD | NEW |