summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-06-17 12:34:02 +0000
committeraarne <aarne@cs.chalmers.se>2008-06-17 12:34:02 +0000
commit7c097669d2c3934622c57f6e2f4ddee8826953d3 (patch)
tree937e03b32e3ee7651327a205bbd78e873679fe57
parent327d0a6a4a634b74f46c9395040fdc2945a629cf (diff)
fixed command abbreviations in GFI
-rw-r--r--src-3.0/GF/Command/Interpreter.hs13
-rw-r--r--src-3.0/GF/Command/Parse.hs1
-rw-r--r--src-3.0/GFI.hs6
3 files changed, 12 insertions, 8 deletions
diff --git a/src-3.0/GF/Command/Interpreter.hs b/src-3.0/GF/Command/Interpreter.hs
index 5663d12b3..9c0d32849 100644
--- a/src-3.0/GF/Command/Interpreter.hs
+++ b/src-3.0/GF/Command/Interpreter.hs
@@ -1,7 +1,8 @@
module GF.Command.Interpreter (
CommandEnv (..),
mkCommandEnv,
- interpretCommandLine
+ interpretCommandLine,
+ getCommandOp
) where
import GF.Command.Commands
@@ -71,11 +72,11 @@ interpret env trees0 comm = case lookCommand co comms of
-- analyse command parse tree to a uniform datastructure, normalizing comm name
getCommand :: Command -> [Exp] -> (String,[Option],[Exp])
getCommand co ts = case co of
- Command c opts (AExp t) -> (getOp c,opts,[t]) -- ignore piped
- Command c opts ANoArg -> (getOp c,opts,ts) -- use piped
- where
- -- abbreviation convention from gf
- getOp s = case break (=='_') s of
+ Command c opts (AExp t) -> (getCommandOp c,opts,[t]) -- ignore piped
+ Command c opts ANoArg -> (getCommandOp c,opts,ts) -- use piped
+
+-- abbreviation convention from gf commands
+getCommandOp s = case break (=='_') s of
(a:_,_:b:_) -> [a,b] -- axx_byy --> ab
_ -> case s of
[a,b] -> s -- ab --> ab
diff --git a/src-3.0/GF/Command/Parse.hs b/src-3.0/GF/Command/Parse.hs
index b5a76ed3e..f209b713b 100644
--- a/src-3.0/GF/Command/Parse.hs
+++ b/src-3.0/GF/Command/Parse.hs
@@ -23,7 +23,6 @@ pCommand = do
cmd <- pIdent
RP.skipSpaces
opts <- RP.sepBy pOption RP.skipSpaces
--- opts <- RP.many pOption
arg <- RP.option ANoArg (fmap AExp (pExp False))
return (Command cmd opts arg)
diff --git a/src-3.0/GFI.hs b/src-3.0/GFI.hs
index e5352c30c..e956d5c18 100644
--- a/src-3.0/GFI.hs
+++ b/src-3.0/GFI.hs
@@ -45,7 +45,11 @@ loop opts gfenv0 = do
cpu' <- getCPUTime
putStrLnFlush (show ((cpu' - cputime gfenv') `div` 1000000000) ++ " msec")
loop opts $ gfenv' {cputime = cpu'}
- case words s of
+ let
+ pwords = case words s of
+ w:ws -> getCommandOp w :ws
+ ws -> ws
+ case pwords of
-- special commands, requiring source grammar in env
"!":ws -> do
system $ unwords ws