(&mut self, expected: &str)
| 460 | } |
| 461 | |
| 462 | fn consume_close(&mut self, expected: &str) -> Result<bool, String> { |
| 463 | if self.current != Token::LBracket { |
| 464 | return Ok(false); |
| 465 | } |
| 466 | self.advance(); |
| 467 | if self.current != Token::Slash { |
| 468 | return Err(format!("unexpected nested block in [{expected}]")); |
| 469 | } |
| 470 | self.advance(); |
| 471 | let end = self.expect_ident()?; |
| 472 | self.expect(Token::RBracket)?; |
| 473 | if end != expected { |
| 474 | return Err(format!("expected [/{expected}], got [/{end}]")); |
| 475 | } |
| 476 | Ok(true) |
| 477 | } |
| 478 | |
| 479 | fn expect(&mut self, token: Token<'a>) -> Result<(), String> { |
| 480 | if self.current != token { |
no test coverage detected