css_ast/functions/
tree_counting_functions.rs1use super::prelude::*;
2
3#[node]
13#[derive(Parse, Peek, ToCursors, ToSpan, SemanticEq, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
14#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
15#[cfg_attr(feature = "visitable", derive(Visitable), visit)]
16#[derive(csskit_derives::NodeWithMetadata)]
17#[metadata(declaration_kinds = Computed)]
18pub enum TreeCountingFunction {
19 SiblingCount(#[atom(CssAtomSet::SiblingCount)] Function, #[semantic_eq(skip)] RightParen),
20 SiblingIndex(#[atom(CssAtomSet::SiblingIndex)] Function, #[semantic_eq(skip)] RightParen),
21}
22
23#[cfg(test)]
24mod tests {
25 use super::*;
26 use css_parse::assert_parse;
27
28 #[test]
29 fn test_tree_counting_function() {
30 assert_parse!(CssAtomSet::ATOMS, TreeCountingFunction, "sibling-count()");
31 assert_parse!(CssAtomSet::ATOMS, TreeCountingFunction, "sibling-index()");
32 }
33}