summaryrefslogtreecommitdiffstats
path: root/src/shell.pest
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-01-17 01:19:08 -0500
committerJesse Luehrs <doy@tozt.net>2022-01-17 01:23:08 -0500
commit9b1595b795121d233cd0cf32537661839e318914 (patch)
tree26edb4376ed189373e8a4f3b3d41da6c27d23bf4 /src/shell.pest
parent1327c2a7ba3b81fe69e4126270b2cfe24c8aa4ee (diff)
downloadnbsh-9b1595b795121d233cd0cf32537661839e318914.tar.gz
nbsh-9b1595b795121d233cd0cf32537661839e318914.zip
basic subshell implementation
Diffstat (limited to 'src/shell.pest')
-rw-r--r--src/shell.pest6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/shell.pest b/src/shell.pest
index 8a51070..fdfb1b1 100644
--- a/src/shell.pest
+++ b/src/shell.pest
@@ -3,7 +3,8 @@ escape_char = @{ "\\" ~ ANY }
bareword_char = @{
escape_char |
- !("|" | ";" | "\"" | "'" | "$" | "{" | WHITESPACE | COMMENT) ~ ANY
+ !("|" | ";" | "\"" | "'" | "$" | "{" | "(" | ")" | WHITESPACE | COMMENT)
+ ~ ANY
}
single_string_char = @{ basic_escape_char | (!"'" ~ ANY) }
double_string_char = @{ escape_char | (!("\"" | "$") ~ ANY) }
@@ -44,8 +45,9 @@ word = ${ word_part+ }
word_or_redirect = ${ redir_prefix? ~ word }
exe = ${ word_or_redirect ~ (w ~ word_or_redirect)* }
+subshell = ${ "(" ~ w? ~ commands ~ w? ~ ")" }
list = ${ word ~ (w ~ word)* }
-pipeline = ${ exe ~ (w? ~ "|" ~ w? ~ exe)* }
+pipeline = ${ (subshell | exe) ~ (w? ~ "|" ~ w? ~ (subshell | exe))* }
control_if = ${ "if" ~ w ~ pipeline }
control_while = ${ "while" ~ w ~ pipeline }