summaryrefslogtreecommitdiff
path: root/src/GF/Parsing/FCFG/PInfo.hs
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2007-09-24 08:12:11 +0000
committerkr.angelov <kr.angelov@gmail.com>2007-09-24 08:12:11 +0000
commit6aacec3591e0e6e1d3ddca4605f6467e302cb65f (patch)
treeb18525e17809f1bbef96c6778038085eb7bd8ea0 /src/GF/Parsing/FCFG/PInfo.hs
parent0cd5e62e836e8cb8d2b49f76bfb899081aa2366f (diff)
remove FTypes module and move all definitions to Formalism.FCFG
Diffstat (limited to 'src/GF/Parsing/FCFG/PInfo.hs')
-rw-r--r--src/GF/Parsing/FCFG/PInfo.hs30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/GF/Parsing/FCFG/PInfo.hs b/src/GF/Parsing/FCFG/PInfo.hs
index e463cf65a..8a45b651a 100644
--- a/src/GF/Parsing/FCFG/PInfo.hs
+++ b/src/GF/Parsing/FCFG/PInfo.hs
@@ -23,10 +23,10 @@ import Data.Maybe
-- type declarations
-- | the list of categories = possible starting categories
-type FCFParser c n t = FCFPInfo c n t
- -> [c]
- -> Input t
- -> SyntaxChart n (c,RangeRec)
+type FCFParser = FCFPInfo
+ -> [FCat]
+ -> Input FToken
+ -> SyntaxChart FName (FCat,RangeRec)
makeFinalEdge cat 0 0 = (cat, [EmptyRange])
makeFinalEdge cat i j = (cat, [makeRange i j])
@@ -36,19 +36,19 @@ makeFinalEdge cat i j = (cat, [makeRange i j])
type RuleId = Int
-data FCFPInfo c n t
- = FCFPInfo { allRules :: Array RuleId (FCFRule c n t)
- , topdownRules :: Assoc c (SList RuleId)
+data FCFPInfo
+ = FCFPInfo { allRules :: Array RuleId FRule
+ , topdownRules :: Assoc FCat (SList RuleId)
-- ^ used in 'GF.Parsing.MCFG.Active' (Earley):
- -- , emptyRules :: [RuleId]
+ -- , emptyRules :: [RuleId]
, epsilonRules :: [RuleId]
-- ^ used in 'GF.Parsing.MCFG.Active' (Kilbury):
- , leftcornerCats :: Assoc c (SList RuleId)
- , leftcornerTokens :: Assoc t (SList RuleId)
+ , leftcornerCats :: Assoc FCat (SList RuleId)
+ , leftcornerTokens :: Assoc FToken (SList RuleId)
-- ^ used in 'GF.Parsing.MCFG.Active' (Kilbury):
- , grammarCats :: SList c
- , grammarToks :: SList t
- , grammarLexer :: t -> (c,SyntaxNode RuleId RangeRec)
+ , grammarCats :: SList FCat
+ , grammarToks :: SList FToken
+ , grammarLexer :: FToken -> (FCat,SyntaxNode RuleId RangeRec)
}
@@ -68,7 +68,7 @@ getLeftCornerCat lins
where
syms = lins ! 0
-buildFCFPInfo :: (Ord c, Ord n, Ord t) => (t -> (c,SyntaxNode RuleId RangeRec)) -> FCFGrammar c n t -> FCFPInfo c n t
+buildFCFPInfo :: (FToken -> (FCat,SyntaxNode RuleId RangeRec)) -> FGrammar -> FCFPInfo
buildFCFPInfo lexer grammar =
FCFPInfo { allRules = allrules
, topdownRules = topdownrules
@@ -98,7 +98,7 @@ buildFCFPInfo lexer grammar =
----------------------------------------------------------------------
-- pretty-printing of statistics
-instance (Ord c, Ord n, Ord t) => Print (FCFPInfo c n t) where
+instance Print FCFPInfo where
prt pI = "[ allRules=" ++ sl (elems . allRules) ++
"; tdRules=" ++ sla topdownRules ++
-- "; emptyRules=" ++ sl emptyRules ++