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

Side by Side Diff: frog/css/csstemplate.dart

Issue 8498020: Beginning of CSS parser using frog parsering infrastructure. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #import('css.dart');
6
7 class CssTemplate {
8 // TODO(terry): Add obfuscation mapping file.
9 static void xlate(String cssExpression, CssWorld world) {
jimhug 2011/11/09 16:04:03 Speaking for Bob <smile>. Any reason not to just
terry 2011/11/09 21:56:06 Good point Bob (Jim?) I'll do that. Done.
10 Parser parser = new Parser(new SourceFile(SourceFile.IN_MEMORY_FILE,
11 cssExpression));
12 try {
13 var tree = parser.template(true);
14 if (tree != null) {
15 parser.validateTemplate(tree.selectors, world);
16 }
17 } catch (var cssException) {
18 print(cssException.toString());
19 throw cssException;
20 }
21 }
22
23 // Returns pretty printed tree of the expression.
24 static String xlateDebug(String cssExpression, CssWorld world) {
25 Parser parser = new Parser(new SourceFile(SourceFile.IN_MEMORY_FILE,
26 cssExpression));
27 String output = "";
28 String prettyTree = "";
29 try {
30 var tree = parser.template(true);
31 if (tree != null) {
32 prettyTree = tree.toDebugString();
33 parser.validateTemplate(tree.selectors, world);
34 output = prettyTree;
35 }
36 } catch (var cssException) {
37 String error = cssException.toString();
38 output = "$error\n$prettyTree";
39 throw cssException;
40 }
41
42 return output;
43 }
44
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698