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

Shell: Add the (now) free subshell support

This commit is contained in:
AnotherTest 2020-09-08 15:59:07 +04:30 committed by Andreas Kling
parent 0fd8d5ad3d
commit b194d79c53
4 changed files with 92 additions and 0 deletions

View file

@ -53,6 +53,7 @@ private:
RefPtr<AST::Node> parse_control_structure();
RefPtr<AST::Node> parse_for_loop();
RefPtr<AST::Node> parse_if_expr();
RefPtr<AST::Node> parse_subshell();
RefPtr<AST::Node> parse_redirection();
RefPtr<AST::Node> parse_list_expression();
RefPtr<AST::Node> parse_expression();
@ -129,6 +130,8 @@ pipe_sequence :: command '|' pipe_sequence
control_structure :: for_expr
| if_expr
| subshell
for_expr :: 'for' ws+ (identifier ' '+ 'in' ws*)? expression ws+ '{' toplevel '}'
if_expr :: 'if' ws+ or_logical_sequence ws+ '{' toplevel '}' else_clause?
@ -136,6 +139,8 @@ if_expr :: 'if' ws+ or_logical_sequence ws+ '{' toplevel '}' else_clause?
else_clause :: else '{' toplevel '}'
| else if_expr
subshell :: '{' toplevel '}'
command :: redirection command
| list_expression command?