diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-08 18:16:29 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-08 18:16:29 -0500 |
commit | 879ff29a10b07194b8240aa0a7d4cb19cf397801 (patch) | |
tree | d4f75d0aba0a799d274638d97816c98d0e8a2b55 /src/parse | |
parent | 629aac44ac08f3b0d665f240038de6e70ed95533 (diff) | |
download | nbsh-879ff29a10b07194b8240aa0a7d4cb19cf397801.tar.gz nbsh-879ff29a10b07194b8240aa0a7d4cb19cf397801.zip |
fix control statement parsing
Diffstat (limited to 'src/parse')
-rw-r--r-- | src/parse/ast.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/parse/ast.rs b/src/parse/ast.rs index 2216dcb..f33734b 100644 --- a/src/parse/ast.rs +++ b/src/parse/ast.rs @@ -58,10 +58,8 @@ impl Command { let next = command.into_inner().next().unwrap(); match next.as_rule() { Rule::pipeline => Self::Pipeline(Pipeline::build_ast(next)), - Rule::command => { - let control = next.into_inner().next().unwrap(); - assert!(matches!(control.as_rule(), Rule::control)); - let ty = control.into_inner().next().unwrap(); + Rule::control => { + let ty = next.into_inner().next().unwrap(); match ty.as_rule() { Rule::control_if => Self::If(Pipeline::build_ast( ty.into_inner().next().unwrap(), |