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/Grammar/Grammar.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/Grammar/Grammar.hs')
| -rw-r--r-- | src/compiler/GF/Grammar/Grammar.hs | 14 |
1 files changed, 10 insertions, 4 deletions
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) |
