summaryrefslogtreecommitdiff
path: root/src-3.0/GF/Parsing/FCFG/PInfo.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2008-05-29 10:55:34 +0000
committerkrasimir <krasimir@chalmers.se>2008-05-29 10:55:34 +0000
commit64d3a1226da712bcf3c2744bcc141ebd40acac27 (patch)
tree3427929509359f7ea1cf9c3e7f13a7b3a9fecf8c /src-3.0/GF/Parsing/FCFG/PInfo.hs
parent45e1eedff34f11a1e267d1e8923c12a33c7a217a (diff)
simplify the Profile type and remove the NameProfile type
Diffstat (limited to 'src-3.0/GF/Parsing/FCFG/PInfo.hs')
-rw-r--r--src-3.0/GF/Parsing/FCFG/PInfo.hs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src-3.0/GF/Parsing/FCFG/PInfo.hs b/src-3.0/GF/Parsing/FCFG/PInfo.hs
index 8b288f2f1..dc934c1e5 100644
--- a/src-3.0/GF/Parsing/FCFG/PInfo.hs
+++ b/src-3.0/GF/Parsing/FCFG/PInfo.hs
@@ -15,7 +15,7 @@ import GF.Formalism.FCFG
import GF.Data.SortedList
import GF.Data.Assoc
import GF.Parsing.FCFG.Range
-import qualified GF.GFCC.CId as AbsGFCC
+import GF.GFCC.CId
import Data.Array
import Data.Maybe
@@ -30,7 +30,7 @@ import Debug.Trace
type FCFParser = FCFPInfo
-> [FCat]
-> Input FToken
- -> SyntaxChart FName (FCat,RangeRec)
+ -> SyntaxChart (CId,[Profile]) (FCat,RangeRec)
makeFinalEdge cat 0 0 = (cat, [EmptyRange])
makeFinalEdge cat i j = (cat, [makeRange i j])
@@ -52,7 +52,7 @@ data FCFPInfo
-- ^ used in 'GF.Parsing.MCFG.Active' (Kilbury):
, grammarCats :: SList FCat
, grammarToks :: SList FToken
- , startupCats :: Map.Map AbsGFCC.CId [FCat]
+ , startupCats :: Map.Map CId [FCat]
}
@@ -86,18 +86,17 @@ buildFCFPInfo (grammar,startup) = -- trace (unlines [prt (x,Set.toList set) | (x
}
where allrules = listArray (0,length grammar-1) grammar
- topdownrules = accumAssoc id [(cat, ruleid) | (ruleid, FRule _ _ cat _) <- assocs allrules]
- -- emptyrules = [ruleid | (ruleid, FRule _ [] _ _) <- assocs allrules]
- epsilonrules = [ ruleid | (ruleid, FRule _ _ _ lins) <- assocs allrules,
+ topdownrules = accumAssoc id [(cat, ruleid) | (ruleid, FRule _ _ _ cat _) <- assocs allrules]
+ epsilonrules = [ ruleid | (ruleid, FRule _ _ _ _ lins) <- assocs allrules,
not (inRange (bounds (lins ! 0)) 0) ]
leftcorncats = accumAssoc id
[ (fromJust (getLeftCornerCat lins), ruleid) |
- (ruleid, FRule _ _ _ lins) <- assocs allrules, isJust (getLeftCornerCat lins) ]
+ (ruleid, FRule _ _ _ _ lins) <- assocs allrules, isJust (getLeftCornerCat lins) ]
leftcorntoks = accumAssoc id
[ (fromJust (getLeftCornerTok lins), ruleid) |
- (ruleid, FRule _ _ _ lins) <- assocs allrules, isJust (getLeftCornerTok lins) ]
+ (ruleid, FRule _ _ _ _ lins) <- assocs allrules, isJust (getLeftCornerTok lins) ]
grammarcats = aElems topdownrules
- grammartoks = nubsort [t | (FRule _ _ _ lins) <- grammar, lin <- elems lins, FSymTok t <- elems lin]
+ grammartoks = nubsort [t | (FRule _ _ _ _ lins) <- grammar, lin <- elems lins, FSymTok t <- elems lin]
fcfPInfoToFGrammar :: FCFPInfo -> FGrammar
fcfPInfoToFGrammar pinfo = (elems (allRules pinfo), startupCats pinfo)