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