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

Side by Side Diff: packages/yaml/lib/src/loader.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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
« no previous file with comments | « packages/yaml/lib/src/event.dart ('k') | packages/yaml/lib/src/null_span.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) 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.loader;
6
7 import 'package:charcode/ascii.dart'; 5 import 'package:charcode/ascii.dart';
8 import 'package:source_span/source_span.dart'; 6 import 'package:source_span/source_span.dart';
9 7
10 import 'equality.dart'; 8 import 'equality.dart';
11 import 'event.dart'; 9 import 'event.dart';
12 import 'parser.dart'; 10 import 'parser.dart';
13 import 'yaml_document.dart'; 11 import 'yaml_document.dart';
14 import 'yaml_exception.dart'; 12 import 'yaml_exception.dart';
15 import 'yaml_node.dart'; 13 import 'yaml_node.dart';
16 14
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 return node; 140 return node;
143 } 141 }
144 142
145 /// Composes a mapping node. 143 /// Composes a mapping node.
146 YamlNode _loadMapping(MappingStartEvent firstEvent) { 144 YamlNode _loadMapping(MappingStartEvent firstEvent) {
147 if (firstEvent.tag != "!" && firstEvent.tag != null && 145 if (firstEvent.tag != "!" && firstEvent.tag != null &&
148 firstEvent.tag != "tag:yaml.org,2002:map") { 146 firstEvent.tag != "tag:yaml.org,2002:map") {
149 throw new YamlException("Invalid tag for mapping.", firstEvent.span); 147 throw new YamlException("Invalid tag for mapping.", firstEvent.span);
150 } 148 }
151 149
152 var children = deepEqualsMap(); 150 var children = deepEqualsMap/*<dynamic, YamlNode>*/();
153 var node = new YamlMap.internal( 151 var node = new YamlMap.internal(
154 children, firstEvent.span, firstEvent.style); 152 children, firstEvent.span, firstEvent.style);
155 _registerAnchor(firstEvent.anchor, node); 153 _registerAnchor(firstEvent.anchor, node);
156 154
157 var event = _parser.parse(); 155 var event = _parser.parse();
158 while (event.type != EventType.MAPPING_END) { 156 while (event.type != EventType.MAPPING_END) {
159 var key = _loadNode(event); 157 var key = _loadNode(event);
160 var value = _loadNode(_parser.parse()); 158 var value = _loadNode(_parser.parse());
159 if (children.containsKey(key)) {
160 throw new YamlException("Duplicate mapping key.", key.span);
161 }
162
161 children[key] = value; 163 children[key] = value;
162 event = _parser.parse(); 164 event = _parser.parse();
163 } 165 }
164 166
165 setSpan(node, firstEvent.span.expand(event.span)); 167 setSpan(node, firstEvent.span.expand(event.span));
166 return node; 168 return node;
167 } 169 }
168 170
169 /// Parses a scalar according to its tag name. 171 /// Parses a scalar according to its tag name.
170 YamlScalar _parseByTag(ScalarEvent scalar) { 172 YamlScalar _parseByTag(ScalarEvent scalar) {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 case ".nan": 352 case ".nan":
351 case ".NaN": 353 case ".NaN":
352 case ".NAN": 354 case ".NAN":
353 return double.NAN; 355 return double.NAN;
354 } 356 }
355 } 357 }
356 358
357 return null; 359 return null;
358 } 360 }
359 } 361 }
OLDNEW
« no previous file with comments | « packages/yaml/lib/src/event.dart ('k') | packages/yaml/lib/src/null_span.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698