summaryrefslogtreecommitdiffstats
path: root/src/shell.pest
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-22 20:46:44 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-22 20:46:44 -0500
commit9b82f429e3c6a1d4414fbc93db0b5425e3955d5f (patch)
treea914bec6136cf9d5045d0fd89c97cc2321b14ba0 /src/shell.pest
parent6e9ba966a1fd097196394f00c43eca15ac571843 (diff)
downloadnbsh-9b82f429e3c6a1d4414fbc93db0b5425e3955d5f.tar.gz
nbsh-9b82f429e3c6a1d4414fbc93db0b5425e3955d5f.zip
allow running multiple commands separated by semicolons
Diffstat (limited to 'src/shell.pest')
-rw-r--r--src/shell.pest18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/shell.pest b/src/shell.pest
index f1f39ab..49a84b4 100644
--- a/src/shell.pest
+++ b/src/shell.pest
@@ -1,17 +1,11 @@
-char = { ASCII_ALPHANUMERIC }
-
+char = @{ !("|" | ";" | WHITESPACE) ~ ANY }
word = @{ char+ }
-exe = { word+ }
-
-and = { "&&" ~ command }
-or = { "||" ~ command }
-both = { ";" ~ command }
-pipe = { "|" ~ command }
-
-command = { exe ~ (and | or | both | pipe)? }
+exe = { word+ }
+pipeline = { exe ~ ("|" ~ exe)* }
+commands = { pipeline ~ (";" ~ pipeline)* }
-line = { SOI ~ command ~ EOI }
+line = { SOI ~ commands ~ EOI }
-WHITESPACE = _{ " " }
+WHITESPACE = _{ (" " | "\t" | "\n") }
COMMENT = _{ "#" ~ ANY* }