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

Method parse

crates/css_ast/src/rules/layer.rs:33–48  ·  view source on GitHub ↗
(p: &mut Parser<'a, I>)

Source from the content-addressed store, hash-verified

31
32impl<'a> Parse<'a> for LayerName<'a> {
33 fn parse<I>(p: &mut Parser<'a, I>) -> ParserResult<Self>
34 where
35 I: Iterator<Item = Cursor> + Clone,
36 {
37 let mut parts = Vec::new_in(p.bump());
38 let first = p.parse::<T![Ident]>()?;
39 loop {
40 if p.peek::<T![.]>() {
41 let dot = p.parse::<T![.]>()?;
42 let ident = p.parse::<T![Ident]>()?;
43 parts.push((dot, ident));
44 } else {
45 return Ok(Self(first, parts));
46 }
47 }
48 }
49}
50
51#[derive(Parse, Peek, ToCursors, ToSpan, SemanticEq, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]

Callers

nothing calls this directly

Calls 1

bumpMethod · 0.45

Tested by

no test coverage detected