summaryrefslogtreecommitdiff
path: root/src/GF/Devel/Compile/CheckGrammar.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-02-01 22:01:10 +0000
committeraarne <aarne@cs.chalmers.se>2008-02-01 22:01:10 +0000
commit48895581378353743e51bae6cbbe60bf31b7b8e3 (patch)
tree91ffacfa4b95a59e216d32cf69673256b9370415 /src/GF/Devel/Compile/CheckGrammar.hs
parent3addf256bcfaaa7748b0159a3dd6f6ce8fcd8b7c (diff)
added some new pattern forms, incl. pattern macros, to testgf3
Diffstat (limited to 'src/GF/Devel/Compile/CheckGrammar.hs')
-rw-r--r--src/GF/Devel/Compile/CheckGrammar.hs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/GF/Devel/Compile/CheckGrammar.hs b/src/GF/Devel/Compile/CheckGrammar.hs
index 55f499d38..5038c5168 100644
--- a/src/GF/Devel/Compile/CheckGrammar.hs
+++ b/src/GF/Devel/Compile/CheckGrammar.hs
@@ -577,6 +577,12 @@ inferLType gr trm = case trm of
--- checkIfComplexVariantType trm ty
check trm ty
+ EPattType ty -> do
+ ty' <- justCheck ty typeType
+ return (ty',typeType)
+ EPatt p -> do
+ ty <- inferPatt p
+ return (trm, EPattType ty)
_ -> prtFail "cannot infer lintype of" trm
where
@@ -612,20 +618,25 @@ inferLType gr trm = case trm of
PString _ -> True
PInt _ -> True
PFloat _ -> True
- PSeq p q -> isConstPatt p && isConstPatt q
- PAlt p q -> isConstPatt p && isConstPatt q
+ PSeq p q -> isConstPatt p || isConstPatt q
+ PAlt p q -> isConstPatt p || isConstPatt q
PRep p -> isConstPatt p
PNeg p -> isConstPatt p
PAs _ p -> isConstPatt p
+ PChar -> True
+ PChars _ -> True
_ -> False
inferPatt p = case p of
- PP q c ps | q /= cPredef -> checkErr $ lookupOperType gr q c >>= return . snd . prodForm
+ PP q c ps | q /= cPredef ->
+ checkErr $ lookupOperType gr q c >>= return . snd . prodForm
PAs _ p -> inferPatt p
PNeg p -> inferPatt p
PAlt p q -> checks [inferPatt p, inferPatt q]
PSeq _ _ -> return $ typeStr
PRep _ -> return $ typeStr
+ PChar -> return $ typeStr
+ PChars _ -> return $ typeStr
_ -> infer (patt2term p) >>= return . snd