summaryrefslogtreecommitdiff
path: root/Shell/Parser.cpp
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-06-22 00:30:14 +0430
committerAndreas Kling <kling@serenityos.org>2020-07-05 15:43:14 +0200
commit42304d7bf1bf8b447b05018df7dee325f7a42e52 (patch)
tree3d8b0a9a728d952ed790b5d56ae9abc20c8c7763 /Shell/Parser.cpp
parent8e078cf4ab4d6834fbd9254384aae592fffc7da1 (diff)
downloadserenity-42304d7bf1bf8b447b05018df7dee325f7a42e52.zip
Shell: Parse a pipe sequence inside $(...)
Diffstat (limited to 'Shell/Parser.cpp')
-rw-r--r--Shell/Parser.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/Shell/Parser.cpp b/Shell/Parser.cpp
index caed8a1d61..7e715cf416 100644
--- a/Shell/Parser.cpp
+++ b/Shell/Parser.cpp
@@ -633,18 +633,24 @@ RefPtr<AST::Node> Parser::parse_evaluate()
return nullptr;
consume();
+ if (peek() == '(') {
+ consume();
+ auto inner = parse_pipe_sequence();
+ if (!inner || !expect(')'))
+ inner = create<AST::SyntaxError>();
+ else
+ inner = create<AST::Execute>(move(inner), true);
+ return inner;
+ }
auto inner = parse_expression();
if (!inner) {
inner = create<AST::SyntaxError>();
} else {
if (inner->is_list()) {
- auto execute_inner = create<AST::Execute>(move(inner));
- execute_inner->capture_stdout();
+ auto execute_inner = create<AST::Execute>(move(inner), true);
inner = execute_inner;
} else {
- // Trying to evaluate something other than a list
- // FIXME: This bit be dynamic, what do?
auto dyn_inner = create<AST::DynamicEvaluate>(move(inner));
inner = dyn_inner;
}