Skip to content

Commit

Permalink
Simplify getParseOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
josephcsible committed Dec 14, 2024
1 parent 7deb7e8 commit d3001f3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ShellCheck/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 it does not match the string, return Left [ParseProblems]
getParseOutput parser string = runIdentity $ do
(res, sys) <- runParser testEnvironment
(parser >> eof >> getState) "-" string
case (res, sys) of
(Right userState, systemState) ->
return $ Right $ parseNotes userState ++ parseProblems systemState
(Left _, systemState) -> return $ Left $ parseProblems systemState
(res, systemState) <- runParser testEnvironment
(parser >> eof >> getState) "-" string
return $ case res of
Right userState ->
Right $ parseNotes userState ++ parseProblems systemState
Left _ -> Left $ parseProblems systemState

-- If the parser matches the string, return Just whether it was clean (without emitting suggestions)
-- Otherwise, Nothing
Expand Down

0 comments on commit d3001f3

Please sign in to comment.