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

Side by Side Diff: utils/css/generate.dart

Issue 9695048: Template parser (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Siggi's comments Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/css/cssselectorexception.dart ('k') | utils/css/parser.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class Generate { 5 class Generate {
6 6
7 // Build up list of all known class selectors in all CSS files. 7 // Build up list of all known class selectors in all CSS files.
8 static List<String> computeClassSelectors(RuleSet ruleset, classes) { 8 static List<String> computeClassSelectors(RuleSet ruleset, classes) {
9 for (final selector in ruleset.selectorGroup.selectors) { 9 for (final selector in ruleset.selectorGroup.selectors) {
10 var selSeqs = selector.simpleSelectorSequences; 10 var selSeqs = selector.simpleSelectorSequences;
11 for (final selSeq in selSeqs) { 11 for (final selSeq in selSeqs) {
12 var simpleSelector = selSeq.simpleSelector; 12 var simpleSelector = selSeq.simpleSelector;
13 if (simpleSelector is ClassSelector) { 13 if (simpleSelector is ClassSelector) {
14 String className = simpleSelector.name; 14 String className = simpleSelector.name;
15 if (classes.indexOf(className) == -1) { // Class name already known? 15 if (classes.indexOf(className) == -1) { // Class name already known?
16 // No, expose it. 16 // No, expose it.
17 classes.add(className); 17 classes.add(className);
18 } 18 }
19 } 19 }
20 } 20 }
21 } 21 }
22 22
23 return classes; 23 return classes;
24 } 24 }
25 25
26 static dartClass(FileSystem files, String outPath, Stylesheet stylesheet, 26 static dartClass(var files, String outPath, Stylesheet stylesheet,
27 String filename) { 27 String filename) {
28 28
29 List<String> knownClasses = []; 29 List<String> knownClasses = [];
30 30
31 StringBuffer buff = new StringBuffer( 31 StringBuffer buff = new StringBuffer(
32 '// File generated by Dart CSS from source file ${filename}\n' + 32 '// File generated by Dart CSS from source file ${filename}\n' +
33 '// Do not edit.\n\n'); 33 '// Do not edit.\n\n');
34 34
35 // Emit class for any @stylet directive. 35 // Emit class for any @stylet directive.
36 for (final production in stylesheet._topLevels) { 36 for (final production in stylesheet._topLevels) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 buff.add(classSelectors.toString()); 83 buff.add(classSelectors.toString());
84 84
85 // Write Dart file. 85 // Write Dart file.
86 String outFile = '${outPath}CSS.dart'; 86 String outFile = '${outPath}CSS.dart';
87 files.writeString(outFile, buff.toString()); 87 files.writeString(outFile, buff.toString());
88 88
89 return outFile; 89 return outFile;
90 } 90 }
91 } 91 }
92 92
OLDNEW
« no previous file with comments | « utils/css/cssselectorexception.dart ('k') | utils/css/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698