relit 0.1.0 → 0.1.1
raw patch · 2 files changed
+24/−3 lines, 2 files
Files
- Text/Regex/Literal.hs +23/−2
- relit.cabal +1/−1
Text/Regex/Literal.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleContexts, FlexibleInstances, UndecidableInstances #-}+{-# LANGUAGE FlexibleContexts, FlexibleInstances, UndecidableInstances, CPP #-} {-# OPTIONS -fno-warn-orphans #-} {-|@@ -8,9 +8,12 @@ extensions making possible to directly specify reqular expression literal. This means that awkward backslashes are not necessary. + You can copy a regular expression in other languages and paste it+ to your Haskell program.+ Sample code: -> { -# LANGUAGE QuasiQuotes, OverloadedStrings #- }+> { -# LANGUAGE QuasiQuotes, OverloadedStrings, CPP #- } > -- Due to Haddock limitation, spaces are inserted after and before "}". > -- Remove them if you copy this. >@@ -23,7 +26,13 @@ > > -- Regular expression as the regular expression literal > regexp :: Regex+> -- Due to Haddock limitation, spaces are inserted between "-"s.+> -- Remove them if you copy this.+> #if _ _GLASGOW_HASKELL_ _ >= 700+> regexp = [re|\\(foo)\\(bar\.c)|]+> #else > regexp = [$re|\\(foo)\\(bar\.c)|]+> #endif -} module Text.Regex.Literal (re) where @@ -36,13 +45,25 @@ A 'QuasiQuoter' function to implement regular expression literal. -} re :: QuasiQuoter+#if __GLASGOW_HASKELL__ >= 700+re = QuasiQuoter parseExprExp parseExprPat parseExprType parseExprDec+#else re = QuasiQuoter parseExprExp parseExprPat+#endif parseExprExp :: String -> ExpQ parseExprExp x = return . LitE . StringL $ x parseExprPat :: String -> PatQ parseExprPat = undefined++#if __GLASGOW_HASKELL__ >= 700+parseExprType :: String -> TypeQ+parseExprType = undefined++parseExprDec :: String -> Q [Dec]+parseExprDec = undefined+#endif instance (RegexMaker regex compOpt execOpt String) => IsString regex where fromString s = make s
relit.cabal view
@@ -1,5 +1,5 @@ Name: relit-Version: 0.1.0+Version: 0.1.1 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3