| 18 | // https://drafts.csswg.org/css-syntax-3/#consume-a-simple-block |
| 19 | impl<'a> Parse<'a> for SimpleBlock<'a> { |
| 20 | fn parse<Iter>(p: &mut Parser<'a, Iter>) -> ParserResult<Self> |
| 21 | where |
| 22 | Iter: Iterator<Item = crate::Cursor> + Clone, |
| 23 | { |
| 24 | let open = p.parse::<T![PairWiseStart]>()?; |
| 25 | let stop = p.set_stop(KindSet::new(&[open.end()])); |
| 26 | let values = p.parse::<ComponentValues>(); |
| 27 | p.set_stop(stop); |
| 28 | let values = values?; |
| 29 | if <T![PairWiseEnd]>::peek(p, p.peek_n(1)) { |
| 30 | return Ok(Self { open, values, close: p.parse::<T![PairWiseEnd]>().ok() }); |
| 31 | } |
| 32 | Ok(Self { open, values, close: None }) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | impl<'a> ToCursors for SimpleBlock<'a> { |