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

Side by Side Diff: utils/pub/yaml/composer.dart

Issue 11267018: Make getKeys, getValues getters (keys, values). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files with co19 issue number. Created 8 years, 1 month 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
« no previous file with comments | « utils/pub/version_solver.dart ('k') | utils/pub/yaml/deep_equals.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 5 /**
6 * Takes a parsed YAML document (what the spec calls the "serialization tree") 6 * Takes a parsed YAML document (what the spec calls the "serialization tree")
7 * and resolves aliases, resolves tags, and parses scalars to produce the 7 * and resolves aliases, resolves tags, and parses scalars to produce the
8 * "representation graph". 8 * "representation graph".
9 */ 9 */
10 class _Composer extends _Visitor { 10 class _Composer extends _Visitor {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 return setAnchor(scalar, parseString(scalar.content)); 53 return setAnchor(scalar, parseString(scalar.content));
54 } 54 }
55 55
56 // TODO(nweiz): support the full YAML type repository 56 // TODO(nweiz): support the full YAML type repository
57 var tagParsers = { 57 var tagParsers = {
58 'null': parseNull, 'bool': parseBool, 'int': parseInt, 58 'null': parseNull, 'bool': parseBool, 'int': parseInt,
59 'float': parseFloat, 'str': parseString 59 'float': parseFloat, 'str': parseString
60 }; 60 };
61 61
62 for (var key in tagParsers.getKeys()) { 62 for (var key in tagParsers.keys) {
63 if (scalar.tag.name != _Tag.yaml(key)) continue; 63 if (scalar.tag.name != _Tag.yaml(key)) continue;
64 var result = tagParsers[key](scalar.content); 64 var result = tagParsers[key](scalar.content);
65 if (result != null) return setAnchor(scalar, result); 65 if (result != null) return setAnchor(scalar, result);
66 throw new YamlException('invalid literal for $key: "${scalar.content}"'); 66 throw new YamlException('invalid literal for $key: "${scalar.content}"');
67 } 67 }
68 68
69 throw new YamlException('undefined tag: "${scalar.tag.name}"'); 69 throw new YamlException('undefined tag: "${scalar.tag.name}"');
70 } 70 }
71 71
72 /** Assigns a tag to the sequence and recursively composes its contents. */ 72 /** Assigns a tag to the sequence and recursively composes its contents. */
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 value: Math.parseDouble("NaN")); 172 value: Math.parseDouble("NaN"));
173 } 173 }
174 174
175 return null; 175 return null;
176 } 176 }
177 177
178 /** Parses a string scalar. */ 178 /** Parses a string scalar. */
179 _ScalarNode parseString(String content) => 179 _ScalarNode parseString(String content) =>
180 new _ScalarNode(_Tag.yaml("str"), value: content); 180 new _ScalarNode(_Tag.yaml("str"), value: content);
181 } 181 }
OLDNEW
« no previous file with comments | « utils/pub/version_solver.dart ('k') | utils/pub/yaml/deep_equals.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698