summaryrefslogtreecommitdiff
path: root/src/GF/Compile/ReadFiles.hs
diff options
context:
space:
mode:
authorbjorn <bjorn@bringert.net>2008-10-02 14:11:41 +0000
committerbjorn <bjorn@bringert.net>2008-10-02 14:11:41 +0000
commitfa69bd8ab3c82a6c7e3358db42c96919f8ce4967 (patch)
treef4a5f79312e915146c9af4fe2b04575a51c427a6 /src/GF/Compile/ReadFiles.hs
parent9e501521b4f88ebd5c5fb95e24af06d5be6ffe3a (diff)
Regenerate source GF parser from GF.cf. Now, when GF/Source/Makefile is used, no hand-hacking is needed.
Diffstat (limited to 'src/GF/Compile/ReadFiles.hs')
-rw-r--r--src/GF/Compile/ReadFiles.hs18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/GF/Compile/ReadFiles.hs b/src/GF/Compile/ReadFiles.hs
index 956114c1c..a8558963e 100644
--- a/src/GF/Compile/ReadFiles.hs
+++ b/src/GF/Compile/ReadFiles.hs
@@ -103,13 +103,29 @@ getAllFiles opts ps env file = do
imps <- if st == CSEnv
then return (maybe [] snd mb_envmod)
else do s <- ioeIO $ BS.readFile file
- (mname,imps) <- ioeErr ((liftM importsOfModule . pModHeader . myLexer) s)
+ (mname,imps) <- ioeErr ((liftM (importsOfModule . modHeaderToModDef) . pModHeader . myLexer) s)
ioeErr $ testErr (mname == name)
("module name" +++ mname +++ "differs from file name" +++ name)
return imps
return (name,st,t,imps,dropFileName file)
+-- FIXME: this is pretty ugly, it's just to get around the difference
+-- between ModHeader as returned when parsing just the module header
+-- when looking for imports, and ModDef, which includes the whole module.
+modHeaderToModDef :: ModHeader -> ModDef
+modHeaderToModDef (MModule2 x y z) = MModule x y (modHeaderBodyToModBody z)
+ where
+ modHeaderBodyToModBody :: ModHeaderBody -> ModBody
+ modHeaderBodyToModBody b = case b of
+ MBody2 x y -> MBody x y []
+ MNoBody2 x -> MNoBody x
+ MWith2 x y -> MWith x y
+ MWithBody2 x y z -> MWithBody x y z []
+ MWithE2 x y z -> MWithE x y z
+ MWithEBody2 x y z w -> MWithEBody x y z w []
+ MReuse2 x -> MReuse x
+ MUnion2 x -> MUnion x
isGFO :: FilePath -> Bool
isGFO = (== ".gfo") . takeExtensions