rust/src/syntax_kinds/mod.rs

28 lines
512 B
Rust
Raw Normal View History

2018-07-29 07:16:07 -05:00
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(crate) fn is_trivia(self: SyntaxKind) -> bool {
match self {
WHITESPACE | COMMENT | DOC_COMMENT => true,
_ => false,
}
}
}