summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Command/Interpreter.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2010-04-19 09:38:36 +0000
committerkrasimir <krasimir@chalmers.se>2010-04-19 09:38:36 +0000
commit6313244eacf992fb10a5091bee28582e84540809 (patch)
tree8208fb18a5e1ab9447bd060cf08a3d78ed0a8c0a /src/compiler/GF/Command/Interpreter.hs
parent8b5827fc892c2f395ae26f1811da2d4cc3b1669d (diff)
use the native unicode support from GHC 6.12
Diffstat (limited to 'src/compiler/GF/Command/Interpreter.hs')
-rw-r--r--src/compiler/GF/Command/Interpreter.hs28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/compiler/GF/Command/Interpreter.hs b/src/compiler/GF/Command/Interpreter.hs
index ff84da8a3..4f146bb93 100644
--- a/src/compiler/GF/Command/Interpreter.hs
+++ b/src/compiler/GF/Command/Interpreter.hs
@@ -29,24 +29,24 @@ data CommandEnv = CommandEnv {
expmacros :: Map.Map String Expr
}
-mkCommandEnv :: Encoding -> PGF -> CommandEnv
-mkCommandEnv enc pgf =
+mkCommandEnv :: PGF -> CommandEnv
+mkCommandEnv pgf =
let mos = Map.fromList [(la,buildMorpho pgf la) | la <- languages pgf] in
- CommandEnv pgf mos (allCommands enc (pgf, mos)) Map.empty Map.empty
+ CommandEnv pgf mos (allCommands (pgf, mos)) Map.empty Map.empty
emptyCommandEnv :: CommandEnv
-emptyCommandEnv = mkCommandEnv UTF_8 emptyPGF
+emptyCommandEnv = mkCommandEnv emptyPGF
-interpretCommandLine :: (String -> String) -> CommandEnv -> String -> IO ()
-interpretCommandLine enc env line =
+interpretCommandLine :: CommandEnv -> String -> IO ()
+interpretCommandLine env line =
case readCommandLine line of
Just [] -> return ()
- Just pipes -> mapM_ (interpretPipe enc env) pipes
+ Just pipes -> mapM_ (interpretPipe env) pipes
Nothing -> putStrLnFlush "command not parsed"
-interpretPipe enc env cs = do
+interpretPipe env cs = do
v@(_,s) <- intercs ([],"") cs
- putStrLnFlush $ enc s
+ putStrLnFlush s
return v
where
intercs treess [] = return treess
@@ -57,14 +57,14 @@ interpretPipe enc env cs = do
'%':f -> case Map.lookup f (commandmacros env) of
Just css ->
case getCommandTrees env False arg es of
- Right es -> do mapM_ (interpretPipe enc env) (appLine es css)
+ Right es -> do mapM_ (interpretPipe env) (appLine es css)
return ([],[])
Left msg -> do putStrLn ('\n':msg)
return ([],[])
Nothing -> do
putStrLn $ "command macro " ++ co ++ " not interpreted"
return ([],[])
- _ -> interpret enc env es comm
+ _ -> interpret env es comm
appLine es = map (map (appCommand es))
-- macro definition applications: replace ?i by (exps !! i)
@@ -81,14 +81,14 @@ appCommand xs c@(Command i os arg) = case arg of
EFun x -> EFun x
-- return the trees to be sent in pipe, and the output possibly printed
-interpret :: (String -> String) -> CommandEnv -> [Expr] -> Command -> IO CommandOutput
-interpret enc env trees comm =
+interpret :: CommandEnv -> [Expr] -> Command -> IO CommandOutput
+interpret env trees comm =
case getCommand env trees comm of
Left msg -> do putStrLn ('\n':msg)
return ([],[])
Right (info,opts,trees) -> do tss@(_,s) <- exec info opts trees
if isOpt "tr" opts
- then putStrLn (enc s)
+ then putStrLn s
else return ()
return tss