From 899d9eb44529fdfd6de3301f69b6295765e269f3 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Tue, 5 Feb 2013 20:35:39 -0800 Subject: [PATCH] Warn against open parenthesis in normal words --- ShellCheck/Parser.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ShellCheck/Parser.hs b/ShellCheck/Parser.hs index 9be910f..5741e1f 100644 --- a/ShellCheck/Parser.hs +++ b/ShellCheck/Parser.hs @@ -541,7 +541,17 @@ checkPossibleTermination pos [T_Literal _ x] = else return () checkPossibleTermination _ _ = return () -readNormalWordPart end = readSingleQuoted <|> readDoubleQuoted <|> readGlob <|> readDollar <|> readBraced <|> readBackTicked <|> readProcSub <|> (readNormalLiteral end) +readNormalWordPart end = do + checkForParenthesis + readSingleQuoted <|> readDoubleQuoted <|> readGlob <|> readDollar <|> readBraced <|> readBackTicked <|> readProcSub <|> (readNormalLiteral end) + where + checkForParenthesis = do + return () `attempting` do + pos <- getPosition + lookAhead $ char '(' + parseProblemAt pos ErrorC "'(' is invalid here. Did you forget to escape it?" + + readSpacePart = do id <- getNextId x <- many1 whitespace