diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2011-11-02 11:44:59 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2011-11-02 11:44:59 +0000 |
| commit | 5fe49ed9f7ac7089301e867e55bfedefcba230dd (patch) | |
| tree | 3d49a4fbd3e3af5350b4e276d65ec3c17f0907c3 /src/compiler/GF/Infra/Modules.hs | |
| parent | 42af63414fae6cec2ea6d648464f9475501b2b28 (diff) | |
Now the compiler maintains more precise information for the source locations of the different definitions. There is a --tags option which generates a list of all identifiers with their source locations.
Diffstat (limited to 'src/compiler/GF/Infra/Modules.hs')
| -rw-r--r-- | src/compiler/GF/Infra/Modules.hs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/compiler/GF/Infra/Modules.hs b/src/compiler/GF/Infra/Modules.hs index a80c0060a..67e010ece 100644 --- a/src/compiler/GF/Infra/Modules.hs +++ b/src/compiler/GF/Infra/Modules.hs @@ -46,16 +46,11 @@ import GF.Data.Operations import Data.List import qualified Data.Map as Map import Text.PrettyPrint +import System.FilePath --- AR 29/4/2003 --- The same structure will be used in both source code and canonical. --- The parameters tell what kind of data is involved. -- Invariant: modules are stored in dependency order ---mGrammar = MGrammar ---newtype MGrammar a = MGrammar {modules :: [(Ident,ModInfo a)]} - data MGrammar a = MGrammar { moduleMap :: Map.Map Ident (ModInfo a), modules :: [(Ident,ModInfo a)] } deriving Show @@ -69,6 +64,7 @@ data ModInfo a = ModInfo { mwith :: Maybe (Ident,MInclude,[(Ident,Ident)]), opens :: [OpenSpec], mexdeps :: [Ident], + msrc :: FilePath, jments :: Map.Map Ident a } deriving Show @@ -109,13 +105,13 @@ updateMGrammar (MGrammar omap os) (MGrammar nmap ns) = nis = map fst ns -} updateModule :: ModInfo t -> Ident -> t -> ModInfo t -updateModule (ModInfo mt ms fs me mw ops med js) i t = ModInfo mt ms fs me mw ops med (updateTree (i,t) js) +updateModule (ModInfo mt ms fs me mw ops med src js) i t = ModInfo mt ms fs me mw ops med src (updateTree (i,t) js) replaceJudgements :: ModInfo t -> Map.Map Ident t -> ModInfo t -replaceJudgements (ModInfo mt ms fs me mw ops med _) js = ModInfo mt ms fs me mw ops med js +replaceJudgements (ModInfo mt ms fs me mw ops med src _) js = ModInfo mt ms fs me mw ops med src js addOpenQualif :: Ident -> Ident -> ModInfo t -> ModInfo t -addOpenQualif i j (ModInfo mt ms fs me mw ops med js) = ModInfo mt ms fs me mw (OQualif i j : ops) med js +addOpenQualif i j (ModInfo mt ms fs me mw ops med src js) = ModInfo mt ms fs me mw (OQualif i j : ops) med src js addFlag :: Options -> ModInfo t -> ModInfo t addFlag f mo = mo {flags = flags mo `addOptions` f} @@ -227,7 +223,7 @@ emptyMGrammar :: MGrammar a emptyMGrammar = mGrammar [] emptyModInfo :: ModInfo a -emptyModInfo = ModInfo MTResource MSComplete noOptions [] Nothing [] [] emptyBinTree +emptyModInfo = ModInfo MTResource MSComplete noOptions [] Nothing [] [] "" emptyBinTree -- | we store the module type with the identifier |
