From 8abf80dc4d4aa9c6a783f41346e44a5012649d03 Mon Sep 17 00:00:00 2001 From: bringert Date: Tue, 17 May 2005 13:04:35 +0000 Subject: Changed CFGM format and printer to allow constants in profiles. --- src/GF/CFGM/PrintCFGrammar.hs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/GF/CFGM/PrintCFGrammar.hs') diff --git a/src/GF/CFGM/PrintCFGrammar.hs b/src/GF/CFGM/PrintCFGrammar.hs index bea35ad35..456bc1b19 100644 --- a/src/GF/CFGM/PrintCFGrammar.hs +++ b/src/GF/CFGM/PrintCFGrammar.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/05/17 11:20:25 $ --- > CVS $Author: peb $ --- > CVS $Revision: 1.19 $ +-- > CVS $Date: 2005/05/17 14:04:38 $ +-- > CVS $Author: bringert $ +-- > CVS $Revision: 1.20 $ -- -- Handles printing a CFGrammar in CFGM format. ----------------------------------------------------------------------------- @@ -80,11 +80,12 @@ ruleToCFGMRule (CFRule c rhs (GU.Name fun profile)) c' = catToCFGMCat c rhs' = map symbolToGFCMSymbol rhs -profileToCFGMProfile :: [GU.Profile a] -> AbsCFG.Profile -profileToCFGMProfile = AbsCFG.Profile . map cnvProfile - where cnvProfile (GU.Unify ns) = AbsCFG.Ints $ map fromIntegral ns - cnvProfile (GU.Constant a) = AbsCFG.Ints [] - -- FIXME: this should be replaced with a new constructor in 'AbsCFG' +profileToCFGMProfile :: [GU.Profile (GU.SyntaxForest GT.Fun)] -> AbsCFG.Profiles +profileToCFGMProfile = AbsCFG.Profiles . map cnvProfile + where cnvProfile (GU.Unify ns) = AbsCFG.UnifyProfile $ map fromIntegral ns + -- FIXME: is it always FNode? + cnvProfile (GU.Constant (GU.FNode c _)) = AbsCFG.ConstProfile $ identToCFGMIdent c + identToCFGMIdent :: Ident -> AbsCFG.Ident identToCFGMIdent = AbsCFG.Ident . prt -- cgit v1.2.3