aboutsummaryrefslogtreecommitdiff
path: root/src/parser/token_set.rs
blob: a800f200db6fe5706e40025f8bc37e69fcea0265 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use SyntaxKind;

pub(crate) struct TokenSet {
    pub tokens: &'static [SyntaxKind],
}

impl TokenSet {
    pub fn contains(&self, kind: SyntaxKind) -> bool {
        self.tokens.contains(&kind)
    }
}

#[macro_export]
macro_rules! token_set {
    ($($t:ident),*) => {
        TokenSet {
            tokens: &[$($t),*],
        }
    };

    ($($t:ident),* ,) => {
        token_set!($($t),*)
    };
}