mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-10 21:39:32 -06:00
cf for restricted import; new API funs
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/04/21 16:21:11 $
|
||||
-- > CVS $Author: bringert $
|
||||
-- > CVS $Revision: 1.13 $
|
||||
-- > CVS $Date: 2005/05/31 12:47:52 $
|
||||
-- > CVS $Author: aarne $
|
||||
-- > CVS $Revision: 1.14 $
|
||||
--
|
||||
-- AR 27\/1\/2000 -- 3\/12\/2001 -- 8\/6\/2003
|
||||
-----------------------------------------------------------------------------
|
||||
@@ -42,17 +42,22 @@ canon2cf opts gr c = tracePrt "#size of CF" (err id (show.length.rulesOfCF)) $ d
|
||||
a <- M.abstractOfConcrete gr c
|
||||
let cncs = [m | (n, M.ModMod m) <- M.modules gr, elem n ms]
|
||||
let mms = [(a, tree2list (M.jments m)) | m <- cncs]
|
||||
rules0 <- liftM concat $ mapM (uncurry (cnc2cfCond opts)) mms
|
||||
cnc <- liftM M.jments $ M.lookupModMod gr c
|
||||
rules0 <- liftM concat $ mapM (uncurry (cnc2cfCond opts cnc)) mms
|
||||
let bindcats = map snd $ allBindCatsOf gr
|
||||
let rules = filter (not . isCircularCF) rules0 ---- temporarily here
|
||||
let grules = groupCFRules rules
|
||||
let predef = mkCFPredef opts bindcats grules
|
||||
return $ CF predef
|
||||
|
||||
cnc2cfCond :: Options -> Ident -> [(Ident,Info)] -> Err [CFRule]
|
||||
cnc2cfCond opts m gr =
|
||||
cnc2cfCond :: Options -> BinTree Ident Info ->
|
||||
Ident -> [(Ident,Info)] -> Err [CFRule]
|
||||
cnc2cfCond opts cnc m gr =
|
||||
liftM concat $
|
||||
mapM lin2cf [(m,fun,cat,args,lin) | (fun, CncFun cat args lin _) <- gr]
|
||||
mapM lin2cf [(m,fun,cat,args,lin) |
|
||||
(fun, CncFun cat args lin _) <- gr, is fun]
|
||||
where
|
||||
is f = isInBinTree f cnc
|
||||
|
||||
type IFun = Ident
|
||||
type ICat = CIdent
|
||||
|
||||
@@ -83,7 +83,7 @@ trees2trms opts sg cn as ts0 info = do
|
||||
,checkWarn (unlines ("Raw CF trees:":(map prCFTree ts0))) >> return []
|
||||
]
|
||||
_ -> do
|
||||
let num = optIntOrN opts flagRawtrees 99999
|
||||
let num = optIntOrN opts flagRawtrees 999999
|
||||
let (ts01,rest) = splitAt num ts0
|
||||
if null rest then return ()
|
||||
else checkWarn ("Warning: only" +++ show num +++ "raw parses out of" +++
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/05/11 10:28:16 $
|
||||
-- > CVS $Author: peb $
|
||||
-- > CVS $Revision: 1.23 $
|
||||
-- > CVS $Date: 2005/05/31 12:47:52 $
|
||||
-- > CVS $Author: aarne $
|
||||
-- > CVS $Revision: 1.24 $
|
||||
--
|
||||
-- (Description of the module)
|
||||
-----------------------------------------------------------------------------
|
||||
@@ -104,7 +104,7 @@ trees2trms opts sg cn as ts0 info = do
|
||||
,checkWarn (unlines ("Raw CF trees:":(map prCFTree ts0))) >> return []
|
||||
]
|
||||
_ -> do
|
||||
let num = optIntOrN opts flagRawtrees 99999
|
||||
let num = optIntOrN opts flagRawtrees 999999
|
||||
let (ts01,rest) = splitAt num ts0
|
||||
if null rest then return ()
|
||||
else raise ("Warning: only" +++ show num +++ "raw parses out of" +++
|
||||
|
||||
Reference in New Issue
Block a user