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 /** | 5 /** |
6 * A script to assist in documenting the difference between the dart:html API | 6 * A script to assist in documenting the difference between the dart:html API |
7 * and the old DOM API. | 7 * and the old DOM API. |
8 */ | 8 */ |
9 #library('html_diff'); | 9 #library('html_diff'); |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 /** | 66 /** |
67 * Perform static initialization of [world]. This should be run before | 67 * Perform static initialization of [world]. This should be run before |
68 * calling [HtmlDiff.run]. | 68 * calling [HtmlDiff.run]. |
69 */ | 69 */ |
70 static void initialize(Path libDir) { | 70 static void initialize(Path libDir) { |
71 _compilation = new Compilation.library(<Path>[new Path(HTML_LIBRARY_NAME)], | 71 _compilation = new Compilation.library(<Path>[new Path(HTML_LIBRARY_NAME)], |
72 libDir); | 72 libDir); |
73 _mirrors = _compilation.mirrors; | 73 _mirrors = _compilation.mirrors; |
74 } | 74 } |
75 | 75 |
76 HtmlDiff([bool printWarnings = false]) : | 76 HtmlDiff({bool printWarnings: false}) : |
77 _printWarnings = printWarnings, | 77 _printWarnings = printWarnings, |
78 htmlToDom = new Map<String, Set<String>>(), | 78 htmlToDom = new Map<String, Set<String>>(), |
79 htmlTypesToDom = new Map<String, Set<String>>(), | 79 htmlTypesToDom = new Map<String, Set<String>>(), |
80 comments = new CommentMap(); | 80 comments = new CommentMap(); |
81 | 81 |
82 void warn(String s) { | 82 void warn(String s) { |
83 if (_printWarnings) { | 83 if (_printWarnings) { |
84 print('Warning: $s'); | 84 print('Warning: $s'); |
85 } | 85 } |
86 } | 86 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 Map<String, String> _getTags(String comment) { | 225 Map<String, String> _getTags(String comment) { |
226 if (comment == null) return const <String, String>{}; | 226 if (comment == null) return const <String, String>{}; |
227 final re = const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"); | 227 final re = const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"); |
228 final tags = <String, String>{}; | 228 final tags = <String, String>{}; |
229 for (var m in re.allMatches(comment.trim())) { | 229 for (var m in re.allMatches(comment.trim())) { |
230 tags[m[1]] = m[2]; | 230 tags[m[1]] = m[2]; |
231 } | 231 } |
232 return tags; | 232 return tags; |
233 } | 233 } |
234 } | 234 } |
OLD | NEW |