diff --git a/src/parser/sexp.rs b/src/parser/sexp.rs index 3694554..9c98ef7 100644 --- a/src/parser/sexp.rs +++ b/src/parser/sexp.rs @@ -44,28 +44,28 @@ impl<'s> Token<'s> { pub fn as_vector<'p>(&'p self) -> Result<&'p Vec>, Box> { Ok(match self { Token::Vector(children) => Ok(children), - _ => Err(format!("wrong token type {:?}", self)), + _ => Err(format!("wrong token type, expected vector: {:?}", self)), }?) } pub fn as_list<'p>(&'p self) -> Result<&'p Vec>, Box> { Ok(match self { Token::List(children) => Ok(children), - _ => Err(format!("wrong token type {:?}", self)), + _ => Err(format!("wrong token type, expected list: {:?}", self)), }?) } pub fn as_atom<'p>(&'p self) -> Result<&'s str, Box> { Ok(match self { Token::Atom(body) => Ok(*body), - _ => Err(format!("wrong token type {:?}", self)), + _ => Err(format!("wrong token type, expected atom: {:?}", self)), }?) } pub fn as_text<'p>(&'p self) -> Result<&'p TextWithProperties<'s>, Box> { Ok(match self { Token::TextWithProperties(body) => Ok(body), - _ => Err(format!("wrong token type {:?}", self)), + _ => Err(format!("wrong token type, expected text: {:?}", self)), }?) }