From 5fe49ed9f7ac7089301e867e55bfedefcba230dd Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Wed, 2 Nov 2011 11:44:59 +0000 Subject: 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. --- src/compiler/GF/Grammar/Grammar.hs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/compiler/GF/Grammar/Grammar.hs') diff --git a/src/compiler/GF/Grammar/Grammar.hs b/src/compiler/GF/Grammar/Grammar.hs index ae29ab6d5..627355033 100644 --- a/src/compiler/GF/Grammar/Grammar.hs +++ b/src/compiler/GF/Grammar/Grammar.hs @@ -20,7 +20,7 @@ module GF.Grammar.Grammar (SourceGrammar, SourceModule, mapSourceModule, Info(..), - L(..), unLoc, + Location(..), L(..), unLoc, Type, Cat, Fun, @@ -80,7 +80,7 @@ data Info = | AbsFun (Maybe (L Type)) (Maybe Int) (Maybe [L Equation]) (Maybe Bool) -- ^ (/ABS/) type, arrity and definition of a function -- judgements in resource - | ResParam (Maybe [L Param]) (Maybe [Term]) -- ^ (/RES/) the second parameter is list of all possible values + | ResParam (Maybe (L [Param])) (Maybe [Term]) -- ^ (/RES/) the second parameter is list of all possible values | ResValue (L Type) -- ^ (/RES/) to mark parameter constructors for lookup | ResOper (Maybe (L Type)) (Maybe (L Term)) -- ^ (/RES/) @@ -94,8 +94,14 @@ data Info = | AnyInd Bool Ident -- ^ (/INDIR/) the 'Bool' says if canonical deriving Show -data L a = L (Int,Int) a -- location information - deriving (Eq,Show) +data Location + = NoLoc + | Local Int Int + | External FilePath Location + deriving (Show,Eq,Ord) + +data L a = L Location a -- location information + deriving Show instance Functor L where fmap f (L loc x) = L loc (f x) -- cgit v1.2.3