| 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 tree; | 5 part of tree; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Pretty-prints Node tree in XML-like format. | 8 * Pretty-prints Node tree in XML-like format. |
| 9 * | 9 * |
| 10 * TODO(smok): Add main() to run from command-line to print out tree for given | 10 * TODO(smok): Add main() to run from command-line to print out tree for given |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 addTypeWithParams(tag); | 83 addTypeWithParams(tag); |
| 84 sb.write(">\n"); | 84 sb.write(">\n"); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void addTypeWithParams(String type, [Map params]) { | 87 void addTypeWithParams(String type, [Map params]) { |
| 88 if (params == null) params = new Map(); | 88 if (params == null) params = new Map(); |
| 89 sb.write("${type}"); | 89 sb.write("${type}"); |
| 90 params.forEach((k, v) { | 90 params.forEach((k, v) { |
| 91 String value; | 91 String value; |
| 92 if (v != null) { | 92 if (v != null) { |
| 93 value = v | 93 var str = v; |
| 94 if (v is Token) str = v.value; |
| 95 value = str |
| 94 .replaceAll("<", "<") | 96 .replaceAll("<", "<") |
| 95 .replaceAll(">", ">") | 97 .replaceAll(">", ">") |
| 96 .replaceAll('"', "'"); | 98 .replaceAll('"', "'"); |
| 97 } else { | 99 } else { |
| 98 value = "[null]"; | 100 value = "[null]"; |
| 99 } | 101 } |
| 100 sb.write(' $k="$value"'); | 102 sb.write(' $k="$value"'); |
| 101 }); | 103 }); |
| 102 } | 104 } |
| 103 | 105 |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 475 } |
| 474 | 476 |
| 475 visitStringNode(StringNode node) { | 477 visitStringNode(StringNode node) { |
| 476 unimplemented('visitNode', node: node); | 478 unimplemented('visitNode', node: node); |
| 477 } | 479 } |
| 478 | 480 |
| 479 unimplemented(String message, {Node node}) { | 481 unimplemented(String message, {Node node}) { |
| 480 throw message; | 482 throw message; |
| 481 } | 483 } |
| 482 } | 484 } |
| OLD | NEW |