mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 16:42:51 -06:00
system command (!) in gf3 shell
This commit is contained in:
@@ -19,6 +19,7 @@ import Data.Char
|
|||||||
import Data.List(isPrefixOf)
|
import Data.List(isPrefixOf)
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Text.ParserCombinators.ReadP as RP
|
import qualified Text.ParserCombinators.ReadP as RP
|
||||||
|
import System
|
||||||
import System.CPUTime
|
import System.CPUTime
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
|
|
||||||
@@ -45,6 +46,9 @@ loop opts gfenv0 = do
|
|||||||
loop opts $ gfenv' {cputime = cpu'}
|
loop opts $ gfenv' {cputime = cpu'}
|
||||||
case words s of
|
case words s of
|
||||||
-- special commands, requiring source grammar in env
|
-- special commands, requiring source grammar in env
|
||||||
|
"!":ws -> do
|
||||||
|
system $ unwords ws
|
||||||
|
loopNewCPU gfenv
|
||||||
"cc":ws -> do
|
"cc":ws -> do
|
||||||
-- FIXME: add options parsing for cc arguments
|
-- FIXME: add options parsing for cc arguments
|
||||||
let (style,term) = (TermPrintDefault, ws)
|
let (style,term) = (TermPrintDefault, ws)
|
||||||
@@ -60,7 +64,9 @@ loop opts gfenv0 = do
|
|||||||
loopNewCPU gfenv'
|
loopNewCPU gfenv'
|
||||||
|
|
||||||
-- other special commands, working on GFEnv
|
-- other special commands, working on GFEnv
|
||||||
"e":_ -> loopNewCPU $ gfenv {commandenv=env{multigrammar=emptyPGF}}
|
"e":_ -> loopNewCPU $ gfenv {
|
||||||
|
commandenv=env{multigrammar=emptyPGF}, sourcegrammar = emptyGrammar
|
||||||
|
}
|
||||||
"ph":_ -> mapM_ putStrLn (reverse (history gfenv0)) >> loopNewCPU gfenv
|
"ph":_ -> mapM_ putStrLn (reverse (history gfenv0)) >> loopNewCPU gfenv
|
||||||
"q":_ -> putStrLn "See you." >> return gfenv
|
"q":_ -> putStrLn "See you." >> return gfenv
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user