From 6e9ba966a1fd097196394f00c43eca15ac571843 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 22 Dec 2021 02:57:56 -0500 Subject: start writing a parser --- src/shell.pest | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/shell.pest (limited to 'src/shell.pest') diff --git a/src/shell.pest b/src/shell.pest new file mode 100644 index 0000000..f1f39ab --- /dev/null +++ b/src/shell.pest @@ -0,0 +1,17 @@ +char = { ASCII_ALPHANUMERIC } + +word = @{ char+ } + +exe = { word+ } + +and = { "&&" ~ command } +or = { "||" ~ command } +both = { ";" ~ command } +pipe = { "|" ~ command } + +command = { exe ~ (and | or | both | pipe)? } + +line = { SOI ~ command ~ EOI } + +WHITESPACE = _{ " " } +COMMENT = _{ "#" ~ ANY* } -- cgit v1.2.3-54-g00ecf