summaryrefslogtreecommitdiff
path: root/support/texlab/src/syntax/latex.rs
blob: ce1ca125fde47a018acda1f85411aeb7f7b11647 (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
28
29
mod cst;
mod kind;

pub use self::{
    cst::*,
    kind::SyntaxKind::{self, *},
};

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum LatexLanguage {}

impl rowan::Language for LatexLanguage {
    type Kind = SyntaxKind;

    fn kind_from_raw(raw: rowan::SyntaxKind) -> Self::Kind {
        assert!(raw.0 <= ROOT as u16);
        unsafe { std::mem::transmute::<u16, SyntaxKind>(raw.0) }
    }

    fn kind_to_raw(kind: Self::Kind) -> rowan::SyntaxKind {
        kind.into()
    }
}

pub type SyntaxNode = rowan::SyntaxNode<LatexLanguage>;

pub type SyntaxToken = rowan::SyntaxToken<LatexLanguage>;

pub type SyntaxElement = rowan::SyntaxElement<LatexLanguage>;