mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
Haddock documentation: expose exportPGF, some other small improvements
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
-- | GF, the Grammatical Framework, as a library
|
||||
module GF(
|
||||
-- * Command line interface
|
||||
module GF.Main,
|
||||
@@ -7,6 +8,8 @@ module GF(
|
||||
-- * Compiling GF grammars
|
||||
module GF.Compile,
|
||||
module GF.CompileInParallel,
|
||||
-- module PF.Compile.Export, -- haddock does the wrong thing with this
|
||||
exportPGF,
|
||||
module GF.CompileOne,
|
||||
|
||||
-- * Abstract syntax, parsing, pretty printing and serialisation
|
||||
@@ -25,6 +28,7 @@ import GF.Interactive
|
||||
import GF.Compile
|
||||
import GF.CompileInParallel
|
||||
import GF.CompileOne
|
||||
import GF.Compile.Export(exportPGF)
|
||||
|
||||
import GF.Compile.GetGrammar
|
||||
import GF.Grammar.Grammar
|
||||
|
||||
@@ -25,6 +25,8 @@ import GF.Text.Pretty
|
||||
|
||||
-- top-level access to code generation
|
||||
|
||||
-- | Export a PGF to the given 'OutputFormat'. For many output formats,
|
||||
-- additional 'Options' can be used to control the output.
|
||||
exportPGF :: Options
|
||||
-> OutputFormat
|
||||
-> PGF
|
||||
|
||||
@@ -105,7 +105,7 @@ compileSourceModule opts cwd mb_gfFile gr =
|
||||
|
||||
-- Apply to complete modules when not generating tags
|
||||
backend mo3 =
|
||||
do mo4 <- runPassE id Optimize "optimizing" $ optimizeModule opts gr mo3
|
||||
do mo4 <- runPassE Optimize "optimizing" $ optimizeModule opts gr mo3
|
||||
if isModCnc (snd mo4) && flag optPMCFG opts
|
||||
then runPassI "generating PMCFG" $ generatePMCFG opts gr mb_gfFile mo4
|
||||
else runPassI "" $ return mo4
|
||||
@@ -126,9 +126,9 @@ compileSourceModule opts cwd mb_gfFile gr =
|
||||
|
||||
-- * Running a compiler pass, with impedance matching
|
||||
runPass = runPass' fst fst snd (liftErr . runCheck' opts)
|
||||
runPassE = runPass2e liftErr
|
||||
runPassE = runPass2e liftErr id
|
||||
runPassI = runPass2e id id Canon
|
||||
runPass2e lift f = runPass' id f (const "") lift
|
||||
runPass2e lift dump = runPass' id dump (const "") lift
|
||||
|
||||
runPass' ret dump warn lift pass pp m =
|
||||
do out <- putpp pp $ lift m
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module GF.Compiler (mainGFC, writePGF, linkGrammars) where
|
||||
module GF.Compiler (mainGFC, linkGrammars, writePGF, writeOutputs) where
|
||||
|
||||
import PGF
|
||||
import PGF.Internal(concretes,optimizePGF,unionPGF)
|
||||
@@ -56,7 +56,7 @@ compileSourceFiles opts fs =
|
||||
-- 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.
|
||||
-- recreated. Calls 'writePGF' and 'writeOutputs'.
|
||||
linkGrammars opts (t_src,~cnc_grs@(~(cnc,gr):_)) =
|
||||
do let abs = render (srcAbsName gr cnc)
|
||||
pgfFile = outputPath opts (grammarName' opts abs<.>"pgf")
|
||||
@@ -111,6 +111,8 @@ unionPGFFiles opts fs =
|
||||
readPGFVerbose f =
|
||||
putPointE Normal opts ("Reading " ++ f ++ "...") $ liftIO $ readPGF f
|
||||
|
||||
-- | Export the PGF to the 'OutputFormat's specified in the 'Options'.
|
||||
-- Calls 'exportPGF'.
|
||||
writeOutputs :: Options -> PGF -> IOE ()
|
||||
writeOutputs opts pgf = do
|
||||
sequence_ [writeOutput opts name str
|
||||
|
||||
Reference in New Issue
Block a user