//! Evaluation of markup into modules. #[macro_use] mod array; #[macro_use] mod dict; #[macro_use] mod value; #[macro_use] mod styles; mod capture; mod class; mod collapse; mod func; mod layout; mod ops; mod scope; mod show; mod template; pub use array::*; pub use capture::*; pub use class::*; pub use collapse::*; pub use dict::*; pub use func::*; pub use layout::*; pub use scope::*; pub use show::*; pub use styles::*; pub use template::*; pub use value::*; use std::io; use std::mem; use unicode_segmentation::UnicodeSegmentation; use crate::diag::{At, Error, StrResult, Trace, Tracepoint, TypResult}; use crate::geom::{Angle, Fractional, Length, Relative}; use crate::library; use crate::syntax::ast::*; use crate::syntax::{Span, Spanned}; use crate::util::EcoString; use crate::Vm; /// An evaluated module, ready for importing or conversion to a root layout /// tree. #[derive(Debug, Clone)] pub struct Module { /// The top-level definitions that were bound in this module. pub scope: Scope, /// The module's layoutable contents. pub template: Template, } /// Evaluate an expression. pub trait Eval { /// The output of evaluating the expression. type Output; /// Evaluate the expression to the output value. fn eval(&self, vm: &mut Vm) -> TypResult; } impl Eval for Markup { type Output = Template; fn eval(&self, vm: &mut Vm) -> TypResult { eval_markup(vm, &mut self.nodes()) } } /// Evaluate a stream of markup nodes. fn eval_markup( vm: &mut Vm, nodes: &mut impl Iterator, ) -> TypResult