diff options
-rw-r--r-- | src/parse/ast.rs | 7 | ||||
-rw-r--r-- | src/shell.pest | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/parse/ast.rs b/src/parse/ast.rs index 37e7fe0..4c65c6a 100644 --- a/src/parse/ast.rs +++ b/src/parse/ast.rs @@ -242,7 +242,12 @@ impl Redirect { super::Direction::Out | super::Direction::Append => 1, } } else { - from.parse().unwrap() + match from { + "in" => 0, + "out" => 1, + "err" => 2, + _ => from.parse().unwrap(), + } }; Self { from, to, dir } } diff --git a/src/shell.pest b/src/shell.pest index 4c5f728..dc3f247 100644 --- a/src/shell.pest +++ b/src/shell.pest @@ -14,7 +14,9 @@ var = @{ ("${" ~ (!"}" ~ ANY)+ ~ "}") } -redir_prefix = @{ ASCII_DIGIT* ~ (">>" | ">" | "<") ~ WHITESPACE* } +redir_prefix = @{ + ("in" | "out" | "err" | ASCII_DIGIT*) ~ (">>" | ">" | "<") ~ WHITESPACE* +} bareword = @{ bareword_char+ } single_string = @{ single_string_char+ } double_string = @{ double_string_char+ } |