mirror of
				https://github.com/koalaman/shellcheck.git
				synced 2025-10-31 22:52:50 +08:00 
			
		
		
		
	Added warning for fi }, and not for ) }
This commit is contained in:
		| @@ -1199,11 +1199,24 @@ readPattern = (readNormalWord `thenSkip` spacing) `sepBy1` (char '|' `thenSkip` | |||||||
|  |  | ||||||
| readCompoundCommand = do | readCompoundCommand = do | ||||||
|     id <- getNextId |     id <- getNextId | ||||||
|     cmd <- choice [ readBraceGroup, readArithmeticExpression, readSubshell, readCondition, readWhileClause, readUntilClause, readIfClause, readForClause, readCaseClause, readFunctionDefinition] |     -- This is all Bash specific. fi } fails, but ) } works. | ||||||
|  |     cmd <- do  | ||||||
|  |             x <- needsSeparator | ||||||
|  |             return (True, x) | ||||||
|  |           <|> do | ||||||
|  |             x <- noSeparator | ||||||
|  |             return (False, x) | ||||||
|     spacing |     spacing | ||||||
|     redirs <- many readIoRedirect |     redirs <- many readIoRedirect | ||||||
|     return $ T_Redirecting id redirs $ cmd |     when (fst cmd) $ optional $ do | ||||||
|  |         try . lookAhead $ (spacing >> g_Rbrace) | ||||||
|  |         parseProblem WarningC "Bash requires semicolon or linefeed before the } here." | ||||||
|  |  | ||||||
|  |     return $ T_Redirecting id redirs $ snd cmd | ||||||
|  |  | ||||||
|  |   where | ||||||
|  |         needsSeparator = choice [ readArithmeticExpression, readCondition, readWhileClause, readUntilClause, readIfClause, readForClause, readCaseClause] | ||||||
|  |         noSeparator = choice [ readBraceGroup, readSubshell, readFunctionDefinition] | ||||||
|  |  | ||||||
| readCompoundList = readTerm | readCompoundList = readTerm | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user