summaryrefslogtreecommitdiff
path: root/src/GF/Grammar
diff options
context:
space:
mode:
authoraarne <unknown>2004-09-24 08:46:03 +0000
committeraarne <unknown>2004-09-24 08:46:03 +0000
commit33ea630d4d431045c13e96c51e953ce0bafb4f0f (patch)
treefbac8eb1c4b9c2344e4ddfcd8a281e859aaf7f42 /src/GF/Grammar
parent2c60a2d82a0d7b90924e7dbbcacf36afb8549d17 (diff)
bug fixes in parsing etc; improved ImperC
Diffstat (limited to 'src/GF/Grammar')
-rw-r--r--src/GF/Grammar/LookAbs.hs9
-rw-r--r--src/GF/Grammar/Macros.hs4
2 files changed, 13 insertions, 0 deletions
diff --git a/src/GF/Grammar/LookAbs.hs b/src/GF/Grammar/LookAbs.hs
index 06e3ce3a5..ba809822a 100644
--- a/src/GF/Grammar/LookAbs.hs
+++ b/src/GF/Grammar/LookAbs.hs
@@ -105,6 +105,15 @@ allCatsOf gr =
isModAbs m,
(c, C.AbsCat cont _) <- tree2list (jments m)]
+allBindCatsOf :: GFCGrammar -> [Cat]
+allBindCatsOf gr =
+ nub [c | (i, ModMod m) <- modules gr,
+ isModAbs m,
+ (c, C.AbsFun typ _) <- tree2list (jments m),
+ Ok (cont,_) <- [firstTypeForm typ],
+ c <- concatMap fst $ errVal [] $ mapM (catSkeleton . snd) cont
+ ]
+
funsForType :: (Val -> Type -> Bool) -> GFCGrammar -> Val -> [(Fun,Type)]
funsForType compat gr val = [(fun,typ) | (fun,typ) <- funRulesOf gr,
compat val typ]
diff --git a/src/GF/Grammar/Macros.hs b/src/GF/Grammar/Macros.hs
index f11b9bbe9..8b9f825b5 100644
--- a/src/GF/Grammar/Macros.hs
+++ b/src/GF/Grammar/Macros.hs
@@ -273,6 +273,10 @@ typeString = constPredefRes "String"
typeInt = constPredefRes "Int"
typeInts i = App (constPredefRes "Ints") (EInt i)
+isTypeInts ty = case ty of
+ App c _ -> c == constPredefRes "Ints"
+ _ -> False
+
constPredefRes s = Q (IC "Predef") (zIdent s)
isPredefConstant t = case t of