/// 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)] pub(crate) struct $istruct { pub(crate) post_blank: organic::types::PostBlank, } impl $istruct { #[allow(clippy::extra_unused_lifetimes)] pub(crate) async fn new<'reg, 'orig, 'parse>( _intermediate_context: crate::intermediate::IntermediateContext<'orig, 'parse>, original: &'orig organic::types::$pstruct<'parse>, ) -> Result<$istruct, CustomError> { Ok($istruct { post_blank: original.get_post_blank(), }) } } }; } pub(crate) use inoop; /// Write the implementation for the intermediate ast node. /// /// This exists to make changing the type signature easier. macro_rules! intermediate { ($istruct:ident, $pstruct:ty, $original:ident, $intermediate_context:ident, $fnbody:tt) => { impl $istruct { pub(crate) async fn new<'orig, 'parse>( $intermediate_context: crate::intermediate::IntermediateContext<'orig, 'parse>, $original: $pstruct, ) -> Result<$istruct, CustomError> { $fnbody } } }; } pub(crate) use intermediate; /// Write the implementation for the intermediate ast node. /// /// This exists to make changing the type signature easier. macro_rules! iselector { ($istruct:ident, $pstruct:ident, $original:ident, $intermediate_context:ident, $fnbody:tt) => { impl $istruct { pub(crate) fn new<'orig, 'parse>( $intermediate_context: crate::intermediate::IntermediateContext<'orig, 'parse>, $original: &'orig organic::types::$pstruct<'parse>, ) -> BoxFuture<'orig, Result<$istruct, CustomError>> { async move { $fnbody }.boxed() } } }; } pub(crate) use iselector; macro_rules! iitem { ($intermediate_context:expr, $original:expr, $(($penum:path, $ienum:path, $istruct:ident),)*) => { match $original { $( $penum(inner) => Ok($ienum( $istruct::new($intermediate_context.clone(), inner).await?, )), )* } }; } pub(crate) use iitem;