Skip to content

Commit

Permalink
better error handling when there are parsing issues when building mak…
Browse files Browse the repository at this point in the history
…e file graph
  • Loading branch information
dorchard committed Aug 15, 2024
1 parent 8eaa50f commit 3a2ca1d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Language/Fortran/Analysis/ModGraph.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,16 @@ genModGraph mversion includeDirs cppOpts paths = do
let version = fromMaybe (deduceFortranVersion path) mversion
mods = map snd fileMods
parserF0 = Parser.byVerWithMods mods version
parserF fn bs = fromRight' $ parserF0 fn bs
parserF fn bs =
case parserF0 fn bs of
Right x -> return x
Left err -> do
error $ show err
forM_ fileMods $ \ (fileName, mod) -> do
forM_ [ name | Named name <- M.keys (combinedModuleMap [mod]) ] $ \ name -> do
_ <- maybeAddModName name . Just $ MOFSMod fileName
pure ()
let pf = parserF path contents
pf <- parserF path contents
mapM_ (perModule path) (childrenBi pf :: [ProgramUnit ()])
pure ()
execStateT (mapM_ iter paths) modGraph0
Expand Down

0 comments on commit 3a2ca1d

Please sign in to comment.