diff options
| author | aarne <unknown> | 2004-04-19 15:33:45 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2004-04-19 15:33:45 +0000 |
| commit | 2e0c510285ac1cabefea0ab68ffb1215d7297578 (patch) | |
| tree | 805df5361f07e0ff22c9eb69c0daf9abb6353aba /src/GF | |
| parent | fa07ada6ab11f8e0820fe075ce58d8ca700e13e3 (diff) | |
some more printing
Diffstat (limited to 'src/GF')
| -rw-r--r-- | src/GF/CF/CFtoSRG.hs | 4 | ||||
| -rw-r--r-- | src/GF/Canon/CanonToGrammar.hs | 7 | ||||
| -rw-r--r-- | src/GF/Shell.hs | 4 | ||||
| -rw-r--r-- | src/GF/UseGrammar/Custom.hs | 5 |
4 files changed, 13 insertions, 7 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) |
