2024-04-24 11:07:38 +02:00
|
|
|
#![feature(type_alias_impl_trait, lint_reasons)]
|
2024-06-05 18:00:14 +02:00
|
|
|
|
|
|
|
use crate::lst_parser::syntax_kind::SyntaxKind;
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
|
|
pub 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()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub type SyntaxNode = rowan::SyntaxNode<Lang>;
|
|
|
|
pub type SyntaxToken = rowan::SyntaxNode<Lang>;
|
|
|
|
pub type SyntaxElement = rowan::NodeOrToken<SyntaxNode, SyntaxToken>;
|
|
|
|
|
|
|
|
pub mod ast;
|
2024-04-30 12:21:06 +02:00
|
|
|
pub mod lst_parser;
|