[csswg-drafts] [css-syntax] How to tokenize a hex color? (#6204)

tbjgolden has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-syntax] How to tokenize a hex color? ==
I have been attempting to write a CSS tokenizer following the steps listed here:

https://drafts.csswg.org/css-syntax-3/#consume-token

**However**, it seems that there's no way (that I can see) to tokenize a hex color according to the steps listed.

When reaching U+0023 NUMBER SIGN (#), it contains instructions to create a hash token, but the instructions do not include a way to parse a hex color.

If the `#` is parsed as a `<delim-token>`, then following tokens create ambiguities.

example 1: `#1e2125` `<delim-token #><number-token 1*10^2125>` (which ends up being "rounded to Infinity" and so is lossy)
example 2: `#ee2125` `<delim-token #><ident-token ee2125>`
example 3: `#1a2125` `<delim-token #><number-token 1><ident-token a2125>`

I could not find anything in document that covers this.


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6204 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 00:35:20 UTC