forked from GitHub/gf-core
restored CanonToGFCC as a wrapper of GFCC generation
This commit is contained in:
@@ -19,7 +19,7 @@ import GF.Canon.GFC
|
||||
import GF.Canon.AbsGFC
|
||||
import GF.GFCC.Raw.AbsGFCCRaw(CId(CId))
|
||||
--import GF.GFCC.DataGFCC(mkGFCC)
|
||||
import GF.Canon.CanonToGFCC as C2GFCC
|
||||
import GF.Canon.CanonToGFCC
|
||||
import GF.Grammar.Macros
|
||||
import GF.Grammar.MMacros
|
||||
|
||||
@@ -264,12 +264,10 @@ updateShellState opts ign mcnc sh ((_,sgr,gr,eenv),rts) = do
|
||||
let fromGFC = snd . snd . Cnv.convertGFC opts
|
||||
(mcfgs, cfgs) = unzip $ map (curry fromGFC cgr) concrs
|
||||
fcfgs0 = [(IC id,g) | (CId id,g) <-
|
||||
FCnv.convertGrammar (C2GFCC.mkCanon2gfccNoUTF8 cgr)]
|
||||
FCnv.convertGrammar (canon2gfcc opts cgr)] ---- UTF8
|
||||
fcfgs = [(c,g) | c <- concrs, Just g <- [lookup c fcfgs0]]
|
||||
pInfos = zipWith3 Prs.buildPInfo mcfgs (map snd fcfgs) cfgs
|
||||
|
||||
|
||||
|
||||
let funs = funRulesOf cgr
|
||||
let cats = allCatsOf cgr
|
||||
let csi = [(c,(co,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
module GF.Speech.GrammarToVoiceXML (grammar2vxml) where
|
||||
|
||||
import GF.Canon.CanonToGFCC (mkCanon2gfcc)
|
||||
import GF.Canon.CanonToGFCC (canon2gfcc)
|
||||
import qualified GF.GFCC.Raw.AbsGFCCRaw as C
|
||||
import GF.GFCC.DataGFCC (GFCC(..), Abstr(..))
|
||||
import GF.GFCC.Macros
|
||||
@@ -32,6 +32,7 @@ import GF.UseGrammar.GetTree (string2treeErr)
|
||||
import GF.UseGrammar.Linear (linTree2strings)
|
||||
|
||||
import GF.Infra.Ident
|
||||
import GF.Infra.Option (noOptions)
|
||||
import GF.Infra.Modules
|
||||
import GF.Data.Operations
|
||||
|
||||
@@ -65,7 +66,7 @@ prid :: VIdent -> String
|
||||
prid (C.CId x) = x
|
||||
|
||||
vSkeleton :: GFC.CanonGrammar -> (VIdent,VSkeleton)
|
||||
vSkeleton = gfccSkeleton . mkCanon2gfcc
|
||||
vSkeleton = gfccSkeleton . canon2gfcc noOptions
|
||||
|
||||
gfccSkeleton :: GFCC -> (VIdent,VSkeleton)
|
||||
gfccSkeleton gfcc = (absname gfcc, ts)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
module GF.Speech.TransformCFG where
|
||||
|
||||
import GF.Canon.CanonToGFCC (mkCanon2gfcc)
|
||||
import GF.Canon.CanonToGFCC (canon2gfcc)
|
||||
import qualified GF.GFCC.Raw.AbsGFCCRaw as C
|
||||
import GF.GFCC.Macros (lookType,catSkeleton)
|
||||
import GF.GFCC.DataGFCC (GFCC)
|
||||
@@ -85,7 +85,7 @@ getStartCatCF :: Options -> StateGrammar -> String
|
||||
getStartCatCF opts sgr = getStartCat opts sgr ++ "{}.s"
|
||||
|
||||
stateGFCC :: StateGrammar -> GFCC
|
||||
stateGFCC = mkCanon2gfcc . stateGrammarST
|
||||
stateGFCC = canon2gfcc noOptions . stateGrammarST
|
||||
|
||||
-- * Grammar filtering
|
||||
|
||||
|
||||
@@ -35,17 +35,9 @@ import qualified GF.Grammar.Grammar as G
|
||||
import qualified GF.Canon.AbsGFC as A
|
||||
import qualified GF.Canon.GFC as C
|
||||
|
||||
import qualified GF.Devel.GrammarToGFCC as GFCC
|
||||
import qualified GF.Devel.GFCCtoHaskell as CCH
|
||||
import GF.Devel.PrintGFCC
|
||||
import qualified GF.Devel.GFCCtoJS as JS
|
||||
import GF.GFCC.CheckGFCC (checkGFCCmaybe)
|
||||
import GF.GFCC.OptimizeGFCC
|
||||
|
||||
--import qualified GF.Canon.CanonToGFCC as GFCC
|
||||
--import qualified GF.Devel.GFCCtoHaskell as CCH
|
||||
--import qualified GF.GFCC.DataGFCC as DataGFCC
|
||||
--import qualified GF.Canon.CanonToJS as JS (prCanon2js)
|
||||
import GF.Canon.CanonToGFCC
|
||||
import qualified GF.Devel.GFCCtoHaskell as CCH
|
||||
|
||||
import qualified GF.Source.AbsGF as GF
|
||||
import qualified GF.Grammar.MMacros as MM
|
||||
@@ -351,21 +343,6 @@ customMultiGrammarPrinter =
|
||||
,(strCI "cfg-prolog", CnvProlog.prtCMulti)
|
||||
]
|
||||
|
||||
---Options -> CanonGrammar -> String
|
||||
canon2gfccPr opts = printGFCC . canon2gfcc opts
|
||||
canon2gfcc opts = source2gfcc opts . canon2source ----
|
||||
canon2source = err error id . canon2sourceGrammar . unSubelimCanon
|
||||
|
||||
source2gfcc opts gf =
|
||||
let
|
||||
(abs,gfcc) = GFCC.mkCanon2gfcc opts (gfcabs gf) gf
|
||||
gfcc1 = maybe undefined id $ checkGFCCmaybe gfcc
|
||||
in if oElem (iOpt "noopt") opts then gfcc1 else optGFCC gfcc1
|
||||
|
||||
gfcabs gfc =
|
||||
prt $ head $ M.allConcretes gfc $ maybe (error "no abstract") id $
|
||||
M.greatestAbstract gfc
|
||||
|
||||
|
||||
customSyntaxPrinter =
|
||||
customData "Syntax printers, selected by option -printer=x" $
|
||||
|
||||
Reference in New Issue
Block a user