Allow numbers in variable names
This commit is contained in:
parent
7975d468f1
commit
ae708091a6
@ -372,7 +372,7 @@ impl<'a> Lexer<'a> {
|
|||||||
self.pos.next_char();
|
self.pos.next_char();
|
||||||
let mut name = String::with_capacity(99);
|
let mut name = String::with_capacity(99);
|
||||||
while let Some(c) = self.buf.peek() {
|
while let Some(c) = self.buf.peek() {
|
||||||
if !c.is_alphabetic() && c != &'-' && c != &'_' {
|
if !c.is_alphanumeric() && c != &'-' && c != &'_' {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let tok = self
|
let tok = self
|
||||||
|
@ -95,6 +95,11 @@ mod test_variables {
|
|||||||
"$a: red; a {\n color: #{#{$a}};\n}\n",
|
"$a: red; a {\n color: #{#{$a}};\n}\n",
|
||||||
"a {\n color: red;\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)]
|
#[cfg(test)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user