1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:38:11 +00:00

Shell: Allow control structures to appear in pipe sequences

This makes commands like the following to be possible:
```sh
$ ls && for $(seq 10) { echo $it }
$ ls | for $(seq 1) { cat > foobar }
```
This commit is contained in:
AnotherTest 2020-09-07 20:49:53 +04:30 committed by Andreas Kling
parent 7b5ead64a5
commit aa2df9277d
5 changed files with 73 additions and 41 deletions

View file

@ -107,7 +107,6 @@ toplevel :: sequence?
sequence :: variable_decls? or_logical_sequence terminator sequence
| variable_decls? or_logical_sequence '&' sequence
| variable_decls? control_structure terminator sequence
| variable_decls? or_logical_sequence
| variable_decls? terminator sequence
@ -125,6 +124,8 @@ variable_decls :: identifier '=' expression (' '+ variable_decls)? ' '*
pipe_sequence :: command '|' pipe_sequence
| command
| control_structure '|' pipe_sequence
| control_structure
control_structure :: for_expr
| if_expr