[csswg-drafts] [css-values] Grammar syntax for defining excluded idents for <custom-ident> productions (#11924)

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

== [css-values] Grammar syntax for defining excluded idents for <custom-ident> productions ==
As part of an ongoing effort to generate the parsing and serialization of CSS values from the grammars in specs, another missing piece of information is the prose defined "excluded values" for `<custom-ident>` productions.

To give some concrete examples, lets take a look at the grammar for the [view-transition-class](https://drafts.csswg.org/css-view-transitions-2/#propdef-view-transition-class) property:

```
none | <custom-ident>+
```

In prose below the grammar is the text "`none` is an invalid <custom-ident> for [view-transition-class](https://drafts.csswg.org/css-view-transitions-2/#propdef-view-transition-class), even when combined with another <custom-ident>."

If instead, that information was available in a machine readable way, parsing and testing would be directly implementable.

I don't have strong opinions on the specifics of a syntax extension, so as a strawman I propose `<custom-ident excluding=foo,bar,baz>`

For the example above, this might look like:

```
none | <custom-ident excluding=none>+
```

Additional properties this would be beneficial for are:

CSS Conditional Rules Module Level 5: [`<'container-name'>`](https://www.w3.org/TR/css-conditional-5/#valdef-container-name-custom-ident) excludes "none", "and", "or", and "not".
CSS Lists and Counters Module Level 3: [`<counter-name>`](https://www.w3.org/TR/css-lists-3/#typedef-counter-name) excludes "none".
CSS Will Change Module Level 1: [`<animateable-feature>`](https://www.w3.org/TR/css-will-change/#valdef-will-change-custom-ident) excludes  "will-change", "none", "all", "auto", "scroll-position", and "contents".
CSS Color Adjustment Module Level 1: [`<'color-scheme'>`](https://www.w3.org/TR/css-color-adjust/#valdef-color-scheme-custom-ident) excludes  "normal", "light", "dark", and "only".

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11924 using your GitHub account


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

Received on Wednesday, 12 March 2025 16:28:51 UTC