aboutsummaryrefslogtreecommitdiff
path: root/src/tree
diff options
context:
space:
mode:
Diffstat (limited to 'src/tree')
-rw-r--r--src/tree/mod.rs21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/tree/mod.rs b/src/tree/mod.rs
index 30a4b33a9..795f23f42 100644
--- a/src/tree/mod.rs
+++ b/src/tree/mod.rs
@@ -1,5 +1,4 @@
1use text::{TextRange, TextUnit}; 1use text::{TextRange, TextUnit};
2use syntax_kinds::syntax_info;
3 2
4use std::fmt; 3use std::fmt;
5use std::cmp; 4use std::cmp;
@@ -7,25 +6,7 @@ use std::cmp;
7mod file_builder; 6mod file_builder;
8pub(crate) use self::file_builder::{FileBuilder, Sink}; 7pub(crate) use self::file_builder::{FileBuilder, Sink};
9 8
10/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. 9pub use syntax_kinds::SyntaxKind;
11#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
12pub struct SyntaxKind(pub(crate) u32);
13
14pub(crate) const EOF: SyntaxKind = SyntaxKind(!0);
15pub(crate) const EOF_INFO: SyntaxInfo = SyntaxInfo { name: "EOF" };
16
17pub(crate) const TOMBSTONE: SyntaxKind = SyntaxKind(!0 - 1);
18pub(crate) const TOMBSTONE_INFO: SyntaxInfo = SyntaxInfo { name: "TOMBSTONE" };
19
20impl SyntaxKind {
21 fn info(self) -> &'static SyntaxInfo {
22 match self {
23 EOF => &EOF_INFO,
24 TOMBSTONE => &TOMBSTONE_INFO,
25 _ => syntax_info(self),
26 }
27 }
28}
29 10
30impl fmt::Debug for SyntaxKind { 11impl fmt::Debug for SyntaxKind {
31 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 12 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {