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 /// A parser for [YAML](http://www.yaml.org/). |
| 6 /// |
| 7 /// Use [loadYaml] to load a single document, or [loadYamlStream] to load a |
| 8 /// stream of documents. For example: |
| 9 /// |
| 10 /// import 'package:yaml/yaml.dart'; |
| 11 /// main() { |
| 12 /// var doc = loadYaml("YAML: YAML Ain't Markup Language"); |
| 13 /// print(doc['YAML']); |
| 14 /// } |
| 15 /// |
| 16 /// This library currently doesn't support dumping to YAML. You should use |
| 17 /// `stringify` from `dart:json` instead: |
| 18 /// |
| 19 /// import 'dart:json' as json; |
| 20 /// import 'package:yaml/yaml.dart'; |
| 21 /// main() { |
| 22 /// var doc = loadYaml("YAML: YAML Ain't Markup Language"); |
| 23 /// print(json.stringify(doc)); |
| 24 /// } |
5 library yaml; | 25 library yaml; |
6 | 26 |
7 import 'dart:math' as Math; | 27 import 'dart:math' as Math; |
8 import 'dart:collection' show Queue; | 28 import 'dart:collection' show Queue; |
9 | 29 |
10 import 'deep_equals.dart'; | 30 import 'deep_equals.dart'; |
11 | 31 |
12 part 'yaml_map.dart'; | 32 part 'yaml_map.dart'; |
13 part 'model.dart'; | 33 part 'model.dart'; |
14 part 'parser.dart'; | 34 part 'parser.dart'; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 66 } |
47 | 67 |
48 /// An error thrown by the YAML processor. | 68 /// An error thrown by the YAML processor. |
49 class YamlException implements Exception { | 69 class YamlException implements Exception { |
50 String msg; | 70 String msg; |
51 | 71 |
52 YamlException(this.msg); | 72 YamlException(this.msg); |
53 | 73 |
54 String toString() => msg; | 74 String toString() => msg; |
55 } | 75 } |
OLD | NEW |