Properly parse spaced lists
This commit is contained in:
parent
3919e92dcb
commit
8a811dae9e
@ -123,10 +123,16 @@ impl Value {
|
||||
Ok(x) => x,
|
||||
Err(_) => return Ok(left),
|
||||
};
|
||||
if let Value::List(v, ListSeparator::Space) = right {
|
||||
let mut v2 = vec![left];
|
||||
v2.extend(v);
|
||||
Ok(Value::List(v2, ListSeparator::Space))
|
||||
} else {
|
||||
Ok(Value::List(vec![left, right], ListSeparator::Space))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn _from_tokens<I: Iterator<Item = Token>>(
|
||||
toks: &mut Peekable<I>,
|
||||
|
@ -86,13 +86,11 @@ test!(
|
||||
opacity_function_number_unit,
|
||||
"a {\n color: opacity(1px);\n}\n"
|
||||
);
|
||||
// blocked on better value parsing
|
||||
// specifically, this is parsed as a number and a list
|
||||
// test!(
|
||||
// rgba_one_arg,
|
||||
// "a {\n color: rgba(1 2 3);\n}\n",
|
||||
// "a {\n color: #010203;\n}\n"
|
||||
// );
|
||||
test!(
|
||||
rgba_one_arg,
|
||||
"a {\n color: rgba(1 2 3);\n}\n",
|
||||
"a {\n color: #010203;\n}\n"
|
||||
);
|
||||
test!(
|
||||
rgb_two_args,
|
||||
"a {\n color: rgb(#123, 0);\n}\n",
|
||||
|
@ -129,11 +129,11 @@ test!(
|
||||
"a {\n color: type-of(red)\n}\n",
|
||||
"a {\n color: color;\n}\n"
|
||||
);
|
||||
// test!(
|
||||
// type_of_spaced_list,
|
||||
// "a {\n color: type-of(1 2 3)\n}\n",
|
||||
// "a {\n color: list;\n}\n"
|
||||
// );
|
||||
test!(
|
||||
type_of_spaced_list,
|
||||
"a {\n color: type-of(1 2 3)\n}\n",
|
||||
"a {\n color: list;\n}\n"
|
||||
);
|
||||
test!(
|
||||
type_of_true,
|
||||
"a {\n color: type-of(true)\n}\n",
|
||||
@ -274,11 +274,11 @@ test!(
|
||||
// "a {\n color: inspect(())\n}\n",
|
||||
// "a {\n color: ();\n}\n"
|
||||
// );
|
||||
// test!(
|
||||
// inspect_spaced_list,
|
||||
// "a {\n color: inspect(1 2 3)\n}\n",
|
||||
// "a {\n color: 1 2 3;\n}\n"
|
||||
// );
|
||||
test!(
|
||||
inspect_spaced_list,
|
||||
"a {\n color: inspect(1 2 3)\n}\n",
|
||||
"a {\n color: 1 2 3;\n}\n"
|
||||
);
|
||||
// test!(
|
||||
// inspect_comma_list,
|
||||
// "a {\n color: inspect(1, 2, 3)\n}\n",
|
||||
|
@ -169,3 +169,8 @@ test!(
|
||||
"@mixin a {\n a {\n color: red;\n }\n}\n\n@include a;\n",
|
||||
"a {\n color: red;\n}\n"
|
||||
);
|
||||
test!(
|
||||
include_list,
|
||||
"@mixin foo($x) {\n color: $x;\n}\na {\n @include foo(0px 0px 0px 0px #ef8086 inset !important);\n}\n",
|
||||
"a {\n color: 0px 0px 0px 0px #ef8086 inset !important;\n}\n"
|
||||
);
|
||||
|
@ -463,3 +463,13 @@ test!(
|
||||
"a {\n color: (a b) - (1 2);\n}\n",
|
||||
"a {\n color: a b-1 2;\n}\n"
|
||||
);
|
||||
test!(
|
||||
length_of_list_as_var,
|
||||
"$a: 1 2 3 4 5;a {\n color: length($a);\n}\n",
|
||||
"a {\n color: 5;\n}\n"
|
||||
);
|
||||
test!(
|
||||
length_of_list,
|
||||
"a {\n color: length(1 2 3 4 5);\n}\n",
|
||||
"a {\n color: 5;\n}\n"
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user