2023-09-25 14:23:03 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2023 Alain Zscheile <fogti+devel@ytrizja.de>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2023-09-24 21:58:28 +00:00
|
|
|
//use bitflags::bitflags;
|
|
|
|
pub mod parser;
|
2023-09-26 12:20:35 +00:00
|
|
|
|
|
|
|
mod expr;
|
|
|
|
pub use expr::Expr;
|
2023-09-24 21:58:28 +00:00
|
|
|
|
2023-09-26 09:40:05 +00:00
|
|
|
mod pat;
|
|
|
|
pub use pat::{FullPattern, Pattern};
|
|
|
|
|
2023-09-26 12:12:43 +00:00
|
|
|
mod record;
|
|
|
|
pub use record::{Record, RecordEntry};
|
|
|
|
|
2023-09-26 09:45:07 +00:00
|
|
|
pub mod typeck;
|
2023-09-25 20:26:15 +00:00
|
|
|
|
2023-09-26 10:04:09 +00:00
|
|
|
use core::cmp;
|
2023-09-25 20:26:15 +00:00
|
|
|
use miette::SourceSpan;
|
2023-09-25 21:27:58 +00:00
|
|
|
|
2023-09-26 10:04:09 +00:00
|
|
|
/// A SourceSpan which is always equal to all other SourceSpans
|
|
|
|
/// (to be used to ignore span differences in expression comparisons)
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
pub struct EvEqSourceSpan(pub SourceSpan);
|
|
|
|
|
|
|
|
impl cmp::PartialEq for EvEqSourceSpan {
|
|
|
|
#[inline(always)]
|
|
|
|
fn eq(&self, _: &Self) -> bool {
|
|
|
|
true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<(usize, usize)> for EvEqSourceSpan {
|
|
|
|
#[inline]
|
|
|
|
fn from(x: (usize, usize)) -> Self {
|
|
|
|
Self(x.into())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<core::ops::Range<usize>> for EvEqSourceSpan {
|
|
|
|
#[inline]
|
|
|
|
fn from(x: core::ops::Range<usize>) -> Self {
|
|
|
|
Self(x.into())
|
|
|
|
}
|
2023-09-24 21:58:28 +00:00
|
|
|
}
|
|
|
|
|
2023-09-26 10:04:09 +00:00
|
|
|
impl From<EvEqSourceSpan> for SourceSpan {
|
|
|
|
#[inline(always)]
|
|
|
|
fn from(x: EvEqSourceSpan) -> SourceSpan {
|
|
|
|
x.0
|
2023-09-25 20:26:15 +00:00
|
|
|
}
|
2023-09-26 10:04:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> From<&'a EvEqSourceSpan> for SourceSpan {
|
|
|
|
#[inline(always)]
|
|
|
|
fn from(x: &'a EvEqSourceSpan) -> SourceSpan {
|
|
|
|
x.0
|
2023-09-25 20:26:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-26 12:17:24 +00:00
|
|
|
pub trait Subst {
|
|
|
|
fn incr_refs(&mut self, keep: usize, offset: usize);
|
|
|
|
fn subst(&mut self, bnest: usize, with_e: &Expr);
|
|
|
|
}
|