summaryrefslogtreecommitdiff
path: root/src/PGF/Raw/Convert.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2008-10-15 07:47:57 +0000
committerkrasimir <krasimir@chalmers.se>2008-10-15 07:47:57 +0000
commit5f33e0bda955c66aa81356c6636ec65d9a40bc2e (patch)
tree2500b5ba571901235a944a4a832532f17aeb98ca /src/PGF/Raw/Convert.hs
parent57ee52103dcccbcda75b895ea399e230e18d0a92 (diff)
store the total number of PMCFG categories in the PGF file
Diffstat (limited to 'src/PGF/Raw/Convert.hs')
-rw-r--r--src/PGF/Raw/Convert.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/PGF/Raw/Convert.hs b/src/PGF/Raw/Convert.hs
index 2912bced1..5a5654ed7 100644
--- a/src/PGF/Raw/Convert.hs
+++ b/src/PGF/Raw/Convert.hs
@@ -72,11 +72,12 @@ toConcr pgf rexp =
add cnc (App "parser" ts) = cnc { parser = Just (toPInfo ts) }
toPInfo :: [RExp] -> ParserInfo
-toPInfo [App "functions" fs, App "sequences" ss, App "productions" ps,App "startcats" cs] =
+toPInfo [App "functions" fs, App "sequences" ss, App "productions" ps,App "categories" (t:cs)] =
ParserInfo { functions = functions
, sequences = seqs
, productions = productions
, startCats = cats
+ , totalCats = expToInt t
}
where
functions = mkArray (map toFFun fs)
@@ -229,7 +230,7 @@ fromPInfo p = App "parser" [
App "functions" [fromFFun fun | fun <- elems (functions p)],
App "sequences" [fromFSeq seq | seq <- elems (sequences p)],
App "productions" [fromProductionSet xs | xs <- IntMap.toList (productions p)],
- App "startcats" [App (prCId f) (map intToExp xs) | (f,xs) <- Map.toList (startCats p)]
+ App "categories" (intToExp (totalCats p) : [App (prCId f) (map intToExp xs) | (f,xs) <- Map.toList (startCats p)])
]
fromFFun :: FFun -> RExp