summaryrefslogtreecommitdiff
path: root/src/GF/Shell.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-03-02 17:19:36 +0000
committeraarne <aarne@cs.chalmers.se>2006-03-02 17:19:36 +0000
commit32508e37b37a0baad884e6aaa518071b62e1e6d8 (patch)
tree9400875b1959d136da85bfb66de693ca18f66d70 /src/GF/Shell.hs
parent35aac815db52ecdb6fd12e61139d3a74545cac6d (diff)
treebanks in shell state: i -treebank and lt
Diffstat (limited to 'src/GF/Shell.hs')
-rw-r--r--src/GF/Shell.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs
index 0d5332fb8..39460b2f2 100644
--- a/src/GF/Shell.hs
+++ b/src/GF/Shell.hs
@@ -181,6 +181,10 @@ execLine put (c@(co, os), arg, cs) (outps,st) = do
execC :: CommandOpt -> ShellIO
execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case comm of
+ CImport file | oElem (iOpt "treebank") opts -> do
+ ss <- readFileIf file >>= return . lines
+ let tb = pre2treebank $ getTreebank ss
+ changeState (addTreebank (I.identC (takeWhile (/='.') file), tb)) sa
CImport file | oElem fromExamples opts -> do
es <- liftM nub $ getGFEFiles opts file
system $ "gf -examples" +++ unlines es
@@ -303,6 +307,15 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com
comm = "command" ----
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
+
CShowTreeGraph | oElem emitCode opts -> do -- -o
returnArg (AString $ visualizeTrees opts $ strees $ s2t a) sa
CShowTreeGraph -> do