Re: [community-group] Split units and values in type definitions (#121)

A good way to get a sense of the complexity involved would be to explore how dimension tokens are parsed in CSS.

In our tokenizer this is done here : https://github.com/csstools/postcss-plugins/blob/postcss-preset-env--v8/packages/css-tokenizer/src/consume/numeric-token.ts#L19

number specifically : https://github.com/csstools/postcss-plugins/blob/postcss-preset-env--v8/packages/css-tokenizer/src/consume/number.ts

CSS is not JSON so the exact implementation is different.
But similar things apply.

oversimplified :
1. consume a number byte by byte
2. check if the reminder starts an ident
  2.a consume an ident byte by byte
  2.b return the tuple
3. return a number



-- 
GitHub Notification of comment by romainmenke
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/121#issuecomment-1345671446 using your GitHub account


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

Received on Sunday, 11 December 2022 22:13:30 UTC