rust/src/parser/token_set.rs
Aleksey Kladov f356628ad8 Formatting
2018-02-11 17:59:24 +03:00

24 lines
403 B
Rust

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),*)
};
}