mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-21 17:12:50 -06:00
rename GF.Grammar.Predef.isPredefCat to isLiteralCat
This commit is contained in:
@@ -161,7 +161,7 @@ checkInferExp th tenv@(k,_,_) e typ = do
|
|||||||
inferExp :: Theory -> TCEnv -> Exp -> Err (AExp, Val, [(Val,Val)])
|
inferExp :: Theory -> TCEnv -> Exp -> Err (AExp, Val, [(Val,Val)])
|
||||||
inferExp th tenv@(k,rho,gamma) e = case e of
|
inferExp th tenv@(k,rho,gamma) e = case e of
|
||||||
Vr x -> mkAnnot (AVr x) $ noConstr $ lookupVar gamma x
|
Vr x -> mkAnnot (AVr x) $ noConstr $ lookupVar gamma x
|
||||||
Q (m,c) | m == cPredefAbs && isPredefCat c
|
Q (m,c) | m == cPredefAbs && isLiteralCat c
|
||||||
-> return (ACn (m,c) vType, vType, [])
|
-> return (ACn (m,c) vType, vType, [])
|
||||||
| otherwise -> mkAnnot (ACn (m,c)) $ noConstr $ lookupConst th (m,c)
|
| otherwise -> mkAnnot (ACn (m,c)) $ noConstr $ lookupConst th (m,c)
|
||||||
QC c -> mkAnnot (ACn c) $ noConstr $ lookupConst th c ----
|
QC c -> mkAnnot (ACn c) $ noConstr $ lookupConst th c ----
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ renameIdentTerm env@(act,imps) t =
|
|||||||
|
|
||||||
-- this facility is mainly for BWC with GF1: you need not import PredefAbs
|
-- this facility is mainly for BWC with GF1: you need not import PredefAbs
|
||||||
predefAbs c s
|
predefAbs c s
|
||||||
| isPredefCat c = return $ Q (cPredefAbs,c)
|
| isLiteralCat c = return $ Q (cPredefAbs,c)
|
||||||
| otherwise = checkError s
|
| otherwise = checkError s
|
||||||
|
|
||||||
ident alt c = case lookupTree showIdent c act of
|
ident alt c = case lookupTree showIdent c act of
|
||||||
Ok f -> return $ f c
|
Ok f -> return $ f c
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ lookupIdentInfo mo i = lookupIdent i (jments mo)
|
|||||||
|
|
||||||
lookupResDef :: SourceGrammar -> QIdent -> Err Term
|
lookupResDef :: SourceGrammar -> QIdent -> Err Term
|
||||||
lookupResDef gr (m,c)
|
lookupResDef gr (m,c)
|
||||||
| isPredefCat c = lock c defLinType
|
| isLiteralCat c = lock c defLinType
|
||||||
| otherwise = look m c
|
| otherwise = look m c
|
||||||
where
|
where
|
||||||
look m c = do
|
look m c = do
|
||||||
mo <- lookupModule gr m
|
mo <- lookupModule gr m
|
||||||
@@ -161,7 +161,7 @@ lookupAbsDef gr m c = errIn (render (text "looking up absdef of" <+> ppIdent c))
|
|||||||
_ -> return (Nothing,Nothing)
|
_ -> return (Nothing,Nothing)
|
||||||
|
|
||||||
lookupLincat :: SourceGrammar -> Ident -> Ident -> Err Type
|
lookupLincat :: SourceGrammar -> Ident -> Ident -> Err Type
|
||||||
lookupLincat gr m c | isPredefCat c = return defLinType --- ad hoc; not needed?
|
lookupLincat gr m c | isLiteralCat c = return defLinType --- ad hoc; not needed?
|
||||||
lookupLincat gr m c = do
|
lookupLincat gr m c = do
|
||||||
mo <- lookupModule gr m
|
mo <- lookupModule gr m
|
||||||
info <- lookupIdentInfo mo c
|
info <- lookupIdentInfo mo c
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module GF.Grammar.Predef
|
|||||||
, cErrorType
|
, cErrorType
|
||||||
, cOverload
|
, cOverload
|
||||||
, cUndefinedType
|
, cUndefinedType
|
||||||
, isPredefCat
|
, isLiteralCat
|
||||||
|
|
||||||
, cPTrue, cPFalse
|
, cPTrue, cPFalse
|
||||||
|
|
||||||
@@ -88,8 +88,8 @@ cOverload = identC (BS.pack "overload")
|
|||||||
cUndefinedType :: Ident
|
cUndefinedType :: Ident
|
||||||
cUndefinedType = identC (BS.pack "UndefinedType")
|
cUndefinedType = identC (BS.pack "UndefinedType")
|
||||||
|
|
||||||
isPredefCat :: Ident -> Bool
|
isLiteralCat :: Ident -> Bool
|
||||||
isPredefCat c = elem c [cInt,cString,cFloat]
|
isLiteralCat c = elem c [cInt,cString,cFloat]
|
||||||
|
|
||||||
cPTrue :: Ident
|
cPTrue :: Ident
|
||||||
cPTrue = identC (BS.pack "PTrue")
|
cPTrue = identC (BS.pack "PTrue")
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module GF.Grammar.Values (-- * values used in TC type checking
|
|||||||
Binds, Constraints, MetaSubst,
|
Binds, Constraints, MetaSubst,
|
||||||
-- * for TC
|
-- * for TC
|
||||||
valAbsInt, valAbsFloat, valAbsString, vType,
|
valAbsInt, valAbsFloat, valAbsString, vType,
|
||||||
isPredefCat,
|
isLiteralCat,
|
||||||
eType,
|
eType,
|
||||||
--Z tree2exp, loc2treeFocus
|
--Z tree2exp, loc2treeFocus
|
||||||
) where
|
) where
|
||||||
|
|||||||
Reference in New Issue
Block a user