properly escape backslashes in quotes in variables
This commit is contained in:
parent
981bf27cb8
commit
cd40ada653
@ -126,7 +126,10 @@ pub(crate) fn read_until_closing_quote<I: Iterator<Item = Token>>(
|
||||
is_escaped = false;
|
||||
continue;
|
||||
}
|
||||
TokenKind::Symbol(Symbol::BackSlash) if !is_escaped => is_escaped = true,
|
||||
TokenKind::Symbol(Symbol::BackSlash) if !is_escaped => {
|
||||
t.push(tok);
|
||||
is_escaped = true
|
||||
},
|
||||
TokenKind::Symbol(Symbol::BackSlash) => {
|
||||
is_escaped = false;
|
||||
t.push(tok);
|
||||
|
@ -98,3 +98,8 @@ test!(
|
||||
"a {\n $a: red\n}\n\nb {\n color: blue;\n}\n",
|
||||
"b {\n color: blue;\n}\n"
|
||||
);
|
||||
test!(
|
||||
properly_escapes_backslash,
|
||||
"a {\n $a: unquote(\"\\\\0 \");\n color: $a;\n}\n",
|
||||
"a {\n color: \\0 ;\n}\n"
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user