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