diff --git a/src/utils.rs b/src/utils.rs index 4a204da..5c7524d 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -375,7 +375,7 @@ pub(crate) fn eat_ident>( return Err("Expected identifier.".into()); } } - '-' | '_' | _ if tok.kind.is_alphanumeric() => s.push(toks.next().unwrap().kind), + 'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '_' => s.push(toks.next().unwrap().kind), '\\' => { toks.next(); let mut n = String::new(); @@ -407,9 +407,6 @@ pub(crate) fn eat_ident>( s.push(c); }; } - _ if !tok.kind.is_ascii() && !tok.kind.is_control() => { - s.push(toks.next().unwrap().kind) - } _ => break, } } @@ -425,7 +422,7 @@ pub(crate) fn eat_ident_no_interpolation>( '#' => { break; } - '-' | '_' | _ if tok.kind.is_alphanumeric() => s.push(toks.next().unwrap().kind), + 'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '_' => s.push(toks.next().unwrap().kind), '\\' => { s.push('\\'); toks.next(); @@ -439,9 +436,6 @@ 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 fac58f8..6741600 100644 --- a/src/value/parse.rs +++ b/src/value/parse.rs @@ -365,7 +365,7 @@ impl Value { Ok(parse_hex(toks, scope, super_selector)?) } } - '_' | '\\' | _ if kind.is_alphabetic() || (!kind.is_ascii() && !kind.is_control()) => { + 'a'..='z' | 'A'..='Z' | '_' | '\\' => { let mut s = eat_ident(toks, scope, super_selector)?; match toks.peek() { Some(Token { kind: '(', .. }) => {