From a73d898bd8b90d2cccc84be4fb35901231c90fac Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Fri, 30 Nov 2012 15:16:20 -0800 Subject: [PATCH] Added warning for { if :; then :; fi > cow } --- ShellCheck/Parser.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ShellCheck/Parser.hs b/ShellCheck/Parser.hs index 00a84f8..ca85ec0 100644 --- a/ShellCheck/Parser.hs +++ b/ShellCheck/Parser.hs @@ -1202,8 +1202,14 @@ readCompoundCommand = do cmd <- choice [ readBraceGroup, readArithmeticExpression, readSubshell, readCondition, readWhileClause, readUntilClause, readIfClause, readForClause, readCaseClause, readFunctionDefinition] spacing redirs <- many readIoRedirect + when (not . null $ redirs) $ optional $ do + lookAhead $ try (spacing >> needsSeparator) + parseProblem WarningC "Bash requires ; or \\n here, after redirecting nested compound commands." return $ T_Redirecting id redirs $ cmd + where + needsSeparator = choice [ g_Then, g_Else, g_Elif, g_Fi, g_Do, g_Done, g_Esac, g_Rbrace ] + readCompoundList = readTerm