diff options
| author | aarne <aarne@cs.chalmers.se> | 2008-06-12 21:04:16 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2008-06-12 21:04:16 +0000 |
| commit | 3b15ade685f0281d67eba079391981a822e68a23 (patch) | |
| tree | 802fff6c3ec1c60c9df6d9e721dacce45a6cb55c /src-3.0/GF/Command/Parse.hs | |
| parent | 4369e679986fb602180b03f461105b9b3a2fdce2 (diff) | |
file name as option in commands
Diffstat (limited to 'src-3.0/GF/Command/Parse.hs')
| -rw-r--r-- | src-3.0/GF/Command/Parse.hs | 6 |
1 files changed, 5 insertions, 1 deletions
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) |
