jmacro 0.6.11 → 0.6.12
raw patch · 3 files changed
+20/−17 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- Language/Javascript/JMacro/QQ.hs +17/−14
- Language/Javascript/JMacro/TypeCheck.hs +1/−1
- jmacro.cabal +2/−2
Language/Javascript/JMacro/QQ.hs view
@@ -14,7 +14,7 @@ module Language.Javascript.JMacro.QQ(jmacro,jmacroE,parseJM,parseJME) where import Prelude hiding (tail, init, head, last, minimum, maximum, foldr1, foldl1, (!!), read)-import Control.Applicative hiding ((<|>),many,optional,(<*))+import Control.Applicative hiding ((<|>),many,optional) import Control.Arrow(first) import Control.Monad.State.Strict import Data.Char(digitToInt, toLower, isUpper)@@ -105,12 +105,13 @@ antiIdents ss x = foldr antiIdent x ss fixIdent :: String -> String+fixIdent "_" = "_x_" fixIdent css@(c:_) | isUpper c = '_' : escapeDollar css | otherwise = escapeDollar css where escapeDollar = map (\x -> if x =='$' then 'dž' else x)-fixIdent _ = "_"+fixIdent _ = "_x_" jm2th :: Data a => a -> TH.ExpQ@@ -260,8 +261,8 @@ lexeme :: JMParser a -> JMParser a lexeme = P.lexeme lexer -(<*) :: Monad m => m b -> m a -> m b-x <* y = do+(<<*) :: Monad m => m b -> m a -> m b+x <<* y = do xr <- x _ <- y return xr@@ -432,7 +433,7 @@ foreignStat = do reserved "foreign"- i <- try $ identdecl <* reservedOp "::"+ i <- try $ identdecl <<* reservedOp "::" t <- runTypeParser return [ForeignStat i t] @@ -507,12 +508,14 @@ b <- statement return $ jFor' before after p b where threeStat =- liftM3 (,,) (option [] statement <* optional semi)- (optionMaybe expr <* semi)+ liftM3 (,,) (option [] statement <<* optional semi)+ (optionMaybe expr <<* semi) (option [] statement) jFor' :: [JStat] -> Maybe JExpr -> [JStat]-> [JStat] -> [JStat]- jFor' before p after bs = before ++ [WhileStat False (fromMaybe (jsv "true") p) b']- where b' = BlockStat $ bs ++ after+ jFor' before p after bs = decl ++ before ++ [WhileStat False (fromMaybe (jsv "true") p) b']+ where b' = BlockStat $ maybeAfter : bs+ maybeAfter = IfStat (InfixExpr "==" (jsv "jmId_loop") (jsv "true")) (BlockStat after) (AssignStat (jsv "jmId_loop") (jsv "true"))+ decl = [DeclStat (StrI "jmId_loop") Nothing, AssignStat (jsv "jmId_loop") (jsv "false")] assignOpStat = do let rop x = reservedOp x >> return x@@ -568,7 +571,7 @@ labelStat = do lbl <- try $ do- l <- myIdent <* char ':'+ l <- myIdent <<* char ':' guard (l /= "default") return l s <- l2s <$> statblock0@@ -702,19 +705,19 @@ statOrEblock = try (ReturnStat <$> expr `folBy` '}') <|> (l2s <$> statblock) propPair = liftM2 (,) myIdent (colon >> expr) ---notFolBy a b = a <* notFollowedBy (char b)+--notFolBy a b = a <<* notFollowedBy (char b) folBy :: JMParser a -> Char -> JMParser a-folBy a b = a <* (lookAhead (char b) >>= const (return ()))+folBy a b = a <<* (lookAhead (char b) >>= const (return ())) --Parsers without Lexeme braces', brackets', parens', oxfordBraces :: JMParser a -> JMParser a brackets' = around' '[' ']' braces' = around' '{' '}' parens' = around' '(' ')'-oxfordBraces x = lexeme (reservedOp "{|") >> (lexeme x <* reservedOp "|}")+oxfordBraces x = lexeme (reservedOp "{|") >> (lexeme x <<* reservedOp "|}") around' :: Char -> Char -> JMParser a -> JMParser a-around' a b x = lexeme (char a) >> (lexeme x <* char b)+around' a b x = lexeme (char a) >> (lexeme x <<* char b) myIdent :: JMParser String myIdent = lexeme $ many1 (alphaNum <|> oneOf "_-!@#$%^&*()") <|> myStringLiteral '\''
Language/Javascript/JMacro/TypeCheck.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GeneralizedNewtypeDeriving, FlexibleInstances, PatternGuards, RankNTypes #-}+{-# LANGUAGE GeneralizedNewtypeDeriving, FlexibleInstances, PatternGuards, RankNTypes, FlexibleContexts #-} module Language.Javascript.JMacro.TypeCheck where
jmacro.cabal view
@@ -1,5 +1,5 @@ name: jmacro-version: 0.6.11+version: 0.6.12 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@@ -7,7 +7,7 @@ license-file: LICENSE author: Gershom Bazerman maintainer: gershomb@gmail.com-Tested-With: GHC == 7.8.4+Tested-With: GHC == 7.10 Build-Type: Simple Cabal-Version: >= 1.6