diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index 7d78f9e14..2f8fba75c 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -27,7 +27,7 @@ import PGF.Optimize import GF.Compile.Export import GF.Compile.ToAPI import GF.Compile.ExampleBased -import GF.Infra.Option (noOptions, readOutputFormat) +import GF.Infra.Option (noOptions, readOutputFormat, outputFormatsExpl) import GF.Infra.UseIO import GF.Data.ErrM ---- 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.", "N.B.1 Since grammars are compiled when imported, this command", "generally shows a grammar that looks rather different from the source.", - "N.B.2 This command is slightly obsolete: to produce different formats", - "the batch compiler gfc is recommended, and has many more options." + "N.B.2 Another way to produce different formats is to use 'gf -make',", + "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, flags = [ --"cat", ("file", "set the file name when printing with -pgf option"), ("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 = [ ("cats", "show just the names of abstract syntax categories"), diff --git a/src/compiler/GF/Infra/Option.hs b/src/compiler/GF/Infra/Option.hs index aac652768..95e9b40fd 100644 --- a/src/compiler/GF/Infra/Option.hs +++ b/src/compiler/GF/Infra/Option.hs @@ -3,9 +3,11 @@ module GF.Infra.Option -- * Option types Options, Flags(..), - Mode(..), Phase(..), Verbosity(..), OutputFormat(..), + Mode(..), Phase(..), Verbosity(..), + OutputFormat(..), SISRFormat(..), Optimization(..), CFGTransform(..), HaskellOption(..), Dump(..), Printer(..), Recomp(..), + outputFormatsExpl, -- * Option parsing parseOptions, parseModuleOptions, fixRelativeLibPaths, -- * Option pretty-printing @@ -435,27 +437,31 @@ optDescr = set = return . Options outputFormats :: [(String,OutputFormat)] -outputFormats = - [("pgf_pretty", FmtPGFPretty), - ("js", FmtJavaScript), - ("haskell", FmtHaskell), - ("prolog", FmtProlog), - ("prolog_abs", FmtProlog_Abs), - ("lambda_prolog",FmtLambdaProlog), - ("bnf", FmtBNF), - ("ebnf", FmtEBNF), - ("regular", FmtRegular), - ("nolr", FmtNoLR), - ("srgs_xml", FmtSRGS_XML), - ("srgs_xml_nonrec", FmtSRGS_XML_NonRec), - ("srgs_abnf", FmtSRGS_ABNF), - ("srgs_abnf_nonrec", FmtSRGS_ABNF_NonRec), - ("jsgf", FmtJSGF), - ("gsl", FmtGSL), - ("vxml", FmtVoiceXML), - ("slf", FmtSLF), - ("regexp", FmtRegExp), - ("fa", FmtFA)] +outputFormats = map fst outputFormatsExpl + +outputFormatsExpl :: [((String,OutputFormat),String)] +outputFormatsExpl = + [(("pgf_pretty", FmtPGFPretty),"human-readable pgf"), + (("js", FmtJavaScript),"JavaScript (whole grammar)"), + (("haskell", FmtHaskell),"Haskell (abstract syntax)"), + (("prolog", FmtProlog),"Prolog (whole grammar)"), + (("prolog_abs", FmtProlog_Abs),"Prolog (abstract syntax)"), + (("lambda_prolog",FmtLambdaProlog),"LambdaProlog (abstract syntax)"), + (("bnf", FmtBNF),"BNF (context-free grammar)"), + (("ebnf", FmtEBNF),"Extended BNF"), + (("regular", FmtRegular),"* regular grammar"), + (("nolr", FmtNoLR),"* context-free with no left recursion"), + (("srgs_xml", FmtSRGS_XML),"* SRGS XML speech recognition format"), + (("srgs_xml_nonrec", FmtSRGS_XML_NonRec),"* SRGS XML, recursion eliminated"), + (("srgs_abnf", FmtSRGS_ABNF),"* ABNF speech recognition format"), + (("srgs_abnf_nonrec", FmtSRGS_ABNF_NonRec),"* ABNF, recursion eliminated"), + (("jsgf", FmtJSGF),"* JSGF speech recognition format"), + (("gsl", FmtGSL),"Nuance speech recognition format"), + (("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 show = lookupShow outputFormats