summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-03-02 20:27:42 +0000
committeraarne <aarne@cs.chalmers.se>2006-03-02 20:27:42 +0000
commit6c5763615fc3e2c5fb40b15daec39d301a0a9a18 (patch)
tree39043e0f658b02e018088a3636fe3b83f6c7b11a /src
parent32508e37b37a0baad884e6aaa518071b62e1e6d8 (diff)
several treebanks in shell state
Diffstat (limited to 'src')
-rw-r--r--src/GF/Compile/ShellState.hs3
-rw-r--r--src/GF/Shell.hs19
2 files changed, 14 insertions, 8 deletions
diff --git a/src/GF/Compile/ShellState.hs b/src/GF/Compile/ShellState.hs
index 696b3776e..269b9adb1 100644
--- a/src/GF/Compile/ShellState.hs
+++ b/src/GF/Compile/ShellState.hs
@@ -273,7 +273,8 @@ prShellStateInfo sh = unlines [
"canonical modules :" +++ unwords (map (P.prt .fst) (M.modules (canModules sh))),
"source modules : " +++ unwords (map (P.prt .fst) (M.modules (srcModules sh))),
"global options : " +++ prOpts (gloptions sh),
- "transfer modules : " +++ unwords (map (P.prt . fst) (transfers sh))
+ "transfer modules : " +++ unwords (map (P.prt . fst) (transfers sh)),
+ "treebanks : " +++ unwords (map (P.prt . fst) (treebanks sh))
]
abstractName :: ShellState -> String
diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs
index 39460b2f2..d502b74ce 100644
--- a/src/GF/Shell.hs
+++ b/src/GF/Shell.hs
@@ -308,13 +308,18 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com
returnArg (AString $ unlines $ mkTreebank opts st comm ts) sa
CLookupTreebank -> do
- case treebanks st of
- [] -> returnArg (AError "no treebank") sa
- (_,tb):_ -> do
- let s = prCommandArg a
- let tes = map (string2treeErr gro . snd) $ lookupTreebank tb s
- terms = [t | Ok t <- tes]
- returnArg (ATrms terms) sa
+ let tbs = treebanks st
+ if null tbs
+ then returnArg (AError "no treebank") sa
+ else do
+ let tbi = maybe (fst $ head tbs) I.identC (getOptVal opts (aOpt "treebank"))
+ case lookup tbi tbs of
+ Nothing -> returnArg (AError ("no treebank" +++ prt tbi)) sa
+ Just tb -> do
+ let s = prCommandArg a
+ let tes = map (string2treeErr gro . snd) $ lookupTreebank tb s
+ terms = [t | Ok t <- tes]
+ returnArg (ATrms terms) sa
CShowTreeGraph | oElem emitCode opts -> do -- -o
returnArg (AString $ visualizeTrees opts $ strees $ s2t a) sa