pub use super::token::WordPart;
pub type Word = Vec<WordPart>;
#[derive(Debug, Clone, PartialEq)]
pub enum Stmt {
Assign { name: String, value: Word },
Pipeline(Vec<Command>),
AndOr {
pipelines: Vec<Vec<Command>>,
ops: Vec<ChainOp>,
},
If {
arms: Vec<(Vec<Stmt>, Vec<Stmt>)>,
otherwise: Option<Vec<Stmt>>,
},
For {
var: String,
items: Vec<Word>,
body: Vec<Stmt>,
},
While {
cond: Vec<Stmt>,
body: Vec<Stmt>,
},
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ChainOp {
And,
Or,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Command {
pub name: Word,
pub args: Vec<Word>,
}