mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
detect when we load a grammar with a different abstract and don't try to merge
This commit is contained in:
@@ -31,20 +31,22 @@ import System.Directory
|
||||
|
||||
grammar2PGF :: Options -> Maybe PGF -> SourceGrammar -> ModuleName -> Map.Map PGF2.Fun Double -> IO PGF
|
||||
grammar2PGF opts mb_pgf gr am probs = do
|
||||
let abs_name = mi2i am
|
||||
pgf <- case mb_pgf of
|
||||
Nothing -> let abs_name = mi2i am
|
||||
in if snd (flag optLinkTargets opts)
|
||||
then do let fname = maybe id (</>)
|
||||
(flag optOutputDir opts)
|
||||
(fromMaybe abs_name (flag optName opts)<.>"ngf")
|
||||
exists <- doesFileExist fname
|
||||
if exists
|
||||
then removeFile fname
|
||||
else return ()
|
||||
putStr ("(Boot image "++fname++") ")
|
||||
newNGF abs_name (Just fname)
|
||||
else newNGF abs_name Nothing
|
||||
Just pgf -> return pgf
|
||||
Just pgf | abstractName pgf == abs_name ->
|
||||
do return pgf
|
||||
_ | snd (flag optLinkTargets opts) ->
|
||||
do let fname = maybe id (</>)
|
||||
(flag optOutputDir opts)
|
||||
(fromMaybe abs_name (flag optName opts)<.>"ngf")
|
||||
exists <- doesFileExist fname
|
||||
if exists
|
||||
then removeFile fname
|
||||
else return ()
|
||||
putStr ("(Boot image "++fname++") ")
|
||||
newNGF abs_name (Just fname)
|
||||
| otherwise ->
|
||||
do newNGF abs_name Nothing
|
||||
|
||||
pgf <- modifyPGF pgf $ do
|
||||
sequence_ [setAbstractFlag name value | (name,value) <- optionsPGF aflags]
|
||||
|
||||
Reference in New Issue
Block a user