diff options
Diffstat (limited to 'src/syntax_kinds/mod.rs')
-rw-r--r-- | src/syntax_kinds/mod.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/syntax_kinds/mod.rs b/src/syntax_kinds/mod.rs new file mode 100644 index 000000000..a8e9bfe29 --- /dev/null +++ b/src/syntax_kinds/mod.rs | |||
@@ -0,0 +1,27 @@ | |||
1 | mod generated; | ||
2 | |||
3 | use std::fmt; | ||
4 | use ::{SyntaxKind::*}; | ||
5 | |||
6 | pub use self::generated::SyntaxKind; | ||
7 | |||
8 | impl fmt::Debug for SyntaxKind { | ||
9 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
10 | let name = self.info().name; | ||
11 | f.write_str(name) | ||
12 | } | ||
13 | } | ||
14 | |||
15 | pub(crate) struct SyntaxInfo { | ||
16 | pub name: &'static str, | ||
17 | } | ||
18 | |||
19 | |||
20 | impl SyntaxKind { | ||
21 | pub(crate) fn is_trivia(self: SyntaxKind) -> bool { | ||
22 | match self { | ||
23 | WHITESPACE | COMMENT | DOC_COMMENT => true, | ||
24 | _ => false, | ||
25 | } | ||
26 | } | ||
27 | } | ||