diff options
| author | krasimir <krasimir@chalmers.se> | 2010-01-15 21:13:46 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2010-01-15 21:13:46 +0000 |
| commit | 869621db6685e36da97e87ae24de0e10d84ed571 (patch) | |
| tree | 51357a139b9d092742b6947a5c5f561c34bef1a2 /src/runtime/haskell | |
| parent | 9fc1325b9571b35eacfe2f91039e7ef0267309c8 (diff) | |
now the abstract syntax in PGF allows the same syntax for integers, floats and strings as in Haskell. This includes negative integers and exponents in the floats
Diffstat (limited to 'src/runtime/haskell')
| -rw-r--r-- | src/runtime/haskell/PGF/Expr.hs | 17 |
1 files changed, 6 insertions, 11 deletions
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)
-----------------------------------------------------
|
