Skip to content

parsec: bug in caret escape parsing

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'))
                         }
Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries (other)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC sof
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information