better error message for missing closing paren

This commit is contained in:
ConnorSkees 2020-03-20 23:21:40 -04:00
parent f0c2522967
commit 1a481000b6

View File

@ -196,10 +196,10 @@ impl Value {
return Ok(Value::List(Vec::new(), ListSeparator::Space));
}
let val = Self::from_tokens(toks, scope, super_selector)?;
assert_eq!(
toks.next().unwrap().kind,
TokenKind::Symbol(Symbol::CloseParen)
);
let next = toks.next();
if next.is_none() || !next.unwrap().is_symbol(Symbol::CloseParen) {
return Err("expected \")\".".into());
}
Ok(Value::Paren(Box::new(val)))
}
TokenKind::Symbol(Symbol::BitAnd) => {