diff options
| author | aarne <aarne@cs.chalmers.se> | 2008-06-18 09:14:31 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2008-06-18 09:14:31 +0000 |
| commit | 8e5b78f886065d082677101b28c44d7980763eb0 (patch) | |
| tree | 1573210ce78564d167b5a28cf65578263966c310 /src-3.0/GF/Command/Interpreter.hs | |
| parent | 0f21f8f3436d732838dc76da0c1005eb332961ff (diff) | |
term macro help
Diffstat (limited to 'src-3.0/GF/Command/Interpreter.hs')
| -rw-r--r-- | src-3.0/GF/Command/Interpreter.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src-3.0/GF/Command/Interpreter.hs b/src-3.0/GF/Command/Interpreter.hs index 3e774a693..ee354bd45 100644 --- a/src-3.0/GF/Command/Interpreter.hs +++ b/src-3.0/GF/Command/Interpreter.hs @@ -3,6 +3,7 @@ module GF.Command.Interpreter ( mkCommandEnv, emptyCommandEnv, interpretCommandLine, + interpretPipe, getCommandOp ) where @@ -36,15 +37,17 @@ interpretCommandLine :: CommandEnv -> String -> IO () interpretCommandLine env line = case readCommandLine line of Just [] -> return () - Just pipes -> do res <- runInterruptibly (mapM_ interPipe pipes) + Just pipes -> do res <- runInterruptibly (mapM_ (interpretPipe env) pipes) case res of Left ex -> putStrLnFlush (show ex) Right x -> return x Nothing -> putStrLnFlush "command not parsed" - where - interPipe cs = do - (_,s) <- intercs ([],"") cs + +interpretPipe env cs = do + v@(_,s) <- intercs ([],"") cs putStrLnFlush s + return v + where intercs treess [] = return treess intercs (trees,_) (c:cs) = do treess2 <- interc trees c @@ -52,7 +55,7 @@ interpretCommandLine env line = interc es comm@(Command co _ arg) = case co of '%':f -> case Map.lookup f (commandmacros env) of Just css -> do - mapM_ interPipe (appLine (getCommandArg env arg es) css) + mapM_ (interpretPipe env) (appLine (getCommandArg env arg es) css) return ([],[]) ---- return ? _ -> do putStrLn $ "command macro " ++ co ++ " not interpreted" |
