From 9b82f429e3c6a1d4414fbc93db0b5425e3955d5f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 22 Dec 2021 20:46:44 -0500 Subject: allow running multiple commands separated by semicolons --- src/shell.pest | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/shell.pest') 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* } -- cgit v1.2.3-54-g00ecf