Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: third_party/pkg/angular/lib/tools/html_extractor.dart

Issue 1058283006: Update pubspecs and dependencies to get pkgbuild tests working. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/lib/tools/html_extractor.dart
diff --git a/third_party/pkg/angular/lib/tools/html_extractor.dart b/third_party/pkg/angular/lib/tools/html_extractor.dart
deleted file mode 100644
index 4dc637cb478eec4e0765932b4f30634e7597b4a7..0000000000000000000000000000000000000000
--- a/third_party/pkg/angular/lib/tools/html_extractor.dart
+++ /dev/null
@@ -1,78 +0,0 @@
-library angular.html_parser;
-
-import 'package:html5lib/parser.dart';
-import 'package:html5lib/dom.dart';
-
-import 'package:angular/tools/selector.dart';
-import 'package:angular/tools/io.dart';
-import 'package:angular/tools/common.dart';
-
-typedef NodeVisitor(Node node);
-
-RegExp _MUSTACHE_REGEXP = new RegExp(r'{{([^}]*)}}');
-RegExp _NG_REPEAT_SYNTAX = new RegExp(r'^\s*(.+)\s+in\s+(.*?)\s*(\s+track\s+by\s+(.+)\s*)?$');
-
-class HtmlExpressionExtractor {
- List<DirectiveInfo> directiveInfos;
-
- HtmlExpressionExtractor(this.directiveInfos) {
- for (DirectiveInfo directiveInfo in directiveInfos) {
- expressions.addAll(directiveInfo.expressions);
- if (directiveInfo.template != null) {
- parseHtml(directiveInfo.template);
- }
- }
- }
-
- Set<String> expressions = new Set<String>();
-
- void crawl(String root, IoService ioService) {
- ioService.visitFs(root, (String file) {
- if (!file.endsWith('.html')) return;
- parseHtml(ioService.readAsStringSync(file));
- });
- }
-
- void parseHtml(String html) {
- var document = parse(html);
- visitNodes([document], (Node node) {
- if (matchesNode(node, r'[*=/{{.*}}/]')) {
- node.attributes.forEach((attrName, attrValue) {
- _MUSTACHE_REGEXP.allMatches(attrValue).forEach((match) {
- expressions.add(match.group(1));
- });
- });
- }
- if (matchesNode(node, r':contains(/{{.*}}/)')) {
- _MUSTACHE_REGEXP.allMatches(node.value).forEach((match) {
- expressions.add(match.group(1));
- });
- }
- if (matchesNode(node, r'[ng-repeat]')) {
- var expr = _NG_REPEAT_SYNTAX.
- firstMatch(node.attributes['ng-repeat']).group(2);
- expressions.add(expr);
- }
-
- for (DirectiveInfo directiveInfo in directiveInfos) {
- if (matchesNode(node, directiveInfo.selector)) {
- directiveInfo.expressionAttrs.forEach((attr) {
- if (node.attributes[attr] != null && attr != 'ng-repeat') {
- expressions.add(node.attributes[attr]);
- }
- });
- }
- }
- });
- }
-
- visitNodes(List<Node> nodes, NodeVisitor visitor) {
- for (Node node in nodes) {
- visitor(node);
- if (node.nodes.length > 0) {
- visitNodes(node.nodes, visitor);
- }
- }
- }
-}
-
« no previous file with comments | « third_party/pkg/angular/lib/tools/expression_extractor.dart ('k') | third_party/pkg/angular/lib/tools/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698