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