diff options
| author | krasimir <krasimir@chalmers.se> | 2010-03-22 21:15:29 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2010-03-22 21:15:29 +0000 |
| commit | bf74f50733840b0bcec81ac265c824ae2bc3f675 (patch) | |
| tree | 24cb47678cbc2e88de73a3a670930d68c5555593 /src/compiler/GF/Infra/Modules.hs | |
| parent | 716a209f65a2dc10cdaec7e5b12af09267694b3a (diff) | |
store and propagate the exact source location for all judgements in the grammar. It may not be used accurately in the error messages yet
Diffstat (limited to 'src/compiler/GF/Infra/Modules.hs')
| -rw-r--r-- | src/compiler/GF/Infra/Modules.hs | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/compiler/GF/Infra/Modules.hs b/src/compiler/GF/Infra/Modules.hs index 40941c398..af930f881 100644 --- a/src/compiler/GF/Infra/Modules.hs +++ b/src/compiler/GF/Infra/Modules.hs @@ -32,7 +32,6 @@ module GF.Infra.Modules ( emptyMGrammar, emptyModInfo, abstractOfConcrete, abstractModOfConcrete, lookupModule, lookupModuleType, lookupInfo, - lookupPosition, ppPosition, isModAbs, isModRes, isModCnc, sameMType, isCompilableModule, isCompleteModule, allAbstracts, greatestAbstract, allResources, @@ -64,8 +63,7 @@ data ModInfo a = ModInfo { mwith :: Maybe (Ident,MInclude,[(Ident,Ident)]), opens :: [OpenSpec], mexdeps :: [Ident], - jments :: Map.Map Ident a, - positions :: Map.Map Ident (String,(Int,Int)) -- file, first line, last line + jments :: Map.Map Ident a } deriving Show @@ -105,13 +103,13 @@ updateMGrammar old new = MGrammar $ ns = modules new updateModule :: ModInfo t -> Ident -> t -> ModInfo t -updateModule (ModInfo mt ms fs me mw ops med js ps) i t = ModInfo mt ms fs me mw ops med (updateTree (i,t) js) ps +updateModule (ModInfo mt ms fs me mw ops med js) i t = ModInfo mt ms fs me mw ops med (updateTree (i,t) js) replaceJudgements :: ModInfo t -> Map.Map Ident t -> ModInfo t -replaceJudgements (ModInfo mt ms fs me mw ops med _ ps) js = ModInfo mt ms fs me mw ops med js ps +replaceJudgements (ModInfo mt ms fs me mw ops med _) js = ModInfo mt ms fs me mw ops med js addOpenQualif :: Ident -> Ident -> ModInfo t -> ModInfo t -addOpenQualif i j (ModInfo mt ms fs me mw ops med js ps) = ModInfo mt ms fs me mw (OQualif i j : ops) med js ps +addOpenQualif i j (ModInfo mt ms fs me mw ops med js) = ModInfo mt ms fs me mw (OQualif i j : ops) med js addFlag :: Options -> ModInfo t -> ModInfo t addFlag f mo = mo {flags = flags mo `addOptions` f} @@ -216,7 +214,7 @@ emptyMGrammar :: MGrammar a emptyMGrammar = MGrammar [] emptyModInfo :: ModInfo a -emptyModInfo = ModInfo MTResource MSComplete noOptions [] Nothing [] [] emptyBinTree emptyBinTree +emptyModInfo = ModInfo MTResource MSComplete noOptions [] Nothing [] [] emptyBinTree -- | we store the module type with the identifier @@ -250,15 +248,6 @@ lookupModuleType gr m = do lookupInfo :: ModInfo a -> Ident -> Err a lookupInfo mo i = lookupTree showIdent i (jments mo) -lookupPosition :: ModInfo a -> Ident -> Err (String,(Int,Int)) -lookupPosition mo i = lookupTree showIdent i (positions mo) - -ppPosition :: ModInfo a -> Ident -> Doc -ppPosition mo i = case lookupPosition mo i of - Ok (f,(b,e)) | b == e -> text "in" <+> text f <> text ", line" <+> int b - | otherwise -> text "in" <+> text f <> text ", lines" <+> int b <> text "-" <> int e - _ -> empty - isModAbs :: ModInfo a -> Bool isModAbs m = case mtype m of |
