aboutsummaryrefslogtreecommitdiff
path: root/src/syntax_kinds/mod.rs
blob: a8e9bfe294df88f6489b748a5fe0b7b340fdf20b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
mod generated;

use std::fmt;
use ::{SyntaxKind::*};

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(crate) fn is_trivia(self: SyntaxKind) -> bool {
        match self {
            WHITESPACE | COMMENT | DOC_COMMENT => true,
            _ => false,
        }
    }
}