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