rust/crates/ra_syntax/src/syntax_kinds.rs

27 lines
481 B
Rust
Raw Normal View History

2018-07-29 14:16:07 +02:00
mod generated;
2018-10-15 18:55:32 +02:00
use crate::SyntaxKind::*;
use std::fmt;
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 {
2018-10-31 22:38:18 +01:00
WHITESPACE | COMMENT => true,
2018-07-29 14:16:07 +02:00
_ => false,
}
}
}