diff --git a/ShellCheck/Parser.hs b/ShellCheck/Parser.hs index 89b54f04b0974f9f89c25efe395062c6d7780c89..4be7b7f704262018b18a4b866b444a48bca9fe7c 100644 --- a/ShellCheck/Parser.hs +++ b/ShellCheck/Parser.hs @@ -2582,11 +2582,14 @@ tryParseWordToken keyword t = try $ do str <- anycaseString keyword optional $ do - try . lookAhead $ char '[' - parseProblem ErrorC 1069 "You need a space before the [." - optional $ do - try . lookAhead $ char '#' - parseProblem ErrorC 1099 "You need a space before the #." + c <- try . lookAhead $ anyChar + let warning code = parseProblem ErrorC code $ "You need a space before the " ++ [c] ++ "." + case c of + '[' -> warning 1069 + '#' -> warning 1099 + '!' -> warning 1129 + ':' -> warning 1130 + _ -> return () lookAhead keywordSeparator when (str /= keyword) $