rust/crates/ra_syntax/src/syntax_kinds.rs
2018-12-08 19:30:35 +03:00

26 lines
481 B
Rust

mod generated;
use crate::SyntaxKind::*;
use std::fmt;
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 => true,
_ => false,
}
}
}