diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2021-03-05 16:33:23 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-07 10:59:51 +0100 |
commit | a45b2ea6fb1917de9c2833764f3acf0cdf4e7eab (patch) | |
tree | 3bcef2fc5b6c49796f8de6215d5244ba5f4ec5e1 /Userland/Shell/NodeVisitor.cpp | |
parent | a303b69caa74c6c2dbf44a851ea2eb46caf98678 (diff) | |
download | serenity-a45b2ea6fb1917de9c2833764f3acf0cdf4e7eab.zip |
Shell: Add support for 'immediate' expressions as variable substitutions
This commit adds a few basic variable substitution operations:
- length
Find the length of a string or a list
- length_across
Find the lengths of things inside a list
- remove_{suffix,prefix}
Remove a suffix or a prefix from all the passed values
- regex_replace
Replace all matches of a given regex with a given template
- split
Split the given string with the given delimiter (or to its
code points if the delimiter is empty)
- concat_lists
concatenates any given lists into one
Closes #4316 (the ancient version of this same feature)
Diffstat (limited to 'Userland/Shell/NodeVisitor.cpp')
-rw-r--r-- | Userland/Shell/NodeVisitor.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Shell/NodeVisitor.cpp b/Userland/Shell/NodeVisitor.cpp index b4edd8426b..c84094c860 100644 --- a/Userland/Shell/NodeVisitor.cpp +++ b/Userland/Shell/NodeVisitor.cpp @@ -139,6 +139,12 @@ void NodeVisitor::visit(const AST::IfCond* node) node->false_branch()->visit(*this); } +void NodeVisitor::visit(const AST::ImmediateExpression* node) +{ + for (auto& node : node->arguments()) + node.visit(*this); +} + void NodeVisitor::visit(const AST::Join* node) { node->left()->visit(*this); @@ -224,6 +230,10 @@ void NodeVisitor::visit(const AST::SyntaxError*) { } +void NodeVisitor::visit(const AST::SyntheticNode*) +{ +} + void NodeVisitor::visit(const AST::Tilde*) { } |