aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/syntax_kind.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_parser/src/syntax_kind.rs')
-rw-r--r--crates/ra_parser/src/syntax_kind.rs25
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 @@
1mod generated;
2
3use std::fmt;
4
5pub use self::generated::SyntaxKind;
6
7impl 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
14pub(crate) struct SyntaxInfo {
15 pub name: &'static str,
16}
17
18impl SyntaxKind {
19 pub fn is_trivia(self) -> bool {
20 match self {
21 SyntaxKind::WHITESPACE | SyntaxKind::COMMENT => true,
22 _ => false,
23 }
24 }
25}