diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-02-11 14:59:58 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-02-11 14:59:58 +0000 |
commit | a6f9b0414cf5bf49ad7f714b9d3fe5af91a16404 (patch) | |
tree | 2fc1e8ccc43bbee85a06026270d7c8de5959e323 /src/parser/token_set.rs | |
parent | 7a0ada860b57acd44b1d53e944ae621e438652da (diff) | |
parent | f356628ad8392c6e3ffd72a9ac50a7be87d3d183 (diff) |
Merge #50
50: Shiny new parser r=matklad a=matklad
bors r+
Diffstat (limited to 'src/parser/token_set.rs')
-rw-r--r-- | src/parser/token_set.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/parser/token_set.rs b/src/parser/token_set.rs new file mode 100644 index 000000000..a800f200d --- /dev/null +++ b/src/parser/token_set.rs | |||
@@ -0,0 +1,24 @@ | |||
1 | use SyntaxKind; | ||
2 | |||
3 | pub(crate) struct TokenSet { | ||
4 | pub tokens: &'static [SyntaxKind], | ||
5 | } | ||
6 | |||
7 | impl TokenSet { | ||
8 | pub fn contains(&self, kind: SyntaxKind) -> bool { | ||
9 | self.tokens.contains(&kind) | ||
10 | } | ||
11 | } | ||
12 | |||
13 | #[macro_export] | ||
14 | macro_rules! token_set { | ||
15 | ($($t:ident),*) => { | ||
16 | TokenSet { | ||
17 | tokens: &[$($t),*], | ||
18 | } | ||
19 | }; | ||
20 | |||
21 | ($($t:ident),* ,) => { | ||
22 | token_set!($($t),*) | ||
23 | }; | ||
24 | } | ||