Re: [csswg-drafts] [css-color-5] Grammar for parsing relative colors? (#7721)

> It seems to me that this approach would actually make things more complex to implement, as one has to interpolate the prose instructions into the grammar parsing.

Well, depends somewhat on your parsing strategy. Reproducing the entirety of the math-function grammar inline in the RCS syntax, duplicated for each different set of valid channel keywords, would technically work, but if you're not using the grammar directly it makes noticing the parsing differences more difficult. The prose outlines the changes very straightforwardly, so adapting one's existing parsing code to match shouldn't be too odd.

But importantly, we write specs for several purposes and several audiences, and doing that sort of giant grammar duplication (and keeping it in sync with future math-function additions, ugh) would be a massive hit to readability. This not only harms our "web developer" audience, but can potentially harm our "implementor" audience as well, if they're not just literally dropping in our grammar to their system (as mentioned above). I don't believe any of the browsers do so, for instance; they all have parsing code that spans the spectrum from "grammar-driven" to "completely custom" depending on the property/value, and when it's grammar-driven it's not literally the CSS Value Definition Syntax grammar but some other parsing tool's grammar, necessitating rewrites anyway.

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


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

Received on Monday, 12 September 2022 18:08:33 UTC