OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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; | 5 library yaml; |
6 | 6 |
7 import 'dart:math' as Math; | 7 import 'dart:math' as Math; |
8 | 8 |
9 import 'deep_equals.dart'; | 9 import 'deep_equals.dart'; |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 /// Loads a stream of documents from a YAML string. | 34 /// Loads a stream of documents from a YAML string. |
35 /// | 35 /// |
36 /// The return value is mostly normal Dart objects. However, since YAML mappings | 36 /// The return value is mostly normal Dart objects. However, since YAML mappings |
37 /// support some key types that the default Dart map implementation doesn't | 37 /// support some key types that the default Dart map implementation doesn't |
38 /// (null, NaN, booleans, lists, and maps), all maps in the returned document | 38 /// (null, NaN, booleans, lists, and maps), all maps in the returned document |
39 /// are YamlMaps. These have a few small behavioral differences from the default | 39 /// are YamlMaps. These have a few small behavioral differences from the default |
40 /// Map implementation; for details, see the YamlMap class. | 40 /// Map implementation; for details, see the YamlMap class. |
41 List loadYamlStream(String yaml) { | 41 List loadYamlStream(String yaml) { |
42 return new _Parser(yaml).l_yamlStream().map((doc) => | 42 return new _Parser(yaml).l_yamlStream().mappedBy((doc) => |
43 new _Constructor(new _Composer(doc).compose()).construct()); | 43 new _Constructor(new _Composer(doc).compose()).construct()) |
| 44 .toList(); |
44 } | 45 } |
45 | 46 |
46 /// An error thrown by the YAML processor. | 47 /// An error thrown by the YAML processor. |
47 class YamlException implements Exception { | 48 class YamlException implements Exception { |
48 String msg; | 49 String msg; |
49 | 50 |
50 YamlException(this.msg); | 51 YamlException(this.msg); |
51 | 52 |
52 String toString() => msg; | 53 String toString() => msg; |
53 } | 54 } |
OLD | NEW |