Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: pkg/yaml/lib/yaml.dart

Issue 23596007: Remove usage of dart:json. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update generated library. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/). 5 /// A parser for [YAML](http://www.yaml.org/).
6 /// 6 ///
7 /// ## Installing ## 7 /// ## Installing ##
8 /// 8 ///
9 /// Use [pub][] to install this package. Add the following to your 9 /// Use [pub][] to install this package. Add the following to your
10 /// `pubspec.yaml` file. 10 /// `pubspec.yaml` file.
(...skipping 11 matching lines...) Expand all
22 /// Use [loadYaml] to load a single document, or [loadYamlStream] to load a 22 /// Use [loadYaml] to load a single document, or [loadYamlStream] to load a
23 /// stream of documents. For example: 23 /// stream of documents. For example:
24 /// 24 ///
25 /// import 'package:yaml/yaml.dart'; 25 /// import 'package:yaml/yaml.dart';
26 /// main() { 26 /// main() {
27 /// var doc = loadYaml("YAML: YAML Ain't Markup Language"); 27 /// var doc = loadYaml("YAML: YAML Ain't Markup Language");
28 /// print(doc['YAML']); 28 /// print(doc['YAML']);
29 /// } 29 /// }
30 /// 30 ///
31 /// This library currently doesn't support dumping to YAML. You should use 31 /// This library currently doesn't support dumping to YAML. You should use
32 /// `stringify` from `dart:json` instead: 32 /// `stringify` from `dart:json` instead:
nweiz 2013/08/27 17:05:02 Update this line.
floitsch 2013/08/28 08:26:44 Done.
33 /// 33 ///
34 /// import 'dart:json' as json; 34 /// import 'dart:convert';
35 /// import 'package:yaml/yaml.dart'; 35 /// import 'package:yaml/yaml.dart';
36 /// main() { 36 /// main() {
37 /// var doc = loadYaml("YAML: YAML Ain't Markup Language"); 37 /// var doc = loadYaml("YAML: YAML Ain't Markup Language");
38 /// print(json.stringify(doc)); 38 /// print(JSON.encode(doc));
39 /// } 39 /// }
40 /// 40 ///
41 /// [pub]: http://pub.dartlang.org 41 /// [pub]: http://pub.dartlang.org
42 /// [pkg]: http://pub.dartlang.org/packages/yaml 42 /// [pkg]: http://pub.dartlang.org/packages/yaml
43 library yaml; 43 library yaml;
44 44
45 import 'src/composer.dart'; 45 import 'src/composer.dart';
46 import 'src/constructor.dart'; 46 import 'src/constructor.dart';
47 import 'src/parser.dart'; 47 import 'src/parser.dart';
48 import 'src/yaml_exception.dart'; 48 import 'src/yaml_exception.dart';
(...skipping 22 matching lines...) Expand all
71 /// The return value is mostly normal Dart objects. However, since YAML mappings 71 /// The return value is mostly normal Dart objects. However, since YAML mappings
72 /// support some key types that the default Dart map implementation doesn't 72 /// support some key types that the default Dart map implementation doesn't
73 /// (null, NaN, booleans, lists, and maps), all maps in the returned document 73 /// (null, NaN, booleans, lists, and maps), all maps in the returned document
74 /// are [YamlMap]s. These have a few small behavioral differences from the 74 /// are [YamlMap]s. These have a few small behavioral differences from the
75 /// default Map implementation; for details, see the [YamlMap] class. 75 /// default Map implementation; for details, see the [YamlMap] class.
76 List loadYamlStream(String yaml) { 76 List loadYamlStream(String yaml) {
77 return new Parser(yaml).l_yamlStream() 77 return new Parser(yaml).l_yamlStream()
78 .map((doc) => new Constructor(new Composer(doc).compose()).construct()) 78 .map((doc) => new Constructor(new Composer(doc).compose()).construct())
79 .toList(); 79 .toList();
80 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698