swc-project/swc · error
Expected 'u' ident token
Error message
Expected 'u' ident token
What it means
Fired while parsing a UnicodeRange: the range must begin with the ident `u`/`U` (as in U+0-7F), but the current token was not that ident. This match-with-fallback is a validation guard; input at fault is a @unicode-range value that does not start with `u`/`U`, e.g. a bare number or hex digits.
Source
Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:2715
{
fn parse(&mut self) -> PResult<UnicodeRange> {
let span = self.input.cur_span();
let mut unicode_range = String::new();
// should start with `u` or `U`
match cur!(self) {
Token::Ident { value, .. } if matches_eq_ignore_ascii_case!(value, "u") => {
let u = match bump!(self) {
Token::Ident { value, .. } => value,
_ => {
unreachable!();
}
};
unicode_range.push_str(&u);
}
_ => {
return Err(Error::new(span, ErrorKind::Expected("'u' ident token")));
}
};
match cur!(self) {
// u '+' <ident-token> '?'*
// u '+' '?'+
Token::Delim { value } if *value == '+' => {
let plus = match bump!(self) {
Token::Delim { value } => value,
_ => {
unreachable!();
}
};
unicode_range.push(plus);
if is!(self, Ident) {
let ident = match bump!(self) {View on GitHub (pinned to 5176682b65)
Solutions
- Start the range with 'U' or 'u', e.g. 'U+0-7F'
- Check for typos in the unicode-range descriptor value
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:2715 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17).
Data as JSON: /api/errors/0d4ed3dd1fe7911e.
Report an issue: GitHub.