aboutsummaryrefslogtreecommitdiff
path: root/src/parser/token_set.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/token_set.rs')
-rw-r--r--src/parser/token_set.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/parser/token_set.rs b/src/parser/token_set.rs
new file mode 100644
index 000000000..82558fa2e
--- /dev/null
+++ b/src/parser/token_set.rs
@@ -0,0 +1,25 @@
1use SyntaxKind;
2
3pub(crate) struct TokenSet {
4 pub tokens: &'static [SyntaxKind],
5}
6
7impl TokenSet {
8 pub fn contains(&self, kind: SyntaxKind) -> bool {
9 self.tokens.contains(&kind)
10 }
11}
12
13#[macro_export]
14macro_rules! token_set {
15 ($($t:ident),*) => {
16 TokenSet {
17 tokens: &[$($t),*],
18 }
19 };
20
21 ($($t:ident),* ,) => {
22 token_set!($($t),*)
23 };
24}
25