Match and consume a token without payload.
(&mut self, want: Token<'a>, err_msg: &str)
| 532 | |
| 533 | // Match and consume a token without payload. |
| 534 | fn match_token(&mut self, want: Token<'a>, err_msg: &str) -> ParseResult<Token<'a>> { |
| 535 | if self.token() == Some(want) { |
| 536 | Ok(self.consume()) |
| 537 | } else { |
| 538 | err!(self.loc, err_msg) |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | // If the next token is a `want`, consume it, otherwise do nothing. |
| 543 | fn optional(&mut self, want: Token<'a>) -> bool { |
no test coverage detected