From 10a9e25ceb590eacd1ea8a56950329ef3057cc73 Mon Sep 17 00:00:00 2001 From: bringert Date: Wed, 9 Jan 2008 13:51:21 +0000 Subject: [PATCH] Better names for the parsing info components in GFCC. --- src/GF/GFCC/Raw/ConvertGFCC.hs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/GF/GFCC/Raw/ConvertGFCC.hs b/src/GF/GFCC/Raw/ConvertGFCC.hs index ddb79ab9a..b477e9f94 100644 --- a/src/GF/GFCC/Raw/ConvertGFCC.hs +++ b/src/GF/GFCC/Raw/ConvertGFCC.hs @@ -78,14 +78,14 @@ toPInfo = foldl add (FCFPInfo { add :: FCFPInfo -> RExp -> FCFPInfo add p (App (CId f) ts) = case f of - "rules" -> p { allRules = mkArray (lmap toFRule ts) } - "topdownrules" -> p { topdownRules = toAssoc expToInt (lmap expToInt) ts } - "epsilonrules" -> p { epsilonRules = lmap expToInt ts } - "lccats" -> p { leftcornerCats = toAssoc expToInt (lmap expToInt) ts } - "lctoks" -> p { leftcornerTokens = toAssoc expToStr (lmap expToInt) ts } - "cats" -> p { grammarCats = lmap expToInt ts } - "toks" -> p { grammarToks = lmap expToStr ts } - "startupcats" -> p { startupCats = fromList [(c, lmap expToInt cs) | App c cs <- ts] } + "rules" -> p { allRules = mkArray (lmap toFRule ts) } + "catrules" -> p { topdownRules = toAssoc expToInt (lmap expToInt) ts } + "epsilonrules" -> p { epsilonRules = lmap expToInt ts } + "firstcatrules" -> p { leftcornerCats = toAssoc expToInt (lmap expToInt) ts } + "firsttokrules" -> p { leftcornerTokens = toAssoc expToStr (lmap expToInt) ts } + "cats" -> p { grammarCats = lmap expToInt ts } + "toks" -> p { grammarToks = lmap expToStr ts } + "gfcats" -> p { startupCats = fromList [(c, lmap expToInt cs) | App c cs <- ts] } toFRule :: RExp -> FRule toFRule (App (CId "rule") [n, @@ -234,14 +234,14 @@ fromTerm e = case e of fromPInfo :: FCFPInfo -> RExp fromPInfo p = app "parser" [ - app "rules" [fromFRule rule | rule <- Array.elems (allRules p)], - app "topdownrules" (fromAssoc intToExp (lmap intToExp) (topdownRules p)), - app "epsilonrules" (lmap intToExp (epsilonRules p)), - app "lccats" (fromAssoc intToExp (lmap intToExp) (leftcornerCats p)), - app "lctoks" (fromAssoc AStr (lmap intToExp) (leftcornerTokens p)), - app "cats" (lmap intToExp (grammarCats p)), - app "toks" (lmap AStr (grammarToks p)), - app "startupcats" [App f (lmap intToExp cs) | (f,cs) <- toList (startupCats p)] + app "rules" [fromFRule rule | rule <- Array.elems (allRules p)], + app "catrules" (fromAssoc intToExp (lmap intToExp) (topdownRules p)), + app "epsilonrules" (lmap intToExp (epsilonRules p)), + app "firstcatrules" (fromAssoc intToExp (lmap intToExp) (leftcornerCats p)), + app "firsttokrules" (fromAssoc AStr (lmap intToExp) (leftcornerTokens p)), + app "cats" (lmap intToExp (grammarCats p)), + app "toks" (lmap AStr (grammarToks p)), + app "gfcats" [App f (lmap intToExp cs) | (f,cs) <- toList (startupCats p)] ] fromAssoc :: Ord a => (a -> RExp) -> (b -> [RExp]) -> Assoc a b -> [RExp]