pretty-simple 2.2.0.0 → 2.2.0.1
raw patch · 4 files changed
+16/−7 lines, 4 files
Files
- CHANGELOG.md +5/−0
- README.md +1/−1
- pretty-simple.cabal +1/−1
- src/Text/Pretty/Simple/Internal/ExprParser.hs +9/−5
CHANGELOG.md view
@@ -1,3 +1,8 @@+## 2.2.0.1+* Fixed a [bug](https://github.com/cdepillabout/pretty-simple/pull/41) where+ the parser failed to parse escaped quotation marks in string literals.+ Thanks [Andreas](https://github.com/anka-213)!+ ## 2.2.0.0
README.md view
@@ -181,7 +181,7 @@ must enable the `buildexe` flag, since it will not be built by default: ```sh-$ stack install pretty-simple-2.0.2.1 --flag pretty-simple:buildexe+$ stack install pretty-simple-2.2.0.1 --flag pretty-simple:buildexe ``` When run on the command line, you can paste in the Haskell datatype you want to
pretty-simple.cabal view
@@ -1,5 +1,5 @@ name: pretty-simple-version: 2.2.0.0+version: 2.2.0.1 synopsis: pretty printer for data types with a 'Show' instance. description: Please see <https://github.com/cdepillabout/pretty-simple#readme README.md>. homepage: https://github.com/cdepillabout/pretty-simple
src/Text/Pretty/Simple/Internal/ExprParser.hs view
@@ -58,12 +58,16 @@ parseStringLit :: String -> (String, String) parseStringLit [] = ("", "") parseStringLit ('"':rest) = ("", rest)+parseStringLit ('\\':c:cs) = ('\\':c:cs', rest)+ where (cs', rest) = parseStringLit cs parseStringLit (c:cs) = (c:cs', rest) where (cs', rest) = parseStringLit cs parseOther :: String -> (String, String)-parseOther [] = ("", "")-parseOther s@(c:cs)- | c `elem` ("{[()]}\"," :: String) = ("", s)- | otherwise = let (toParse, rest) = parseOther cs- in (c : toParse, rest)+parseOther = span . flip notElem $ ("{[()]}\"," :: String)++-- |+-- Handle escaped characters correctly+--+-- >>> parseExprs $ "Foo \"hello \\\"world!\""+-- ([Other "Foo ",StringLit "hello \\\"world!"],"")