From 944eea8de9e077d1b3ee1a9edad9c52e9dbc2bd0 Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 18 Jun 2008 16:26:12 +0000 Subject: system command pipes (sp) --- src-3.0/PGF/ExprSyntax.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src-3.0/PGF/ExprSyntax.hs') diff --git a/src-3.0/PGF/ExprSyntax.hs b/src-3.0/PGF/ExprSyntax.hs index 596407348..ee4be36ea 100644 --- a/src-3.0/PGF/ExprSyntax.hs +++ b/src-3.0/PGF/ExprSyntax.hs @@ -2,7 +2,7 @@ module PGF.ExprSyntax(readExp, showExp, pExp,ppExp, -- helpers - pIdent + pIdent,pStr ) where import PGF.CId @@ -28,7 +28,8 @@ pExps :: RP.ReadP [Exp] pExps = liftM2 (:) (pExp True) pExps RP.<++ (RP.skipSpaces >> return []) pExp :: Bool -> RP.ReadP Exp -pExp isNested = RP.skipSpaces >> (pParen RP.<++ pAbs RP.<++ pApp RP.<++ pNum RP.<++ pStr RP.<++ pMeta) +pExp isNested = RP.skipSpaces >> (pParen RP.<++ pAbs RP.<++ pApp RP.<++ pNum RP.<++ + liftM EStr pStr RP.<++ pMeta) where pParen = RP.between (RP.char '(') (RP.char ')') (pExp False) pAbs = do xs <- RP.between (RP.char '\\') (RP.skipSpaces >> RP.string "->") (RP.sepBy1 (RP.skipSpaces >> pCId) (RP.skipSpaces >> RP.char ',')) @@ -40,14 +41,15 @@ pExp isNested = RP.skipSpaces >> (pParen RP.<++ pAbs RP.<++ pApp RP.<++ pNum RP. pMeta = do RP.char '?' x <- RP.munch1 isDigit return (EMeta (read x)) - pStr = RP.char '"' >> liftM EStr (RP.manyTill (pEsc RP.<++ RP.get) (RP.char '"')) - where - pEsc = RP.char '\\' >> RP.get pNum = do x <- RP.munch1 isDigit ((RP.char '.' >> RP.munch1 isDigit >>= \y -> return (EFloat (read (x++"."++y)))) RP.<++ (return (EInt (read x)))) +pStr = RP.char '"' >> (RP.manyTill (pEsc RP.<++ RP.get) (RP.char '"')) + where + pEsc = RP.char '\\' >> RP.get + pCId = fmap mkCId pIdent pIdent = liftM2 (:) (RP.satisfy isIdentFirst) (RP.munch isIdentRest) -- cgit v1.2.3