[project @ 2003-02-14 13:01:32 by simonpj]
authorsimonpj <unknown>
Fri, 14 Feb 2003 13:01:32 +0000 (13:01 +0000)
committersimonpj <unknown>
Fri, 14 Feb 2003 13:01:32 +0000 (13:01 +0000)
Fix for deriving of records with leading underscore, and corresponding lex

Text/Read/Lex.hs

index e9b7635..14528c1 100644 (file)
@@ -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` "_'"
 
 -- ---------------------------------------------------------------------------