diff options
Diffstat (limited to 'src/tree/mod.rs')
-rw-r--r-- | src/tree/mod.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/tree/mod.rs b/src/tree/mod.rs index d8f843737..3315b926e 100644 --- a/src/tree/mod.rs +++ b/src/tree/mod.rs | |||
@@ -10,17 +10,24 @@ pub use self::file_builder::{FileBuilder, Sink}; | |||
10 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] | 10 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
11 | pub struct SyntaxKind(pub(crate) u32); | 11 | pub struct SyntaxKind(pub(crate) u32); |
12 | 12 | ||
13 | pub(crate) const EOF: SyntaxKind = SyntaxKind(10000); | 13 | pub(crate) const EOF: SyntaxKind = SyntaxKind(!0); |
14 | pub(crate) const EOF_INFO: SyntaxInfo = SyntaxInfo { | 14 | pub(crate) const EOF_INFO: SyntaxInfo = SyntaxInfo { |
15 | name: "EOF" | 15 | name: "EOF" |
16 | }; | 16 | }; |
17 | 17 | ||
18 | pub(crate) const TOMBSTONE: SyntaxKind = SyntaxKind(!0 - 1); | ||
19 | pub(crate) const TOMBSTONE_INFO: SyntaxInfo = SyntaxInfo { | ||
20 | name: "TOMBSTONE" | ||
21 | }; | ||
22 | |||
23 | |||
18 | impl SyntaxKind { | 24 | impl SyntaxKind { |
19 | fn info(self) -> &'static SyntaxInfo { | 25 | fn info(self) -> &'static SyntaxInfo { |
20 | if self == EOF { | 26 | match self { |
21 | return &EOF_INFO; | 27 | EOF => &EOF_INFO, |
28 | TOMBSTONE => &TOMBSTONE_INFO, | ||
29 | _ => syntax_info(self), | ||
22 | } | 30 | } |
23 | syntax_info(self) | ||
24 | } | 31 | } |
25 | } | 32 | } |
26 | 33 | ||