mirror of
https://github.com/koalaman/shellcheck
synced 2025-08-19 13:00:54 -07:00
Parser: allow subshell function definitions
This commit is contained in:
parent
b936f28763
commit
5b4729d940
1 changed files with 3 additions and 2 deletions
|
@ -1508,12 +1508,13 @@ prop_readFunctionDefinition4 = isWarning readFunctionDefinition "foo(a, b) { tru
|
||||||
prop_readFunctionDefinition5 = isOk readFunctionDefinition ":(){ :|:;}"
|
prop_readFunctionDefinition5 = isOk readFunctionDefinition ":(){ :|:;}"
|
||||||
prop_readFunctionDefinition6 = isOk readFunctionDefinition "?(){ foo; }"
|
prop_readFunctionDefinition6 = isOk readFunctionDefinition "?(){ foo; }"
|
||||||
prop_readFunctionDefinition7 = isOk readFunctionDefinition "..(){ cd ..; }"
|
prop_readFunctionDefinition7 = isOk readFunctionDefinition "..(){ cd ..; }"
|
||||||
|
prop_readFunctionDefinition8 = isOk readFunctionDefinition "foo() (ls)"
|
||||||
readFunctionDefinition = called "function" $ do
|
readFunctionDefinition = called "function" $ do
|
||||||
id <- getNextId
|
id <- getNextId
|
||||||
name <- try readFunctionSignature
|
name <- try readFunctionSignature
|
||||||
allspacing
|
allspacing
|
||||||
(disregard (lookAhead $ char '{') <|> parseProblem ErrorC 1064 "Expected a { to open the function definition.")
|
(disregard (lookAhead $ oneOf "{(") <|> parseProblem ErrorC 1064 "Expected a { to open the function definition.")
|
||||||
group <- readBraceGroup
|
group <- readBraceGroup <|> readSubshell
|
||||||
return $ T_Function id name group
|
return $ T_Function id name group
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue