Fix extendedFunction definition

This commit is contained in:
Adrian Fluturel 2024-12-31 05:01:18 +01:00
parent 34b03040d9
commit ad1d5fa64f
1 changed files with 4 additions and 2 deletions

View File

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