hunk ./src/Text/Parse.hs 27 + , parseLitChar' hunk ./src/Text/Parse.hs 111 - p ('\'':s) = let (P lit) = parseLitChar in fmap show (lit ('\'':s)) + p ('\'':s) = let (P lit) = parseLitChar' in fmap show (lit ('\'':s)) hunk ./src/Text/Parse.hs 114 - lexString acc ('\\':'"':s) = lexString ("\"\\"++acc) s - lexString acc (c:s) = lexString (c:acc) s hunk ./src/Text/Parse.hs 117 + lexString acc s = let (P lit) = parseLitChar + in case lit s of + Failure a b -> Failure a b + Success t c -> lexString (c:acc) t hunk ./src/Text/Parse.hs 268 +-- | Parse a Haskell character literal, including the surrounding single quotes. +parseLitChar' :: TextParser Char +parseLitChar' = do '\'' <- next `adjustErr` (++"expected a literal char") + char <- parseLitChar + '\'' <- next `adjustErrBad` (++"literal char has no final '") + return char + +-- | Parse a Haskell character literal, excluding the surrounding single quotes. hunk ./src/Text/Parse.hs 277 -parseLitChar = do '\'' <- next `adjustErr` (++"expected a literal char") - c <- next +parseLitChar = do c <- next hunk ./src/Text/Parse.hs 282 - '\'' <- next `adjustErrBad` (++"literal char has no final '") hunk ./src/Text/Parse.hs 283 + hunk ./src/Text/Parse.hs 394 - parse = do many (satisfy isSpace); parseLitChar + parse = do many (satisfy isSpace); parseLitChar' hunk ./src/Text/Parse/ByteString.hs 29 + , parseLitChar' hunk ./src/Text/Parse/ByteString.hs 133 - ('\'',t) -> let (P lit) = parseLitChar in fmap show (lit s) + ('\'',t) -> let (P lit) = parseLitChar' in fmap show (lit s) hunk ./src/Text/Parse/ByteString.hs 192 - Just ('\\',r) -> case BS.uncons r of -- "for vim - Just ('\"',t) -> litString (acc++"\\\"") t - _ -> litString (acc++"\\") r -- "vim + Just ('\\',r) -> let (P lit) = parseLitChar + in case lit s of + Failure a b -> Failure a b + Success t char -> + let (u,v) = BS.span (`notElem`"\\\"") t + in litString (acc++[char]++BS.unpack u) v hunk ./src/Text/Parse/ByteString.hs 317 --- | Parse a Haskell character literal. +-- | Parse a Haskell character literal, including surrounding single quotes. +parseLitChar' :: TextParser Char +parseLitChar' = do '\'' <- next `adjustErr` (++"expected a literal char") + char <- parseLitChar + '\'' <- next `adjustErrBad` (++"literal char has no final '") + return char + +-- | Parse a Haskell character literal, excluding surrounding single quotes. hunk ./src/Text/Parse/ByteString.hs 326 -parseLitChar = do '\'' <- next `adjustErr` (++"expected a literal char") - c <- next +parseLitChar = do c <- next hunk ./src/Text/Parse/ByteString.hs 331 - '\'' <- next `adjustErrBad` (++"literal char has no final '") hunk ./src/Text/Parse/ByteString.hs 332 + hunk ./src/Text/Parse/ByteString.hs 438 - parse = do manySatisfy isSpace; parseLitChar + parse = do manySatisfy isSpace; parseLitChar' hunk ./Makefile 2 -VERSION = 1.11 +VERSION = 1.12 hunk ./docs/changelog.html 16 +
+
Version 1.12 contains a fix for lexing escaped chars inside a literal string + in the "word" parser. It also changes the semantics of "parseLitChar" so + that it no longer expects surrounding single quotes. A version that does + consume surrounding single quotes is now provided under the name + parseLitChar'. The new behaviour of parseLitChar matches Haskell's + lexLitChar specification, from which it was derived. + hunk ./polyparse.cabal 2 -version: 1.11 +version: 1.12 hunk ./polyparse.cabal 5 -copyright: (c) 2006-2015 Malcolm Wallace +copyright: (c) 2006-2016 Malcolm Wallace hunk ./polyparse.cabal 53 - cpp-options: -DVERSION="1.11" + cpp-options: -DVERSION="1.12" hunk ./src/Makefile 2 -VERSION = 1.11 +VERSION = 1.12 hunk ./src/Makefile.nhc98 2 -VERSION = 1.11 +VERSION = 1.12