test for crazy interpolation in @for
from value
This commit is contained in:
parent
978984ae15
commit
3f3fd97872
@ -19,8 +19,8 @@ use crate::{
|
|||||||
style::Style,
|
style::Style,
|
||||||
unit::Unit,
|
unit::Unit,
|
||||||
utils::{
|
utils::{
|
||||||
peek_ident_no_interpolation, read_until_closing_curly_brace, read_until_open_curly_brace,
|
peek_ident_no_interpolation, read_until_closing_curly_brace, read_until_closing_quote,
|
||||||
read_until_semicolon_or_closing_curly_brace,
|
read_until_open_curly_brace, read_until_semicolon_or_closing_curly_brace,
|
||||||
},
|
},
|
||||||
value::{Number, Value},
|
value::{Number, Value},
|
||||||
{Cow, Token},
|
{Cow, Token},
|
||||||
@ -698,6 +698,23 @@ impl<'a> Parser<'a> {
|
|||||||
'{' => {
|
'{' => {
|
||||||
return Err(("Expected \"to\" or \"through\".", tok.pos()).into());
|
return Err(("Expected \"to\" or \"through\".", tok.pos()).into());
|
||||||
}
|
}
|
||||||
|
'#' => {
|
||||||
|
from_toks.push(tok);
|
||||||
|
self.toks.next();
|
||||||
|
match self.toks.peek() {
|
||||||
|
Some(Token { kind: '{', .. }) => {
|
||||||
|
from_toks.push(self.toks.next().unwrap());
|
||||||
|
from_toks.append(&mut read_until_closing_curly_brace(self.toks)?);
|
||||||
|
}
|
||||||
|
Some(..) => {}
|
||||||
|
None => return Err(("expected \"{\".", self.span_before).into()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
q @ '\'' | q @ '"' => {
|
||||||
|
from_toks.push(tok);
|
||||||
|
self.toks.next();
|
||||||
|
from_toks.append(&mut read_until_closing_quote(self.toks, q)?);
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
from_toks.push(tok);
|
from_toks.push(tok);
|
||||||
self.toks.next();
|
self.toks.next();
|
||||||
|
@ -88,3 +88,12 @@ test!(
|
|||||||
}",
|
}",
|
||||||
"a {\n color: \\}}}{{{#;\n}\n"
|
"a {\n color: \\}}}{{{#;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
from_crazy_interpolation,
|
||||||
|
"a {
|
||||||
|
@for $i from length(#{\"#{\"\\\\}}}{{{\"}#\"}) to 2 {
|
||||||
|
color: #{\"#{\"\\\\}}}{{{\"}#\"};
|
||||||
|
}
|
||||||
|
}",
|
||||||
|
"a {\n color: \\}}}{{{#;\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user