summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/parse/ast.rs6
-rw-r--r--src/shell.pest2
2 files changed, 3 insertions, 5 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(),
diff --git a/src/shell.pest b/src/shell.pest
index 118ceec..8c0e79c 100644
--- a/src/shell.pest
+++ b/src/shell.pest
@@ -35,7 +35,7 @@ control_for = ${ "for" ~ w ~ bareword ~ w ~ "in" ~ w ~ pipeline }
control_end = ${ "end" }
control = ${ control_if | control_while | control_for | control_end }
-command = ${ pipeline | control }
+command = ${ control | pipeline }
commands = ${ command ~ (w? ~ ";" ~ w? ~ command)* }
line = ${ SOI ~ w? ~ commands ~ w? ~ EOI }