From 4244948c6b1a62bd0e1ef276d1f0cc22c36f6f66 Mon Sep 17 00:00:00 2001 From: Christopher Durham Date: Sat, 27 Jan 2018 21:36:28 -0500 Subject: Convert SyntaxKind to an enum --- src/tree/mod.rs | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'src/tree/mod.rs') diff --git a/src/tree/mod.rs b/src/tree/mod.rs index aaf048c73..43bda480d 100644 --- a/src/tree/mod.rs +++ b/src/tree/mod.rs @@ -1,5 +1,4 @@ use text::{TextRange, TextUnit}; -use syntax_kinds::syntax_info; use std::fmt; use std::cmp; @@ -7,25 +6,7 @@ use std::cmp; mod file_builder; pub use self::file_builder::{FileBuilder, Sink}; -/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct SyntaxKind(pub(crate) u32); - -pub(crate) const EOF: SyntaxKind = SyntaxKind(!0); -pub(crate) const EOF_INFO: SyntaxInfo = SyntaxInfo { name: "EOF" }; - -pub(crate) const TOMBSTONE: SyntaxKind = SyntaxKind(!0 - 1); -pub(crate) const TOMBSTONE_INFO: SyntaxInfo = SyntaxInfo { name: "TOMBSTONE" }; - -impl SyntaxKind { - fn info(self) -> &'static SyntaxInfo { - match self { - EOF => &EOF_INFO, - TOMBSTONE => &TOMBSTONE_INFO, - _ => syntax_info(self), - } - } -} +pub use syntax_kinds::SyntaxKind; impl fmt::Debug for SyntaxKind { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -- cgit v1.2.3