summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/GF/Command/Parse.hs4
-rw-r--r--src/runtime/haskell/PGF/Expr.hs17
2 files changed, 8 insertions, 13 deletions
diff --git a/src/compiler/GF/Command/Parse.hs b/src/compiler/GF/Command/Parse.hs
index 44366c472..d68a0bcd7 100644
--- a/src/compiler/GF/Command/Parse.hs
+++ b/src/compiler/GF/Command/Parse.hs
@@ -39,9 +39,9 @@ pOption = do
RP.option (OOpt flg) (fmap (OFlag flg) (RP.char '=' >> pValue))
pValue = do
- fmap (VInt . read) (RP.munch1 isDigit)
+ fmap VInt (RP.readS_to_P reads)
RP.<++
- fmap VStr pStr
+ fmap VStr (RP.readS_to_P reads)
RP.<++
fmap VId pFilename
diff --git a/src/runtime/haskell/PGF/Expr.hs b/src/runtime/haskell/PGF/Expr.hs
index cf0cb79aa..df257c905 100644
--- a/src/runtime/haskell/PGF/Expr.hs
+++ b/src/runtime/haskell/PGF/Expr.hs
@@ -15,7 +15,7 @@ module PGF.Expr(Tree, BindType(..), Expr(..), Literal(..), Patt(..), Equation(..
MetaId,
-- helpers
- pMeta,pStr,pArg,pLit,freshName,ppMeta,ppLit,ppParens
+ pMeta,pArg,pLit,freshName,ppMeta,ppLit,ppParens
) where
import PGF.CId
@@ -194,16 +194,11 @@ pMeta = do RP.char '?'
return 0
pLit :: RP.ReadP Literal
-pLit = pNum RP.<++ liftM LStr pStr
-
-pNum = do x <- RP.munch1 isDigit
- ((RP.char '.' >> RP.munch1 isDigit >>= \y -> return (LFlt (read (x++"."++y))))
- RP.<++
- (return (LInt (read x))))
-
-pStr = RP.char '"' >> (RP.manyTill (pEsc RP.<++ RP.get) (RP.char '"'))
- where
- pEsc = RP.char '\\' >> RP.get
+pLit = liftM LStr (RP.readS_to_P reads)
+ RP.<++
+ liftM LInt (RP.readS_to_P reads)
+ RP.<++
+ liftM LFlt (RP.readS_to_P reads)
-----------------------------------------------------