mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
move parser to a separate crate
This commit is contained in:
parent
18b0c509f7
commit
d334b5a1db
24 changed files with 91 additions and 18 deletions
25
crates/ra_parser/src/syntax_kind.rs
Normal file
25
crates/ra_parser/src/syntax_kind.rs
Normal 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,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue