MCPcopy Create free account
hub / github.com/csskit/csskit / parse

Method parse

crates/css_parse/src/syntax/simple_block.rs:20–33  ·  view source on GitHub ↗
(p: &mut Parser<'a, Iter>)

Source from the content-addressed store, hash-verified

18// https://drafts.csswg.org/css-syntax-3/#consume-a-simple-block
19impl<'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
36impl<'a> ToCursors for SimpleBlock<'a> {

Callers

nothing calls this directly

Calls 4

set_stopMethod · 0.80
peek_nMethod · 0.80
okMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected