1
0
forked from GitHub/gf-core

Added Read and Show instances for CId. Also added readCId :: String -> Maybe CId, and use that for readLanguage.

This commit is contained in:
bjorn
2008-10-20 11:59:31 +00:00
parent 2174690c5e
commit d41616dd6a
5 changed files with 39 additions and 18 deletions

View File

@@ -10,7 +10,7 @@ module PGF.Expr(Tree(..), Literal(..),
Value(..), Env, eval, apply,
-- helpers
pIdent,pStr,pFactor
pStr,pFactor
) where
import PGF.CId
@@ -145,13 +145,6 @@ 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)
where
isIdentFirst c = c == '_' || isLetter c
isIdentRest c = c == '_' || c == '\'' || isAlphaNum c
-----------------------------------------------------
-- Printing