From 21262399cc1848cf3d85217879e0d12b7a343565 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sun, 25 Nov 2012 00:42:59 -0800 Subject: [PATCH] Added a check for spurious }s --- ShellCheck/Parser.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ShellCheck/Parser.hs b/ShellCheck/Parser.hs index fa5d715..16712c4 100644 --- a/ShellCheck/Parser.hs +++ b/ShellCheck/Parser.hs @@ -450,8 +450,15 @@ prop_readNormalWord2 = isOk readNormalWord "foo**(foo)!!!(@@(bar))" readNormalWord = do id <- getNextId x <- many1 readNormalWordPart + checkPossibleTermination x return $ T_NormalWord id x + +checkPossibleTermination [T_Literal _ "}"] = + parseProblem WarningC "If you meant to terminate a {} block, you need a semicolon or linefeed before the }." +checkPossibleTermination _ = return () + + readNormalWordPart = readSingleQuoted <|> readDoubleQuoted <|> readExtglob <|> readDollar <|> readBraced <|> readBackTicked <|> (readNormalLiteral) readSpacePart = do id <- getNextId