From 6ee7296f9dd5290bb3ee581403a18464444ab28b Mon Sep 17 00:00:00 2001 From: bringert Date: Fri, 5 Jan 2007 15:38:47 +0000 Subject: Changed all SRG printer to take Options and StateGrammar arguments. This makes Custom a lot cleaner. --- src/GF/Speech/TransformCFG.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/GF/Speech/TransformCFG.hs') diff --git a/src/GF/Speech/TransformCFG.hs b/src/GF/Speech/TransformCFG.hs index 923e90d7c..3a167eeef 100644 --- a/src/GF/Speech/TransformCFG.hs +++ b/src/GF/Speech/TransformCFG.hs @@ -24,6 +24,7 @@ module GF.Speech.TransformCFG {- (CFRule_, CFRules, removeEmptyCats, removeIdenticalRules) -} where import GF.Conversion.Types +import GF.CF.PPrCF (prCFCat) import GF.Data.Utilities import GF.Formalism.CFG import GF.Formalism.Utilities (Symbol(..), mapSymbol, filterCats, symbol, @@ -32,7 +33,7 @@ import GF.Infra.Ident import GF.Infra.Option import GF.Infra.Print import GF.Speech.Relation -import GF.Compile.ShellState (StateGrammar, stateCFG) +import GF.Compile.ShellState (StateGrammar, stateCFG, startCatStateOpts) import Control.Monad import Control.Monad.State (State, get, put, evalState) @@ -76,6 +77,13 @@ cfgToCFRules s = profileToTerm (Unify xs) = CFRes (last xs) -- FIXME: unify profileToTerm (Constant f) = maybe CFMeta (\x -> CFObj x []) (forestName f) +getStartCat :: Options -> StateGrammar -> String +getStartCat opts sgr = prCFCat (startCatStateOpts opts sgr) + +getStartCatCF :: Options -> StateGrammar -> String +getStartCatCF opts sgr = getStartCat opts sgr ++ "{}.s" + + -- | Remove productions which use categories which have no productions removeEmptyCats :: CFRules -> CFRules removeEmptyCats = fix removeEmptyCats' -- cgit v1.2.3