css parses a whole stylesheet and validates every value against its MDN grammar, every function against its own signature, and every selector against Selectors-4.
Stdlib only, no deps.
import css
validateValue("width", "clamp(1rem, 2vw, 3rem)").valid # true
validateValue("width", "clamp(1rem, 2vw)").error # "clamp() expects 3 arguments, got 2"
validateValue("color", "rgb(1, 2)").error # "invalid arguments to rgb(): ..."It validates the entire Bootstrap stylesheet (5,542 declarations, 2,556 selectors) with zero false positives — faster per declaration than css-tree, the only other tool I found that grammar-checks values at all. And nothing else does the recursive clamp(calc(...), min(...), max(...)) math grammar, arity and all.
Compiled with nimony, AOT, no JIT — the parser keeps pace with Rust lightningcss.