From 0d1a34a291ed3787f261986b026129b267d2d4bf Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Mon, 23 Jul 2018 16:18:35 -0400 Subject: [PATCH] Fix #949 (failing on @ in function names) '@' was previously mentioned in 5005dc0fa1 as a character needed to fix #909, but was not included in the actual change at that time. --- src/ShellCheck/Parser.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ShellCheck/Parser.hs b/src/ShellCheck/Parser.hs index 1255d7e..e072183 100644 --- a/src/ShellCheck/Parser.hs +++ b/src/ShellCheck/Parser.hs @@ -66,7 +66,7 @@ doubleQuote = char '"' variableStart = upper <|> lower <|> oneOf "_" variableChars = upper <|> lower <|> digit <|> oneOf "_" -- Chars to allow in function names -functionChars = variableChars <|> oneOf ":+?-./^" +functionChars = variableChars <|> oneOf ":+?-./^@" -- Chars to allow in functions using the 'function' keyword extendedFunctionChars = functionChars <|> oneOf "[]*=!" specialVariable = oneOf "@*#?-$!" @@ -2499,6 +2499,7 @@ prop_readFunctionDefinition9 = isOk readFunctionDefinition "function foo { true; prop_readFunctionDefinition10= isOk readFunctionDefinition "function foo () { true; }" prop_readFunctionDefinition11= isWarning readFunctionDefinition "function foo{\ntrue\n}" prop_readFunctionDefinition12= isOk readFunctionDefinition "function []!() { true; }" +prop_readFunctionDefinition13= isOk readFunctionDefinition "@require(){ true; }" readFunctionDefinition = called "function" $ do start <- startSpan functionSignature <- try readFunctionSignature