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

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

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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; 5 library yaml.loader;
6 6
7 import 'package:charcode/ascii.dart'; 7 import 'package:charcode/ascii.dart';
8 import 'package:source_span/source_span.dart'; 8 import 'package:source_span/source_span.dart';
9 9
10 import 'equality.dart'; 10 import 'equality.dart';
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 var document = _loadDocument(event); 56 var document = _loadDocument(event);
57 _span = _span.expand(document.span); 57 _span = _span.expand(document.span);
58 _aliases.clear(); 58 _aliases.clear();
59 return document; 59 return document;
60 } 60 }
61 61
62 /// Composes a document object. 62 /// Composes a document object.
63 YamlDocument _loadDocument(DocumentStartEvent firstEvent) { 63 YamlDocument _loadDocument(DocumentStartEvent firstEvent) {
64 var contents = _loadNode(_parser.parse()); 64 var contents = _loadNode(_parser.parse());
65 65
66 var lastEvent = _parser.parse(); 66 var lastEvent = _parser.parse() as DocumentEndEvent;
67 assert(lastEvent.type == EventType.DOCUMENT_END); 67 assert(lastEvent.type == EventType.DOCUMENT_END);
68 68
69 return new YamlDocument.internal( 69 return new YamlDocument.internal(
70 contents, 70 contents,
71 firstEvent.span.expand(lastEvent.span), 71 firstEvent.span.expand(lastEvent.span),
72 firstEvent.versionDirective, 72 firstEvent.versionDirective,
73 firstEvent.tagDirectives, 73 firstEvent.tagDirectives,
74 startImplicit: firstEvent.isImplicit, 74 startImplicit: firstEvent.isImplicit,
75 endImplicit: lastEvent.isImplicit); 75 endImplicit: lastEvent.isImplicit);
76 } 76 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return node; 120 return node;
121 } 121 }
122 122
123 /// Composes a sequence node. 123 /// Composes a sequence node.
124 YamlNode _loadSequence(SequenceStartEvent firstEvent) { 124 YamlNode _loadSequence(SequenceStartEvent firstEvent) {
125 if (firstEvent.tag != "!" && firstEvent.tag != null && 125 if (firstEvent.tag != "!" && firstEvent.tag != null &&
126 firstEvent.tag != "tag:yaml.org,2002:seq") { 126 firstEvent.tag != "tag:yaml.org,2002:seq") {
127 throw new YamlException("Invalid tag for sequence.", firstEvent.span); 127 throw new YamlException("Invalid tag for sequence.", firstEvent.span);
128 } 128 }
129 129
130 var children = []; 130 var children = <YamlNode>[];
131 var node = new YamlList.internal( 131 var node = new YamlList.internal(
132 children, firstEvent.span, firstEvent.style); 132 children, firstEvent.span, firstEvent.style);
133 _registerAnchor(firstEvent.anchor, node); 133 _registerAnchor(firstEvent.anchor, node);
134 134
135 var event = _parser.parse(); 135 var event = _parser.parse();
136 while (event.type != EventType.SEQUENCE_END) { 136 while (event.type != EventType.SEQUENCE_END) {
137 children.add(_loadNode(event)); 137 children.add(_loadNode(event));
138 event = _parser.parse(); 138 event = _parser.parse();
139 } 139 }
140 140
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 case ".nan": 350 case ".nan":
351 case ".NaN": 351 case ".NaN":
352 case ".NAN": 352 case ".NAN":
353 return double.NAN; 353 return double.NAN;
354 } 354 }
355 } 355 }
356 356
357 return null; 357 return null;
358 } 358 }
359 } 359 }
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