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

Side by Side Diff: pkg/yaml/lib/src/visitor.dart

Issue 302313007: Attach source range information to parsed YAML nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix tests Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « pkg/yaml/lib/src/utils.dart ('k') | pkg/yaml/lib/src/yaml_map.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) 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.visitor; 5 library yaml.visitor;
6 6
7 import 'equality.dart';
7 import 'model.dart'; 8 import 'model.dart';
8 import 'yaml_map.dart';
9 9
10 /// The visitor pattern for YAML documents. 10 /// The visitor pattern for YAML documents.
11 class Visitor { 11 class Visitor {
12 /// Returns [alias]. 12 /// Returns [alias].
13 visitAlias(AliasNode alias) => alias; 13 visitAlias(AliasNode alias) => alias;
14 14
15 /// Returns [scalar]. 15 /// Returns [scalar].
16 visitScalar(ScalarNode scalar) => scalar; 16 visitScalar(ScalarNode scalar) => scalar;
17 17
18 /// Visits each node in [seq] and returns a list of the results. 18 /// Visits each node in [seq] and returns a list of the results.
19 visitSequence(SequenceNode seq) 19 visitSequence(SequenceNode seq)
20 => seq.content.map((e) => e.visit(this)).toList(); 20 => seq.content.map((e) => e.visit(this)).toList();
21 21
22 /// Visits each key and value in [map] and returns a map of the results. 22 /// Visits each key and value in [map] and returns a map of the results.
23 visitMapping(MappingNode map) { 23 visitMapping(MappingNode map) {
24 var out = new YamlMap(); 24 var out = deepEqualsMap();
25 for (var key in map.content.keys) { 25 for (var key in map.content.keys) {
26 out[key.visit(this)] = map.content[key].visit(this); 26 out[key.visit(this)] = map.content[key].visit(this);
27 } 27 }
28 return out; 28 return out;
29 } 29 }
30 } 30 }
OLDNEW
« no previous file with comments | « pkg/yaml/lib/src/utils.dart ('k') | pkg/yaml/lib/src/yaml_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698