OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 visitor; | 5 part of visitor; |
6 | 6 |
7 /** | 7 /** |
8 * Visitor that produces a formatted string representation of the CSS tree. | 8 * Visitor that produces a formatted string representation of the CSS tree. |
9 */ | 9 */ |
10 class CssPrinter extends Visitor { | 10 class CssPrinter extends Visitor { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 void visitKeyFrameBlock(KeyFrameBlock node) { | 140 void visitKeyFrameBlock(KeyFrameBlock node) { |
141 emit('$_sp$_sp'); | 141 emit('$_sp$_sp'); |
142 node._blockSelectors.visit(this); | 142 node._blockSelectors.visit(this); |
143 emit('$_sp{$_newLine'); | 143 emit('$_sp{$_newLine'); |
144 node._declarations.visit(this); | 144 node._declarations.visit(this); |
145 emit('$_sp$_sp}$_newLine'); | 145 emit('$_sp$_sp}$_newLine'); |
146 } | 146 } |
147 | 147 |
148 void visitIncludeDirective(IncludeDirective node) { | |
149 emit('/****** @include ${node._include} ******/\n'); | |
150 if (node._stylesheet != null) { | |
151 node._stylesheet.visit(this); | |
152 } else { | |
153 emit('// <EMPTY>'); | |
154 } | |
155 emit('/****** End of ${node._include} ******/\n\n'); | |
156 } | |
157 | |
158 void visitStyletDirective(StyletDirective node) { | 148 void visitStyletDirective(StyletDirective node) { |
159 emit('/* @stylet export as ${node._dartClassName} */\n'); | 149 emit('/* @stylet export as ${node._dartClassName} */\n'); |
160 } | 150 } |
161 | 151 |
162 void visitNamespaceDirective(NamespaceDirective node) { | 152 void visitNamespaceDirective(NamespaceDirective node) { |
163 bool isStartingQuote(String ch) => ('\'"'.indexOf(ch) >= 0); | 153 bool isStartingQuote(String ch) => ('\'"'.indexOf(ch) >= 0); |
164 | 154 |
165 if (isStartingQuote(node._uri)) { | 155 if (isStartingQuote(node._uri)) { |
166 emit(' @namespace ${node.prefix}"${node._uri}"'); | 156 emit(' @namespace ${node.prefix}"${node._uri}"'); |
167 } else { | 157 } else { |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 426 |
437 void visitWildcard(Wildcard node) { | 427 void visitWildcard(Wildcard node) { |
438 emit('*'); | 428 emit('*'); |
439 } | 429 } |
440 | 430 |
441 void visitDartStyleExpression(DartStyleExpression node) { | 431 void visitDartStyleExpression(DartStyleExpression node) { |
442 // TODO(terry): TBD | 432 // TODO(terry): TBD |
443 throw UnimplementedError; | 433 throw UnimplementedError; |
444 } | 434 } |
445 } | 435 } |
OLD | NEW |