diff options
| author | aarne <unknown> | 2004-06-18 13:14:50 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2004-06-18 13:14:50 +0000 |
| commit | 22613ceb3772722f6e5a5a4470bedd7d6d727474 (patch) | |
| tree | 2453cd1a1811aafe4eb096c77b998a06f4b4262c /src | |
| parent | 29b9dcaf822e3992eabeac3adaa006e0793409d4 (diff) | |
small things
Diffstat (limited to 'src')
| -rw-r--r-- | src/GF/Compile/CheckGrammar.hs | 11 | ||||
| -rw-r--r-- | src/GF/Grammar/Macros.hs | 1 | ||||
| -rw-r--r-- | src/GF/Shell.hs | 7 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/GF/Compile/CheckGrammar.hs b/src/GF/Compile/CheckGrammar.hs index f7df7102d..c4de7beb1 100644 --- a/src/GF/Compile/CheckGrammar.hs +++ b/src/GF/Compile/CheckGrammar.hs @@ -6,6 +6,7 @@ import Modules import Refresh ---- import TypeCheck +import Values (cPredefAbs) --- import PrGrammar import Lookup @@ -208,9 +209,9 @@ computeLType gr t = do where comp ty = case ty of - Q m _ | m == cPredef -> return ty + Q m c | elem c [cPredef,cPredefAbs] -> return ty - Q m ident -> do + Q m ident -> checkIn ("Q" +++ show m) $ do ty' <- checkErr (lookupResDef gr m ident) if ty' == ty then return ty else comp ty' --- is this necessary to test? @@ -259,7 +260,7 @@ checkReservedId x = let c = prt x in inferLType :: SourceGrammar -> Term -> Check (Term, Type) inferLType gr trm = case trm of - Q m ident | m==cPredef -> termWith trm $ checkErr (typPredefined ident) + Q m ident | isPredef m -> termWith trm $ checkErr (typPredefined ident) Q m ident -> checks [ termWith trm $ checkErr (lookupResType gr m ident) @@ -269,7 +270,7 @@ inferLType gr trm = case trm of prtFail "cannot infer type of constant" trm ] - QC m ident | m==cPredef -> termWith trm $ checkErr (typPredefined ident) + QC m ident | isPredef m -> termWith trm $ checkErr (typPredefined ident) QC m ident -> checks [ termWith trm $ checkErr (lookupResType gr m ident) @@ -402,6 +403,8 @@ inferLType gr trm = case trm of check = checkLType env + isPredef m = elem m [cPredef,cPredefAbs] + justCheck ty te = check ty te >>= return . fst -- for record fields, which may be typed diff --git a/src/GF/Grammar/Macros.hs b/src/GF/Grammar/Macros.hs index cdaea6734..5b82b5d1c 100644 --- a/src/GF/Grammar/Macros.hs +++ b/src/GF/Grammar/Macros.hs @@ -272,6 +272,7 @@ constPredefRes s = Q (IC "Predef") (zIdent s) isPredefConstant t = case t of Q (IC "Predef") _ -> True + Q (IC "PredefAbs") _ -> True _ -> False mkSelects :: Term -> [Term] -> Term diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs index e00382bff..014f5bd60 100644 --- a/src/GF/Shell.hs +++ b/src/GF/Shell.hs @@ -128,7 +128,12 @@ execC co@(comm, opts0) sa@((st,(h,_)),a) = checkOptions st co >> case comm of ASTrm _ -> s2t a _ -> a case a' of - ATrms (trm:_) -> do + ATrms (trm:_) -> case tree2exp trm of + G.EInt _ -> do + putStrLn "Warning: Number argument deprecated, use gr -number=n instead" + ts <- randomTreesIO opts gro (optIntOrN opts flagNumber 1) + returnArg (ATrms ts) sa + _ -> do g <- newStdGen case (goFirstMeta (tree2loc trm) >>= refineRandom g 41 cgr) of Ok trm' -> returnArg (ATrms [loc2tree trm']) sa |
