| 433 | |
| 434 | impl<'a> Parse<'a> for Whitespace { |
| 435 | fn parse<I>(p: &mut Parser<'a, I>) -> Result<Self> |
| 436 | where |
| 437 | I: Iterator<Item = Cursor> + Clone, |
| 438 | { |
| 439 | // Whitespace needs to implement parse so that it can change the skip-state to only ensuring Whitespace |
| 440 | // is not ignored. |
| 441 | let skip = p.set_skip(KindSet::COMMENTS); |
| 442 | let c = p.next(); |
| 443 | p.set_skip(skip); |
| 444 | if c != Kind::Whitespace { |
| 445 | Err(crate::Diagnostic::new(c, crate::Diagnostic::unexpected))? |
| 446 | } |
| 447 | Ok(Self(c)) |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | /// Represents a token with [Kind::Ident] that also begins with two HYPHEN MINUS (`--`) |