mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-06 04:51:37 -07:00
Simplify getParseOutput
This commit is contained in:
parent
7deb7e853b
commit
d3001f337a
1 changed files with 6 additions and 6 deletions
|
@ -3451,12 +3451,12 @@ isNotOk p s = parsesCleanly p s == Nothing -- The string does not parse
|
||||||
-- If the parser matches the string, return Right [ParseNotes+ParseProblems]
|
-- If the parser matches the string, return Right [ParseNotes+ParseProblems]
|
||||||
-- If it does not match the string, return Left [ParseProblems]
|
-- If it does not match the string, return Left [ParseProblems]
|
||||||
getParseOutput parser string = runIdentity $ do
|
getParseOutput parser string = runIdentity $ do
|
||||||
(res, sys) <- runParser testEnvironment
|
(res, systemState) <- runParser testEnvironment
|
||||||
(parser >> eof >> getState) "-" string
|
(parser >> eof >> getState) "-" string
|
||||||
case (res, sys) of
|
return $ case res of
|
||||||
(Right userState, systemState) ->
|
Right userState ->
|
||||||
return $ Right $ parseNotes userState ++ parseProblems systemState
|
Right $ parseNotes userState ++ parseProblems systemState
|
||||||
(Left _, systemState) -> return $ Left $ parseProblems systemState
|
Left _ -> Left $ parseProblems systemState
|
||||||
|
|
||||||
-- If the parser matches the string, return Just whether it was clean (without emitting suggestions)
|
-- If the parser matches the string, return Just whether it was clean (without emitting suggestions)
|
||||||
-- Otherwise, Nothing
|
-- Otherwise, Nothing
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue