From 0c3ce7a5b3c10ce1e181dab07bfe71aca7e83b33 Mon Sep 17 00:00:00 2001 From: simonpj Date: Fri, 14 Feb 2003 13:01:32 +0000 Subject: [PATCH] [project @ 2003-02-14 13:01:32 by simonpj] Fix for deriving of records with leading underscore, and corresponding lex --- Text/Read/Lex.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Text/Read/Lex.hs b/Text/Read/Lex.hs index e9b7635..14528c1 100644 --- a/Text/Read/Lex.hs +++ b/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` "_'" -- --------------------------------------------------------------------------- -- 1.7.10.4