diff options
| author | kr.angelov <kr.angelov@chalmers.se> | 2008-06-05 07:33:42 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@chalmers.se> | 2008-06-05 07:33:42 +0000 |
| commit | 4803fb8052caba0421949c9d7768d44ec28d109d (patch) | |
| tree | 669ab3dcc40cca9a91cd9220c366677ce1db8bdb /src-3.0/GF/Command/Commands.hs | |
| parent | 0b1a157222e0f96b9c9d6f8cea98caf547c4bdf9 (diff) | |
use parser combinators to parse the shell commands. simplified CommandLine type
Diffstat (limited to 'src-3.0/GF/Command/Commands.hs')
| -rw-r--r-- | src-3.0/GF/Command/Commands.hs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src-3.0/GF/Command/Commands.hs b/src-3.0/GF/Command/Commands.hs index cddecbc9a..ceabbde7b 100644 --- a/src-3.0/GF/Command/Commands.hs +++ b/src-3.0/GF/Command/Commands.hs @@ -9,9 +9,8 @@ module GF.Command.Commands ( CommandOutput ) where -import GF.Command.AbsGFShell -import GF.Command.PPrTree -import GF.Command.ParGFShell +import GF.Command.Abstract +import GF.Command.Parse import PGF import PGF.CId import PGF.ShowLinearize @@ -66,24 +65,24 @@ commandHelp full (co,info) = unlines $ [ ] else [] valIdOpts :: String -> String -> [Option] -> String -valIdOpts flag def opts = case valOpts flag (VId (Ident def)) opts of - VId (Ident v) -> v - _ -> def +valIdOpts flag def opts = case valOpts flag (VId def) opts of + VId v -> v + _ -> def valIntOpts :: String -> Integer -> [Option] -> Int valIntOpts flag def opts = fromInteger $ case valOpts flag (VInt def) opts of VInt v -> v - _ -> def + _ -> def valOpts :: String -> Value -> [Option] -> Value valOpts flag def opts = case lookup flag flags of Just v -> v _ -> def where - flags = [(f,v) | OFlag (Ident f) v <- opts] + flags = [(f,v) | OFlag f v <- opts] isOpt :: String -> [Option] -> Bool -isOpt o opts = elem o [x | OOpt (Ident x) <- opts] +isOpt o opts = elem o [x | OOpt x <- opts] -- this list must be kept sorted by the command name! allCommands :: PGF -> Map.Map String CommandInfo |
