Commit b0e74ee0 authored by Andrew Gibiansky's avatar Andrew Gibiansky

Merge pull request #408 from gibiansky/show-all-parse-errors

Fix #386: always print parse errors
parents b428310a 1adbce06
......@@ -79,10 +79,6 @@ import Data.Version (versionBranch)
data ErrorOccurred = Success | Failure deriving (Show, Eq)
-- | Enable debugging output
debug :: Bool
debug = False
-- | Set GHC's verbosity for debugging
ghcVerbosity :: Maybe Int
ghcVerbosity = Nothing -- Just 5
......@@ -257,12 +253,27 @@ evaluate kernelState code output = do
cmds <- parseString (cleanString code)
let execCount = getExecutionCounter kernelState
-- Extract all parse errors.
let justError x@ParseError{} = Just x
justError _ = Nothing
errs = mapMaybe (justError . unloc) cmds
updated <- case errs of
-- Only run things if there are no parse errors.
[] -> do
when (getLintStatus kernelState /= LintOff) $ liftIO $ do
lintSuggestions <- lint cmds
unless (noResults lintSuggestions) $
output $ FinalResult lintSuggestions "" []
updated <- runUntilFailure kernelState (map unloc cmds ++ [storeItCommand execCount])
runUntilFailure kernelState (map unloc cmds ++ [storeItCommand execCount])
-- Print all parse errors.
errs -> do
forM_ errs $ \err -> do
out <- evalCommand output err kernelState
liftIO $ output $ FinalResult (evalResult out) "" []
return kernelState
return updated {
getExecutionCounter = execCount + 1
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment