Make parserrors have token
This commit is contained in:
parent
d0c5dce92b
commit
f2f8ac7ee8
@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user