mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-21 10:49:33 -06:00
some more printing
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user