| 53 | |
| 54 | impl<'a> Parse<'a> for ContainerCondition<'a> { |
| 55 | fn parse<I>(p: &mut Parser<'a, I>) -> ParserResult<Self> |
| 56 | where |
| 57 | I: Iterator<Item = Cursor> + Clone, |
| 58 | { |
| 59 | let mut name = None; |
| 60 | let c = p.peek_n(1); |
| 61 | if c == Kind::Ident { |
| 62 | match p.to_atom::<CssAtomSet>(c) { |
| 63 | CssAtomSet::None | CssAtomSet::And | CssAtomSet::Not | CssAtomSet::Or => {} |
| 64 | _ => { |
| 65 | name = Some(p.parse::<T![Ident]>()?); |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | let condition = |
| 70 | if name.is_none() { Some(p.parse::<ContainerQuery>()?) } else { p.parse_if_peek::<ContainerQuery>()? }; |
| 71 | Ok(Self { name, condition }) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | #[derive(ToCursors, ToSpan, SemanticEq, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] |