#![deny(clippy::debug_assert_with_mut_call)]
macro_rules! impl_rowan_lang {
($language:ty, $kind:ty, $name:literal) => {
const _: () = assert!(
<$kind>::ROOT as u16 + 1 == <$kind>::__LAST as u16,
"ROOT must be the final syntax kind"
);
impl From<$kind> for rowan::SyntaxKind {
fn from(kind: $kind) -> Self {
Self(kind as u16)
}
}
impl rowan::Language for $language {
type Kind = $kind;
fn kind_from_raw(raw: rowan::SyntaxKind) -> $kind {
assert!(
raw.0 <= <$kind>::ROOT as u16,
"invalid {} SyntaxKind discriminant: {}",
$name,
raw.0
);
unsafe { std::mem::transmute::<u16, $kind>(raw.0) }
}
fn kind_to_raw(kind: $kind) -> rowan::SyntaxKind {
kind.into()
}
}
};
}
pub mod ast;
pub mod bib;
pub mod declarations;
pub mod directives;
mod error;
pub mod parser;
pub mod semantic;
pub mod syntax;
pub use error::SyntaxError;
pub use rowan;