properly handle unicode characters in identifiers
This commit is contained in:
parent
6608fe3f2f
commit
dea0610f9b
10
src/utils.rs
10
src/utils.rs
@ -375,7 +375,7 @@ pub(crate) fn eat_ident<I: Iterator<Item = Token>>(
|
||||
return Err("Expected identifier.".into());
|
||||
}
|
||||
}
|
||||
'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '_' => s.push(toks.next().unwrap().kind),
|
||||
'-' | '_' | _ if tok.kind.is_alphanumeric() => s.push(toks.next().unwrap().kind),
|
||||
'\\' => {
|
||||
toks.next();
|
||||
let mut n = String::new();
|
||||
@ -407,6 +407,9 @@ pub(crate) fn eat_ident<I: Iterator<Item = Token>>(
|
||||
s.push(c);
|
||||
};
|
||||
}
|
||||
_ if !tok.kind.is_ascii() && !tok.kind.is_control() => {
|
||||
s.push(toks.next().unwrap().kind)
|
||||
}
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
@ -422,7 +425,7 @@ pub(crate) fn eat_ident_no_interpolation<I: Iterator<Item = Token>>(
|
||||
'#' => {
|
||||
break;
|
||||
}
|
||||
'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '_' => s.push(toks.next().unwrap().kind),
|
||||
'-' | '_' | _ if tok.kind.is_alphanumeric() => s.push(toks.next().unwrap().kind),
|
||||
'\\' => {
|
||||
s.push('\\');
|
||||
toks.next();
|
||||
@ -436,6 +439,9 @@ pub(crate) fn eat_ident_no_interpolation<I: Iterator<Item = Token>>(
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
_ if !tok.kind.is_ascii() && !tok.kind.is_control() => {
|
||||
s.push(toks.next().unwrap().kind)
|
||||
}
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ impl Value {
|
||||
Ok(parse_hex(toks, scope, super_selector)?)
|
||||
}
|
||||
}
|
||||
'a'..='z' | 'A'..='Z' | '_' | '\\' => {
|
||||
'_' | '\\' | _ if kind.is_alphabetic() || (!kind.is_ascii() && !kind.is_control()) => {
|
||||
let mut s = eat_ident(toks, scope, super_selector)?;
|
||||
match toks.peek() {
|
||||
Some(Token { kind: '(', .. }) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user