mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-25 04:22:50 -06:00
Refactoring in GF.Compile and GF.ReadFiles with an eye to parallel compilation
In particular, the function compileOne has been moved to the new module
GF.CompileOne and its type has been changed from
compileOne :: ... -> CompileEnv -> FilePath -> IOE CompileEnv
to
compileOne :: ... -> SourceGrammar -> FilePath -> IOE OneCompiledModule
making it more suitable for use in a parallel compiler.
This commit is contained in:
@@ -105,9 +105,26 @@ getSubdirs dir = do
|
||||
then return (fpath:fs)
|
||||
else return fs ) [] fs
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
justModuleName :: FilePath -> String
|
||||
justModuleName = dropExtension . takeFileName
|
||||
|
||||
isGFO :: FilePath -> Bool
|
||||
isGFO = (== ".gfo") . takeExtensions
|
||||
|
||||
gfoFile :: FilePath -> FilePath
|
||||
gfoFile f = addExtension f "gfo"
|
||||
|
||||
gfFile :: FilePath -> FilePath
|
||||
gfFile f = addExtension f "gf"
|
||||
|
||||
gf2gfo :: Options -> FilePath -> FilePath
|
||||
gf2gfo = gf2gfo' . flag optGFODir
|
||||
|
||||
gf2gfo' gfoDir file = maybe (gfoFile (dropExtension file))
|
||||
(\dir -> dir </> gfoFile (takeBaseName file))
|
||||
gfoDir
|
||||
--------------------------------------------------------------------------------
|
||||
splitInModuleSearchPath :: String -> [FilePath]
|
||||
splitInModuleSearchPath s = case break isPathSep s of
|
||||
(f,_:cs) -> f : splitInModuleSearchPath cs
|
||||
|
||||
Reference in New Issue
Block a user