2018-07-29 07:16:07 -05:00
|
|
|
mod generated;
|
|
|
|
|
2018-10-15 16:44:23 -05:00
|
|
|
use std::fmt;
|
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 {
|
2019-02-21 04:27:45 -06:00
|
|
|
SyntaxKind::WHITESPACE | SyntaxKind::COMMENT => true,
|
2018-07-29 07:16:07 -05:00
|
|
|
_ => false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|