| 18 | |
| 19 | impl<'a, D, M> Parse<'a> for NoBlockAllowed<D, M> { |
| 20 | fn parse<Iter>(p: &mut Parser<'a, Iter>) -> Result<Self> |
| 21 | where |
| 22 | Iter: Iterator<Item = crate::Cursor> + Clone, |
| 23 | { |
| 24 | if p.at_end() { |
| 25 | Ok(Self { semicolon: None, _phantom: std::marker::PhantomData }) |
| 26 | } else if let Some(semicolon) = p.parse_if_peek::<T![;]>()? { |
| 27 | Ok(Self { semicolon: Some(semicolon), _phantom: std::marker::PhantomData }) |
| 28 | } else { |
| 29 | Err(Diagnostic::new(p.next(), Diagnostic::unexpected))? |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | impl<'a, D, M> Peek<'a> for NoBlockAllowed<D, M> { |