diff options
| author | aarne <aarne@cs.chalmers.se> | 2007-12-04 17:10:28 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2007-12-04 17:10:28 +0000 |
| commit | 7fabd2345db0e78480851722e7199292b8593db7 (patch) | |
| tree | f837507407963982eedca186d6151520b40fcf8e /src/GF/Devel/Grammar/Modules.hs | |
| parent | 61763b57848eaeb5e08ca0429dc5c0926606ad6c (diff) | |
building extensions in new source format
Diffstat (limited to 'src/GF/Devel/Grammar/Modules.hs')
| -rw-r--r-- | src/GF/Devel/Grammar/Modules.hs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/GF/Devel/Grammar/Modules.hs b/src/GF/Devel/Grammar/Modules.hs index a2845e08f..a3bf69485 100644 --- a/src/GF/Devel/Grammar/Modules.hs +++ b/src/GF/Devel/Grammar/Modules.hs @@ -35,22 +35,27 @@ data Module = Module { mextends :: [(Ident,MInclude)], mopens :: [(Ident,Ident)], -- used name, original name mflags :: Map Ident String, - mjments :: Map Ident (Either Judgement Indirection) -- def or indirection + mjments :: MapJudgement } emptyModule :: Ident -> Module emptyModule m = Module MTGrammar [] [] [] [] empty empty +type MapJudgement = Map Ident JEntry -- def or indirection + isCompleteModule :: Module -> Bool isCompleteModule = Prelude.null . minterfaces -listJudgements :: Module -> [(Ident,Either Judgement Indirection)] +listJudgements :: Module -> [(Ident,JEntry)] listJudgements = assocs . mjments +type JEntry = Either Judgement Indirection + data ModuleType = MTAbstract | MTConcrete Ident | MTGrammar + deriving Eq data MInclude = MIAll @@ -59,3 +64,18 @@ data MInclude = type Indirection = (Ident,Bool) -- module of origin, whether canonical +isConstructorEntry :: Either Judgement Indirection -> Bool +isConstructorEntry ji = case ji of + Left j -> isConstructor j + Right i -> snd i + +isConstructor :: Judgement -> Bool +isConstructor j = jdef j == EData + +isInherited :: MInclude -> Ident -> Bool +isInherited mi i = case mi of + MIExcept is -> notElem i is + MIOnly is -> elem i is + _ -> True + + |
