forked from katzen-cafe/iowo
lang: massive amounts of parser and ast pain
This commit is contained in:
parent
881a987b2f
commit
9da157ff4a
16 changed files with 900 additions and 170 deletions
19
crates/lang/src/parser/ast/lossless.rs
Normal file
19
crates/lang/src/parser/ast/lossless.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use self::lex::SyntaxKind;
|
||||
|
||||
pub mod parser;
|
||||
|
||||
pub mod lex;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
enum Lang {}
|
||||
impl rowan::Language for Lang {
|
||||
type Kind = SyntaxKind;
|
||||
#[allow(unsafe_code)]
|
||||
fn kind_from_raw(raw: rowan::SyntaxKind) -> Self::Kind {
|
||||
assert!(raw.0 <= SyntaxKind::ROOT as u16);
|
||||
unsafe { std::mem::transmute::<u16, SyntaxKind>(raw.0) }
|
||||
}
|
||||
fn kind_to_raw(kind: Self::Kind) -> rowan::SyntaxKind {
|
||||
kind.into()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue