diff options
Diffstat (limited to 'crates/ra_parser/src/token_set.rs')
-rw-r--r-- | crates/ra_parser/src/token_set.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_parser/src/token_set.rs b/crates/ra_parser/src/token_set.rs index 2a6952c01..994017acf 100644 --- a/crates/ra_parser/src/token_set.rs +++ b/crates/ra_parser/src/token_set.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! A bit-set of `SyntaxKind`s. |
2 | 2 | ||
3 | use crate::SyntaxKind; | 3 | use crate::SyntaxKind; |
4 | 4 | ||
@@ -7,9 +7,7 @@ use crate::SyntaxKind; | |||
7 | pub(crate) struct TokenSet(u128); | 7 | pub(crate) struct TokenSet(u128); |
8 | 8 | ||
9 | impl TokenSet { | 9 | impl TokenSet { |
10 | pub(crate) const fn empty() -> TokenSet { | 10 | pub(crate) const EMPTY: TokenSet = TokenSet(0); |
11 | TokenSet(0) | ||
12 | } | ||
13 | 11 | ||
14 | pub(crate) const fn singleton(kind: SyntaxKind) -> TokenSet { | 12 | pub(crate) const fn singleton(kind: SyntaxKind) -> TokenSet { |
15 | TokenSet(mask(kind)) | 13 | TokenSet(mask(kind)) |
@@ -30,7 +28,7 @@ const fn mask(kind: SyntaxKind) -> u128 { | |||
30 | 28 | ||
31 | #[macro_export] | 29 | #[macro_export] |
32 | macro_rules! token_set { | 30 | macro_rules! token_set { |
33 | ($($t:expr),*) => { TokenSet::empty()$(.union(TokenSet::singleton($t)))* }; | 31 | ($($t:expr),*) => { TokenSet::EMPTY$(.union(TokenSet::singleton($t)))* }; |
34 | ($($t:expr),* ,) => { token_set!($($t),*) }; | 32 | ($($t:expr),* ,) => { token_set!($($t),*) }; |
35 | } | 33 | } |
36 | 34 | ||