packages feed

jmacro 0.5.5 → 0.5.7

raw patch · 2 files changed

+38/−3 lines, 2 filesdep −web-encodingsdep ~basePVP ok

version bump matches the API change (PVP)

Dependencies removed: web-encodings

Dependency ranges changed: base

API changes (from Hackage documentation)

Files

Language/Javascript/JMacro/QQ.hs view
@@ -44,8 +44,9 @@ import Language.Javascript.JMacro.ParseTH  import System.IO.Unsafe+import Numeric(readHex) -import Web.Encodings+-- import Web.Encodings  --import Debug.Trace @@ -754,6 +755,40 @@                   c2 <- anyChar                   return [c,c2]            _ -> return [c]++-- Taken from json package by Sigbjorn Finne.+decodeJson :: String -> String+decodeJson x = parse [] x+ where+  parse rs cs =+    case cs of+      '\\' : c : ds -> esc rs c ds+      c    : ds+       | c >= '\x20' && c <= '\xff'    -> parse (c:rs) ds+       | c < '\x20'     -> error $ "Illegal unescaped character in string: " ++ x+       | i <= 0x10ffff  -> parse (c:rs) ds+       | otherwise -> error $ "Illegal unescaped character in string: " ++ x+       where+        i = (fromIntegral (fromEnum c) :: Integer)+      [] -> reverse rs++  esc rs c cs = case c of+   '\\' -> parse ('\\' : rs) cs+   '"'  -> parse ('"'  : rs) cs+   'n'  -> parse ('\n' : rs) cs+   'r'  -> parse ('\r' : rs) cs+   't'  -> parse ('\t' : rs) cs+   'f'  -> parse ('\f' : rs) cs+   'b'  -> parse ('\b' : rs) cs+   '/'  -> parse ('/'  : rs) cs+   'u'  -> case cs of+             d1 : d2 : d3 : d4 : cs' ->+               case readHex [d1,d2,d3,d4] of+                 [(n,"")] -> parse (toEnum n : rs) cs'++                 x -> error $ "Unable to parse JSON String: invalid hex: " ++ (show x)+             _ -> error $ "Unable to parse JSON String: invalid hex: " ++ cs+   _ ->  error $ "Unable to parse JSON String: invalid escape char: " ++ [c]  --tricky bit to deal with regex literals and comments / / -- if we hit // inside, then we fail, since that isn't ending the regex but introducing a comment, and thus the initial / could not have introduced a regex. regexLiteral :: JMParser String
jmacro.cabal view
@@ -1,5 +1,5 @@ name:                jmacro-version:             0.5.5+version:             0.5.7 synopsis:            QuasiQuotation library for programmatic generation of Javascript code. description:         Javascript syntax, functional syntax, hygienic names, compile-time guarantees of syntactic correctness, limited typechecking. Additional documentation available at <http://www.haskell.org/haskellwiki/Jmacro> category:            Language@@ -13,7 +13,7 @@   library-  build-depends:     base >= 4, base < 5, containers, pretty, safe >= 0.2, parsec > 3.0, template-haskell >= 2.3, mtl > 1.1 , haskell-src-exts, haskell-src-meta, bytestring >= 0.9, syb, json, web-encodings > 0.2, regex-posix > 0.9+  build-depends:     base >= 4, base < 5, containers, pretty, safe >= 0.2, parsec > 3.0, template-haskell >= 2.3, mtl > 1.1 , haskell-src-exts, haskell-src-meta, bytestring >= 0.9, syb, json, regex-posix > 0.9    exposed-modules:   Language.Javascript.JMacro                      Language.Javascript.JMacro.Util