1
0
forked from GitHub/gf-core

made command table independent of options

This commit is contained in:
aarne
2007-11-06 11:01:45 +00:00
parent db399191d9
commit 693621ffbe
3 changed files with 39 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
module Main where
import GF.Command.Interpreter
import GF.Command.Commands
import GF.GFCC.API
import System (getArgs)
import Data.Char (isDigit)
@@ -11,15 +12,16 @@ main :: IO ()
main = do
file:_ <- getArgs
grammar <- file2grammar file
let env = CommandEnv grammar (allCommands grammar)
printHelp grammar
loop grammar
loop env
loop :: MultiGrammar -> IO ()
loop grammar = do
loop :: CommandEnv -> IO ()
loop env = do
s <- getLine
if s == "q" then return () else do
interpretCommandLine grammar s
loop grammar
interpretCommandLine env s
loop env
printHelp grammar = do
putStrLn $ "languages: " ++ unwords (languages grammar)