remove some panicking
This commit is contained in:
parent
eb2f3ebe5a
commit
6e7f1cc319
@ -326,7 +326,10 @@ pub(crate) fn eat_expr<I: Iterator<Item = Token>>(
|
||||
}
|
||||
}
|
||||
'@' => {
|
||||
toks.next();
|
||||
let span = toks.next().unwrap().pos();
|
||||
if toks.peek().is_none() {
|
||||
return Err(("Expected identifier.", span).into());
|
||||
}
|
||||
let Spanned { node: ident, span } = eat_ident(toks, scope, super_selector)?;
|
||||
devour_whitespace(toks);
|
||||
let rule = AtRule::from_tokens(
|
||||
|
@ -885,8 +885,10 @@ impl Value {
|
||||
}
|
||||
}
|
||||
';' | '}' | '{' => return None,
|
||||
':' | '?' | ')' | '@' => return Some(Err(("expected \";\".", span).into())),
|
||||
v if v.is_control() => return Some(Err(("Expected expression.", span).into())),
|
||||
':' | '?' | ')' | '@' | '^' => return Some(Err(("expected \";\".", span).into())),
|
||||
v if v as u32 >= 0x80 || v.is_control() => {
|
||||
return Some(Err(("Expected expression.", span).into()))
|
||||
}
|
||||
v => todo!("unexpected token in value parsing: {:?}", v),
|
||||
}))
|
||||
}
|
||||
|
@ -57,3 +57,8 @@ error!(
|
||||
no_value_after_forward_slash,
|
||||
"a {color: 303/;}", "Error: Expected expression."
|
||||
);
|
||||
error!(xor_in_value, "a {color: a^;}", "Error: expected \";\".");
|
||||
error!(
|
||||
nothing_after_at_sign,
|
||||
"a {color: red; @", "Error: Expected identifier."
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user