From 1011ae7b3ca5002bd1f331f6bee389e632dd00ae Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sun, 24 Nov 2013 18:49:49 -0800 Subject: [PATCH] Fixed incorrect parsing of [ foo -a -f bar ] --- ShellCheck/Parser.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ShellCheck/Parser.hs b/ShellCheck/Parser.hs index 8220dc4..94536ee 100644 --- a/ShellCheck/Parser.hs +++ b/ShellCheck/Parser.hs @@ -255,6 +255,7 @@ readConditionContents single = do otherOp = try $ do id <- getNextId s <- readOp + when (s == "-a" || s == "-o") $ fail "Wrong operator" return $ TC_Binary id typ s readCondUnaryExp = do @@ -303,7 +304,6 @@ readConditionContents single = do softCondSpacing return $ TC_And id typ x - readCondOrOp = do id <- getNextId x <- try (string "||" <|> string "-o") @@ -584,6 +584,7 @@ prop_readCondition5b= isOk readCondition "[[ $c =~ f( ($var ]]) )* ]]" prop_readCondition6 = isOk readCondition "[[ $c =~ ^[yY]$ ]]" prop_readCondition7 = isOk readCondition "[[ ${line} =~ ^[[:space:]]*# ]]" prop_readCondition8 = isOk readCondition "[[ $l =~ ogg|flac ]]" +prop_readCondition9 = isOk readCondition "[ foo -a -f bar ]" readCondition = called "test expression" $ do opos <- getPosition id <- getNextId