summaryrefslogtreecommitdiff
path: root/src/GF/Devel
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2007-12-16 22:24:36 +0000
committeraarne <aarne@cs.chalmers.se>2007-12-16 22:24:36 +0000
commit7551c70db6c76a796e93fa1cd4ebe7c850344b7e (patch)
tree9a473d9fc972ac26b7a9bed00673609f47c18193 /src/GF/Devel
parent49b3ffb7a0ba176a6689d7792ad42cdd2f17adee (diff)
restored Int size and last ; added lib/prelude to be the last in any grammar path
Diffstat (limited to 'src/GF/Devel')
-rw-r--r--src/GF/Devel/CheckGrammar.hs5
-rw-r--r--src/GF/Devel/GrammarToGFCC.hs15
-rw-r--r--src/GF/Devel/UseIO.hs2
3 files changed, 12 insertions, 10 deletions
diff --git a/src/GF/Devel/CheckGrammar.hs b/src/GF/Devel/CheckGrammar.hs
index c3fde011d..9502bbec1 100644
--- a/src/GF/Devel/CheckGrammar.hs
+++ b/src/GF/Devel/CheckGrammar.hs
@@ -340,10 +340,7 @@ computeLType gr t = do
Q m c | elem c [cPredef,cPredefAbs] -> return ty
Q m c | elem c [zIdent "Int"] ->
- return $ defLinType
----- let ints k = App (Q (IC "Predef") (IC "Ints")) (EInt k) in
----- RecType [
----- (LIdent "last",ints 9),(LIdent "s", typeStr), (LIdent "size",ints 1)]
+ return $ linTypeInt
Q m c | elem c [zIdent "Float",zIdent "String"] -> return defLinType ----
Q m ident -> checkIn ("module" +++ prt m) $ do
diff --git a/src/GF/Devel/GrammarToGFCC.hs b/src/GF/Devel/GrammarToGFCC.hs
index 0ae0129ad..a61a2ec49 100644
--- a/src/GF/Devel/GrammarToGFCC.hs
+++ b/src/GF/Devel/GrammarToGFCC.hs
@@ -221,9 +221,11 @@ reorder abs cg = M.MGrammar $
(i,mo) <- mos, M.isModCnc mo,
Just r <- [lookup i (M.allExtendSpecs cg la)]]
- predefCDefs = [(IC c, CncCat (Yes GM.defLinType) Nope Nope) |
- ---- lindef,printname
- c <- ["Float","Int","String"]]
+ predefCDefs =
+ (IC "Int", CncCat (Yes Look.linTypeInt) Nope Nope) :
+ [(IC c, CncCat (Yes GM.defLinType) Nope Nope) |
+ ---- lindef,printname
+ c <- ["Float","String"]]
sortIds = sortBy (\ (f,_) (g,_) -> compare f g)
nubFlags = nubBy (\ (Opt (f,_)) (Opt (g,_)) -> f == g)
@@ -304,7 +306,9 @@ type ParamEnv =
--- gathers those param types that are actually used in lincats and lin terms
paramValues :: SourceGrammar -> ParamEnv
paramValues cgr = (labels,untyps,typs) where
- partyps = nub $ [ty |
+ partyps = nub $
+ [App (Q (IC "Predef") (IC "Ints")) (EInt i) | i <- [1,9]] ---linTypeInt
+ ++ [ty |
(_,(_,CncCat (Yes (RecType ls)) _ _)) <- jments,
ty0 <- [ty | (_, ty) <- unlockTyp ls],
ty <- typsFrom ty0
@@ -342,7 +346,8 @@ paramValues cgr = (labels,untyps,typs) where
untyps =
Map.fromList $ concatMap Map.toList [typ | (_,typ) <- Map.toList typs]
lincats =
- [(IC cat,[(LIdent "s",GM.typeStr)]) | cat <- ["Int", "Float", "String"]] ++
+ [(IC "Int",[f | let RecType fs = Look.linTypeInt, f <- fs])] ++
+ [(IC cat,[(LIdent "s",GM.typeStr)]) | cat <- ["Float", "String"]] ++
reverse ---- TODO: really those lincats that are reached
---- reverse is enough to expel overshadowed ones...
[(cat,(unlockTyp ls)) | (_,(cat,CncCat (Yes (RecType ls)) _ _)) <- jments]
diff --git a/src/GF/Devel/UseIO.hs b/src/GF/Devel/UseIO.hs
index 21842724d..134f2f3d0 100644
--- a/src/GF/Devel/UseIO.hs
+++ b/src/GF/Devel/UseIO.hs
@@ -131,7 +131,7 @@ extendPathEnv lib var ps = do
s <- catch (getEnv var) (const (return "")) -- e.g. GF_GRAMMAR_PATH
let fs = pFilePaths s
let ss = ps ++ fs
- liftM concat $ mapM allSubdirs $ ss ++ [b ++ "/" ++ s | s <- ss]
+ liftM concat $ mapM allSubdirs $ ss ++ [b ++ "/" ++ s | s <- ss ++ ["prelude"]]
pFilePaths :: String -> [FilePath]
pFilePaths s = case break isPathSep s of