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

Unified Diff: utils/css/css.dart

Issue 8937017: New CSS parser written in Dart to replace pyparser (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Put back for DartC Created 9 years 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: utils/css/css.dart
diff --git a/utils/css/css.dart b/utils/css/css.dart
index f81e6bf7e56c57d9f5d2e2675e4ebe7755fc5fa0..2cdac1acf6c16fd9ec7a57a02e5aec1d7784df6e 100644
--- a/utils/css/css.dart
+++ b/utils/css/css.dart
@@ -4,19 +4,20 @@
#library('css');
-#import('dart:dom');
#import('../../frog/lang.dart', prefix:'lang');
+#import('../../frog/file_system.dart');
#import('../../frog/file_system_memory.dart');
-
#source('tokenkind.dart');
#source('tokenizer.dart');
#source('tree.dart');
#source('cssselectorexception.dart');
#source('cssworld.dart');
#source('parser.dart');
+#source('validate.dart');
+#source('generate.dart');
-void initCssWorld() {
+void initCssWorld([bool commandLine = true]) {
var fs = new MemoryFileSystem();
lang.parseOptions('', [], fs);
lang.initializeWorld(fs);
@@ -28,15 +29,16 @@ void initCssWorld() {
// problems programmatically.
lang.options.throwOnErrors = true;
lang.options.throwOnFatal = true;
+ lang.options.useColors = commandLine ? true : false;
}
// TODO(terry): Add obfuscation mapping file.
void cssParseAndValidate(String cssExpression, CssWorld world) {
Parser parser = new Parser(new lang.SourceFile(lang.SourceFile.IN_MEMORY_FILE,
cssExpression));
- var tree = parser.template();
+ var tree = parser.parseTemplate();
if (tree != null) {
- parser.validateTemplate(tree.selectors, world);
+ Validate.template(tree.selectors, world);
}
}
@@ -47,10 +49,10 @@ String cssParseAndValidateDebug(String cssExpression, CssWorld world) {
String output = "";
String prettyTree = "";
try {
- var tree = parser.template();
+ var tree = parser.parseTemplate();
if (tree != null) {
prettyTree = tree.toDebugString();
- parser.validateTemplate(tree.selectors, world);
+ Validate.template(tree.selectors, world);
output = prettyTree;
}
} catch (var e) {
« no previous file with comments | « frog/tree.dart ('k') | utils/css/cssworld.dart » ('j') | utils/css/generate.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698