diff options
| author | aarne <unknown> | 2004-02-27 07:43:52 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2004-02-27 07:43:52 +0000 |
| commit | 0166b27ee45f24fb60d79498a5d15b4f316191f3 (patch) | |
| tree | 72a5c1aa21ee0856ce1a621d094471d056040385 /src/GF/Infra | |
| parent | 2e1b57878329eb6a1822ef43c190f8a2aaaa82b7 (diff) | |
Started with unions.
Diffstat (limited to 'src/GF/Infra')
| -rw-r--r-- | src/GF/Infra/Modules.hs | 5 | ||||
| -rw-r--r-- | src/GF/Infra/ReadFiles.hs | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/GF/Infra/Modules.hs b/src/GF/Infra/Modules.hs index 45933e126..b43eb7b4d 100644 --- a/src/GF/Infra/Modules.hs +++ b/src/GF/Infra/Modules.hs @@ -44,6 +44,7 @@ data ModuleType i = | MTInterface | MTInstance i | MTReuse (MReuseType i) + | MTUnion (ModuleType i) [(i,[i])] --- not meant to be recursive deriving (Eq,Show) data MReuseType i = MRInterface i | MRInstance i i | MRResource i @@ -245,21 +246,25 @@ lookupInfo mo i = lookupTree show i (jments mo) isModAbs m = case mtype m of MTAbstract -> True +---- MTUnion t -> isModAbs t _ -> False isModRes m = case mtype m of MTResource -> True MTReuse _ -> True +---- MTUnion t -> isModRes t --- maybe not needed, since eliminated early MTInterface -> True --- MTInstance _ -> True _ -> False isModCnc m = case mtype m of MTConcrete _ -> True +---- MTUnion t -> isModCnc t _ -> False isModTrans m = case mtype m of MTTransfer _ _ -> True +---- MTUnion t -> isModTrans t _ -> False sameMType m n = case (m,n) of diff --git a/src/GF/Infra/ReadFiles.hs b/src/GF/Infra/ReadFiles.hs index 7b95141c7..06205e350 100644 --- a/src/GF/Infra/ReadFiles.hs +++ b/src/GF/Infra/ReadFiles.hs @@ -181,16 +181,21 @@ importsOfFile = getModuleHeader . -- analyse into mod header filter (not . spec) . -- ignore keywords and special symbols unqual . -- take away qualifiers + unrestr . -- take away union restrictions takeWhile (not . term) . -- read until curly or semic lexs . -- analyse into lexical tokens unComm -- ignore comments before the headed line where term = flip elem ["{",";"] - spec = flip elem ["of", "open","in",":", "->","=", "(", ")",",","**"] + spec = flip elem ["of", "open","in",":", "->","=", "(", ")",",","**","union"] unqual ws = case ws of "(":q:ws' -> unqual ws' w:ws' -> w:unqual ws' _ -> ws + unrestr ws = case ws of + "[":ws' -> unrestr $ tail $ dropWhile (/="]") ws' + w:ws' -> w:unrestr ws' + _ -> ws getModuleHeader :: [String] -> ModuleHeader -- with, reuse getModuleHeader ws = case ws of |
