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 part of csslib.visitor; | 5 part of csslib.visitor; |
6 | 6 |
7 /** | 7 /** |
8 * The base type for all nodes in a CSS abstract syntax tree. | 8 * The base type for all nodes in a CSS abstract syntax tree. |
9 */ | 9 */ |
10 abstract class TreeNode { | 10 abstract class TreeNode { |
11 /** The source code this [TreeNode] represents. */ | 11 /** The source code this [TreeNode] represents. */ |
12 final SourceSpan span; | 12 final SourceSpan span; |
13 | 13 |
14 TreeNode(this.span); | 14 TreeNode(this.span); |
15 | 15 |
16 TreeNode clone(); | 16 TreeNode clone(); |
17 | 17 |
18 /** Classic double-dispatch visitor for implementing passes. */ | 18 /** Classic double-dispatch visitor for implementing passes. */ |
19 void visit(VisitorBase visitor); | 19 visit(VisitorBase visitor); |
20 | 20 |
21 /** A multiline string showing the node and its children. */ | 21 /** A multiline string showing the node and its children. */ |
22 String toDebugString() { | 22 String toDebugString() { |
23 var to = new TreeOutput(); | 23 var to = new TreeOutput(); |
24 var tp = new _TreePrinter(to, true); | 24 var tp = new _TreePrinter(to, true); |
25 this.visit(tp); | 25 this.visit(tp); |
26 return to.buf.toString(); | 26 return to.buf.toString(); |
27 } | 27 } |
28 } | 28 } |
29 | 29 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 writeln('null'); | 88 writeln('null'); |
89 } | 89 } |
90 } | 90 } |
91 depth -= 1; | 91 depth -= 1; |
92 writeln(']'); | 92 writeln(']'); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 String toString() => buf.toString(); | 96 String toString() => buf.toString(); |
97 } | 97 } |
OLD | NEW |