File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed
Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ commandParser = commandParser0 eof
8080
8181commandParser0 :: Parser () -> Parser ReplCommand
8282commandParser0 endParser =
83- alias <|> logCommand <|> commandParserExceptAlias endParser <|> tryAlias
83+ alias <|> logCommand <|> commandParserExceptAlias endParser
8484
8585commandParserExceptAlias :: Parser () -> Parser ReplCommand
8686commandParserExceptAlias endParser = do
@@ -121,6 +121,7 @@ nonRecursiveCommand =
121121 , loadScript
122122 , proofStatus
123123 , exit
124+ , tryAlias
124125 ]
125126
126127pipeWith
@@ -407,7 +408,7 @@ tryAlias :: Parser ReplCommand
407408tryAlias = do
408409 name <- some (noneOf [' ' ]) <* Char. space
409410 arguments <- many
410- (QuotedArgument <$> quotedWord <|> SimpleArgument <$> wordWithout " " )
411+ (QuotedArgument <$> quotedWord <|> SimpleArgument <$> wordWithout " |> " )
411412 return . TryAlias $ ReplAlias { name, arguments }
412413
413414infixr 2 <$$>
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ test_replParser =
7070 , loadScriptTests `tests` " load file"
7171 , initScriptTests `testsScript` " repl script"
7272 , aliasesWithArgs `tests` " aliases with arguments"
73+ , aliasRedirectionTests `tests` " alias with redirection"
7374 , proofStatus `tests` " proof-status"
7475 , logTests `tests` " log"
7576 , debugAttemptEquationTests `tests` " debug-attempt-equation"
@@ -454,6 +455,38 @@ aliasesWithArgs =
454455 alias name arguments command =
455456 Alias $ AliasDefinition { name, arguments, command }
456457
458+ aliasRedirectionTests :: [ParserTest ReplCommand ]
459+ aliasRedirectionTests =
460+ [ parsesTo_
461+ " myAlias > file"
462+ ( Redirect
463+ ( TryAlias
464+ ReplAlias {name = " myAlias" , arguments = [] }
465+ )
466+ " file"
467+ )
468+ , parsesTo_
469+ " myAlias >> file"
470+ ( AppendTo
471+ ( TryAlias
472+ ReplAlias {name = " myAlias" , arguments = [] }
473+ )
474+ " file"
475+ )
476+ , parsesTo_
477+ " myAlias | script > file"
478+ ( Redirect
479+ ( Pipe
480+ ( TryAlias
481+ ReplAlias {name = " myAlias" , arguments = [] }
482+ )
483+ " script"
484+ []
485+ )
486+ " file"
487+ )
488+ ]
489+
457490loadScriptTests :: [ParserTest ReplCommand ]
458491loadScriptTests =
459492 [ " load file" `parsesTo_` LoadScript " file"
You can’t perform that action at this time.
0 commit comments