summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compiler.hs
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2014-10-22 15:45:52 +0000
committerhallgren <hallgren@chalmers.se>2014-10-22 15:45:52 +0000
commit6ee67cd04ffbce375d7f10e74a5d9eb742d6428d (patch)
treefa90c0a4d72b30bbe486db51b2ebab81c0767fe9 /src/compiler/GF/Compiler.hs
parent00922153aa1f94754847f60a959f3849dfc4771b (diff)
Various small changes for improved documentation
Diffstat (limited to 'src/compiler/GF/Compiler.hs')
-rw-r--r--src/compiler/GF/Compiler.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/compiler/GF/Compiler.hs b/src/compiler/GF/Compiler.hs
index d8692c681..d92ed387c 100644
--- a/src/compiler/GF/Compiler.hs
+++ b/src/compiler/GF/Compiler.hs
@@ -49,10 +49,14 @@ compileSourceFiles opts fs =
linkGrammars opts output
where
batchCompile = maybe batchCompile' parallelBatchCompile (flag optJobs opts)
- batchCompile' opts fs = do (cnc,t,gr) <- S.batchCompile opts fs
- return (t,[(cnc,gr)])
-
--- | Create a @.pgf@ file from the output of 'parallelBatchCompile'.
+ batchCompile' opts fs = do (t,cnc_gr) <- S.batchCompile opts fs
+ return (t,[cnc_gr])
+
+-- | Create a @.pgf@ file (and possibly files in other formats, if specified
+-- in the 'Options') from the output of 'parallelBatchCompile'.
+-- If a @.pgf@ file by the same name already exists and it is newer than the
+-- source grammar files (as indicated by the 'UTCTime' argument), it is not
+-- recreated.
linkGrammars opts (t_src,~cnc_grs@(~(cnc,gr):_)) =
do let abs = render (srcAbsName gr cnc)
pgfFile = outputPath opts (grammarName' opts abs<.>"pgf")
@@ -61,8 +65,7 @@ linkGrammars opts (t_src,~cnc_grs@(~(cnc,gr):_)) =
else return Nothing
if t_pgf >= Just t_src
then putIfVerb opts $ pgfFile ++ " is up-to-date."
- else do pgfs <- mapM (link opts)
- [(cnc,t_src,gr)|(cnc,gr)<-cnc_grs]
+ else do pgfs <- mapM (link opts) cnc_grs
let pgf = foldl1 unionPGF pgfs
writePGF opts pgf
writeOutputs opts pgf