diff options
author | Aleksey Kladov <[email protected]> | 2019-02-21 10:27:45 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-02-21 10:27:45 +0000 |
commit | d334b5a1db9ec6a57f54077d422a3f4b3c8c1178 (patch) | |
tree | 9d930fe43452e8188594c612de433a77524e4754 /crates/ra_parser/src/syntax_kind.rs | |
parent | 18b0c509f77a8e06141fee6668532cced1ebf5d8 (diff) |
move parser to a separate crate
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 | } | ||