Merge pull request #36 from leonsenft/fix-hex-parsing
Fixes parsing hex number when identifier follows
diff --git a/lib/parser.dart b/lib/parser.dart
index 205011f..168c9da 100644
--- a/lib/parser.dart
+++ b/lib/parser.dart
@@ -2168,7 +2168,8 @@
if (_peekKind(TokenKind.INTEGER)) {
String hexText1 = _peekToken.text;
_next();
- if (_peekIdentifier()) {
+ // Append identifier only if there's no delimiting whitespace.
+ if (_peekIdentifier() && _previousToken.end == _peekToken.start) {
hexText = '$hexText1${identifier().name}';
} else {
hexText = hexText1;
diff --git a/test/declaration_test.dart b/test/declaration_test.dart
index 007916d..6452819 100644
--- a/test/declaration_test.dart
+++ b/test/declaration_test.dart
@@ -566,6 +566,10 @@
.test-background {
background: url(http://www.foo.com/bar.png);
}
+
+.test-background-with-multiple-properties {
+ background: #000 url(http://www.foo.com/bar.png);
+}
''';
final String generated = '@import "simple.css"; '
@@ -591,6 +595,9 @@
'}\n'
'.test-background {\n'
' background: url("http://www.foo.com/bar.png");\n'
+ '}\n'
+ '.test-background-with-multiple-properties {\n'
+ ' background: #000 url("http://www.foo.com/bar.png");\n'
'}';
var stylesheet = parseCss(input, errors: errors);