mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
reload = r command
This commit is contained in:
@@ -28,7 +28,7 @@ import Data.Char (isSpace)
|
|||||||
-- separated from GF Main 24/6/2003
|
-- separated from GF Main 24/6/2003
|
||||||
|
|
||||||
gfInteract :: HState -> IO HState
|
gfInteract :: HState -> IO HState
|
||||||
gfInteract st@(env,hist) = do
|
gfInteract st@(env,hist@(his,_,_,_)) = do
|
||||||
-- putStrFlush "> " M.F 25/01-02 prompt moved to Arch.
|
-- putStrFlush "> " M.F 25/01-02 prompt moved to Arch.
|
||||||
(s,cs) <- getCommandLines st
|
(s,cs) <- getCommandLines st
|
||||||
case ifImpure cs of
|
case ifImpure cs of
|
||||||
@@ -48,6 +48,15 @@ gfInteract st@(env,hist) = do
|
|||||||
st' <- execLinesH line [co] st -- s would not work in execLinesH
|
st' <- execLinesH line [co] st -- s would not work in execLinesH
|
||||||
gfInteract st'
|
gfInteract st'
|
||||||
|
|
||||||
|
Just (ICReload,_) -> case dropWhile (not . isImport) his of
|
||||||
|
line:_ -> do
|
||||||
|
let co = pCommandLine st $ words line
|
||||||
|
st' <- execLinesH line [co] st
|
||||||
|
gfInteract st'
|
||||||
|
_ -> do
|
||||||
|
putStrLn "No previous import"
|
||||||
|
gfInteract st
|
||||||
|
|
||||||
Just (ICEditSession,os) -> case getOptVal os useFile of
|
Just (ICEditSession,os) -> case getOptVal os useFile of
|
||||||
Just file -> do
|
Just file -> do
|
||||||
s <- readFileIf file
|
s <- readFileIf file
|
||||||
@@ -66,6 +75,10 @@ gfInteract st@(env,hist) = do
|
|||||||
opts = globalOptions env
|
opts = globalOptions env
|
||||||
ifNotSilent c =
|
ifNotSilent c =
|
||||||
if oElem beSilent opts then return () else putStrLnFlush c
|
if oElem beSilent opts then return () else putStrLnFlush c
|
||||||
|
isImport l = case words l of
|
||||||
|
"i":_ -> True
|
||||||
|
"import":_ -> True
|
||||||
|
_ -> False
|
||||||
|
|
||||||
gfBatch :: HState -> IO HState
|
gfBatch :: HState -> IO HState
|
||||||
gfBatch st@(sh,_) = do
|
gfBatch st@(sh,_) = do
|
||||||
|
|||||||
@@ -81,6 +81,9 @@ txtHelpFile =
|
|||||||
"\n examples:" ++
|
"\n examples:" ++
|
||||||
"\n i English.gf -- ordinary import of Concrete" ++
|
"\n i English.gf -- ordinary import of Concrete" ++
|
||||||
"\n i -retain german/ParadigmsGer.gf -- import of Resource to test" ++
|
"\n i -retain german/ParadigmsGer.gf -- import of Resource to test" ++
|
||||||
|
"\n" ++
|
||||||
|
"\nr, reload: r" ++
|
||||||
|
"\n Executes the previous import (i) command." ++
|
||||||
"\n " ++
|
"\n " ++
|
||||||
"\nrl, remove_language: rl Language" ++
|
"\nrl, remove_language: rl Language" ++
|
||||||
"\n Takes away the language from the state." ++
|
"\n Takes away the language from the state." ++
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ pCommand ws = case ws of
|
|||||||
|
|
||||||
"es" : [] -> aImpure ICEditSession
|
"es" : [] -> aImpure ICEditSession
|
||||||
"ts" : [] -> aImpure ICTranslateSession
|
"ts" : [] -> aImpure ICTranslateSession
|
||||||
|
"r" : [] -> aImpure ICReload
|
||||||
_ -> (CVoid, [])
|
_ -> (CVoid, [])
|
||||||
|
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -97,8 +97,12 @@ data Command =
|
|||||||
|
|
||||||
-- to isolate the commands that are executed on top level
|
-- to isolate the commands that are executed on top level
|
||||||
data ImpureCommand =
|
data ImpureCommand =
|
||||||
ICQuit | ICExecuteHistory FilePath | ICEarlierCommand Int
|
ICQuit
|
||||||
| ICEditSession | ICTranslateSession
|
| ICExecuteHistory FilePath
|
||||||
|
| ICEarlierCommand Int
|
||||||
|
| ICEditSession
|
||||||
|
| ICTranslateSession
|
||||||
|
| ICReload
|
||||||
|
|
||||||
type CommandOpt = (Command, Options)
|
type CommandOpt = (Command, Options)
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ i, import: i File
|
|||||||
examples:
|
examples:
|
||||||
i English.gf -- ordinary import of Concrete
|
i English.gf -- ordinary import of Concrete
|
||||||
i -retain german/ParadigmsGer.gf -- import of Resource to test
|
i -retain german/ParadigmsGer.gf -- import of Resource to test
|
||||||
|
|
||||||
|
r, reload: r
|
||||||
|
Executes the previous import (i) command.
|
||||||
|
|
||||||
rl, remove_language: rl Language
|
rl, remove_language: rl Language
|
||||||
Takes away the language from the state.
|
Takes away the language from the state.
|
||||||
|
|||||||
Reference in New Issue
Block a user