| OLD | NEW |
| 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 library yaml.yaml_node; | 5 library yaml.yaml_node; |
| 6 | 6 |
| 7 import 'dart:collection' as collection; | 7 import 'dart:collection' as collection; |
| 8 | 8 |
| 9 import 'package:collection/collection.dart'; | 9 import 'package:collection/collection.dart'; |
| 10 import 'package:source_span/source_span.dart'; | 10 import 'package:source_span/source_span.dart'; |
| 11 | 11 |
| 12 import 'event.dart'; |
| 12 import 'null_span.dart'; | 13 import 'null_span.dart'; |
| 13 import 'style.dart'; | 14 import 'style.dart'; |
| 14 import 'yaml_node_wrapper.dart'; | 15 import 'yaml_node_wrapper.dart'; |
| 15 | 16 |
| 16 /// An interface for parsed nodes from a YAML source tree. | 17 /// An interface for parsed nodes from a YAML source tree. |
| 17 /// | 18 /// |
| 18 /// [YamlMap]s and [YamlList]s implement this interface in addition to the | 19 /// [YamlMap]s and [YamlList]s implement this interface in addition to the |
| 19 /// normal [Map] and [List] interfaces, so any maps and lists will be | 20 /// normal [Map] and [List] interfaces, so any maps and lists will be |
| 20 /// [YamlNode]s regardless of how they're accessed. | 21 /// [YamlNode]s regardless of how they're accessed. |
| 21 /// | 22 /// |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 /// will have a reasonable implementation of [SourceSpan.message]. If | 157 /// will have a reasonable implementation of [SourceSpan.message]. If |
| 157 /// [sourceUrl] is passed, it's used as the [SourceSpan.sourceUrl]. | 158 /// [sourceUrl] is passed, it's used as the [SourceSpan.sourceUrl]. |
| 158 /// | 159 /// |
| 159 /// [sourceUrl] may be either a [String], a [Uri], or `null`. | 160 /// [sourceUrl] may be either a [String], a [Uri], or `null`. |
| 160 YamlScalar.wrap(this.value, {sourceUrl}) | 161 YamlScalar.wrap(this.value, {sourceUrl}) |
| 161 : style = ScalarStyle.ANY { | 162 : style = ScalarStyle.ANY { |
| 162 _span = new NullSpan(sourceUrl); | 163 _span = new NullSpan(sourceUrl); |
| 163 } | 164 } |
| 164 | 165 |
| 165 /// Users of the library should not use this constructor. | 166 /// Users of the library should not use this constructor. |
| 166 YamlScalar.internal(this.value, SourceSpan span, this.style) { | 167 YamlScalar.internal(this.value, ScalarEvent scalar) |
| 168 : style = scalar.style { |
| 167 _span = span; | 169 _span = span; |
| 168 } | 170 } |
| 169 | 171 |
| 172 /// Users of the library should not use this constructor. |
| 173 YamlScalar.internalWithSpan(this.value, SourceSpan span) |
| 174 : style = ScalarStyle.ANY { |
| 175 _span = span; |
| 176 } |
| 177 |
| 170 String toString() => value.toString(); | 178 String toString() => value.toString(); |
| 171 } | 179 } |
| 172 | 180 |
| 173 /// Sets the source span of a [YamlNode]. | 181 /// Sets the source span of a [YamlNode]. |
| 174 /// | 182 /// |
| 175 /// This method is not exposed publicly. | 183 /// This method is not exposed publicly. |
| 176 void setSpan(YamlNode node, SourceSpan span) { | 184 void setSpan(YamlNode node, SourceSpan span) { |
| 177 node._span = span; | 185 node._span = span; |
| 178 } | 186 } |
| OLD | NEW |