swc-project/swc · error
Expected '-' between start and end in unicode range
Error message
Expected '-' between start and end in unicode range
What it means
Fired during <urange> parsing: after the start value, if text remains it must begin with '-' (U+002D) separating start and end values. Any other character where the hyphen is expected invalidates the production.
Source
Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:2997
// Otherwise, interpret the consumed code points as a hexadecimal number. This
// is the start value.
// 4. If there are no code points left in text, The end value is the same as the
// start value. Exit this algorithm.
if next.is_none() {
return Ok(UnicodeRange {
span: span!(self, span.lo),
start: self.input.atom(start),
end: None,
raw: Some(self.input.atom(unicode_range)),
});
}
// 5. If the next code point in text is U+002D HYPHEN-MINUS (-), consume it.
// Otherwise, this is an invalid <urange>, and this algorithm must exit.
if next != Some('-') {
return Err(Error::new(
span,
ErrorKind::Expected("'-' between start and end in unicode range"),
));
} else {
next = chars.next();
}
// 6. Consume as many hex digits as possible from text.
// If zero hex digits were consumed, or more than 6 hex digits were consumed,
// this is an invalid <urange>, and this algorithm must exit. If there are any
// code points left in text, this is an invalid <urange>, and this algorithm
// must exit.
let mut end = String::new();
loop {
match next {
Some(c) if c.is_ascii_digit() => {
end.push(c);View on GitHub (pinned to 5176682b65)
Solutions
- Separate start and end with '-': 'U+0-7F'
- Remove extra characters if a single code point was intended
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:2997 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/3ce43214f41ae796.
Report an issue: GitHub.