mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-04 08:42:50 -06:00
make it possible to replace the probabilities while reading a new .pgf
This commit is contained in:
@@ -64,8 +64,14 @@ importPGF opts Nothing f
|
||||
then removeFile f'
|
||||
else return ()
|
||||
putStr ("(Boot image "++f'++") ")
|
||||
fmap Just (bootNGF f f')
|
||||
| otherwise = fmap Just (readPGF f)
|
||||
mb_probs <- case flag optProbsFile opts of
|
||||
Nothing -> return Nothing
|
||||
Just file -> fmap Just (readProbabilitiesFromFile file)
|
||||
fmap Just (bootNGFWithProbs f mb_probs f')
|
||||
| otherwise = do mb_probs <- case flag optProbsFile opts of
|
||||
Nothing -> return Nothing
|
||||
Just file -> fmap Just (readProbabilitiesFromFile file)
|
||||
fmap Just (readPGFWithProbs f mb_probs)
|
||||
importPGF opts (Just pgf) f = fmap Just (modifyPGF pgf (mergePGF f) `catch`
|
||||
(\e@(PGFError loc msg) ->
|
||||
if msg == "The abstract syntax names doesn't match"
|
||||
@@ -73,7 +79,6 @@ importPGF opts (Just pgf) f = fmap Just (modifyPGF pgf (mergePGF f) `catc
|
||||
readPGF f
|
||||
else throwIO e))
|
||||
|
||||
|
||||
importSource :: Options -> [FilePath] -> IO (ModuleName,SourceGrammar)
|
||||
importSource opts files = fmap snd (batchCompile opts files)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user