use crate::{
NameRef,
aux::{Owned, Stack},
ext::{business::Money, math::Natural, shop::Gtin},
runtime::model::ActorKind,
};
#[derive(Owned!)]
pub struct Script<'tok>(pub Vec<Stmt<'tok>>);
#[derive(Owned!)]
pub struct Stmt<'tok> {
pub cmd: Command,
pub args: Args<'tok>,
}
#[derive(Stack!)]
pub enum Command {
Create(ActorKind),
Pay,
Deliver,
Balance,
}
#[derive(Owned!)]
pub struct Args<'tok>(pub Vec<Arg<'tok>>);
#[derive(Owned!)]
pub enum Arg<'tok> {
Named {
key: NameRef<'tok>,
value: Value<'tok>,
},
Pos(Value<'tok>),
}
#[derive(Owned!)]
pub enum Value<'tok> {
Money(Money),
Split(Split),
Gtin(Gtin),
Name(NameRef<'tok>),
}
#[derive(Owned!)]
pub struct Split {
pub from: Natural,
pub to: Natural,
}