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

Unified Diff: utils/css/parser.dart

Issue 9168008: Enabled CSS tests, added CSS tests to buildbot, fixed tooling with nodejs, and added more tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More coding convention changes (consistency). Created 8 years, 11 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
« no previous file with comments | « utils/css/generate.dart ('k') | utils/css/tokenkind.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/css/parser.dart
diff --git a/utils/css/parser.dart b/utils/css/parser.dart
index 7a81cfde7ba772e455b8c144504f387ee20a143f..1fea22c21f52d9df58eff1b93afd8409a0bd6201 100644
--- a/utils/css/parser.dart
+++ b/utils/css/parser.dart
@@ -104,7 +104,7 @@ class Parser {
var message;
try {
message = 'expected $expected, but found $tok';
- } catch (var e) {
+ } catch (final e) {
message = 'parsing error expected $expected';
}
_error(message, tok.span);
@@ -118,6 +118,14 @@ class Parser {
lang.world.fatal(message, location); // syntax errors are fatal for now
}
+ void _warning(String message, [lang.SourceSpan location=null]) {
+ if (location === null) {
+ location = _peekToken.span;
+ }
+
+ lang.world.warning(message, location);
+ }
+
lang.SourceSpan _makeSpan(int start) {
return new lang.SourceSpan(source, start, _previousToken.end);
}
@@ -763,6 +771,12 @@ class Parser {
// FUNCTION
return processFunction(nameValue);
} else {
+ // TODO(terry): Need to have a list of known identifiers today only
+ // 'from' is special.
+ if (nameValue.name == 'from') {
+ return new LiteralTerm(nameValue, nameValue.name, _makeSpan(start));
+ }
+
// What kind of identifier is it?
int value;
try {
@@ -778,16 +792,11 @@ class Parser {
_error('Bad hex number', _makeSpan(start));
}
return new HexColorTerm(value, rgbColor, _makeSpan(start));
- } catch (var error) {
+ } catch (final error) {
if (error is NoColorMatchException) {
- // Other named things to match with validator?
- // TODO(terry): TBD
-// _error('Unknown property value ${error.name}', _makeSpan(start));
-
- value = nameValue.name;
- print('Warning: unknown property value ${error.name}');
+ // TODO(terry): Other named things to match with validator?
+ _warning('Unknown property value ${error.name}', _makeSpan(start));
return new LiteralTerm(nameValue, nameValue.name, _makeSpan(start));
-
}
}
}
@@ -863,6 +872,9 @@ class Parser {
break;
default:
if (urlString) {
+ if (_peek() == TokenKind.LPAREN) {
+ _next(); // Skip the LPAREN.
+ }
stopToken = TokenKind.RPAREN;
} else {
_error('unexpected string', _makeSpan(start));
« no previous file with comments | « utils/css/generate.dart ('k') | utils/css/tokenkind.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698