summaryrefslogtreecommitdiff
path: root/src-3.0/GF/Command/Commands.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-06-11 09:20:26 +0000
committeraarne <aarne@cs.chalmers.se>2008-06-11 09:20:26 +0000
commitad16eb2d788f6fe20e098f115ff42e0db8eb8974 (patch)
treeeca12856bcd33cbb3d3e252c45d4c7762c3fd9d3 /src-3.0/GF/Command/Commands.hs
parent9628eb6314bfcb827142d1869626696de101e245 (diff)
allow spaces between command options; option -treebank in linearize
Diffstat (limited to 'src-3.0/GF/Command/Commands.hs')
-rw-r--r--src-3.0/GF/Command/Commands.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src-3.0/GF/Command/Commands.hs b/src-3.0/GF/Command/Commands.hs
index 292e802b9..7e28ba40b 100644
--- a/src-3.0/GF/Command/Commands.hs
+++ b/src-3.0/GF/Command/Commands.hs
@@ -133,16 +133,12 @@ allCommands pgf = Map.fromList [
("l", emptyCommandInfo {
longname = "linearize",
synopsis = "convert an abstract syntax expression to string",
- explanation = "Shows all linearization forms of Tree by the actual grammar\n"++
- "(which is overridden by the -lang flag).\n"++
- "The pattern list has the form [P, ... ,Q] where P,...,Q follow GF\n"++
- "syntax for patterns. All those forms are generated that match with the\n"++
- "pattern list. Too short lists are filled with variables in the end.\n"++
- "Only the -table flag is available if a pattern list is specified.\n"++
- "HINT: see GF language specification for the syntax of Pattern and Term.\n"++
- "You can also copy and past parsing results.",
+ explanation = unlines [
+ "Shows the linearization of a Tree by the actual grammar",
+ "(which is overridden by the -lang flag)."
+ ],
exec = \opts -> return . fromStrings . map (optLin opts),
- options = ["all","record","table","term"],
+ options = ["all","record","table","term", "treebank"],
flags = ["lang"]
}),
@@ -207,7 +203,11 @@ allCommands pgf = Map.fromList [
lin opts t = unlines [linearize pgf lang t | lang <- optLangs opts]
par opts s = concat [parse pgf lang (optCat opts) s | lang <- optLangs opts]
- optLin opts t = unlines [linea lang t | lang <- optLangs opts] where
+ optLin opts t = case opts of
+ _ | isOpt "treebank" opts -> unlines $ (abstractName pgf ++ ": " ++ showExp t) :
+ [lang ++ ": " ++ linea lang t | lang <- optLangs opts]
+ _ -> unlines [linea lang t | lang <- optLangs opts]
+ where
linea lang = case opts of
_ | isOpt "all" opts -> allLinearize pgf (mkCId lang)
_ | isOpt "table" opts -> tableLinearize pgf (mkCId lang)