9b23dff467
This reverts commit r17907. TBR. Review URL: https://codereview.chromium.org//12090093 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17918 260f80e4-7a28-3924-810f-c04153c831b5
28 lines
854 B
Dart
28 lines
854 B
Dart
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
part of yaml;
|
|
|
|
/// The visitor pattern for YAML documents.
|
|
class _Visitor {
|
|
/// Returns [alias].
|
|
visitAlias(_AliasNode alias) => alias;
|
|
|
|
/// Returns [scalar].
|
|
visitScalar(_ScalarNode scalar) => scalar;
|
|
|
|
/// Visits each node in [seq] and returns a list of the results.
|
|
visitSequence(_SequenceNode seq)
|
|
=> seq.content.map((e) => e.visit(this)).toList();
|
|
|
|
/// Visits each key and value in [map] and returns a map of the results.
|
|
visitMapping(_MappingNode map) {
|
|
var out = new YamlMap();
|
|
for (var key in map.content.keys) {
|
|
out[key.visit(this)] = map.content[key].visit(this);
|
|
}
|
|
return out;
|
|
}
|
|
}
|