From 3b15ade685f0281d67eba079391981a822e68a23 Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 12 Jun 2008 21:04:16 +0000 Subject: file name as option in commands --- src-3.0/GF/Command/Parse.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src-3.0/GF/Command/Parse.hs') diff --git a/src-3.0/GF/Command/Parse.hs b/src-3.0/GF/Command/Parse.hs index 34988632d..5a0deaaf5 100644 --- a/src-3.0/GF/Command/Parse.hs +++ b/src-3.0/GF/Command/Parse.hs @@ -5,6 +5,7 @@ import PGF.Data(Exp) import GF.Command.Abstract import Data.Char +import Control.Monad import qualified Text.ParserCombinators.ReadP as RP readCommandLine :: String -> Maybe CommandLine @@ -32,6 +33,9 @@ pOption = do RP.option (OOpt flg) (fmap (OFlag flg) (RP.char '=' >> pValue)) pValue = do - fmap VId pIdent + fmap VId pFilename RP.<++ fmap (VInt . read) (RP.munch1 isDigit) + +pFilename = liftM2 (:) (RP.satisfy isFileFirst) (RP.munch (not . isSpace)) where + isFileFirst c = not (isSpace c) && not (isDigit c) -- cgit v1.2.3