allow non-ascii characters in idents

This commit is contained in:
ConnorSkees 2020-03-30 01:24:50 -04:00
parent 1e5dc99793
commit 9c690140ec
2 changed files with 19 additions and 3 deletions

View File

@ -375,7 +375,13 @@ 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_ascii_alphanumeric()
|| tok.kind == '-'
|| tok.kind == '_'
|| (!tok.kind.is_ascii() && !tok.kind.is_control()) =>
{
s.push(toks.next().unwrap().kind)
}
'\\' => {
toks.next();
let mut n = String::new();
@ -422,7 +428,13 @@ 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_ascii_alphanumeric()
|| tok.kind == '-'
|| tok.kind == '_'
|| (!tok.kind.is_ascii() && !tok.kind.is_control()) =>
{
s.push(toks.next().unwrap().kind)
}
'\\' => {
s.push('\\');
toks.next();

View File

@ -365,7 +365,11 @@ impl Value {
Ok(parse_hex(toks, scope, super_selector)?)
}
}
'a'..='z' | 'A'..='Z' | '_' | '\\' => {
_ if kind.is_ascii_alphabetic()
|| kind == '_'
|| kind == '\\'
|| (!kind.is_ascii() && !kind.is_control()) =>
{
let mut s = eat_ident(toks, scope, super_selector)?;
match toks.peek() {
Some(Token { kind: '(', .. }) => {