summaryrefslogtreecommitdiff
path: root/src/GF/Shell.hs
diff options
context:
space:
mode:
authoraarne <unknown>2004-05-27 14:43:13 +0000
committeraarne <unknown>2004-05-27 14:43:13 +0000
commit6dcf9f1cd463262bd3015b93afb615c487f0b349 (patch)
treeba443c12c3820f7a6154a889f7f2057362843004 /src/GF/Shell.hs
parent244307ca3765c784cf3cb7d572eb08751a2ba74c (diff)
command option check
Diffstat (limited to 'src/GF/Shell.hs')
-rw-r--r--src/GF/Shell.hs63
1 files changed, 5 insertions, 58 deletions
diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs
index f5692a398..ebfa332b0 100644
--- a/src/GF/Shell.hs
+++ b/src/GF/Shell.hs
@@ -9,6 +9,8 @@ import qualified GFC
import Values
import GetTree
+import ShellCommands
+
import API
import IOGrammar
import Compile
@@ -40,66 +42,11 @@ import UTF8 (encodeUTF8)
-- AR 18/4/2000 - 7/11/2001
-type SrcTerm = G.Term -- term as returned by the command parser
-
-data Command =
- CImport FilePath
- | CRemoveLanguage Language
- | CEmptyState
- | CStripState
- | CTransformGrammar FilePath
- | CConvertLatex FilePath
-
- | CLinearize [()] ---- parameters
- | CParse
- | CTranslate Language Language
- | CGenerateRandom
- | CGenerateTrees
- | CPutTerm
- | CWrapTerm Ident
- | CMorphoAnalyse
- | CTestTokenizer
- | CComputeConcrete String
-
- | CTranslationQuiz Language Language
- | CTranslationList Language Language Int
- | CMorphoQuiz
- | CMorphoList Int
-
- | CReadFile FilePath
- | CWriteFile FilePath
- | CAppendFile FilePath
- | CSpeakAloud
- | CPutString
- | CShowTerm
- | CSystemCommand String
-
- | CSetFlag
- | CSetLocalFlag Language
-
- | CPrintGrammar
- | CPrintGlobalOptions
- | CPrintLanguages
- | CPrintInformation I.Ident
- | CPrintMultiGrammar
- | CPrintGramlet
- | CPrintCanonXML
- | CPrintCanonXMLStruct
- | CPrintHistory
- | CHelp (Maybe String)
-
- | CImpure ImpureCommand
-
- | CVoid
-
--- to isolate the commands that are executed on top level
-data ImpureCommand =
- ICQuit | ICExecuteHistory FilePath | ICEarlierCommand Int
- | ICEditSession | ICTranslateSession
+-- data Command moved to ShellCommands. AR 27/5/2004
type CommandLine = (CommandOpt, CommandArg, [CommandOpt])
-type CommandOpt = (Command, Options)
+type SrcTerm = G.Term -- term as returned by the command parser
type HState = (ShellState,([String],Integer)) -- history & CPU
@@ -144,7 +91,7 @@ execLine put (c@(co, os), arg, cs) (outps,st) = do
-- individual commands possibly piped: value returned; this is not a state monad
execC :: CommandOpt -> ShellIO
-execC co@(comm, opts0) sa@((st,(h,_)),a) = case comm of
+execC co@(comm, opts0) sa@((st,(h,_)),a) = checkOptions st co >> case comm of
CImport file -> useIOE sa $ do
st1 <- shellStateFromFiles opts st file