@ else is case sensitive
This commit is contained in:
parent
5689ae0131
commit
8846a09d1c
@ -64,18 +64,16 @@ impl If {
|
|||||||
let mut else_ = Vec::new();
|
let mut else_ = Vec::new();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match toks.peek().cloned() {
|
if let Some(Token { kind: '@', pos }) = toks.peek().cloned() {
|
||||||
Some(Token { kind: '@', pos }) => {
|
|
||||||
toks.peek_forward(1);
|
toks.peek_forward(1);
|
||||||
let mut ident = peek_ident_no_interpolation(toks, false, pos)?;
|
let ident = peek_ident_no_interpolation(toks, false, pos)?;
|
||||||
ident.node.make_ascii_lowercase();
|
|
||||||
if ident.as_str() != "else" {
|
if ident.as_str() != "else" {
|
||||||
toks.reset_view();
|
toks.reset_view();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
toks.take(4).for_each(drop);
|
toks.take(4).for_each(drop);
|
||||||
}
|
} else {
|
||||||
Some(..) | None => break,
|
break;
|
||||||
}
|
}
|
||||||
devour_whitespace(toks);
|
devour_whitespace(toks);
|
||||||
if let Some(tok) = toks.next() {
|
if let Some(tok) = toks.next() {
|
||||||
|
@ -106,7 +106,12 @@ test!(
|
|||||||
test!(
|
test!(
|
||||||
uppercase_escaped_else,
|
uppercase_escaped_else,
|
||||||
"@if false {}\n\n@\\45lse {\n a {\n color: red;\n }\n}\n",
|
"@if false {}\n\n@\\45lse {\n a {\n color: red;\n }\n}\n",
|
||||||
"a {\n color: red;\n}\n"
|
"@Else {\n a {\n color: red;\n }\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
uppercase_else,
|
||||||
|
"@if false {}\n\n@Else {\n a {\n color: red;\n }\n}\n",
|
||||||
|
"@Else {\n a {\n color: red;\n }\n}\n"
|
||||||
);
|
);
|
||||||
test!(uppercase_if, "@If true {\n a {\n color: red;\n }\n}\n");
|
test!(uppercase_if, "@If true {\n a {\n color: red;\n }\n}\n");
|
||||||
error!(nothing_after_if, "@if", "Error: Expected expression.");
|
error!(nothing_after_if, "@if", "Error: Expected expression.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user