From 03b2d09e798ab8d200b788f5c97833098851ad98 Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 10 Mar 2005 10:14:10 +0000 Subject: hmsg for Hajo's editor --- src/GF/Shell/CommandL.hs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/GF/Shell/CommandL.hs') diff --git a/src/GF/Shell/CommandL.hs b/src/GF/Shell/CommandL.hs index 8419038b6..9f7315c56 100644 --- a/src/GF/Shell/CommandL.hs +++ b/src/GF/Shell/CommandL.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/02/24 11:46:36 $ --- > CVS $Author: peb $ --- > CVS $Revision: 1.14 $ +-- > CVS $Date: 2005/03/10 11:14:11 $ +-- > CVS $Author: aarne $ +-- > CVS $Revision: 1.15 $ -- -- (Description of the module) ----------------------------------------------------------------------------- @@ -77,13 +77,19 @@ getCommand = do -- | decodes UTF8 if u==False, i.e. if the grammar does not use UTF8; -- used in the Java GUI, which always uses UTF8 -getCommandUTF :: Bool -> IO Command +getCommandUTF :: Bool -> IO (String,Command) getCommandUTF u = do s <- getLine - return $ pCommand $ if u then s else decodeUTF8 s + return $ pCommandMsg $ if u then s else decodeUTF8 s pCommand :: String -> Command -pCommand = pCommandWords . words where +pCommand = snd . pCommandMsg + +pCommandMsg :: String -> (String,Command) +pCommandMsg s = (m,pCommandWords $ words c) where + (m,c) = case s of + '[':s2 -> let (a,b) = span (/=']') s2 in (a,drop 1 b) + _ -> ("",s) pCommandWords s = case s of "n" : cat : _ -> CNewCat cat "t" : ws -> CNewTree $ unwords ws -- cgit v1.2.3