Re: [csswg-drafts] [css-syntax] Tokenizing hex colors following spec is ambiguous (#6204)

The `#` shouldn't parse into a delim token if it's a hex color. You'll hit the "U+0023 NUMBER SIGN (#)" clause (the third one in the list), see that it starts with an [identifier code point](https://drafts.csswg.org/css-syntax-3/#identifier-code-point), and then parse it according to the steps listed there, notably consuming the rest of the hash token via [consume an identifier](https://drafts.csswg.org/css-syntax-3/#consume-an-identifier).

From your examples, I suspect the problem you might be running into is assuming that the part following the `#` has to be an identifier in and of itself; that is not actually what's required by the algorithm. An "identifier code point" is any character valid *within* an identifier, which includes digits; the "consume an identifier" algo also doesn't confirm that the stream forms a valid identifier, and specifically calls out that this is something the algo caller needs to do themselves if it's important, otherwise it just keeps pulling characters as long as they're ident characters. Putting these together, it'll gladly parse `1e2125` as an identifier and attach the results to the `<hash-token>`, same as your second example.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6204#issuecomment-817365920 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 11 April 2021 20:14:36 UTC