summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraarne <unknown>2004-04-19 15:33:45 +0000
committeraarne <unknown>2004-04-19 15:33:45 +0000
commit2e0c510285ac1cabefea0ab68ffb1215d7297578 (patch)
tree805df5361f07e0ff22c9eb69c0daf9abb6353aba /src
parentfa07ada6ab11f8e0820fe075ce58d8ca700e13e3 (diff)
some more printing
Diffstat (limited to 'src')
-rw-r--r--src/GF/CF/CFtoSRG.hs4
-rw-r--r--src/GF/Canon/CanonToGrammar.hs7
-rw-r--r--src/GF/Shell.hs4
-rw-r--r--src/GF/UseGrammar/Custom.hs5
-rw-r--r--src/HelpFile4
-rw-r--r--src/HelpFile.hs6
-rw-r--r--src/Today.hs2
7 files changed, 21 insertions, 11 deletions
diff --git a/src/GF/CF/CFtoSRG.hs b/src/GF/CF/CFtoSRG.hs
index c90a772d8..899fdcfe5 100644
--- a/src/GF/CF/CFtoSRG.hs
+++ b/src/GF/CF/CFtoSRG.hs
@@ -22,7 +22,7 @@ import CF
import CFIdent
---import UseGrammar
import PPrCF
-import List (intersperse)
+import List (intersperse,nub)
header :: String
header = unlines ["#ABNF 1.0 ISO-8859-1;\n",
@@ -38,7 +38,7 @@ prSRGC :: [CFCat] -> CF -> String
prSRGC [] _ = []
prSRGC (c:cs) cf = "$" ++ prCFCat c ++ " = " ++ items ++ ";\n"++ prSRGC cs cf
where items = concat $ intersperse " | " $
- map f $ map valItemsCF (rulesForCFCat cf c)
+ map f $ nub $ map valItemsCF (rulesForCFCat cf c)
f [] = "$NULL"
f xs = unwords $ map prSRGItem xs
diff --git a/src/GF/Canon/CanonToGrammar.hs b/src/GF/Canon/CanonToGrammar.hs
index 93dac97f6..ece71c517 100644
--- a/src/GF/Canon/CanonToGrammar.hs
+++ b/src/GF/Canon/CanonToGrammar.hs
@@ -14,7 +14,12 @@ import Operations
import Monad
--- a decompiler. AR 12/6/2003
+-- a decompiler. AR 12/6/2003 -- 19/4/2004
+
+canon2sourceGrammar :: CanonGrammar -> Err G.SourceGrammar
+canon2sourceGrammar gr = do
+ ms' <- mapM canon2sourceModule $ M.modules gr
+ return $ M.MGrammar ms'
canon2sourceModule :: CanonModule -> Err G.SourceModule
canon2sourceModule (i,mi) = do
diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs
index 4c2a067a4..a14461928 100644
--- a/src/GF/Shell.hs
+++ b/src/GF/Shell.hs
@@ -210,9 +210,7 @@ execC co@(comm, opts0) sa@((st,(h,_)),a) = case comm of
| oElem showAll opts -> returnArg (AString txtHelpFile) sa
| otherwise -> returnArg (AString txtHelpFileSummary) sa
- CPrintGrammar
- | oElem showOld opts -> returnArg (AString $ printGrammarOld (canModules st)) sa
- | otherwise -> returnArg (AString (optPrintGrammar opts gro)) sa
+ CPrintGrammar -> returnArg (AString (optPrintGrammar opts gro)) sa
CPrintGlobalOptions -> justOutput (putStrLn $ prShellStateInfo st) sa
CPrintInformation c -> justOutput (useIOE () $ showInformation opts st c) sa
CPrintLanguages -> justOutput
diff --git a/src/GF/UseGrammar/Custom.hs b/src/GF/UseGrammar/Custom.hs
index 166f918ae..ac47a9758 100644
--- a/src/GF/UseGrammar/Custom.hs
+++ b/src/GF/UseGrammar/Custom.hs
@@ -19,10 +19,11 @@ import Option
import CF
import CFIdent
----- import CFtoGrammar
+import CanonToGrammar
import PPrCF
import PrLBNF
import PrGrammar
+import PrOld
import MkGFC
import CFtoSRG
@@ -145,7 +146,9 @@ customGrammarPrinter =
customData "Grammar printers, selected by option -printer=x" $
[
(strCI "gfc", prCanon . stateGrammarST) -- DEFAULT
+ ,(strCI "gf", err id prGrammar . canon2sourceGrammar . stateGrammarST)
,(strCI "cf", prCF . stateCF)
+ ,(strCI "old", printGrammarOld . stateGrammarST)
,(strCI "srg", prSRG . stateCF)
,(strCI "lbnf", prLBNF . stateCF)
,(strCI "morpho", prMorpho . stateMorpho)
diff --git a/src/HelpFile b/src/HelpFile
index 27d030201..0f7db045b 100644
--- a/src/HelpFile
+++ b/src/HelpFile
@@ -347,8 +347,10 @@ q, quit: q
-parser=earley Earley algorithm
-parser=chart bottom-up chart parser
--printer: format in which the grammar is printed. The default is gf.
+-printer: format in which the grammar is printed. The default is gfc.
+ -printer=gfc GFC grammar
-printer=gf GF grammar
+ -printer=old old GF grammar
-printer=cf context-free grammar
*-printer=happy source file for Happy parser generator
-printer=srg speech recognition grammar
diff --git a/src/HelpFile.hs b/src/HelpFile.hs
index 57b38218f..099fee6b9 100644
--- a/src/HelpFile.hs
+++ b/src/HelpFile.hs
@@ -360,11 +360,13 @@ txtHelpFile =
"\n -parser=earley Earley algorithm" ++
"\n -parser=chart bottom-up chart parser" ++
"\n" ++
- "\n-printer: format in which the grammar is printed. The default is gf." ++
+ "\n-printer: format in which the grammar is printed. The default is gfc." ++
+ "\n -printer=gfc GFC grammar" ++
"\n -printer=gf GF grammar" ++
+ "\n -printer=old old GF grammar" ++
"\n -printer=cf context-free grammar" ++
"\n *-printer=happy source file for Happy parser generator" ++
- "\n *-printer=srg speech recognition grammar" ++
+ "\n -printer=srg speech recognition grammar" ++
"\n *-printer=haskell abstract syntax in Haskell, with transl to/from GF" ++
"\n -printer=morpho full-form lexicon, long format" ++
"\n *-printer=latex LaTeX file (for the tg command)" ++
diff --git a/src/Today.hs b/src/Today.hs
index 7b9a5098f..8953c09f8 100644
--- a/src/Today.hs
+++ b/src/Today.hs
@@ -1 +1 @@
-module Today where today = "Fri Apr 16 18:06:59 CEST 2004"
+module Today where today = "Mon Apr 19 17:59:02 CEST 2004"