Opened 5 years ago

Closed 4 years ago

#3050 closed bug (invalid)

parsec: bug in caret escape parsing

Reported by: sof Owned by:
Priority: normal Milestone: Not GHC
Component: libraries (other) Version: 6.10.1
Keywords: Cc: sof, michal.terepeta@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

The parsing of escape carets in character literals isn't quite right:

  • off-by-one (i.e., \A == \NUL; ought to be \A=\001)
  • only A-Z carets are supported.

The following minor mod takes care of the problem:

--- Text/ParserCombinators/Parsec/Token.hs	2009-02-20 10:49:32.115500000 -0800
+++ Text/ParserCombinators/Parsec/Token.hs.~1~	2009-02-20 10:02:45.896750000 -0800
@@ -193,8 +193,8 @@
 
     -- charControl :: CharParser st Char
     charControl     = do{ char '^'
-                        ; code <- (oneOf ['@'..'_']) <|> char '?'
-                        ; return (if code == '?' then '\DEL' else toEnum (fromEnum code - fromEnum '@'))
+                        ; code <- upper
+                        ; return (toEnum (fromEnum code - fromEnum 'A'))
                         }

Change History (2)

comment:1 Changed 5 years ago by igloo

  • Difficulty set to Unknown
  • Milestone set to Not GHC

comment:2 Changed 4 years ago by michalt

  • Cc michal.terepeta@… added
  • Resolution set to invalid
  • Status changed from new to closed
  • Type of failure set to None/Unknown

This is not a GHC bug and it seems to be fixed in Parsec anyway. So I guess the ticket can be closed..

Note: See TracTickets for help on using tickets.