summaryrefslogtreecommitdiff
path: root/libraries/base/Text/Read/Lex.hs
diff options
context:
space:
mode:
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` "_'"
-- ---------------------------------------------------------------------------