aboutsummaryrefslogtreecommitdiffstats
path: root/src/parse/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse/mod.rs')
-rw-r--r--src/parse/mod.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/parse/mod.rs b/src/parse/mod.rs
index 8cc6a4f..47aff20 100644
--- a/src/parse/mod.rs
+++ b/src/parse/mod.rs
@@ -124,6 +124,22 @@ pub fn pipes<const N: usize>(cmds: [Command<PreExpansion>; N]) -> Ast<PreExpansi
})
}
+pub fn cond(
+ condition: Ast<PreExpansion>,
+ true_block: Block,
+ false_block: Block,
+) -> Ast<PreExpansion> {
+ let Ast::Pipes(condition) = condition else {
+ panic!()
+ };
+ Ast::If(If {
+ condition,
+ true_block,
+ false_block,
+ parse_progress: IfParseProgress::Done,
+ })
+}
+
pub fn estr(x: &[u8]) -> ExpString {
ExpString {
parts: vec![StringPart::Boring(x.to_vec())],