[csswg-drafts] [css-values] Grammar syntax for defining default values for optional productions (#11189)

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

== [css-values] Grammar syntax for defining default values for optional productions ==
As part of an ongoing effort to generate the parsing and serialization of CSS values from the grammars in specs, one of the most prominent missing pieces of information is the prose defined "default values" for optional productions.

To give some concrete examples, lets take a look at the grammar for the [`blur()` function](https://drafts.fxtf.org/filter-effects/#funcdef-filter-blur):

```
blur() = blur( <length>? )
```

In prose below the grammar is the text "Default value when omitted is 0px."

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

This would similarly be beneficial for testing.

I don't have strong opinions on the specifics of a syntax extension, so as a strawman I propose `?=[default value here]`.

For the example above, this might look like:

```
blur() = blur( <length>?=[0px] )
```

This won't work for everything, some defaults are quite complicated, but I think it would move things forward.

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


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

Received on Tuesday, 12 November 2024 23:43:46 UTC