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) { |