summaryrefslogtreecommitdiff
path: root/src/GF/Infra/Modules.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Infra/Modules.hs')
-rw-r--r--src/GF/Infra/Modules.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/GF/Infra/Modules.hs b/src/GF/Infra/Modules.hs
index 573c59ca5..0b951dd14 100644
--- a/src/GF/Infra/Modules.hs
+++ b/src/GF/Infra/Modules.hs
@@ -33,7 +33,7 @@ module GF.Infra.Modules (
IdentM(..),
abstractOfConcrete, abstractModOfConcrete,
lookupModule, lookupModuleType, lookupInfo,
- lookupPosition, showPosition,
+ lookupPosition, showPosition, ppPosition,
isModAbs, isModRes, isModCnc, isModTrans,
sameMType, isCompilableModule, isCompleteModule,
allAbstracts, greatestAbstract, allResources,
@@ -45,7 +45,7 @@ import GF.Infra.Option
import GF.Data.Operations
import Data.List
-
+import Text.PrettyPrint
-- AR 29/4/2003
@@ -274,6 +274,12 @@ showPosition mo i = case lookupPosition mo i of
Ok (f,(b,e)) -> "in" +++ f ++ ", lines" +++ show b ++ "-" ++ show e
_ -> ""
+ppPosition :: (Show i, Ord i) => ModInfo i a -> i -> 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 i a -> Bool
isModAbs m = case mtype m of
MTAbstract -> True