OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library yaml.scanner; | 5 library yaml.scanner; |
6 | 6 |
7 import 'package:collection/collection.dart'; | 7 import 'package:collection/collection.dart'; |
8 import 'package:string_scanner/string_scanner.dart'; | 8 import 'package:string_scanner/string_scanner.dart'; |
9 import 'package:source_span/source_span.dart'; | 9 import 'package:source_span/source_span.dart'; |
10 | 10 |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 } | 436 } |
437 return; | 437 return; |
438 case COLON: | 438 case COLON: |
439 if (!_inBlockContext && _tokens.isNotEmpty) { | 439 if (!_inBlockContext && _tokens.isNotEmpty) { |
440 // If a colon follows a "JSON-like" value (an explicit map or list, or | 440 // If a colon follows a "JSON-like" value (an explicit map or list, or |
441 // a quoted string) it isn't required to have whitespace after it | 441 // a quoted string) it isn't required to have whitespace after it |
442 // since it unambiguously describes a map. | 442 // since it unambiguously describes a map. |
443 var token = _tokens.last; | 443 var token = _tokens.last; |
444 if (token.type == TokenType.FLOW_SEQUENCE_END || | 444 if (token.type == TokenType.FLOW_SEQUENCE_END || |
445 token.type == TokenType.FLOW_MAPPING_END || | 445 token.type == TokenType.FLOW_MAPPING_END || |
446 (token.type == TokenType.SCALAR && token.style.isQuoted)) { | 446 (token.type == TokenType.SCALAR && |
| 447 (token as ScalarToken).style.isQuoted)) { |
447 _fetchValue(); | 448 _fetchValue(); |
448 return; | 449 return; |
449 } | 450 } |
450 } | 451 } |
451 | 452 |
452 if (_isPlainCharAt(1)) { | 453 if (_isPlainCharAt(1)) { |
453 _fetchPlainScalar(); | 454 _fetchPlainScalar(); |
454 } else { | 455 } else { |
455 _fetchValue(); | 456 _fetchValue(); |
456 } | 457 } |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 | 1675 |
1675 /// All trailing whitespace is preserved. | 1676 /// All trailing whitespace is preserved. |
1676 static const KEEP = const _Chomping("KEEP"); | 1677 static const KEEP = const _Chomping("KEEP"); |
1677 | 1678 |
1678 final String name; | 1679 final String name; |
1679 | 1680 |
1680 const _Chomping(this.name); | 1681 const _Chomping(this.name); |
1681 | 1682 |
1682 String toString() => name; | 1683 String toString() => name; |
1683 } | 1684 } |
OLD | NEW |