summaryrefslogtreecommitdiff
path: root/src/GF
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-01-24 15:18:46 +0000
committeraarne <aarne@cs.chalmers.se>2006-01-24 15:18:46 +0000
commite8d50c3841380fd46ca511da532fc1aca6c7335a (patch)
tree7e2a94f8fe337d7496e5630ddf71e11543149e44 /src/GF
parentbcb62c87c58be2e922d9d7afb0476cbec8323043 (diff)
the parser can read .gfm files (but they are not yet compiled all the way)
Diffstat (limited to 'src/GF')
-rw-r--r--src/GF/Compile/Compile.hs12
-rw-r--r--src/GF/Compile/GetGrammar.hs11
-rw-r--r--src/GF/Compile/ModDeps.hs2
3 files changed, 17 insertions, 8 deletions
diff --git a/src/GF/Compile/Compile.hs b/src/GF/Compile/Compile.hs
index 0b14cedc1..c364e1adf 100644
--- a/src/GF/Compile/Compile.hs
+++ b/src/GF/Compile/Compile.hs
@@ -77,15 +77,15 @@ compileModule :: Options -> ShellState -> FilePath -> IOE TimedCompileEnv
compileModule opts st0 file |
oElem showOld opts ||
- elem suff ["cf","ebnf"] = do
+ elem suff ["cf","ebnf","gfm"] = do
let putp = putPointE opts
let putpp = putPointEsil opts
let path = [] ----
- grammar1 <- if suff == "cf"
- then putp ("- parsing" +++ suff +++ file) $ getCFGrammar opts file
- else if suff == "ebnf"
- then putp ("- parsing" +++ suff +++ file) $ getEBNFGrammar opts file
- else putp ("- parsing old gf" +++ file) $ getOldGrammar opts file
+ grammar1 <- case suff of
+ "cf" -> putp ("- parsing" +++ suff +++ file) $ getCFGrammar opts file
+ "ebnf" -> putp ("- parsing" +++ suff +++ file) $ getEBNFGrammar opts file
+ "gfm" -> putp ("- parsing" +++ suff +++ file) $ getSourceGrammar file
+ _ -> putp ("- parsing old gf" +++ file) $ getOldGrammar opts file
let mods = modules grammar1
let env = compileEnvShSt st0 []
foldM (comp putpp path) env mods
diff --git a/src/GF/Compile/GetGrammar.hs b/src/GF/Compile/GetGrammar.hs
index a848c9bcf..4eebc2845 100644
--- a/src/GF/Compile/GetGrammar.hs
+++ b/src/GF/Compile/GetGrammar.hs
@@ -12,7 +12,9 @@
-- this module builds the internal GF grammar that is sent to the type checker
-----------------------------------------------------------------------------
-module GF.Compile.GetGrammar (getSourceModule, getOldGrammar, getCFGrammar, getEBNFGrammar,
+module GF.Compile.GetGrammar (
+ getSourceModule, getSourceGrammar,
+ getOldGrammar, getCFGrammar, getEBNFGrammar,
err2err
) where
@@ -50,6 +52,13 @@ getSourceModule file = do
mo1 <- ioeErr $ {- err2err $ -} pModDef tokens
ioeErr $ transModDef mo1
+getSourceGrammar :: FilePath -> IOE SourceGrammar
+getSourceGrammar file = do
+ string <- readFileIOE file
+ let tokens = myLexer string
+ gr1 <- ioeErr $ {- err2err $ -} pGrammar tokens
+ ioeErr $ transGrammar gr1
+
-- for old GF format with includes
diff --git a/src/GF/Compile/ModDeps.hs b/src/GF/Compile/ModDeps.hs
index d2d3cbe83..737c7e4c1 100644
--- a/src/GF/Compile/ModDeps.hs
+++ b/src/GF/Compile/ModDeps.hs
@@ -57,7 +57,7 @@ checkUniqueErr ms = do
checkUniqueImportNames :: [Ident] -> SourceModInfo -> Err ()
checkUniqueImportNames ns mo = case mo of
ModMod m -> test [n | OQualif _ n v <- opens m, n /= v]
-
+ _ -> return () --- Bad $ "bug: ModDeps does not treat" +++ show mo
where
test ms = testErr (all (`notElem` ns) ms)