move parser to a separate crate

This commit is contained in:
Aleksey Kladov 2019-02-21 13:27:45 +03:00
parent 18b0c509f7
commit d334b5a1db
24 changed files with 91 additions and 18 deletions

View file

@ -0,0 +1,25 @@
mod generated;
use std::fmt;
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 fn is_trivia(self) -> bool {
match self {
SyntaxKind::WHITESPACE | SyntaxKind::COMMENT => true,
_ => false,
}
}
}