Make parserrors have token

This commit is contained in:
greg 2019-01-05 17:32:49 -08:00
parent d0c5dce92b
commit f2f8ac7ee8

View File

@ -848,7 +848,9 @@ impl Parser {
#[recursive_descent_method]
fn simple_pattern(&mut self) -> ParseResult<Pattern> {
Ok(match self.peek() {
Ok({
let tok = self.token_handler.peek_token();
match tok.get_kind() {
Identifier(_) => {
let id = self.identifier()?;
match self.peek() {
@ -881,7 +883,8 @@ impl Parser {
self.next();
Pattern::Ignored
},
other => return ParseError::new(&format!("{:?} is not a valid Pattern", other))
other => return ParseError::new_with_token(&format!("{:?} is not a valid Pattern", other), tok)
}
})
}