mod accumulator;
mod content_line;
mod divert_node;
mod helpers;
mod inline_logic;
mod logic_line;
mod multiline_block;
mod tag_line;
pub use accumulator::ContentAccumulator;
pub use content_line::ContentLineOutput;
pub use helpers::{lower_content_node_children, lower_tags};
pub use logic_line::LogicLineOutput;
use super::context::{LowerScope, LowerSink, Lowered};
pub trait LowerBody {
type Output;
fn lower_body(&self, scope: &LowerScope, sink: &mut impl LowerSink) -> Lowered<Self::Output>;
}
pub trait BodyBackend {
fn push_stmt(&mut self, stmt: crate::Stmt);
fn finish(self) -> crate::Block;
}
#[derive(Default)]
pub struct DirectBackend {
stmts: Vec<crate::Stmt>,
}
impl DirectBackend {
pub fn new() -> Self {
Self::default()
}
}
impl BodyBackend for DirectBackend {
fn push_stmt(&mut self, stmt: crate::Stmt) {
self.stmts.push(stmt);
}
fn finish(self) -> crate::Block {
crate::Block {
label: None,
stmts: self.stmts,
container_id: None,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum HandleResult {
Block,
Inline,
}
pub trait Integrate<T> {
fn integrate(&mut self, output: T) -> HandleResult;
}