OLD | NEW |
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 import 'package:charcode/ascii.dart'; | 5 import 'package:charcode/ascii.dart'; |
6 import 'package:source_span/source_span.dart'; | 6 import 'package:source_span/source_span.dart'; |
7 | 7 |
8 import 'equality.dart'; | 8 import 'equality.dart'; |
9 import 'event.dart'; | 9 import 'event.dart'; |
10 import 'parser.dart'; | 10 import 'parser.dart'; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 return node; | 140 return node; |
141 } | 141 } |
142 | 142 |
143 /// Composes a mapping node. | 143 /// Composes a mapping node. |
144 YamlNode _loadMapping(MappingStartEvent firstEvent) { | 144 YamlNode _loadMapping(MappingStartEvent firstEvent) { |
145 if (firstEvent.tag != "!" && firstEvent.tag != null && | 145 if (firstEvent.tag != "!" && firstEvent.tag != null && |
146 firstEvent.tag != "tag:yaml.org,2002:map") { | 146 firstEvent.tag != "tag:yaml.org,2002:map") { |
147 throw new YamlException("Invalid tag for mapping.", firstEvent.span); | 147 throw new YamlException("Invalid tag for mapping.", firstEvent.span); |
148 } | 148 } |
149 | 149 |
150 var children = deepEqualsMap(); | 150 var children = deepEqualsMap/*<dynamic, YamlNode>*/(); |
151 var node = new YamlMap.internal( | 151 var node = new YamlMap.internal( |
152 children, firstEvent.span, firstEvent.style); | 152 children, firstEvent.span, firstEvent.style); |
153 _registerAnchor(firstEvent.anchor, node); | 153 _registerAnchor(firstEvent.anchor, node); |
154 | 154 |
155 var event = _parser.parse(); | 155 var event = _parser.parse(); |
156 while (event.type != EventType.MAPPING_END) { | 156 while (event.type != EventType.MAPPING_END) { |
157 var key = _loadNode(event); | 157 var key = _loadNode(event); |
158 var value = _loadNode(_parser.parse()); | 158 var value = _loadNode(_parser.parse()); |
159 children[key] = value; | 159 children[key] = value; |
160 event = _parser.parse(); | 160 event = _parser.parse(); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 case ".nan": | 348 case ".nan": |
349 case ".NaN": | 349 case ".NaN": |
350 case ".NAN": | 350 case ".NAN": |
351 return double.NAN; | 351 return double.NAN; |
352 } | 352 } |
353 } | 353 } |
354 | 354 |
355 return null; | 355 return null; |
356 } | 356 } |
357 } | 357 } |
OLD | NEW |