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 csslib.visitor; | 5 part of csslib.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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 String get _newLine => prettyPrint ? '\n' : ' '; | 32 String get _newLine => prettyPrint ? '\n' : ' '; |
33 String get _sp => prettyPrint ? ' ' : ''; | 33 String get _sp => prettyPrint ? ' ' : ''; |
34 | 34 |
35 // TODO(terry): When adding obfuscation we'll need isOptimized (compact w/ | 35 // TODO(terry): When adding obfuscation we'll need isOptimized (compact w/ |
36 // obufuscation) and have isTesting (compact no obfuscation) and | 36 // obufuscation) and have isTesting (compact no obfuscation) and |
37 // isCompact would be !prettyPrint. We'll need another boolean | 37 // isCompact would be !prettyPrint. We'll need another boolean |
38 // flag for obfuscation. | 38 // flag for obfuscation. |
39 bool get _isTesting => !prettyPrint; | 39 bool get _isTesting => !prettyPrint; |
40 | 40 |
| 41 void visitCalcTerm(CalcTerm node) { |
| 42 emit('${node.text}('); |
| 43 node.expr.visit(this); |
| 44 emit(')'); |
| 45 } |
| 46 |
41 void visitCssComment(CssComment node) { | 47 void visitCssComment(CssComment node) { |
42 emit('/* ${node.comment} */'); | 48 emit('/* ${node.comment} */'); |
43 } | 49 } |
44 | 50 |
45 void visitCommentDefinition(CommentDefinition node) { | 51 void visitCommentDefinition(CommentDefinition node) { |
46 emit('<!-- ${node.comment} -->'); | 52 emit('<!-- ${node.comment} -->'); |
47 } | 53 } |
48 | 54 |
49 void visitMediaExpression(MediaExpression node) { | 55 void visitMediaExpression(MediaExpression node) { |
50 emit(node.andOperator ? ' AND ' : ' '); | 56 emit(node.andOperator ? ' AND ' : ' '); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 | 513 |
508 void visitWildcard(Wildcard node) { | 514 void visitWildcard(Wildcard node) { |
509 emit('*'); | 515 emit('*'); |
510 } | 516 } |
511 | 517 |
512 void visitDartStyleExpression(DartStyleExpression node) { | 518 void visitDartStyleExpression(DartStyleExpression node) { |
513 // TODO(terry): TBD | 519 // TODO(terry): TBD |
514 throw UnimplementedError; | 520 throw UnimplementedError; |
515 } | 521 } |
516 } | 522 } |
OLD | NEW |