diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/GF/Compile/GenerateFCFG.hs | 1 | ||||
| -rw-r--r-- | src/GF/Compile/GeneratePMCFG.hs | 1 | ||||
| -rw-r--r-- | src/PGF/Data.hs | 1 | ||||
| -rw-r--r-- | src/PGF/Parsing/FCFG/Incremental.hs | 6 | ||||
| -rw-r--r-- | src/PGF/Raw/Convert.hs | 5 |
5 files changed, 7 insertions, 7 deletions
diff --git a/src/GF/Compile/GenerateFCFG.hs b/src/GF/Compile/GenerateFCFG.hs index de6c05ef1..108976506 100644 --- a/src/GF/Compile/GenerateFCFG.hs +++ b/src/GF/Compile/GenerateFCFG.hs @@ -330,6 +330,7 @@ getParserInfo (GrammarEnv last_id catSet seqSet funSet prodSet) = , sequences = mkArray seqSet , productions = prodSet , startCats = Map.map getFCatList catSet + , totalCats = last_id+1 } where mkArray map = array (0,Map.size map-1) [(v,k) | (k,v) <- Map.toList map] diff --git a/src/GF/Compile/GeneratePMCFG.hs b/src/GF/Compile/GeneratePMCFG.hs index 870396255..20ba80e2e 100644 --- a/src/GF/Compile/GeneratePMCFG.hs +++ b/src/GF/Compile/GeneratePMCFG.hs @@ -319,6 +319,7 @@ getParserInfo (GrammarEnv last_id catSet seqSet funSet crcSet prodSet) = , sequences = mkArray seqSet , productions = IntMap.union prodSet coercions , startCats = Map.map (\(start,end,_) -> range (start,end)) catSet + , totalCats = last_id+1 } where mkArray map = array (0,Map.size map-1) [(v,k) | (k,v) <- Map.toList map] diff --git a/src/PGF/Data.hs b/src/PGF/Data.hs index 224059ed6..f50a49c31 100644 --- a/src/PGF/Data.hs +++ b/src/PGF/Data.hs @@ -134,6 +134,7 @@ data ParserInfo , sequences :: Array SeqId FSeq , productions :: IntMap.IntMap (Set.Set Production) , startCats :: Map.Map CId [FCat] + , totalCats :: {-# UNPACK #-} !FCat } diff --git a/src/PGF/Parsing/FCFG/Incremental.hs b/src/PGF/Parsing/FCFG/Incremental.hs index c8d9d8f8d..8dc3c3da5 100644 --- a/src/PGF/Parsing/FCFG/Incremental.hs +++ b/src/PGF/Parsing/FCFG/Incremental.hs @@ -35,12 +35,8 @@ initState pinfo start = (lbl,seqid) <- assocs lins
return (Active 0 0 funid seqid args (AK cat lbl))
- max_fid = maximum (0:[maximum (cat:args) | (cat, set) <- IntMap.toList (productions pinfo)
- , p <- Set.toList set
- , let args = case p of {FApply _ args -> args; FCoerce cat -> [cat]}])+1
-
in State pinfo
- (Chart emptyAC [] emptyPC (productions pinfo) max_fid 0)
+ (Chart emptyAC [] emptyPC (productions pinfo) (totalCats pinfo) 0)
(Set.fromList items)
-- | From the current state and the next token
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 |
