style: Fix whitespace handling in clamp() parsing

We should just restore the state when seeing whitespace and an unknown
token like when we do when finding any other token a few lines below.

This is not an issue for most callers (it's only an issue for clamp())
because the other callers use either `parse_comma_separated()` (for
min/max), or `parse_nested_block()` (for parens / nested calc()).

Both of those functions restrict the input in such a way that
is_exhausted returns true (a few lines above) and thus we parse
successfully.

Differential Revision: https://phabricator.services.mozilla.com/D112681
This commit is contained in:
Oriol Brufau 2023-05-17 00:32:26 +02:00
parent d12cb17d73
commit 54965bbcb9

View file

@ -374,9 +374,9 @@ impl CalcNode {
rhs.negate();
sum.push(rhs);
},
ref t => {
let t = t.clone();
return Err(input.new_unexpected_token_error(t));
_ => {
input.reset(&start);
break;
},
}
},