Skip to content

Commit

Permalink
improve error reporting if syntax error with mod file
Browse files Browse the repository at this point in the history
  • Loading branch information
dorchard committed Sep 3, 2024
1 parent a21e146 commit 04c497a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,12 @@ compileFileToMod mvers mods path moutfile = do
mmap = combinedModuleMap mods
tenv = combinedTypeEnv mods
runCompile = genModFile . fst . analyseTypesWithEnv tenv . analyseRenamesWithModuleMap mmap . initAnalysis
parsedPF = fromRight' $ (Parser.byVerWithMods mods version) path contents
mod = runCompile parsedPF
parsedPF <-
case (Parser.byVerWithMods mods version) path contents of
Right pf -> return pf
Left err -> do
fail $ "Error parsing " ++ path ++ ": " ++ show err
let mod = runCompile parsedPF
fspath = path -<.> modFileSuffix `fromMaybe` moutfile
LB.writeFile fspath $ encodeModFile [mod]
return mod
Expand Down
1 change: 0 additions & 1 deletion src/Language/Fortran/Analysis/ModGraph.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import Data.Data
import Data.Generics.Uniplate.Data
import Data.Graph.Inductive hiding (version)
import Data.Maybe
import Data.Either.Combinators ( fromRight' )
import qualified Data.Map as M

--------------------------------------------------
Expand Down

0 comments on commit 04c497a

Please sign in to comment.