1
0
forked from GitHub/gf-core

redesign the open-literals API

This commit is contained in:
krasimir
2010-07-01 08:51:59 +00:00
parent 706b215fce
commit 5ae7be358d
15 changed files with 198 additions and 176 deletions

View File

@@ -60,8 +60,8 @@ lookupIdentInfo mo i = lookupIdent i (jments mo)
lookupResDef :: SourceGrammar -> QIdent -> Err Term
lookupResDef gr (m,c)
| isLiteralCat c = lock c defLinType
| otherwise = look m c
| isPredefCat c = lock c defLinType
| otherwise = look m c
where
look m c = do
mo <- lookupModule gr m
@@ -161,7 +161,7 @@ lookupAbsDef gr m c = errIn (render (text "looking up absdef of" <+> ppIdent c))
_ -> return (Nothing,Nothing)
lookupLincat :: SourceGrammar -> Ident -> Ident -> Err Type
lookupLincat gr m c | isLiteralCat c = return defLinType --- ad hoc; not needed?
lookupLincat gr m c | isPredefCat c = return defLinType --- ad hoc; not needed?
lookupLincat gr m c = do
mo <- lookupModule gr m
info <- lookupIdentInfo mo c

View File

@@ -25,7 +25,7 @@ module GF.Grammar.Predef
, cErrorType
, cOverload
, cUndefinedType
, isLiteralCat
, isPredefCat
, cPTrue, cPFalse
@@ -92,8 +92,8 @@ cOverload = identC (BS.pack "overload")
cUndefinedType :: Ident
cUndefinedType = identC (BS.pack "UndefinedType")
isLiteralCat :: Ident -> Bool
isLiteralCat c = elem c [cInt,cString,cFloat,cVar]
isPredefCat :: Ident -> Bool
isPredefCat c = elem c [cInt,cString,cFloat]
cPTrue :: Ident
cPTrue = identC (BS.pack "PTrue")

View File

@@ -19,7 +19,7 @@ module GF.Grammar.Values (-- * values used in TC type checking
Binds, Constraints, MetaSubst,
-- * for TC
valAbsInt, valAbsFloat, valAbsString, vType,
isLiteralCat,
isPredefCat,
eType,
--Z tree2exp, loc2treeFocus
) where