summaryrefslogtreecommitdiff
path: root/src/GF/IDE
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-06-25 16:43:48 +0000
committeraarne <aarne@cs.chalmers.se>2008-06-25 16:43:48 +0000
commitb96b36f43de3e2f8b58d5f539daa6f6d47f25870 (patch)
tree0992334be13cec6538a1dea22fbbf26ad6bdf224 /src/GF/IDE
parentfe367412e0aeb4ad5c02de68e6eca382e0f96984 (diff)
removed src for 2.9
Diffstat (limited to 'src/GF/IDE')
-rw-r--r--src/GF/IDE/IDECommands.hs95
1 files changed, 0 insertions, 95 deletions
diff --git a/src/GF/IDE/IDECommands.hs b/src/GF/IDE/IDECommands.hs
deleted file mode 100644
index 56d392a71..000000000
--- a/src/GF/IDE/IDECommands.hs
+++ /dev/null
@@ -1,95 +0,0 @@
-----------------------------------------------------------------------
--- |
--- Module : IDECommands
--- Maintainer : AR
--- Stability : (stable)
--- Portability : (portable)
---
--- > CVS $Date: 2005/11/14 16:03:41 $
--- > CVS $Author: aarne $
--- > CVS $Revision: 1.2 $
---
--- Commands usable in grammar-writing IDE.
------------------------------------------------------------------------------
-
-module GF.IDE.IDECommands where
-
-import GF.Infra.Ident (Ident, identC)
-import GF.Compile.ShellState
-import qualified GF.Shell.ShellCommands as S
-import qualified GF.Shell.Commands as E
-import qualified GF.Shell.CommandL as PE
-import GF.UseGrammar.Session
-import GF.UseGrammar.Custom
-import GF.Grammar.PrGrammar
-
-import GF.Infra.Option
-import GF.Data.Operations
-import GF.Infra.Modules
-import GF.Infra.UseIO
-
-data IDEState = IDE {
- ideShellState :: ShellState,
- ideAbstract :: Maybe Ident,
- ideConcretes :: [Ident],
- ideCurrentCnc :: Maybe Ident,
- ideCurrentLin :: Maybe Ident, -- lin or lincat
- ideSState :: Maybe SState
- }
-
-emptyIDEState :: ShellState -> IDEState
-emptyIDEState shst = IDE shst Nothing [] Nothing Nothing Nothing
-
-data IDECommand =
- IDEInit
- | IDEAbstract Ident
- | IDEConcrete Ident
- | IDELin Ident
- | IDEShell String -- S.Command
- | IDEEdit String -- E.Command
- | IDEQuit
- | IDEVoid String -- the given command itself maybe
-
-
-execIDECommand :: IDECommand -> IDEState -> IOE IDEState
-execIDECommand c state = case c of
- IDEInit ->
- return $ emptyIDEState env
- IDEAbstract a ->
- return $ state {ideAbstract = Just a} ---- check a exists or import it
- IDEConcrete a ->
- return $ state {ideCurrentCnc = Just a} ---- check a exists or import it
- IDELin a ->
- return $ state {ideCurrentLin = Just a} ---- check a exists
- IDEEdit s ->
- execEdit s
- IDEShell s ->
- execShell s
- IDEVoid s -> ioeErr $ fail s
- _ -> ioeErr $ fail "command not implemented"
-
- where
- env = ideShellState state
- sstate = maybe initSState id $ ideSState state
-
- execShell s = execEdit $ "gf" +++ s
-
- execEdit s = ioeIO $ do
- (env',sstate') <- E.execCommand env (PE.pCommand s) sstate
- return $ state {ideShellState = env', ideSState = Just sstate'}
-
- putMsg = putStrLn ---- XML
-
-pCommands :: String -> [IDECommand]
-pCommands = map pCommand . concatMap (chunks ";;" . words) . lines
-
-pCommand :: [String] -> IDECommand
-pCommand ws = case ws of
- "gf" : s -> IDEShell $ unwords s
- "edit" : s -> IDEEdit $ unwords s
- "abstract" : a : _ -> IDEAbstract $ identC a
- "concrete" : a : _ -> IDEConcrete $ identC a
- "lin" : a : _ -> IDELin $ identC a
- "empty" : _ -> IDEInit
- "quit" : _ -> IDEQuit
- _ -> IDEVoid $ unwords ws