From cbcb6eb53ee65710657b2e058d2bfe8c5837a96d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 17 Jan 2022 16:50:27 -0500 Subject: implement else --- src/parse/ast.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/parse') diff --git a/src/parse/ast.rs b/src/parse/ast.rs index 9d74331..534c87e 100644 --- a/src/parse/ast.rs +++ b/src/parse/ast.rs @@ -42,6 +42,7 @@ pub enum Command { If(Pipeline), While(Pipeline), For(String, Vec), + Else(Option), End, } @@ -70,6 +71,9 @@ impl Command { list.into_inner().map(Word::build_ast).collect(); Self::For(var.as_str().to_string(), vals) } + Rule::control_else => Self::Else( + ty.into_inner().next().map(Pipeline::build_ast), + ), Rule::control_end => Self::End, _ => unreachable!(), } -- cgit v1.2.3-54-g00ecf