refactor how to value in @for
is parsed
This commit is contained in:
parent
b42ae61435
commit
978984ae15
@ -720,9 +720,7 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let to_toks = read_until_open_curly_brace(self.toks)?;
|
let to_val = self.parse_value()?;
|
||||||
self.toks.next();
|
|
||||||
let to_val = self.parse_value_from_vec(to_toks)?;
|
|
||||||
let to = match to_val.node {
|
let to = match to_val.node {
|
||||||
Value::Dimension(n, _) => match n.to_integer().to_isize() {
|
Value::Dimension(n, _) => match n.to_integer().to_isize() {
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
@ -736,6 +734,13 @@ impl<'a> Parser<'a> {
|
|||||||
.into())
|
.into())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// consume the open curly brace
|
||||||
|
match self.toks.next() {
|
||||||
|
Some(Token { kind: '{', pos }) => pos,
|
||||||
|
Some(..) | None => return Err(("expected \"{\".", to_val.span).into()),
|
||||||
|
};
|
||||||
|
|
||||||
let body = read_until_closing_curly_brace(self.toks)?;
|
let body = read_until_closing_curly_brace(self.toks)?;
|
||||||
self.toks.next();
|
self.toks.next();
|
||||||
|
|
||||||
|
@ -79,3 +79,12 @@ test!(
|
|||||||
}",
|
}",
|
||||||
"a {\n color: red;\n}\n"
|
"a {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
to_crazy_interpolation,
|
||||||
|
"a {
|
||||||
|
@for $i from 0 to length(#{\"#{\"\\\\}}}{{{\"}#\"}) {
|
||||||
|
color: #{\"#{\"\\\\}}}{{{\"}#\"};
|
||||||
|
}
|
||||||
|
}",
|
||||||
|
"a {\n color: \\}}}{{{#;\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user