use std::borrow::Cow;
use crate::types::ast;
use crate::types::span::Span;
use crate::Value;
pub const FIXME: usize = !0;
#[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, Span),
JumpIfFalse(usize, Span),
Emit(Span),
EmitRaw(Span),
EmitWith(ast::Ident, Span),
LoopStart(ast::LoopVars, Span),
LoopNext(usize),
WithStart(ast::Ident),
WithEnd,
Include(ast::String),
IncludeWith(ast::String),
ExprStart(ast::Var),
ExprStartLit(Value),
Apply(ast::Ident, Span, Option<ast::Args>),
}
#[cfg(not(internal_debug))]
impl std::fmt::Debug for Template<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("<compiled>")
}
}