rust/crates/ra_syntax/src/syntax_kinds/mod.rs

27 lines
495 B
Rust
Raw Normal View History

2018-07-29 14:16:07 +02:00
mod generated;
use std::fmt;
2018-10-15 18:55:32 +02:00
use crate::SyntaxKind::*;
2018-07-29 14:16:07 +02:00
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 {
2018-08-12 17:50:16 +02:00
pub fn is_trivia(self) -> bool {
2018-07-29 14:16:07 +02:00
match self {
WHITESPACE | COMMENT | DOC_COMMENT => true,
_ => false,
}
}
}