1
0
forked from GitHub/gf-core

documented the pgf -printer values for help

This commit is contained in:
aarne
2010-12-14 20:40:17 +00:00
parent 4a5d8d9f55
commit 9c86b62212
2 changed files with 37 additions and 26 deletions

View File

@@ -27,7 +27,7 @@ import PGF.Optimize
import GF.Compile.Export import GF.Compile.Export
import GF.Compile.ToAPI import GF.Compile.ToAPI
import GF.Compile.ExampleBased import GF.Compile.ExampleBased
import GF.Infra.Option (noOptions, readOutputFormat) import GF.Infra.Option (noOptions, readOutputFormat, outputFormatsExpl)
import GF.Infra.UseIO import GF.Infra.UseIO
import GF.Data.ErrM ---- import GF.Data.ErrM ----
import GF.Command.Abstract import GF.Command.Abstract
@@ -545,15 +545,20 @@ allCommands env@(pgf, mos) = Map.fromList [
"The -printer=P flag sets the format in which the grammar is printed.", "The -printer=P flag sets the format in which the grammar is printed.",
"N.B.1 Since grammars are compiled when imported, this command", "N.B.1 Since grammars are compiled when imported, this command",
"generally shows a grammar that looks rather different from the source.", "generally shows a grammar that looks rather different from the source.",
"N.B.2 This command is slightly obsolete: to produce different formats", "N.B.2 Another way to produce different formats is to use 'gf -make',",
"the batch compiler gfc is recommended, and has many more options." "the batch compiler. The following values are available both for",
"the batch compiler (flag -output-format) and the print_grammar",
"command (flag -printer) ; * = not supported at the moment:",
""
] ++ unlines [
" " ++ opt ++ "\t\t" ++ expl | ((opt,_),expl) <- outputFormatsExpl
], ],
exec = \opts _ -> prGrammar opts, exec = \opts _ -> prGrammar opts,
flags = [ flags = [
--"cat", --"cat",
("file", "set the file name when printing with -pgf option"), ("file", "set the file name when printing with -pgf option"),
("lang", "select languages for the some options (default all languages)"), ("lang", "select languages for the some options (default all languages)"),
("printer","select the printing format (see gfc --help)") ("printer","select the printing format (see flag values above)")
], ],
options = [ options = [
("cats", "show just the names of abstract syntax categories"), ("cats", "show just the names of abstract syntax categories"),

View File

@@ -3,9 +3,11 @@ module GF.Infra.Option
-- * Option types -- * Option types
Options, Options,
Flags(..), Flags(..),
Mode(..), Phase(..), Verbosity(..), OutputFormat(..), Mode(..), Phase(..), Verbosity(..),
OutputFormat(..),
SISRFormat(..), Optimization(..), CFGTransform(..), HaskellOption(..), SISRFormat(..), Optimization(..), CFGTransform(..), HaskellOption(..),
Dump(..), Printer(..), Recomp(..), Dump(..), Printer(..), Recomp(..),
outputFormatsExpl,
-- * Option parsing -- * Option parsing
parseOptions, parseModuleOptions, fixRelativeLibPaths, parseOptions, parseModuleOptions, fixRelativeLibPaths,
-- * Option pretty-printing -- * Option pretty-printing
@@ -435,27 +437,31 @@ optDescr =
set = return . Options set = return . Options
outputFormats :: [(String,OutputFormat)] outputFormats :: [(String,OutputFormat)]
outputFormats = outputFormats = map fst outputFormatsExpl
[("pgf_pretty", FmtPGFPretty),
("js", FmtJavaScript), outputFormatsExpl :: [((String,OutputFormat),String)]
("haskell", FmtHaskell), outputFormatsExpl =
("prolog", FmtProlog), [(("pgf_pretty", FmtPGFPretty),"human-readable pgf"),
("prolog_abs", FmtProlog_Abs), (("js", FmtJavaScript),"JavaScript (whole grammar)"),
("lambda_prolog",FmtLambdaProlog), (("haskell", FmtHaskell),"Haskell (abstract syntax)"),
("bnf", FmtBNF), (("prolog", FmtProlog),"Prolog (whole grammar)"),
("ebnf", FmtEBNF), (("prolog_abs", FmtProlog_Abs),"Prolog (abstract syntax)"),
("regular", FmtRegular), (("lambda_prolog",FmtLambdaProlog),"LambdaProlog (abstract syntax)"),
("nolr", FmtNoLR), (("bnf", FmtBNF),"BNF (context-free grammar)"),
("srgs_xml", FmtSRGS_XML), (("ebnf", FmtEBNF),"Extended BNF"),
("srgs_xml_nonrec", FmtSRGS_XML_NonRec), (("regular", FmtRegular),"* regular grammar"),
("srgs_abnf", FmtSRGS_ABNF), (("nolr", FmtNoLR),"* context-free with no left recursion"),
("srgs_abnf_nonrec", FmtSRGS_ABNF_NonRec), (("srgs_xml", FmtSRGS_XML),"* SRGS XML speech recognition format"),
("jsgf", FmtJSGF), (("srgs_xml_nonrec", FmtSRGS_XML_NonRec),"* SRGS XML, recursion eliminated"),
("gsl", FmtGSL), (("srgs_abnf", FmtSRGS_ABNF),"* ABNF speech recognition format"),
("vxml", FmtVoiceXML), (("srgs_abnf_nonrec", FmtSRGS_ABNF_NonRec),"* ABNF, recursion eliminated"),
("slf", FmtSLF), (("jsgf", FmtJSGF),"* JSGF speech recognition format"),
("regexp", FmtRegExp), (("gsl", FmtGSL),"Nuance speech recognition format"),
("fa", FmtFA)] (("vxml", FmtVoiceXML),"Voice XML based on abstract syntax"),
(("slf", FmtSLF),"* SLF speech recognition format"),
(("regexp", FmtRegExp),"* regular expression"),
(("fa", FmtFA),"* finite automaton in graphviz format")
]
instance Show OutputFormat where instance Show OutputFormat where
show = lookupShow outputFormats show = lookupShow outputFormats