fix regression involving min
and max
inside color functions
This commit is contained in:
parent
6beb95ece0
commit
f587a36367
@ -345,9 +345,9 @@ impl<'a> Parser<'a> {
|
|||||||
None => return Err(("expected \")\".", span).into()),
|
None => return Err(("expected \")\".", span).into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(..) => {
|
Some(c) => {
|
||||||
value?;
|
value?;
|
||||||
unreachable!()
|
unreachable!("{:?}", c)
|
||||||
}
|
}
|
||||||
None => return Err(("expected \")\".", span).into()),
|
None => return Err(("expected \")\".", span).into()),
|
||||||
}
|
}
|
||||||
|
@ -240,6 +240,8 @@ impl<'a> Parser<'a> {
|
|||||||
')' => {
|
')' => {
|
||||||
self.toks.advance_cursor();
|
self.toks.advance_cursor();
|
||||||
buf.push(')');
|
buf.push(')');
|
||||||
|
// todo: https://github.com/foresterre/peekmore/issues/38
|
||||||
|
self.toks.peek();
|
||||||
return Ok(Some(buf));
|
return Ok(Some(buf));
|
||||||
}
|
}
|
||||||
'+' | '-' | '*' | '/' => {
|
'+' | '-' | '*' | '/' => {
|
||||||
|
@ -268,25 +268,10 @@ impl<'a> Parser<'a> {
|
|||||||
if let Some(Token { kind: '(', .. }) = self.toks.peek() {
|
if let Some(Token { kind: '(', .. }) = self.toks.peek() {
|
||||||
self.toks.next();
|
self.toks.next();
|
||||||
|
|
||||||
if lower == "min" {
|
if lower == "min" || lower == "max" {
|
||||||
match self.try_parse_min_max("min", true)? {
|
match self.try_parse_min_max(&lower, true)? {
|
||||||
Some(val) => {
|
Some(val) => {
|
||||||
self.toks.truncate_iterator_to_cursor();
|
self.toks.truncate_iterator_to_cursor();
|
||||||
self.toks.next();
|
|
||||||
return Ok(IntermediateValue::Value(HigherIntermediateValue::Literal(
|
|
||||||
Value::String(val, QuoteKind::None),
|
|
||||||
))
|
|
||||||
.span(span));
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
self.toks.reset_cursor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if lower == "max" {
|
|
||||||
match self.try_parse_min_max("max", true)? {
|
|
||||||
Some(val) => {
|
|
||||||
self.toks.truncate_iterator_to_cursor();
|
|
||||||
self.toks.next();
|
|
||||||
return Ok(IntermediateValue::Value(HigherIntermediateValue::Literal(
|
return Ok(IntermediateValue::Value(HigherIntermediateValue::Literal(
|
||||||
Value::String(val, QuoteKind::None),
|
Value::String(val, QuoteKind::None),
|
||||||
))
|
))
|
||||||
|
@ -674,3 +674,9 @@ error!(
|
|||||||
alpha_filter_invalid_non_alphabetic_start,
|
alpha_filter_invalid_non_alphabetic_start,
|
||||||
"a {\n color: alpha(1=a);\n}\n", "Error: $color: 1=a is not a color."
|
"a {\n color: alpha(1=a);\n}\n", "Error: $color: 1=a is not a color."
|
||||||
);
|
);
|
||||||
|
// todo: we need many more of these tests
|
||||||
|
test!(
|
||||||
|
rgba_special_fn_4th_arg_max,
|
||||||
|
"a {\n color: rgba(1 2 max(3, 3));\n}\n",
|
||||||
|
"a {\n color: rgba(1, 2, max(3, 3));\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user