Re: [csswg-drafts] [css-values-4] Definition of a calculation (#6802)

My misunderstanding came from the terms/verbs *internal representation* and *representing*, and also from how I implemented matching a component value against a CSS grammar.

In this implementation, component values ​​are matched in order from the deepest to shallowest type (`calc-value` then `calc-product` then `calc-sum` then `calc()`), and "hook" functions are run with the component value(s) matching this type, in order to run specific rules for parsing the corresponding type. I created hook functions to implement parsing a calculation: collecting `Product` in the hook for `calc-product`, collecting `Sum` for `calc-sum`, but then I struggled with simplification, which had to run in the hook for parsing math function types, then the above terms in the related procedures became blurry to me.

Anyway, I found an implementation that seems to match the specification, and all tests for math functions pass, including cases like `calc(1s + 1px)`, `calc(2px / 1px)`, `min(2px, 1%)`, etc. I didn't want to read your answers before that, but thank you of course.

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


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

Received on Wednesday, 10 November 2021 17:45:23 UTC