summaryrefslogtreecommitdiff
path: root/src/Parser/Shell.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Parser/Shell.hs')
-rw-r--r--src/Parser/Shell.hs22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/Parser/Shell.hs b/src/Parser/Shell.hs
index ffc8cf1..b575842 100644
--- a/src/Parser/Shell.hs
+++ b/src/Parser/Shell.hs
@@ -71,9 +71,29 @@ parseTextArgument = lexeme $ fmap (App AnnNone (Pure T.concat) <$> foldr (liftA2
[ char ' ' >> return " "
]
+parseRedirection :: TestParser (Expr ShellArgument)
+parseRedirection = choice
+ [ do
+ osymbol "<"
+ fmap ShellRedirectStdin <$> parseTextArgument
+ , do
+ osymbol ">"
+ fmap (ShellRedirectStdout False) <$> parseTextArgument
+ , do
+ osymbol ">>"
+ fmap (ShellRedirectStdout True) <$> parseTextArgument
+ , do
+ osymbol "2>"
+ fmap (ShellRedirectStderr False) <$> parseTextArgument
+ , do
+ osymbol "2>>"
+ fmap (ShellRedirectStderr True) <$> parseTextArgument
+ ]
+
parseArgument :: TestParser (Expr ShellArgument)
parseArgument = choice
- [ fmap ShellArgument <$> parseTextArgument
+ [ parseRedirection
+ , fmap ShellArgument <$> parseTextArgument
]
parseArguments :: TestParser (Expr [ ShellArgument ])