boseiju/lexer/tokens/intermediates/
any_number_of_clause.rs

1#[derive(serde::Serialize, serde::Deserialize)]
2#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
3pub struct AnyNumberOfClause {
4    #[cfg(feature = "spanned_tree")]
5    pub span: crate::ability_tree::span::TreeSpan,
6}
7
8impl AnyNumberOfClause {
9    pub const COUNT: usize = 1;
10    pub const fn id(&self) -> usize {
11        0
12    }
13
14    pub fn try_from_span(span: &crate::lexer::Span) -> Option<Self> {
15        match span.text {
16            "a deck can have any number of cards named ~." => Some(Self {
17                #[cfg(feature = "spanned_tree")]
18                span: span.into(),
19            }),
20            _ => None,
21        }
22    }
23}