From b5021411a84822cb3f1e3aeffad9550dd15bdeb6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 16 Sep 2018 12:54:24 +0300 Subject: rename all things --- crates/ra_syntax/src/syntax_kinds/mod.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 crates/ra_syntax/src/syntax_kinds/mod.rs (limited to 'crates/ra_syntax/src/syntax_kinds/mod.rs') diff --git a/crates/ra_syntax/src/syntax_kinds/mod.rs b/crates/ra_syntax/src/syntax_kinds/mod.rs new file mode 100644 index 000000000..332cd13ac --- /dev/null +++ b/crates/ra_syntax/src/syntax_kinds/mod.rs @@ -0,0 +1,26 @@ +mod generated; + +use std::fmt; +use SyntaxKind::*; + +pub use self::generated::SyntaxKind; + +impl fmt::Debug for SyntaxKind { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let name = self.info().name; + f.write_str(name) + } +} + +pub(crate) struct SyntaxInfo { + pub name: &'static str, +} + +impl SyntaxKind { + pub fn is_trivia(self) -> bool { + match self { + WHITESPACE | COMMENT | DOC_COMMENT => true, + _ => false, + } + } +} -- cgit v1.2.3