summaryrefslogtreecommitdiff
path: root/src/GF/CFGM/PrintCFGrammar.hs
diff options
context:
space:
mode:
authorbringert <unknown>2005-05-17 13:04:35 +0000
committerbringert <unknown>2005-05-17 13:04:35 +0000
commit8abf80dc4d4aa9c6a783f41346e44a5012649d03 (patch)
tree6b03cbbffa6b435b57fc6f60a24f10a92ad6a3cd /src/GF/CFGM/PrintCFGrammar.hs
parent31044ec728d3a9a56a660fdd32d880d13dc9ffbf (diff)
Changed CFGM format and printer to allow constants in profiles.
Diffstat (limited to 'src/GF/CFGM/PrintCFGrammar.hs')
-rw-r--r--src/GF/CFGM/PrintCFGrammar.hs17
1 files changed, 9 insertions, 8 deletions
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