diff --git a/src/ShellCheck/Parser.hs b/src/ShellCheck/Parser.hs index 17107ba..d884a7b 100644 --- a/src/ShellCheck/Parser.hs +++ b/src/ShellCheck/Parser.hs @@ -70,8 +70,10 @@ variableChars = upper <|> lower <|> digit <|> oneOf "_" functionStartChars = variableChars <|> oneOf ":+?-./^@," -- Chars to allow inside function names functionChars = variableChars <|> oneOf "#:+?-./^@," +-- Chars to allow function names to start with, using the 'function' keyword +extendedFunctionStartChars = functionStartChars <|> oneOf "[]*=!" -- Chars to allow in functions using the 'function' keyword -extendedFunctionChars = functionChars <|> oneOf "[]*=!" +extendedFunctionChars = extendedFunctionStartChars <|> oneOf "[]*=!" specialVariable = oneOf (concat specialVariables) paramSubSpecialChars = oneOf "/:+-=%" quotableChars = "|&;<>()\\ '\t\n\r\xA0" ++ doubleQuotableChars @@ -2770,7 +2772,7 @@ readFunctionDefinition = called "function" $ do string "function" whitespace spacing - name <- (:) <$> functionStartChars <*> many extendedFunctionChars + name <- (:) <$> extendedFunctionStartChars <*> many extendedFunctionChars spaces <- spacing hasParens <- wasIncluded readParens when (not hasParens && null spaces) $