2019-09-30 03:58:53 -05:00
|
|
|
//! FIXME: write short doc here
|
|
|
|
|
2019-05-08 10:35:32 -05:00
|
|
|
#[macro_use]
|
2018-07-29 07:16:07 -05:00
|
|
|
mod generated;
|
|
|
|
|
|
|
|
pub use self::generated::SyntaxKind;
|
|
|
|
|
2019-08-19 05:11:51 -05:00
|
|
|
impl From<u16> for SyntaxKind {
|
|
|
|
fn from(d: u16) -> SyntaxKind {
|
|
|
|
assert!(d <= (SyntaxKind::__LAST as u16));
|
|
|
|
unsafe { std::mem::transmute::<u16, SyntaxKind>(d) }
|
2018-07-29 07:16:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-19 05:11:51 -05:00
|
|
|
impl From<SyntaxKind> for u16 {
|
|
|
|
fn from(k: SyntaxKind) -> u16 {
|
|
|
|
k as u16
|
|
|
|
}
|
2018-07-29 07:16:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|