summaryrefslogtreecommitdiff
path: root/src/GF/Shell
diff options
context:
space:
mode:
authoraarne <unknown>2004-06-16 14:49:50 +0000
committeraarne <unknown>2004-06-16 14:49:50 +0000
commita77519ba1045d23a7bb8ea1c56cc90518e9fedb9 (patch)
tree68d72eb77950cf179e8a23ca749a9909b1f2d457 /src/GF/Shell
parent9fae09a77c1f31468129a47cb79156d55f5f2939 (diff)
bug fixes ; command so ; reintroduce batch mode
Diffstat (limited to 'src/GF/Shell')
-rw-r--r--src/GF/Shell/PShell.hs8
-rw-r--r--src/GF/Shell/ShellCommands.hs3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/GF/Shell/PShell.hs b/src/GF/Shell/PShell.hs
index d58b18c16..230a6e62a 100644
--- a/src/GF/Shell/PShell.hs
+++ b/src/GF/Shell/PShell.hs
@@ -9,7 +9,9 @@ import Option
import PGrammar (pzIdent, pTrm) --- (string2formsAndTerm)
import API
import Arch(fetchCommand)
+
import Char (isDigit)
+import IO
-- parsing GF shell commands. AR 11/11/2001
@@ -20,6 +22,11 @@ getCommandLines = do
s <- fetchCommand "> "
return (s,pCommandLines s)
+getCommandLinesBatch :: IO (String,[CommandLine])
+getCommandLinesBatch = do
+ s <- catch getLine (\e -> if IO.isEOFError e then return "q" else ioError e)
+ return $ (s,pCommandLines s)
+
pCommandLines :: String -> [CommandLine]
pCommandLines = map pCommandLine . concatMap (chunks ";;" . words) . lines
@@ -80,6 +87,7 @@ pCommand ws = case ws of
"ma" : s -> aString CMorphoAnalyse s
"tt" : s -> aString CTestTokenizer s
"cc" : s -> aUnit $ CComputeConcrete $ unwords s
+ "so" : s -> aUnit $ CShowOpers $ unwords s
"tq" : i:o:[] -> aUnit (CTranslationQuiz (language i) (language o))
"tl":i:o:n:[] -> aUnit (CTranslationList (language i) (language o) (readIntArg n))
diff --git a/src/GF/Shell/ShellCommands.hs b/src/GF/Shell/ShellCommands.hs
index 650364d45..03e8fafbd 100644
--- a/src/GF/Shell/ShellCommands.hs
+++ b/src/GF/Shell/ShellCommands.hs
@@ -33,6 +33,7 @@ data Command =
| CMorphoAnalyse
| CTestTokenizer
| CComputeConcrete String
+ | CShowOpers String
| CTranslationQuiz Language Language
| CTranslationList Language Language Int
@@ -98,6 +99,7 @@ testValidFlag :: ShellState -> OptFunId -> String -> Err ()
testValidFlag st f x = case f of
"cat" -> testIn (map prQIdent_ (allCategories st))
"lang" -> testIn (map prt (allLanguages st))
+ "res" -> testIn (map prt (allResources (srcModules st)))
"number" -> testN
"printer" -> testInc customGrammarPrinter
"lexer" -> testInc customTokenizer
@@ -143,6 +145,7 @@ optionsOfCommand co = case co of
CMorphoAnalyse -> both "short" "lang"
CTestTokenizer -> flags "lexer"
CComputeConcrete _ -> flags "res"
+ CShowOpers _ -> flags "res"
CTranslationQuiz _ _ -> flags "cat"
CTranslationList _ _ _ -> flags "cat"