Simplify getParseOutput

This commit is contained in:
Joseph C. Sible 2024-12-13 23:57:50 -05:00
parent 7deb7e853b
commit d3001f337a
1 changed files with 6 additions and 6 deletions

View File

@ -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