2023-10-29 17:29:16 -04:00
|
|
|
/// Write the implementation for the intermediate ast node for a type that is a noop or is not yet implemented.
|
|
|
|
|
///
|
|
|
|
|
/// This exists to make changing the type signature easier.
|
|
|
|
|
macro_rules! inoop {
|
|
|
|
|
($istruct:ident, $pstruct:ident) => {
|
|
|
|
|
#[derive(Debug, Clone)]
|
2023-12-21 14:56:58 -05:00
|
|
|
pub(crate) struct $istruct {
|
|
|
|
|
pub(crate) post_blank: organic::types::PostBlank,
|
|
|
|
|
}
|
2023-10-29 17:29:16 -04:00
|
|
|
|
|
|
|
|
impl $istruct {
|
2025-02-22 19:42:24 -05:00
|
|
|
#[allow(clippy::extra_unused_lifetimes)]
|
2023-10-29 17:29:16 -04:00
|
|
|
pub(crate) async fn new<'reg, 'orig, 'parse>(
|
2023-12-21 13:53:56 -05:00
|
|
|
_intermediate_context: crate::intermediate::IntermediateContext<'orig, 'parse>,
|
2023-12-21 14:56:58 -05:00
|
|
|
original: &'orig organic::types::$pstruct<'parse>,
|
2023-10-29 17:29:16 -04:00
|
|
|
) -> Result<$istruct, CustomError> {
|
2023-12-21 14:56:58 -05:00
|
|
|
Ok($istruct {
|
|
|
|
|
post_blank: original.get_post_blank(),
|
|
|
|
|
})
|
2023-10-29 17:29:16 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(crate) use inoop;
|
|
|
|
|
|
|
|
|
|
/// Write the implementation for the intermediate ast node.
|
|
|
|
|
///
|
|
|
|
|
/// This exists to make changing the type signature easier.
|
|
|
|
|
macro_rules! intermediate {
|
2023-12-21 13:53:56 -05:00
|
|
|
($istruct:ident, $pstruct:ty, $original:ident, $intermediate_context:ident, $fnbody:tt) => {
|
2023-10-29 17:29:16 -04:00
|
|
|
impl $istruct {
|
2023-10-29 21:19:30 -04:00
|
|
|
pub(crate) async fn new<'orig, 'parse>(
|
2023-12-21 13:53:56 -05:00
|
|
|
$intermediate_context: crate::intermediate::IntermediateContext<'orig, 'parse>,
|
2023-12-19 17:09:11 -05:00
|
|
|
$original: $pstruct,
|
2023-10-29 17:29:16 -04:00
|
|
|
) -> Result<$istruct, CustomError> {
|
2023-10-29 18:35:42 -04:00
|
|
|
$fnbody
|
2023-10-29 17:29:16 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(crate) use intermediate;
|
|
|
|
|
|
|
|
|
|
/// Write the implementation for the intermediate ast node.
|
|
|
|
|
///
|
|
|
|
|
/// This exists to make changing the type signature easier.
|
|
|
|
|
macro_rules! iselector {
|
2023-12-21 13:53:56 -05:00
|
|
|
($istruct:ident, $pstruct:ident, $original:ident, $intermediate_context:ident, $fnbody:tt) => {
|
2023-10-29 17:29:16 -04:00
|
|
|
impl $istruct {
|
2023-10-29 21:19:30 -04:00
|
|
|
pub(crate) fn new<'orig, 'parse>(
|
2023-12-21 13:53:56 -05:00
|
|
|
$intermediate_context: crate::intermediate::IntermediateContext<'orig, 'parse>,
|
|
|
|
|
$original: &'orig organic::types::$pstruct<'parse>,
|
2023-10-29 21:19:30 -04:00
|
|
|
) -> BoxFuture<'orig, Result<$istruct, CustomError>> {
|
2023-10-29 20:01:44 -04:00
|
|
|
async move { $fnbody }.boxed()
|
2023-10-29 17:29:16 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(crate) use iselector;
|
2023-10-29 18:26:52 -04:00
|
|
|
|
|
|
|
|
macro_rules! iitem {
|
2023-12-21 13:53:56 -05:00
|
|
|
($intermediate_context:expr, $original:expr, $(($penum:path, $ienum:path, $istruct:ident),)*) => {
|
2023-10-29 18:26:52 -04:00
|
|
|
match $original {
|
|
|
|
|
$(
|
2023-10-29 18:54:50 -04:00
|
|
|
$penum(inner) => Ok($ienum(
|
2023-12-21 13:53:56 -05:00
|
|
|
$istruct::new($intermediate_context.clone(), inner).await?,
|
2023-10-29 18:26:52 -04:00
|
|
|
)),
|
|
|
|
|
)*
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(crate) use iitem;
|