28 lines
512 B
Rust
28 lines
512 B
Rust
|
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,
|
||
|
}
|
||
|
}
|
||
|
}
|