diff options
| author | aarne <aarne@cs.chalmers.se> | 2008-05-31 16:30:36 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2008-05-31 16:30:36 +0000 |
| commit | bd7d0c7c5e62b1c008be9ce0d85e8d0592fec0eb (patch) | |
| tree | 5ba9b80e706791ed37e1e000b2bf6ea8c1e802bc /src-3.0/GF/Infra/Modules.hs | |
| parent | 9229c157642c3503d365f42fe5ecac414958ab9b (diff) | |
printing line numbers in rename and check-grammar error messages
Diffstat (limited to 'src-3.0/GF/Infra/Modules.hs')
| -rw-r--r-- | src-3.0/GF/Infra/Modules.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src-3.0/GF/Infra/Modules.hs b/src-3.0/GF/Infra/Modules.hs index 001818d46..797f729c8 100644 --- a/src-3.0/GF/Infra/Modules.hs +++ b/src-3.0/GF/Infra/Modules.hs @@ -34,6 +34,7 @@ module GF.Infra.Modules ( IdentM(..), typeOfModule, abstractOfConcrete, abstractModOfConcrete, lookupModule, lookupModuleType, lookupModMod, lookupInfo, + lookupPosition, showPosition, allModMod, isModAbs, isModRes, isModCnc, isModTrans, sameMType, isCompilableModule, isCompleteModule, allAbstracts, greatestAbstract, allResources, @@ -326,6 +327,16 @@ lookupModMod gr i = do lookupInfo :: (Show i, Ord i) => Module i a -> i -> Err a lookupInfo mo i = lookupTree show i (jments mo) +lookupPosition :: (Show i, Ord i) => Module i a -> i -> Err (String,(Int,Int)) +lookupPosition mo i = lookupTree show i (positions mo) + +showPosition :: (Show i, Ord i) => Module i a -> i -> String +showPosition mo i = case lookupPosition mo i of + Ok (f,(b,e)) | b == e -> "in" +++ f ++ ", line" +++ show b + Ok (f,(b,e)) -> "in" +++ f ++ ", lines" +++ show b ++ "-" ++ show e + _ -> "" + + allModMod :: (Show i,Eq i) => MGrammar i a -> [(i,Module i a)] allModMod gr = [(i,m) | (i, ModMod m) <- modules gr] |
