summaryrefslogtreecommitdiff
path: root/src/GF/Command
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2007-11-08 16:37:30 +0000
committeraarne <aarne@cs.chalmers.se>2007-11-08 16:37:30 +0000
commit44df29f52d074f372053e7b622849c65608728c4 (patch)
treec4365b2af7a0f12e8afdddeff591115cce8a842f /src/GF/Command
parent23b2826a4476c1514e368d86e09434108da7836f (diff)
gfi linearization with flags -table -record -term
Diffstat (limited to 'src/GF/Command')
-rw-r--r--src/GF/Command/Commands.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/GF/Command/Commands.hs b/src/GF/Command/Commands.hs
index 79e28865f..8dcefece9 100644
--- a/src/GF/Command/Commands.hs
+++ b/src/GF/Command/Commands.hs
@@ -12,6 +12,7 @@ module GF.Command.Commands (
import GF.Command.AbsGFShell hiding (Tree)
import GF.Command.PPrTree
import GF.Command.ParGFShell
+import GF.GFCC.ShowLinearize
import GF.GFCC.API
import GF.GFCC.Macros
import GF.GFCC.AbsGFCC ----
@@ -101,7 +102,8 @@ allCommands mgr = Map.fromAscList [
_ -> commandHelpAll mgr opts)
}),
("l", emptyCommandInfo {
- exec = \opts -> return . fromStrings . map (lin opts),
+ exec = \opts -> return . fromStrings . map (optLin opts),
+ options = ["record","table","term"],
flags = ["lang"]
}),
("p", emptyCommandInfo {
@@ -113,6 +115,14 @@ allCommands mgr = Map.fromAscList [
lin opts t = unlines [linearize mgr lang t | lang <- optLangs opts]
par opts s = concat [parse mgr lang (optCat opts) s | lang <- optLangs opts]
+ optLin opts t = unlines [linea lang t | lang <- optLangs opts] where
+ linea lang = case opts of
+ _ | isOpt "table" opts -> tableLinearize gr (cid lang)
+ _ | isOpt "term" opts -> termLinearize gr (cid lang)
+ _ | isOpt "record" opts -> recordLinearize gr (cid lang)
+ _ -> linearize mgr lang
+
+
optLangs opts = case valIdOpts "lang" "" opts of
"" -> languages mgr
lang -> [lang]