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

Method parse

crates/css_ast/src/selector/namespace.rs:17–43  ·  view source on GitHub ↗
(p: &mut Parser<'a, I>)

Source from the content-addressed store, hash-verified

15
16impl<'a> Parse<'a> for Namespace {
17 fn parse<I>(p: &mut Parser<'a, I>) -> ParserResult<Self>
18 where
19 I: Iterator<Item = Cursor> + Clone,
20 {
21 if p.peek::<T![*|]>() {
22 let prefix = p.parse::<NamespacePrefix>()?;
23 let tag = p.parse::<NamespaceTag>()?;
24 return Ok(Self { prefix: Some(prefix), tag });
25 }
26 if p.peek::<T![|]>() {
27 let prefix = p.parse::<NamespacePrefix>()?;
28 let tag = p.parse::<NamespaceTag>()?;
29 return Ok(Self { prefix: Some(prefix), tag });
30 }
31
32 let ident = p.parse::<T![Ident]>()?;
33 let skip = p.set_skip(KindSet::NONE);
34 if p.peek::<T![|]>() && !p.peek::<T![|=]>() {
35 let pipe = p.parse::<T![|]>();
36 let tag = p.parse::<NamespaceTag>();
37 p.set_skip(skip);
38 let prefix = NamespacePrefix::Name(ident, pipe?);
39 return Ok(Self { prefix: Some(prefix), tag: tag? });
40 }
41 let tag = p.parse::<NamespaceTag>()?;
42 Ok(Self { prefix: None, tag })
43 }
44}
45
46#[derive(Peek, ToSpan, ToCursors, SemanticEq, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]

Callers

nothing calls this directly

Calls 5

WildcardClass · 0.85
TagEnum · 0.85
ErrClass · 0.85
set_skipMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected