Permalink
Browse files

0.11.1.0: Fix the Haddocks

  * Cannot hide Text.RE.ZeInternals.SearchReaplace modules (#101)
  * Cabal Stability now Stable
  * Improve the Haddocks
  • Loading branch information...
cdornan committed Mar 31, 2017
1 parent f43e98c commit f728c7eb78a8c943b7b022b22edf98688ea37219
Showing with 1,669 additions and 410 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 .travis.yml
  3. +21 −8 Text/RE.hs
  4. +64 −15 Text/RE/PCRE.hs
  5. +58 −11 Text/RE/PCRE/ByteString.hs
  6. +58 −11 Text/RE/PCRE/ByteString/Lazy.hs
  7. +58 −11 Text/RE/PCRE/Sequence.hs
  8. +58 −11 Text/RE/PCRE/String.hs
  9. +20 −8 Text/RE/REOptions.lhs
  10. +1 −1 Text/RE/Summa.hs
  11. +33 −13 Text/RE/TDFA.hs
  12. +58 −11 Text/RE/TDFA/ByteString.hs
  13. +58 −11 Text/RE/TDFA/ByteString/Lazy.hs
  14. +58 −11 Text/RE/TDFA/Sequence.hs
  15. +58 −11 Text/RE/TDFA/String.hs
  16. +58 −11 Text/RE/TDFA/Text.hs
  17. +58 −11 Text/RE/TDFA/Text/Lazy.hs
  18. +15 −0 Text/RE/ZeInternals.hs
  19. +1 −1 Text/RE/ZeInternals/EscapeREString.hs
  20. +12 −12 Text/RE/ZeInternals/PCRE.hs
  21. +15 −2 Text/RE/ZeInternals/SearchReplace/PCRE/ByteString.hs
  22. +15 −2 Text/RE/ZeInternals/SearchReplace/PCRE/ByteString/Lazy.hs
  23. +15 −2 Text/RE/ZeInternals/SearchReplace/PCRE/Sequence.hs
  24. +15 −2 Text/RE/ZeInternals/SearchReplace/PCRE/String.hs
  25. +15 −2 Text/RE/ZeInternals/SearchReplace/TDFA/ByteString.hs
  26. +15 −2 Text/RE/ZeInternals/SearchReplace/TDFA/ByteString/Lazy.hs
  27. +15 −2 Text/RE/ZeInternals/SearchReplace/TDFA/Sequence.hs
  28. +15 −2 Text/RE/ZeInternals/SearchReplace/TDFA/String.hs
  29. +15 −2 Text/RE/ZeInternals/SearchReplace/TDFA/Text.hs
  30. +15 −2 Text/RE/ZeInternals/SearchReplace/TDFA/Text/Lazy.hs
  31. +11 −11 Text/RE/ZeInternals/TDFA.hs
  32. +8 −10 Text/RE/ZeInternals/TestBench.lhs
  33. +3 −0 changelog
  34. +20 −0 data/pcre-macros-src.txt
  35. +143 −0 data/pcre-macros.txt
  36. +25 −0 data/pcre-nginx-log-processor-src.txt
  37. +159 −0 data/pcre-nginx-log-processor.txt
  38. +21 −0 data/tdfa-macros-src.txt
  39. +150 −0 data/tdfa-macros.txt
  40. +22 −14 examples/re-nginx-log-processor.lhs
  41. +1 −1 examples/re-prep.lhs
  42. +12 −1 examples/re-tests.lhs
  43. +2 −2 examples/re-tutorial-master.lhs
  44. +6 −6 examples/re-tutorial.lhs
  45. +2 −2 lib/cabal-masters/executables-incl.cabal
  46. +11 −11 lib/cabal-masters/library-incl.cabal
  47. +5 −4 lib/cabal-masters/mega-regex.cabal
  48. +1 −1 lib/cabal-masters/regex-examples.cabal
  49. +5 −4 lib/cabal-masters/regex-incl.cabal
  50. +1 −4 lib/cabal-masters/regex-with-pcre.cabal
  51. +10 −11 lib/cabal-masters/regex.cabal
  52. +3 −3 lib/cabal-masters/test-extra-source-files-incl.cabal
  53. +5 −5 lib/md/build-status.md
  54. +3 −3 lib/md/index.md
  55. +2 −1 lib/md/roadmap-incl.md
  56. +3 −3 lib/md/summary-incl.md
  57. +40 −35 lib/mega-regex.cabal
  58. +29 −25 lib/regex-examples.cabal
  59. +9 −11 lib/regex-with-pcre.cabal
  60. +17 −17 lib/regex.cabal
  61. +1 −1 lib/version.txt
  62. +40 −35 regex.cabal
  63. BIN releases/regex-0.11.1.0.tar.gz
  64. BIN releases/regex-examples-0.11.1.0.tar.gz
  65. BIN releases/regex-with-pcre-0.11.1.0.tar.gz
View
@@ -1,5 +1,6 @@
# regex
+docs
.hub
.ghci
.hub
View
@@ -215,4 +215,4 @@ script:
after_script:
- travis_retry curl -L https://lainepress.github.io/shc/shc.tar.xz | tar xJ
- |
- [ "$BUILD" == stack -a "$GHCVER" == 7.10.3 ] && ./shc --exclude-files=Text/RE/Internal/QQ.hs --partial-coverage regex re-gen-cabals-test re-gen-modules-test re-include-test re-nginx-log-processor-test re-prep-test re-tests-test re-tutorial-test
+ [ "$BUILD" == stack -a "$GHCVER" == 7.10.3 ] && ./shc --exclude-files=Text/RE/ZeInternals/QQ.hs --partial-coverage regex re-gen-cabals-test re-gen-modules-test re-include-test re-nginx-log-processor-test re-prep-test re-tests-test re-tutorial-test
View
@@ -15,14 +15,18 @@ module Text.RE
-- * How to use this library
-- $use
- -- * Matches
+ -- * Further Use
+ -- $further
+
+ -- * The regex Foundational Types
+ -- ** Matches
Matches
, matchesSource
, allMatches
, anyMatches
, countMatches
, matches
- -- * Match
+ -- ** Match
, Match
, matchSource
, matched
@@ -38,17 +42,17 @@ import Text.RE.ZeInternals.Types.Matches
-- $use
--
--- This module just provides an overview of the key type on which
--- the regex package is built. You will need to import one of the API
--- modules of which there is a choice which will depend upon two factors:
+-- This module just provides a brief overview of the regex package. You
+-- will need to import one of the API modules of which there is a choice
+-- which will depend upon two factors:
--
--- * Which flavour of regular expression do you want to use? If you want
--- Posix flavour REs then you want the TDFA modules, otherwise its
+-- * Which flavour of regular expression do you want to use? If you need
+-- Posix flavour REs then you will want the TDFA modules, otherwise its
-- PCRE for Perl-style REs.
--
-- * What type of text do you want to match: (slow) @String@s, @ByteString@,
-- @ByteString.Lazy@, @Text@, @Text.Lazy@ or the anachronistic @Seq Char@
--- or indeed a good old-fashioned polymorphic operators?
+-- or indeed some good old-fashioned polymorphic operators?
--
-- While we aim to provide all combinations of these choices, some of them
-- are currently not available. In the regex package we have:
@@ -71,3 +75,12 @@ import Text.RE.ZeInternals.Types.Matches
-- * Text.RE.PCRE.Sequence
-- * Text.RE.PCRE.String
-- * Text.RE.PCRE
+
+-- $further
+-- For more specialist applications we have the following:
+--
+-- * "Text.RE.REOptions" for specifying back-end specific options;
+-- * "Text.RE.Replace" for the full replace toolkit;
+-- * "Text.RE.TestBench" for building up, testing and doumenting;
+-- macro environments for use in REs;
+-- * "Text.RE.Tools" for an AWK-like text-processing toolkit.
View
@@ -20,9 +20,6 @@ module Text.RE.PCRE
-- * The SearchReplace Operators
, (*=~/)
, (?=~/)
- -- * The Classic rexex-base Match Operators
- , (=~)
- , (=~~)
-- * Matches
, Matches
, matchesSource
@@ -35,17 +32,25 @@ module Text.RE.PCRE
, matchSource
, matched
, matchedText
- -- * The 'RE' Type and Functions
+ -- * The 'RE' Type
, RE
- , SimpleREOptions(..)
, reSource
+ -- * Options
+ -- $options
+ , SimpleREOptions(..)
+ -- * Compiling and Escaping REs
, compileRegex
, compileRegexWith
, escape
, escapeWith
, escapeREString
+ -- * The Classic rexex-base Match Operators
+ , (=~)
+ , (=~~)
+ -- * The Quasi Quoters and Minor Functions
+ -- $re
, module Text.RE.ZeInternals.PCRE
- -- * The [ed| ... |] quasi quoters
+ -- $ed
, module Text.RE.ZeInternals.SearchReplace.PCRE
-- * The Operator Instances
-- $instances
@@ -71,7 +76,8 @@ import Text.RE.IsRegex
import Text.RE.REOptions
--- | find all matches in text; e.g., to count the number of naturals in s:
+-- | find all the matches in the argument text; e.g., to count the number
+-- of naturals in s:
--
-- @countMatches $ s *=~ [re|[0-9]+|]@
--
@@ -81,21 +87,35 @@ import Text.RE.REOptions
-> Matches s
(*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ matchMany rex bs
--- | find first match in text
+-- | find the first match in the argument text; e.g., to test if there
+-- is a natural number in the input text:
+--
+-- @matched $ s ?=~ [re|[0-9]+|]@
+--
(?=~) :: IsRegex RE s
=> s
-> RE
-> Match s
(?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ matchOnce rex bs
--- | search and replace once
-(?=~/) :: IsRegex RE s => s -> SearchReplace RE s -> s
-(?=~/) = flip searchReplaceFirst
-
--- | search and replace, all occurrences
+-- | search and replace all matches in the argument text; e.g., this section
+-- will convert every YYYY-MM-DD format date in its argument text into a
+-- DD\/MM\/YYYY date:
+--
+-- @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@
+--
(*=~/) :: IsRegex RE s => s -> SearchReplace RE s -> s
(*=~/) = flip searchReplaceAll
+-- | search and replace the first occurrence only (if any) in the input text
+-- e.g., to prefix the first string of four hex digits in the imput text,
+-- if any, with @0x@:
+--
+-- @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])
+--
+(?=~/) :: IsRegex RE s => s -> SearchReplace RE s -> s
+(?=~/) = flip searchReplaceFirst
+
-- | the regex-base polymorphic match operator
(=~) :: ( B.RegexContext PCRE.Regex s a
, B.RegexMaker PCRE.Regex PCRE.CompOption PCRE.ExecOption s
@@ -120,7 +140,7 @@ import Text.RE.REOptions
-- $about
-- This module provides access to the back end through polymorphic functions
--- that operate over all of the String/Text/ByteString types supported by the
+-- that operate over all of the String\/Text\/ByteString types supported by the
-- PCRE back end. If you don't need this generality you might find it easier
-- to work with one of the modules that have been specialised for each of these
-- types:
@@ -131,6 +151,35 @@ import Text.RE.REOptions
-- * "Text.RE.PCRE.Sequence"
-- * "Text.RE.PCRE.String"
--- $instances
+-- $options
+-- You can specify different compilation options by appending a
+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter
+-- to select the corresponding compilation option. For example, the
+-- section,
--
+-- @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@
+--
+-- will replace a @foo@ suffix of the argument text, of any
+-- capitalisation, with a (lower case) @bar@. If you need to specify the
+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@
+-- quasi quoters, which generate functions that take an 'IsOption' option
+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'
+-- as apropriate. For example if you have a 'SimpleReOptions' value in
+-- @sro@ then
+--
+-- @(?=~/ [ed_|foo$\/\/\/bar|] sro)@
+--
+-- will compile the @foo$@ RE according to the value of @sro@. For more
+-- on specifying RE options see "Text.RE.REOptions".
+
+-- $re
+-- The @[re|.*|]@ quasi quoters, with variants for specifing different
+-- options to the RE compiler (see "Text.RE.REOptions"), and the
+-- specialised back-end types and functions.
+
+-- $ed
+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different
+-- options to the RE compiler (see "Text.RE.REOptions").
+
+-- $instances
-- These modules merely provide the 'IsRegex' instances.
View
@@ -20,9 +20,6 @@ module Text.RE.PCRE.ByteString
-- * The 'SearchReplace' Operators
, (*=~/)
, (?=~/)
- -- * The Classic rexex-base match Operators
- , (=~)
- , (=~~)
-- * Matches
, Matches
, matchesSource
@@ -35,16 +32,25 @@ module Text.RE.PCRE.ByteString
, matchSource
, matched
, matchedText
- -- * The 'RE' Type and Functions
+ -- * The 'RE' Type
, RE
- , SimpleREOptions(..)
, reSource
+ -- * Options
+ -- $options
+ , SimpleREOptions(..)
+ -- * Compiling and Escaping REs
, compileRegex
, compileRegexWith
, escape
, escapeWith
, escapeREString
+ -- * The Classic rexex-base Match Operators
+ , (=~)
+ , (=~~)
+ -- * The Quasi Quoters and Minor Functions
+ -- $re
, module Text.RE.ZeInternals.PCRE
+ -- $ed
, module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString
) where
@@ -62,7 +68,8 @@ import Text.RE.ZeInternals.PCRE
import qualified Text.Regex.PCRE as PCRE
--- | find all matches in text; e.g., to count the number of naturals in s:
+-- | find all the matches in the argument text; e.g., to count the number
+-- of naturals in s:
--
-- @countMatches $ s *=~ [re|[0-9]+|]@
--
@@ -71,21 +78,31 @@ import qualified Text.Regex.PCRE as PCRE
-> Matches B.ByteString
(*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs
--- | find first match in text
+-- | find the first match in the argument text; e.g., to test if there
+-- is a natural number in the input text:
+--
+-- @matched $ s ?=~ [re|[0-9]+|]@
+--
(?=~) :: B.ByteString
-> RE
-> Match B.ByteString
(?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs
--- | search and replace all occurrences; e.g., this section will yield a function to
--- convert every a YYYY-MM-DD into a DD/MM/YYYY:
+-- | search and replace all matches in the argument text; e.g., this section
+-- will convert every YYYY-MM-DD format date in its argument text into a
+-- DD\/MM\/YYYY date:
--
--- @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@
+-- @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@
--
(*=~/) :: B.ByteString -> SearchReplace RE B.ByteString -> B.ByteString
(*=~/) = flip searchReplaceAll
--- | search and replace the first occurrence only
+-- | search and replace the first occurrence only (if any) in the input text
+-- e.g., to prefix the first string of four hex digits in the imput text,
+-- if any, with @0x@:
+--
+-- @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])
+--
(?=~/) :: B.ByteString -> SearchReplace RE B.ByteString -> B.ByteString
(?=~/) = flip searchReplaceFirst
@@ -120,3 +137,33 @@ instance IsRegex RE B.ByteString where
-- $tutorial
-- We have a regex tutorial at <http://tutorial.regex.uk>.
+
+-- $options
+-- You can specify different compilation options by appending a
+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter
+-- to select the corresponding compilation option. For example, the
+-- section,
+--
+-- @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@
+--
+-- will replace a @foo@ suffix of the argument text, of any
+-- capitalisation, with a (lower case) @bar@. If you need to specify the
+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@
+-- quasi quoters, which generate functions that take an 'IsOption' option
+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'
+-- as apropriate. For example if you have a 'SimpleReOptions' value in
+-- @sro@ then
+--
+-- @(?=~/ [ed_|foo$\/\/\/bar|] sro)@
+--
+-- will compile the @foo$@ RE according to the value of @sro@. For more
+-- on specifying RE options see "Text.RE.REOptions".
+
+-- $re
+-- The @[re|.*|]@ quasi quoters, with variants for specifing different
+-- options to the RE compiler (see "Text.RE.REOptions"), and the
+-- specialised back-end types and functions.
+
+-- $ed
+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different
+-- options to the RE compiler (see "Text.RE.REOptions").
Oops, something went wrong.

0 comments on commit f728c7e

Please sign in to comment.