summaryrefslogtreecommitdiff
path: root/libraries/base/Text/Read/Lex.hs
diff options
context:
space:
mode:
authorsimonpj <unknown>2003-02-14 13:01:32 +0000
committersimonpj <unknown>2003-02-14 13:01:32 +0000
commitcd2140e82c61a08bab769e66b03c09b5990746f9 (patch)
tree66fc4cff1a45a0fc694481693e2dc2a2f5ff9031 /libraries/base/Text/Read/Lex.hs
parentdf20eb8fee15c0191c2831843771af4d91131fa3 (diff)
downloadhaskell-cd2140e82c61a08bab769e66b03c09b5990746f9.tar.gz
[project @ 2003-02-14 13:01:32 by simonpj]
Fix for deriving of records with leading underscore, and corresponding lex
Diffstat (limited to 'libraries/base/Text/Read/Lex.hs')
-rw-r--r--libraries/base/Text/Read/Lex.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/libraries/base/Text/Read/Lex.hs b/libraries/base/Text/Read/Lex.hs
index e9b7635075..14528c1343 100644
--- a/libraries/base/Text/Read/Lex.hs
+++ b/libraries/base/Text/Read/Lex.hs
@@ -98,7 +98,7 @@ lexPunc =
do c <- satisfy isPuncChar
return (Punc [c])
where
- isPuncChar c = c `elem` ",;()[]{}_`"
+ isPuncChar c = c `elem` ",;()[]{}`"
-- ----------------------------------------------------------------------
-- Symbols
@@ -119,10 +119,12 @@ lexSymbol =
lexId :: ReadP Lexeme
lexId =
- do c <- satisfy isAlpha
+ do c <- satisfy isIdsChar
s <- munch isIdfChar
return (Ident (c:s))
where
+ -- Identifiers can start with a '_'
+ isIdsChar c = isAlpha c || c == '_'
isIdfChar c = isAlphaNum c || c `elem` "_'"
-- ---------------------------------------------------------------------------