mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-22 17:42:51 -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 :: Options -> Maybe PGF -> SourceGrammar -> ModuleName -> Map.Map PGF2.Fun Double -> IO PGF
|
||||||
grammar2PGF opts mb_pgf gr am probs = do
|
grammar2PGF opts mb_pgf gr am probs = do
|
||||||
|
let abs_name = mi2i am
|
||||||
pgf <- case mb_pgf of
|
pgf <- case mb_pgf of
|
||||||
Nothing -> let abs_name = mi2i am
|
Just pgf | abstractName pgf == abs_name ->
|
||||||
in if snd (flag optLinkTargets opts)
|
do return pgf
|
||||||
then do let fname = maybe id (</>)
|
_ | snd (flag optLinkTargets opts) ->
|
||||||
(flag optOutputDir opts)
|
do let fname = maybe id (</>)
|
||||||
(fromMaybe abs_name (flag optName opts)<.>"ngf")
|
(flag optOutputDir opts)
|
||||||
exists <- doesFileExist fname
|
(fromMaybe abs_name (flag optName opts)<.>"ngf")
|
||||||
if exists
|
exists <- doesFileExist fname
|
||||||
then removeFile fname
|
if exists
|
||||||
else return ()
|
then removeFile fname
|
||||||
putStr ("(Boot image "++fname++") ")
|
else return ()
|
||||||
newNGF abs_name (Just fname)
|
putStr ("(Boot image "++fname++") ")
|
||||||
else newNGF abs_name Nothing
|
newNGF abs_name (Just fname)
|
||||||
Just pgf -> return pgf
|
| otherwise ->
|
||||||
|
do newNGF abs_name Nothing
|
||||||
|
|
||||||
pgf <- modifyPGF pgf $ do
|
pgf <- modifyPGF pgf $ do
|
||||||
sequence_ [setAbstractFlag name value | (name,value) <- optionsPGF aflags]
|
sequence_ [setAbstractFlag name value | (name,value) <- optionsPGF aflags]
|
||||||
|
|||||||
Reference in New Issue
Block a user