diff --git a/src/utils.rs b/src/utils.rs index 5c7524d..4a204da 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -375,7 +375,7 @@ pub(crate) fn eat_ident>( 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>( 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>( '#' => { 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>( todo!() } } + _ if !tok.kind.is_ascii() && !tok.kind.is_control() => { + s.push(toks.next().unwrap().kind) + } _ => break, } } diff --git a/src/value/parse.rs b/src/value/parse.rs index 6741600..fac58f8 100644 --- a/src/value/parse.rs +++ b/src/value/parse.rs @@ -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: '(', .. }) => {