Fixed parsing for cmd &> file
This commit is contained in:
parent
f3c8ce3e3d
commit
3b246f94a3
|
@ -969,13 +969,14 @@ readIoFile = called "redirection" $ do
|
||||||
return $ T_FdRedirect id "" $ T_IoFile id op file
|
return $ T_FdRedirect id "" $ T_IoFile id op file
|
||||||
|
|
||||||
readIoNumber = try $ do
|
readIoNumber = try $ do
|
||||||
x <- many1 digit
|
x <- many1 digit <|> string "&"
|
||||||
lookAhead readIoFileOp
|
lookAhead readIoFileOp
|
||||||
return x
|
return x
|
||||||
|
|
||||||
prop_readIoNumberRedirect = isOk readIoNumberRedirect "3>&2"
|
prop_readIoNumberRedirect = isOk readIoNumberRedirect "3>&2"
|
||||||
prop_readIoNumberRedirect2 = isOk readIoNumberRedirect "2> lol"
|
prop_readIoNumberRedirect2 = isOk readIoNumberRedirect "2> lol"
|
||||||
prop_readIoNumberRedirect3 = isOk readIoNumberRedirect "4>&-"
|
prop_readIoNumberRedirect3 = isOk readIoNumberRedirect "4>&-"
|
||||||
|
prop_readIoNumberRedirect4 = isOk readIoNumberRedirect "&> lol"
|
||||||
readIoNumberRedirect = do
|
readIoNumberRedirect = do
|
||||||
id <- getNextId
|
id <- getNextId
|
||||||
n <- readIoNumber
|
n <- readIoNumber
|
||||||
|
@ -1004,6 +1005,7 @@ prop_roflol = isWarning readScript "a &; b"
|
||||||
prop_roflol2 = isOk readScript "a & b"
|
prop_roflol2 = isOk readScript "a & b"
|
||||||
readSeparatorOp = do
|
readSeparatorOp = do
|
||||||
notFollowedBy2 (g_AND_IF <|> g_DSEMI)
|
notFollowedBy2 (g_AND_IF <|> g_DSEMI)
|
||||||
|
notFollowedBy2 (string "&>")
|
||||||
f <- (try $ do
|
f <- (try $ do
|
||||||
char '&'
|
char '&'
|
||||||
spacing
|
spacing
|
||||||
|
@ -1032,6 +1034,7 @@ makeSimpleCommand id1 id2 tokens =
|
||||||
in T_Redirecting id1 redirections $ T_SimpleCommand id2 assignment rest2
|
in T_Redirecting id1 redirections $ T_SimpleCommand id2 assignment rest2
|
||||||
|
|
||||||
prop_readSimpleCommand = isOk readSimpleCommand "echo test > file"
|
prop_readSimpleCommand = isOk readSimpleCommand "echo test > file"
|
||||||
|
prop_readSimpleCommand2 = isOk readSimpleCommand "cmd &> file"
|
||||||
readSimpleCommand = called "simple command" $ do
|
readSimpleCommand = called "simple command" $ do
|
||||||
id1 <- getNextId
|
id1 <- getNextId
|
||||||
id2 <- getNextId
|
id2 <- getNextId
|
||||||
|
|
Loading…
Reference in New Issue