summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraarne <unknown>2004-03-24 15:31:38 +0000
committeraarne <unknown>2004-03-24 15:31:38 +0000
commit2433403b6247022ac56133ca935307868fcef6b9 (patch)
treea53994e4d7dd1a253171c4d78f13ef8ffe3a0ee4 /src
parentdc71ffcf5bae1f2b91467de273c71e7c3294acb3 (diff)
Making cf2gf to work...
Diffstat (limited to 'src')
-rw-r--r--src/GF/API/IOGrammar.hs6
-rw-r--r--src/GF/CF/PPrCF.hs2
-rw-r--r--src/GF/Compile/Compile.hs7
-rw-r--r--src/GF/Compile/GetGrammar.hs2
-rw-r--r--src/HelpFile2
-rw-r--r--src/Today.hs2
6 files changed, 9 insertions, 12 deletions
diff --git a/src/GF/API/IOGrammar.hs b/src/GF/API/IOGrammar.hs
index 53b056c46..9b6fe0c5a 100644
--- a/src/GF/API/IOGrammar.hs
+++ b/src/GF/API/IOGrammar.hs
@@ -6,7 +6,6 @@ import PGrammar
import TypeCheck
import Compile
import ShellState
-import GetGrammar
import Modules
import Option
@@ -38,11 +37,6 @@ string2annotTree gr m = annotate gr . string2absTerm (prt m) ---- prt
shellStateFromFiles :: Options -> ShellState -> FilePath -> IOE ShellState
shellStateFromFiles opts st file = case fileSuffix file of
- "cf" -> do
- let opts' = addOptions (options [beVerbose]) opts
- sgr <- getCFGrammar opts' file
- ioeIO $ print sgr -----
- return st
"gfcm" -> do
(_,_,cgr) <- compileOne opts (compileEnvShSt st []) file
ioeErr $ updateShellState opts st (cgr,(emptyMGrammar,[]))
diff --git a/src/GF/CF/PPrCF.hs b/src/GF/CF/PPrCF.hs
index 91ab240ea..6712c45f3 100644
--- a/src/GF/CF/PPrCF.hs
+++ b/src/GF/CF/PPrCF.hs
@@ -55,7 +55,7 @@ getCFRule mo s = getcf (wrds s) where
fun : cat : _ : its = words s
mkIt ('"':w@(_:_)) = atomCFTerm (string2CFTok (init w))
mkIt w = CFNonterm (string2CFCat mo w)
- getcf _ = Bad "invalid rule"
+ getcf _ = Bad (" invalid rule:" +++ s)
wrds = takeWhile (/= ";") . words -- to permit semicolon in the end
pCF :: String -> String -> Err CF
diff --git a/src/GF/Compile/Compile.hs b/src/GF/Compile/Compile.hs
index 9d80f6a05..e6936809c 100644
--- a/src/GF/Compile/Compile.hs
+++ b/src/GF/Compile/Compile.hs
@@ -55,10 +55,13 @@ batchCompileOld f = compileOld defOpts f
compileModule :: Options -> ShellState -> FilePath ->
IOE (GFC.CanonGrammar, (SourceGrammar,[(FilePath,ModTime)]))
-compileModule opts st0 file | oElem showOld opts = do
+
+compileModule opts st0 file | oElem showOld opts || fileSuffix file == "cf" = do
let putp = putPointE opts
let path = [] ----
- grammar1 <- putp ("- parsing old gf" +++ file) $ getOldGrammar opts file
+ grammar1 <- if fileSuffix file == "cf"
+ then putp ("- parsing cf" +++ file) $ getCFGrammar opts file
+ else putp ("- parsing old gf" +++ file) $ getOldGrammar opts file
let mods = modules grammar1
let env = compileEnvShSt st0 []
(_,sgr,cgr) <- foldM (comp putp path) env mods
diff --git a/src/GF/Compile/GetGrammar.hs b/src/GF/Compile/GetGrammar.hs
index f5698bb9c..58ce8d62b 100644
--- a/src/GF/Compile/GetGrammar.hs
+++ b/src/GF/Compile/GetGrammar.hs
@@ -88,7 +88,7 @@ getCFGrammar :: Options -> FilePath -> IOE SourceGrammar
getCFGrammar opts file = do
let mo = takeWhile (/='-') file
s <- ioeIO $ readFileIf file
- cf <- ioeErr $ pCF mo file
+ cf <- ioeErr $ pCF mo s
defs <- return $ cf2grammar cf
let g = A.OldGr A.NoIncl defs
ioeErr $ transOldGrammar opts file g
diff --git a/src/HelpFile b/src/HelpFile
index 90b10de4f..c99c999e5 100644
--- a/src/HelpFile
+++ b/src/HelpFile
@@ -18,7 +18,7 @@ i, import: i File
.gfr precompiled GF resource
.gfcm multilingual canonical GF
*.ebnf Extended BNF format
- *.cf Context-free (BNF) format
+ .cf Context-free (BNF) format
options:
-old old: parse in GF<2.0 format
-v verbose: give lots of messages
diff --git a/src/Today.hs b/src/Today.hs
index a68cbaafa..e947e5ef0 100644
--- a/src/Today.hs
+++ b/src/Today.hs
@@ -1 +1 @@
-module Today where today = "Wed Mar 24 16:54:35 CET 2004"
+module Today where today = "Wed Mar 24 17:14:49 CET 2004"