@@ -823,7 +823,8 @@ pub const Parser = struct {
823823// nameStart returns whether c can be the first character of an identifier
824824// (not counting an initial hyphen, or an escape sequence).
825825fn nameStart (c : u8 ) bool {
826- return 'a' <= c and c <= 'z' or 'A' <= c and c <= 'Z' or c == '_' or c > 127 ;
826+ return 'a' <= c and c <= 'z' or 'A' <= c and c <= 'Z' or c == '_' or c > 127 or
827+ '0' <= c and c <= '9' ;
827828}
828829
829830// nameChar returns whether c can be a character within an identifier
@@ -892,7 +893,7 @@ test "parser.parseIdentifier" {
892893 err : bool = false ,
893894 }{
894895 .{ .s = "x" , .exp = "x" },
895- .{ .s = "96" , .exp = "" , .err = true },
896+ .{ .s = "96" , .exp = "96 " , .err = false },
896897 .{ .s = "-x" , .exp = "-x" },
897898 .{ .s = "r\\ e9 sumé" , .exp = "résumé" },
898899 .{ .s = "r\\ 0000e9 sumé" , .exp = "résumé" },
@@ -977,6 +978,7 @@ test "parser.parse" {
977978 .{ .s = ":root" , .exp = .{ .pseudo_class = .root } },
978979 .{ .s = ".\\ :bar" , .exp = .{ .class = ":bar" } },
979980 .{ .s = ".foo\\ :bar" , .exp = .{ .class = "foo:bar" } },
981+ .{ .s = "[class=75c0fa18a94b9e3a6b8e14d6cbe688a27f5da10a]" , .exp = .{ .attribute = .{ .key = "class" , .val = "75c0fa18a94b9e3a6b8e14d6cbe688a27f5da10a" , .op = .eql } } },
980982 };
981983
982984 for (testcases ) | tc | {
0 commit comments