summaryrefslogtreecommitdiffstats
path: root/src/shell.pest
diff options
context:
space:
mode:
Diffstat (limited to 'src/shell.pest')
-rw-r--r--src/shell.pest12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/shell.pest b/src/shell.pest
index 1ff20c4..ffb0f42 100644
--- a/src/shell.pest
+++ b/src/shell.pest
@@ -1,6 +1,12 @@
-bareword_char = @{ !("|" | ";" | "\"" | "'" | WHITESPACE | COMMENT) ~ ANY }
-single_string_char = @{ "\\'" | (!"'" ~ ANY) }
-double_string_char = @{ "\\\"" | (!"\"" ~ ANY) }
+basic_escape_char = @{ "\\\\" | "\\'" }
+escape_char = @{ "\\" ~ ANY }
+
+bareword_char = @{
+ escape_char |
+ !("|" | ";" | "\"" | "'" | WHITESPACE | COMMENT) ~ ANY
+}
+single_string_char = @{ basic_escape_char | (!"'" ~ ANY) }
+double_string_char = @{ escape_char | (!"\"" ~ ANY) }
redir_prefix = @{ ASCII_DIGIT* ~ (">>" | ">" | "<") ~ WHITESPACE* }
bareword = @{ bareword_char+ }