Allow numbers in variable names

This commit is contained in:
ConnorSkees 2020-01-27 17:21:18 -05:00
parent 7975d468f1
commit ae708091a6
2 changed files with 6 additions and 1 deletions

View File

@ -372,7 +372,7 @@ impl<'a> Lexer<'a> {
self.pos.next_char();
let mut name = String::with_capacity(99);
while let Some(c) = self.buf.peek() {
if !c.is_alphabetic() && c != &'-' && c != &'_' {
if !c.is_alphanumeric() && c != &'-' && c != &'_' {
break;
}
let tok = self

View File

@ -95,6 +95,11 @@ mod test_variables {
"$a: red; a {\n color: #{#{$a}};\n}\n",
"a {\n color: red;\n}\n"
);
test!(
numbers_in_variable,
"$var1: red; a {\n color: $var1;\n}\n",
"a {\n color: red;\n}\n"
);
}
#[cfg(test)]