mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
gfc generation to incomplete modules
This commit is contained in:
@@ -27,10 +27,10 @@ import qualified Modules as M
|
||||
|
||||
type OptSpec = [Integer] ---
|
||||
|
||||
doOptFactor :: OptSpec
|
||||
doOptFactor :: OptSpec -> Bool
|
||||
doOptFactor opt = elem 2 opt
|
||||
|
||||
doOptValues :: OptSpec
|
||||
doOptValues :: OptSpec -> Bool
|
||||
doOptValues opt = elem 3 opt
|
||||
|
||||
shareOpt :: OptSpec
|
||||
|
||||
@@ -282,22 +282,25 @@ generateModuleCode opts path minfo@(name,info) = do
|
||||
"none" -> minfo0 -- no optimization
|
||||
_ -> shareModule shareOpt minfo0 -- sharing; default
|
||||
|
||||
-- for resource, also emit gfr
|
||||
-- for resource, also emit gfr.
|
||||
--- Also for incomplete, to create timestamped gfc/gfr files
|
||||
case info of
|
||||
ModMod m | emitsGFR m && emit && nomulti -> do
|
||||
let (file,out) = (gfrFile pname, prGrammar (MGrammar [minfo]))
|
||||
let rminfo = if isCompilable info then minfo
|
||||
else (name,emptyModInfo)
|
||||
let (file,out) = (gfrFile pname, prGrammar (MGrammar [rminfo]))
|
||||
ioeIO $ writeFile file out >> putStr (" wrote file" +++ file)
|
||||
_ -> return ()
|
||||
(file,out) <- do
|
||||
code <- return $ MkGFC.prCanonModInfo minfo'
|
||||
return (gfcFile pname, code)
|
||||
if isCompilable info && emit && nomulti
|
||||
if emit && nomulti ---- && isCompilable info
|
||||
then ioeIO (writeFile file out) >> ioeIOIf (putStr (" wrote file" +++ file))
|
||||
else ioeIOIf $ putStrFlush $ "no need to save module" +++ prt name
|
||||
return minfo'
|
||||
where
|
||||
ioeIOIf = if oElem beSilent opts then (const (return ())) else ioeIO
|
||||
emitsGFR m = isModRes m && isCompilable info
|
||||
emitsGFR m = isModRes m ---- && isCompilable info
|
||||
---- isModRes m || (isModCnc m && mstatus m == MSIncomplete)
|
||||
isCompilable mi = case mi of
|
||||
ModMod m -> not $ isModCnc m && mstatus m == MSIncomplete
|
||||
|
||||
@@ -52,7 +52,7 @@ redModInfo (c,info) = do
|
||||
let isIncompl = not $ isCompleteModule m
|
||||
(e,os) <- if isIncompl then return ([],[]) else redExtOpen m ----
|
||||
flags <- mapM redFlag $ flags m
|
||||
(a,mt) <- case mtype m of
|
||||
(a,mt0) <- case mtype m of
|
||||
MTConcrete a -> do
|
||||
a' <- redIdent a
|
||||
return (a', MTConcrete a')
|
||||
@@ -62,8 +62,9 @@ redModInfo (c,info) = do
|
||||
MTInstance _ -> return (c',MTResource) --- c' not needed
|
||||
MTTransfer x y -> return (c',MTTransfer (om x) (om y)) --- c' not needed
|
||||
|
||||
---- this generates empty GFC. Better: none
|
||||
--- this generates empty GFC reosurce for interface and incomplete
|
||||
let js = if isIncompl then NT else jments m
|
||||
mt = mt0 ---- if isIncompl then MTResource else mt0
|
||||
|
||||
defss <- mapM (redInfo a) $ tree2list $ js
|
||||
defs <- return $ sorted2tree $ concat defss -- sorted, but reduced
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
-- > CVS $Author $
|
||||
-- > CVS $Revision $
|
||||
--
|
||||
-- (Description of the module)
|
||||
-- Decide what files to read as function of dependencies and time stamps.
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
module ReadFiles
|
||||
|
||||
Reference in New Issue
Block a user