diff options
| author | aarne <unknown> | 2004-03-24 15:09:06 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2004-03-24 15:09:06 +0000 |
| commit | dc71ffcf5bae1f2b91467de273c71e7c3294acb3 (patch) | |
| tree | a4e705bba717aa9f7421c000cfa5756d5eb8462b /src/GF/Compile | |
| parent | 31836c0da9ba7a716ee0480e6219d771da4999fa (diff) | |
Restoring old functionality
Diffstat (limited to 'src/GF/Compile')
| -rw-r--r-- | src/GF/Compile/CheckGrammar.hs | 6 | ||||
| -rw-r--r-- | src/GF/Compile/GetGrammar.hs | 11 | ||||
| -rw-r--r-- | src/GF/Compile/Rename.hs | 2 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/GF/Compile/CheckGrammar.hs b/src/GF/Compile/CheckGrammar.hs index 6e8abc02d..3a1b480ff 100644 --- a/src/GF/Compile/CheckGrammar.hs +++ b/src/GF/Compile/CheckGrammar.hs @@ -13,6 +13,7 @@ import LookAbs import Macros import ReservedWords ---- import PatternMatch +import AppPredefined import Operations import CheckM @@ -207,6 +208,8 @@ computeLType gr t = do where comp ty = case ty of + Q m _ | m == cPredef -> return ty + Q m ident -> do ty' <- checkErr (lookupResDef gr m ident) if ty' == ty then return ty else comp ty' --- is this necessary to test? @@ -256,6 +259,8 @@ 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 -> checks [ termWith trm $ checkErr (lookupResType gr m ident) , @@ -616,6 +621,7 @@ checkEqLType env t u trm = do ---- this should be made in Rename (Q m a, Q n b) | a == b -> elem m (allExtendsPlus env n) || elem n (allExtendsPlus env m) + || m == n --- for Predef (QC m a, QC n b) | a == b -> elem m (allExtendsPlus env n) || elem n (allExtendsPlus env m) (QC m a, Q n b) | a == b -> elem m (allExtendsPlus env n) diff --git a/src/GF/Compile/GetGrammar.hs b/src/GF/Compile/GetGrammar.hs index 3b9acd9d6..f5698bb9c 100644 --- a/src/GF/Compile/GetGrammar.hs +++ b/src/GF/Compile/GetGrammar.hs @@ -16,6 +16,9 @@ import Option import ParGF import qualified LexGF as L +import PPrCF +import CFtoGrammar + import ReadFiles ---- import List (nub) @@ -81,3 +84,11 @@ oldLexer = map change . L.tokens where new = words $ "abstract concrete interface incomplete " ++ "instance out open resource reuse transfer union with where" +getCFGrammar :: Options -> FilePath -> IOE SourceGrammar +getCFGrammar opts file = do + let mo = takeWhile (/='-') file + s <- ioeIO $ readFileIf file + cf <- ioeErr $ pCF mo file + defs <- return $ cf2grammar cf + let g = A.OldGr A.NoIncl defs + ioeErr $ transOldGrammar opts file g diff --git a/src/GF/Compile/Rename.hs b/src/GF/Compile/Rename.hs index 5d5bae2a9..30c2b2c71 100644 --- a/src/GF/Compile/Rename.hs +++ b/src/GF/Compile/Rename.hs @@ -6,6 +6,7 @@ import Modules import Ident import Macros import PrGrammar +import AppPredefined import Lookup import Extend import Operations @@ -56,6 +57,7 @@ renameIdentTerm env@(act,imps) t = Cn c -> do f <- lookupTreeMany prt opens c return $ f c + Q m' c | m' == cPredef {- && isInPredefined c -} -> return t Q m' c -> do m <- lookupErr m' qualifs f <- lookupTree prt c m |
