htmls/interpreter/
pipeline.rs

1use super::Interpreter;
2use super::Visitor;
3use super::error::{InterpreterError, InterpreterResult};
4use crate::parser::ast::Node;
5
6pub fn apply_pipeline(it: &mut Interpreter, left: &Node, right: &Node) -> InterpreterResult<()> {
7    it.visit_node(left)?;
8
9    if it.result.is_empty() {
10        return Ok(());
11    }
12
13    if it.result.is_texts() {
14        return Err(InterpreterError::execution_error(
15            "The text results on the left side of the pipeline cannot be used as input for the operations on the right side.",
16        ));
17    }
18
19    it.visit_node(right)?;
20
21    Ok(())
22}