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

Method parse

crates/css_ast/src/values/writing_modes/impls.rs:6–38  ·  view source on GitHub ↗
(p: &mut Parser<'a, I>)

Source from the content-addressed store, hash-verified

4
5impl<'a> Parse<'a> for GlyphOrientationVerticalStyleValue {
6 fn parse<I>(p: &mut Parser<'a, I>) -> ParseResult<Self>
7 where
8 I: Iterator<Item = Cursor> + Clone,
9 {
10 let c = p.peek_n(1);
11 if <T![Ident]>::peek(p, c) && p.equals_atom(c, &CssAtomSet::Auto) {
12 p.parse::<T![Ident]>().map(Self::Auto)
13 } else {
14 if let Some(int) = p.parse_if_peek::<CSSInt>()? {
15 match int.into() {
16 0i32 => {
17 return Ok(Self::Literal0(Exact(int)));
18 }
19 90i32 => {
20 return Ok(Self::Literal90(Exact(int)));
21 }
22 _ => {}
23 }
24 }
25 if let Some(dimension) = p.parse_if_peek::<T![Dimension]>()? {
26 match (dimension.value(), p.to_atom::<CssAtomSet>(dimension.into())) {
27 (0f32, CssAtomSet::Deg) => {
28 return Ok(Self::Literal0deg(Exact(dimension)));
29 }
30 (90f32, CssAtomSet::Deg) => {
31 return Ok(Self::Literal90deg(Exact(dimension)));
32 }
33 _ => {}
34 }
35 }
36 Err(Diagnostic::new(p.next(), Diagnostic::unexpected))?
37 }
38 }
39}
40
41#[cfg(test)]

Callers

nothing calls this directly

Calls 6

ExactClass · 0.85
ErrClass · 0.85
peek_nMethod · 0.80
equals_atomMethod · 0.45
valueMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected