use std::borrow::Cow;
use crate::types::ast;
use crate::types::span::Span;
#[cfg_attr(internal_debug, derive(Debug))]
pub struct Template<'source> {
pub source: Cow<'source, str>,
pub instrs: Vec<Instr>,
}
#[cfg_attr(internal_debug, derive(Debug))]
pub enum Instr {
Jump(usize),
JumpIfTrue(usize),
JumpIfFalse(usize),
Emit,
EmitRaw(Span),
EmitWith(ast::Ident, usize, Span),
LoopStart(ast::LoopVars, Span),
LoopNext(usize),
WithStart(ast::Ident),
WithEnd,
Include(ast::String),
IncludeWith(ast::String),
ExprStartVar(ast::Var),
ExprStartLiteral(ast::Literal),
ExprStartList(Span),
ExprStartMap(Span),
ExprListPush,
ExprMapInsert(ast::String),
Apply(ast::Ident, usize, Span),
}
#[cfg(not(internal_debug))]
impl std::fmt::Debug for Template<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Template").finish_non_exhaustive()
}
}