regex-base 0.72.0.2 → 0.83
raw patch · 14 files changed
+113/−368 lines, 14 filesdep +mtldep −arraydep −bytestringdep ~basebuild-type:Customsetup-changednew-uploader
Dependencies added: mtl
Dependencies removed: array, bytestring
Dependency ranges changed: base
Files
- LICENSE +7/−26
- Setup.hs +6/−0
- Setup.lhs +0/−11
- Text/Regex/Base.hs +11/−3
- Text/Regex/Base/Context.hs +1/−10
- Text/Regex/Base/RegexLike.hs +77/−16
- doc/README +0/−39
- doc/Redesign.txt +0/−14
- doc/lazy.html +0/−139
- examples/Example.hs +0/−14
- examples/Example2.hs +0/−44
- examples/Example3.lhs +0/−21
- prologue.txt +0/−1
- regex-base.cabal +11/−30
LICENSE view
@@ -1,31 +1,12 @@-The Glasgow Haskell Compiler License+This modile is under this "3 clause" BSD license: -Copyright 2004, The University Court of the University of Glasgow. +Copyright (c) 2007, Christopher Kuklewicz All rights reserved. -Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are met:+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -- Redistributions of source code must retain the above copyright notice,-this list of conditions and the following disclaimer.- -- Redistributions in binary form must reproduce the above copyright notice,-this list of conditions and the following disclaimer in the documentation-and/or other materials provided with the distribution.- -- Neither name of the University nor the names of its contributors may be-used to endorse or promote products derived from this software without-specific prior written permission. + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.+ * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF-GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE-UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH-DAMAGE.+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,6 @@+#!/usr/bin/env runhaskell++-- I usually compile this with "ghc --make -o setup Setup.hs"++import Distribution.Simple(defaultMain)+main = defaultMain
− Setup.lhs
@@ -1,11 +0,0 @@-#!/usr/bin/env runhaskell--> -- I usually compile this with "ghc --make -o setup Setup.hs"--> module Main (main) where->-> import Distribution.Simple->-> main :: IO ()-> main = defaultMain-
Text/Regex/Base.hs view
@@ -41,10 +41,18 @@ -- TODO: Copy Example*hs files into this haddock comment ----------------------------------------------------------------------------- -module Text.Regex.Base (+module Text.Regex.Base (getVersion_Text_Regex_Base -- | RegexLike defines classes and type, and 'Extract' instances- module Text.Regex.Base.RegexLike- ) where+ ,module Text.Regex.Base.RegexLike+ -- | Context only exports instances for 'RegexContext'+ ,module Text.Regex.Base.Context) where +import Data.Version(Version(..)) import Text.Regex.Base.RegexLike import Text.Regex.Base.Context++getVersion_Text_Regex_Base :: Version+getVersion_Text_Regex_Base =+ Version { versionBranch = [0,83]+ , versionTags = ["unstable"]+ }
Text/Regex/Base/Context.hs view
@@ -60,7 +60,7 @@ (@ RegexLike a b => RegexContext a b (MatchResult b) @) : The 'MatchResult' structure for the match. -These instances are for all the matches (non-overlapping):+These instances are for all the matches (non-overlapping). Note that backends are supposed to supply RegexLike instances for which matchAll and matchAllText stop searching after returning any successful but empty match. (@ RegexLike a b => RegexContext a b Int @) : The number of matches@@ -185,12 +185,9 @@ match r s = maybe (-1,0) (!0) (matchOnce r s) matchM r s = maybe regexFailed (return.(!0)) (matchOnce r s) -#if __GLASGOW_HASKELL__--- overlaps with instance (RegexLike a b) => RegexContext a b (Array Int b) instance (RegexLike a b) => RegexContext a b MatchArray where match r s = maybe nullArray id (matchOnce r s) matchM r s = maybe regexFailed return (matchOnce r s)-#endif instance (RegexLike a b) => RegexContext a b (b,MatchText b,b) where match r s = maybe (s,nullArray,empty) id (matchOnceText r s)@@ -223,23 +220,17 @@ -- ** Instances based on matchAll,matchAllText -#if __GLASGOW_HASKELL__--- overlaps with instance (RegexLike a b) => RegexContext a b [Array Int b] instance (RegexLike a b) => RegexContext a b [MatchArray] where match = matchAll matchM = nullFail-#endif instance (RegexLike a b) => RegexContext a b [MatchText b] where match = matchAllText matchM = nullFail -#if __GLASGOW_HASKELL__--- overlaps with instance (RegexLike a b) => RegexContext a b [b] instance (RegexLike a b) => RegexContext a b [(MatchOffset,MatchLength)] where match r s = [ ma!0 | ma <- matchAll r s ] matchM = nullFail-#endif instance (RegexLike a b) => RegexContext a b [b] where match r s = [ fst (ma!0) | ma <- matchAllText r s ]
Text/Regex/Base/RegexLike.hs view
@@ -38,10 +38,12 @@ Extract(..), ) where +import Control.Monad.Error() import Data.Array(Array,(!)) import Data.Maybe(isJust)-import Data.ByteString(ByteString)-import qualified Data.ByteString as B (take,drop,empty)+import qualified Data.ByteString as B (take,drop,empty,ByteString)+import qualified Data.ByteString.Lazy as L (take,drop,empty,ByteString)+import qualified Data.Sequence as S(take,drop,empty,Seq) -- | 0 based index from start of source, or (-1) for unused type MatchOffset = Int@@ -52,7 +54,6 @@ type MatchArray = Array Int (MatchOffset,MatchLength) type MatchText source = Array Int (source,(MatchOffset,MatchLength)) - -- | This is the same as the type from JRegex. data MatchResult a = MR { mrBefore :: a,@@ -82,34 +83,70 @@ ---------------- -- | RegexMaker captures the creation of the compiled regular--- expression from a source type and an option type. The 'makeRegex'--- function has a default implementation that depends on makeRegexOpts--- and used 'defaultCompOpt' and 'defaultExecOpt'.+-- expression from a source type and an option type. 'makeRegexM' and+-- 'makeRegexM' report parse error using 'MonadError', usually (Either+-- String regex).+-- +-- The 'makeRegex' function has a default implementation that depends+-- on makeRegexOpts and used 'defaultCompOpt' and 'defaultExecOpt'.+-- Similarly for 'makeRegexM' and 'makeRegexOptsM'.+--+-- There are also default implementaions for 'makeRegexOpts' and+-- 'makeRegexOptsM' in terms of each other. So a minimal instance+-- definition needs to only define one of these, hopefully+-- 'makeRegexOptsM'. class (RegexOptions regex compOpt execOpt) => RegexMaker regex compOpt execOpt source | regex -> compOpt execOpt, compOpt -> regex execOpt, execOpt -> regex compOpt where -- | make using the defaultCompOpt and defaultExecOpt makeRegex :: source -> regex -- | Specify your own options makeRegexOpts :: compOpt -> execOpt -> source -> regex+ -- | make using the defaultCompOpt and defaultExecOpt, reporting errors with fail+ makeRegexM :: (Monad m) => source -> m regex+ -- | Specify your own options, reporting errors with fail+ makeRegexOptsM :: (Monad m) => compOpt -> execOpt -> source -> m regex makeRegex = makeRegexOpts defaultCompOpt defaultExecOpt+ makeRegexM = makeRegexOptsM defaultCompOpt defaultExecOpt+ makeRegexOpts c e s = either error id (makeRegexOptsM c e s)+ makeRegexOptsM c e s = return (makeRegexOpts c e s) ---------------- -- | RegexLike is parametrized on a regular expression type and a -- source type to run the matching on. ----- There are default implementations: matchTest and matchOnceText--- using matchOnce; matchCount and matchAllText using--- matchAll. matchOnce uses matchOnceText and matchAll uses--- matchAllText. So a minimal complete instance need to provide--- (matchOnce or matchOnceText) and (matchAll or matchAllText).+-- There are default implementations: matchTest and matchOnceText use+-- matchOnce; matchCount and matchAllText use matchAll. matchOnce uses+-- matchOnceText and matchAll uses matchAllText. So a minimal complete+-- instance need to provide at least (matchOnce or matchOnceText) and+-- (matchAll or matchAllText). Additional definitions are often+-- provided where they will increase efficiency.+--+-- > [ c | let notVowel = makeRegex "[^aeiou]" :: Regex, c <- ['a'..'z'], matchTest notVowel [c] ]+-- >+-- > "bcdfghjklmnpqrstvwxyz"+--+-- The strictness of these functions is instance dependent. class (Extract source)=> RegexLike regex source where- matchAll :: regex -> source-> [MatchArray]- -- | This can return an array of (offset,length) index pairs for the- -- match and captured substrings.+ -- | This returns the first match in the source (it checks the whole+ -- source, not just at the start). This returns an array of+ -- (offset,length) index pairs for the match and captured+ -- substrings. The offset is 0-based. A (-1) for an offset means a+ -- failure to match. The lower bound of the array is 0, and the 0th+ -- element is the (offset,length) for the whole match. matchOnce :: regex -> source-> Maybe MatchArray+ -- | matchAll returns a list of matches. The matches are in order+ -- and do not overlap. If any match succeeds but has 0 length then+ -- this will be the last match in the list.+ matchAll :: regex -> source-> [MatchArray]+ -- | matchCount returns the number of non-overlapping matches+ -- returned by matchAll. matchCount :: regex -> source-> Int+ -- | matchTest return True if there is a match somewhere in the+ -- source (it checks the whole source not just at the start). matchTest :: regex -> source-> Bool+ -- | This is matchAll with the actual subsections of the source+ -- instead of just the (offset,length) information. matchAllText :: regex -> source-> [MatchText source] -- | This can return a tuple of three items: the source before the -- match, an array of the match and captured substrings (with their@@ -131,7 +168,25 @@ (matchAll regex source) ------------------- | RegexContext is the polymorphic interface to do matching+-- | RegexContext is the polymorphic interface to do matching. Since+-- 'target' is polymorphic you may need to suply the type explicitly+-- in contexts where it cannot be inferred.+--+-- The monadic 'matchM' version uses 'fail' to report when the 'regex'+-- has no match in 'source'. Two examples:+--+-- Here the contest 'Bool' is inferred:+--+-- > [ c | let notVowel = makeRegex "[^aeiou]" :: Regex, c <- ['a'..'z'], match notVowel [c] ]+-- >+-- > "bcdfghjklmnpqrstvwxyz"+--+-- Here the context '[String]' must be supplied:+--+-- > let notVowel = (makeRegex "[^aeiou]" :: Regex )+-- > in do { c <- ['a'..'z'] ; matchM notVowel [c] } :: [String]+-- >+-- > ["b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z"] class (RegexLike regex source) => RegexContext regex source target where match :: regex -> source -> target matchM :: (Monad m) => regex -> source -> m target@@ -154,5 +209,11 @@ instance Extract String where before = take; after = drop; empty = [] -instance Extract ByteString where+instance Extract B.ByteString where before = B.take; after = B.drop; empty = B.empty++instance Extract L.ByteString where+ before = L.take . toEnum; after = L.drop . toEnum; empty = L.empty++instance Extract (S.Seq a) where+ before = S.take; after = S.drop; empty = S.empty
− doc/README
@@ -1,39 +0,0 @@-README for TestRegexLazy-0.66--By Chris Kuklewicz (TextRegexLazy (at) personal (dot) mightyreason (dot) com)--For more detail on Text.Regex.Lazy look at the very very outdated-lazy.html file or the LICENSE file.--To build and install:- get Data.ByteString from http://www.cse.unsw.edu.au/~dons/fps.html- (You probably want to configure ByteString's cabal with -p for profiling)- edit list of BACKENDS in Makefile if you want to exclude regex-tre or regex-pcre- edit regex-pcre/regex-pcre.cabal to point to your PCRE installation- edit CONF and USER variables in Makefile to point to your setup- (The CONF includes -p for profiling)- run "make all" which will create and install all the packages in $(SUBDIRS)--The packages:- regex-base : This hold the type class definitions and (most) RegexContext,Extract instances- regex-compat : Builds Text.Regex.New (soon to replace Text.Regex) on top of regex-parsec- regex-pcre : Build the PCRE backend, http://www.pcre.org/- regex-posix : Builds the Posix backend- regex-parsec : Builds my lazy parsec based pure haskell backend- regex-dfa : Build the simple backend based on CTKLight (this is LGPL)--There is an additional "regex-devel" package where I am setting up-testing and bechmarking. Use "make regex-devel" at the top level to-compile (not install), or use its cabal Setup.hs.-regex-devel/bench/runbench.sh is my simple toy benchmark.--To use =~ and =~~ new API:--> import Text.Regex.(Parsec|DFA|PCRE|PosixRE|TRE)-and perhaps-> import Text.Regex.Base--Look at Example*.hs and instances in Text.Regex.Base.Context.hs for what it can do.--For old "Text.Regex" API drop in compatibility, import Text.Regex.New (uses PosixRE backend)-
− doc/Redesign.txt
@@ -1,14 +0,0 @@-The regular expression stuff needs some of a rethink.--Things that could be made more efficient, as I think of them:--(1) Making Arrays in Wrap* may be a bit inefficient-counter: Usage may be like "look up element 3" so random access is good--(2) String DFA: the findRegex computes the prefix string itself, which is sometimes wasted / sometimes wanted / always discarded. Also, the input string at the start of the match is discarded--(3) Lazy computes MatchedStrings array then discards it. Wasteful.--(4) Mighty extend RegexLike with ability to return "strings", i.e. Extract instance. The default conversion could be left in for some things. Then RegexContext could pull from that instead of matchOnce/matchAll.--(5) make RegexLike default matchAll/matchOnce in terms of matchOnceText and matchAllText
− doc/lazy.html
@@ -1,139 +0,0 @@-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">-<HTML>- <head>- <title>Text.Regex.Lazy</title>- </head>-<body>-<h1><tt>Text.Regex.Lazy</tt></h1>-<h2>Version 0.70 (2006-08-10)</h2>--<h3>By Chris Kuklewicz (TextRegexLazy (at) personal (dot) mightyreason (dot) com)</h3>--Changes from 0.66 to 0.70-<ul>- <li> regex-tre added for libtre backend (Text.Regex.TRE), see http://laurikari.net/tre/- <li> regex-devel added for tests and benchmarks- <li> Text.Regex.*.Wrap APIs improved: the exported wrap* functions- never call fail or error under normal circumstances, and use Either- types to report errors. Allocation failures are reported with fail.- <li> Text.Regex.*.(ByteString|String) all should export- compile/execute/regexec functions which report errors using Either.-</ul>--Changes from 0.55 to 0.66-<ul>- <li> I broke this into many packages, regex-base for the interface and regex-pcre, regex-posix, regex-parsec, regex-dfa for the four backends and regex-compat to replace Text.Regex(.New)- <li> The top level Makefile now can drive setup and installation of all the packages at once.-</ul>--Changes from 0.44 to 0.55-<ul>- <li> <b>JRegex has been assimilated: PCRE and PosixRE are here</b>.- The JRegex-style API rocks, see below and Context.hs and Example.hs- <li> Haddock seems to run via ./setup haddock, but the documentation is very thin- <li> ./setup test runs TestTestRegexLazy binary if uncommented in cabal file- <li> default is now to compile with -Wall -Werror -O2- <li> You may need to point the cabal file's "Extra-Lib-Dirs" to point to pcre.- <li> You may or may not need a "-lpcre" option to ghc when building- projects that depend on Text.Regex.Lazy now.-</ul>--Changes from 0.33 to 0.44-<ul>- <li> Cabal- <li> Compile with -Wall -Werror- <li> Change DFAEngineFPS from Data.FastPackedString to Data.ByteString-</ul>-See the LICENSE file for details on copyright. See README for building instructions.-<br/>-The new API is very close to JRegex and supports 4 backends:-<ul>- <li> Posix, the standard c regex library- <li> PCRE, the <a href="http://www.pcre.org/">Perl Compatible Regular Expressions</a> c library- <li> Full, the lazy Parsec based library (see old api below)- <li> DFA, the fast lazy matching library (see old api below)-</ul>-And for all backends, there are two types that can be used as a source-of regular expressions or to match a regular expression against:-String, and ByteString. The ByteString library will be in the next-GHC and can be gotten-from <a-href="http://www.cse.unsw.edu.au/~dons/fps.html">http://www.cse.unsw.edu.au/~dons/fps.html</a>.-<p>-For simplest use of the new API: import Text.Regex.Lazy and one of-<pre>-import Text.Regex.PCRE((=~),(=~~))-import Text.Regex.Parsec((=~),(=~~))-import Text.Regex.DFA((=~),(=~~))-import Text.Regex.PosixRE((=~),(=~~))-import Text.Regex.TRE((=~),(=~~))-</pre>-The things you can demand of (=~) and (=~~) are all-instance defined in Text.Regex.Impl.Context and they are used-in <tt>Example.hs</tt> as well.-<p>-<p>-You can redefine (=~) and (=~~) to use different options by using makeRegexOpts:-<pre>-(=~) :: (RegexMaker Regex CompOption ExecOption source,RegexContext Regex source1 target) => source1 -> source -> target-(=~) x r = let q :: Regex- q = makeRegexOpts (some compoption) (some execoption) r- in match q x--(=~~) ::(RegexMaker Regex CompOption ExecOption source,RegexContext Regex source1 target,Monad m) => source1 -> source -> m target-(=~~) x r = let q :: Regex- q = makeRegexOpts (some compoption) (some execoption) r- in matchM q x-</pre>-There is a medium level API with functions compile/execute/regexec in-all the Text.Regex.*.(String|ByteString) modules. These allow for-errors to be reported as Either types when compiling or running.-<p>-The low level APIs are in the Text.Regex.*.Wrap modules. For the-c-library backends these expose most of the c-api in wrap* functions-that make the type more Haskell-like: CString and CStingLen and-newtypes to specify compile and execute options. The actual foreign-calls are not exported; it does not export the raw c api.-<p>-Also, Text.Regex.PCRE.Wrap will let you query if it was compiled with-UTF8 suppor: <tt>configUTF8 :: Bool</tt>. But I do not provide a way-to marshall to or from UTF8. (If you have a UTF8 ByteString then you-would probably be able to make it work, assuming the indices PCRE uses-are in bytes, otherwise look at the wrap* functions which are a thin-layer over the pcreapi).-<p>--<p>-The old Text.Regex API is can be replaced. If you need to be drop in-compatible with <tt>Text.Regex</tt> then you can-import <tt>Text.Regex.New</tt> and report any infidelities as bugs.--Some advantages of <tt>Text.Regex.Parsec</tt> over <tt>Text.Regex</tt>:-<ul>- <li> It does not marshal to and from c-code arrays, so it is much- faster on large input strings.- <li> It consumes the input <tt>String</tt> in a mostly lazy manner.- This makes streaming from input to output possible.- <li> It performs sanity checks so that <tt>subRegex</tt>- and <tt>splitRegex</tt> don't loop or go crazy if the pattern- matches an empty string -- it will just return the input.- <li> If the <tt>String</tt> regex does not parse then you get a nicer error- message.-</ul>-<p>-Internally it uses <tt>Parsec</tt> to turn the string regex into-a <tt>Pattern</tt> data type, simplify the <tt>Pattern</tt>, then-transform the <tt>Pattern</tt> into a <tt>Parsec</tt> parser that-accepts matching strings and stores the sub-strings of parenthesized-groups.-<p>-All of this was motivated by the inability to use <tt>Text.Regex</tt>-to complete-the <a-href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=regexdna&lang=all">regex-dna-benchmark</a> on <a href="http://shootout.alioth.debian.org/">The-Computer Language Shootout</a>. The current entry there, by Don-Stewart and Alson Kemp and Chris Kuklewicz, does not use this Parsec-solution, but rather a custom DFA lexer from the CTK library.-</body>-</HTML>
− examples/Example.hs
@@ -1,14 +0,0 @@-{-# OPTIONS_GHC -fglasgow-exts #-}-import Text.Regex.Base-import Text.Regex.Posix((=~),(=~~)) -- or DFA or PCRE or PosixRE-import qualified Data.ByteString.Char8 as B(ByteString,pack)--main = let b :: Bool- b = ("abaca" =~ "(.)a")- c :: [MatchArray]- c = ("abaca" =~ "(.)a")- d :: Maybe (String,String,String,[String])- d = ("abaca" =~~ "(.)a")- in do print b- print c- print d
− examples/Example2.hs
@@ -1,44 +0,0 @@-{-# OPTIONS_GHC -fglasgow-exts #-}-import Text.Regex.Base-import Text.Regex.Posix(Regex,(=~),(=~~)) -- or DFA or PCRE or PosixRE-import qualified Data.ByteString.Char8 as B(ByteString,pack)---- Show mixing of ByteString and String as well as polymorphism:--main = let x :: (RegexContext Regex String target) => target- x = ("abaca" =~ B.pack "(.)a")- x' :: (RegexContext Regex String target,Monad m) => m target- x' = ("abaca" =~~ "(.)a")- y :: (RegexContext Regex B.ByteString target) => target- y = (B.pack "abaca" =~ "(.)a")- y' :: (RegexContext Regex B.ByteString target,Monad m) => m target- y' = (B.pack "abaca" =~~ B.pack "(.)a")- in do print (x :: Bool)- print (x :: Int)- print (x :: [MatchArray])- print (x' :: Maybe (String,String,String,[String]))- print (y :: Bool)- print (y :: Int)- print (y :: [MatchArray])- print (y' :: Maybe (B.ByteString,B.ByteString,B.ByteString,[B.ByteString]))--{- Output is, except for replacing Full with DFA (which has no capture)-True-2-[array (0,1) [(0,(1,2)),(1,(1,1))],array (0,1) [(0,(3,2)),(1,(3,1))]]-Just ("a","ba","ca",["b"])-True-2-[array (0,1) [(0,(1,2)),(1,(1,1))],array (0,1) [(0,(3,2)),(1,(3,1))]]-Just ("a","ba","ca",["b"])--}-{- The output for DFA is-True-2-[array (0,0) [(0,(1,2))],array (0,0) [(0,(3,2))]]-Just ("a","ba","ca",[])-True-2-[array (0,0) [(0,(1,2))],array (0,0) [(0,(3,2))]]-Just ("a","ba","ca",[])--}
− examples/Example3.lhs
@@ -1,21 +0,0 @@-> {-# OPTIONS_GHC -fglasgow-exts #-}--> import Text.Regex.Base--> import qualified Text.Regex.PCRE as R-> import qualified Text.Regex.PosixRE as S-> import qualified Text.Regex.Parsec as F--Choose which library to use depending on presence of PCRE library.--> (=~) :: (RegexMaker R.Regex R.CompOption R.ExecOption a,RegexContext R.Regex b t-> ,RegexMaker F.Regex F.CompOption F.ExecOption a,RegexContext F.Regex b t-> ,RegexMaker S.Regex S.CompOption S.ExecOption a,RegexContext S.Regex b t)-> => b -> a -> t-> (=~) = case R.getVersion of-> Just _ -> (R.=~)-> Nothing -> case S.getVersion of-> Just _ -> (S.=~)-> Nothing -> (F.=~)--> main = print ("abc" =~ "(.)c" :: Bool)
− prologue.txt
@@ -1,1 +0,0 @@-Interfaces for regular expressions
regex-base.cabal view
@@ -1,8 +1,5 @@--- ****************************************************************--- To fix for cabal < 1.1.4 comment out the Extra-Source-Files line--- **************************************************************** Name: regex-base-Version: 0.72.0.2+Version: 0.83 -- Cabal-Version: >=1.1.4 License: BSD3 License-File: LICENSE@@ -11,43 +8,27 @@ Maintainer: TextRegexLazy@personal.mightyreason.com Stability: Seems to work, passes a few tests Homepage: http://sourceforge.net/projects/lazy-regex--- Package-URL:+Package-URL: http://darcs.haskell.org/packages/regex-unstable/regex-base/ Synopsis: Replaces/Enhances Text.Regex-Description: Interface API for regex-posix,pcre,parsec,dfa+Description: Interface API for regex-posix,pcre,parsec,tdfa,dfa Category: Text Tested-With: GHC-Build-Type: Simple-Cabal-Version: >=1.2--Flag split-base-Flag bytestring-in-base--Library- if flag(split-base)- Build-Depends: base >= 3, array- else- Build-Depends: base < 3- if flag(bytestring-in-base)- Build-Depends: base >= 2 && < 3- else- Build-Depends: base < 2 || >= 3, bytestring+Build-Depends: base >= 2.0, mtl -- Data-Files:--- Extra-Source-Files: Text/Regex/Lazy/TestCompat.hs, Text/Regex/Lazy/TestFull.hs, Text/Regex/Impl/TestContext.hs, TestTextRegexLazy.hs, Example.hs, Example2.hs, lazy.html, README, Makefile+-- Extra-Source-Files: -- Extra-Tmp-Files:- Exposed-Modules: Text.Regex.Base+Exposed-Modules: Text.Regex.Base Text.Regex.Base.RegexLike Text.Regex.Base.Context Text.Regex.Base.Impl- Buildable: True+Buildable: True -- Other-Modules:--- ********* Be backward compatible until 6.4.2 is futher deployed -- HS-Source-Dirs: "."- Extensions: MultiParamTypeClasses, FunctionalDependencies, CPP+Extensions: MultiParamTypeClasses, FunctionalDependencies -- GHC-Options: -Wall -Werror--- GHC-Options: -Wall -Werror -O2- GHC-Options: -Wall -O2--- GHC-Options: -Wall -ddump-minimal-imports--- GHC-Prog-Options: +GHC-Options: -Wall -Werror -O2+-- GHC-Options: -Wall -ddump-minimal-GHC+-- imports-Prof-Options: -auto-all -- Hugs-Options: -- NHC-Options: -- Includes: