regex-pderiv 0.0.8.1 → 0.0.8.2
raw patch · 8 files changed
+36/−23 lines, 8 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Text.Regex.PDeriv.Dictionary: instance (Key a) => Key [a]
- Text.Regex.PDeriv.Nfa: instance (Show a) => Show (SNFA s a)
+ Text.Regex.PDeriv.Common: maxBinder :: Int
+ Text.Regex.PDeriv.Common: minBinder :: Int
+ Text.Regex.PDeriv.Dictionary: instance Key a => Key [a]
+ Text.Regex.PDeriv.Nfa: instance Show a => Show (SNFA s a)
- Text.Regex.PDeriv.ByteString: defaultCompOpt :: (RegexOptions regex compOpt execOpt) => compOpt
+ Text.Regex.PDeriv.ByteString: defaultCompOpt :: RegexOptions regex compOpt execOpt => compOpt
- Text.Regex.PDeriv.ByteString: defaultExecOpt :: (RegexOptions regex compOpt execOpt) => execOpt
+ Text.Regex.PDeriv.ByteString: defaultExecOpt :: RegexOptions regex compOpt execOpt => execOpt
- Text.Regex.PDeriv.ByteString.LeftToRight: defaultCompOpt :: (RegexOptions regex compOpt execOpt) => compOpt
+ Text.Regex.PDeriv.ByteString.LeftToRight: defaultCompOpt :: RegexOptions regex compOpt execOpt => compOpt
- Text.Regex.PDeriv.ByteString.LeftToRight: defaultExecOpt :: (RegexOptions regex compOpt execOpt) => execOpt
+ Text.Regex.PDeriv.ByteString.LeftToRight: defaultExecOpt :: RegexOptions regex compOpt execOpt => execOpt
- Text.Regex.PDeriv.ByteString.LeftToRightD: defaultCompOpt :: (RegexOptions regex compOpt execOpt) => compOpt
+ Text.Regex.PDeriv.ByteString.LeftToRightD: defaultCompOpt :: RegexOptions regex compOpt execOpt => compOpt
- Text.Regex.PDeriv.ByteString.LeftToRightD: defaultExecOpt :: (RegexOptions regex compOpt execOpt) => execOpt
+ Text.Regex.PDeriv.ByteString.LeftToRightD: defaultExecOpt :: RegexOptions regex compOpt execOpt => execOpt
- Text.Regex.PDeriv.ByteString.Posix: defaultCompOpt :: (RegexOptions regex compOpt execOpt) => compOpt
+ Text.Regex.PDeriv.ByteString.Posix: defaultCompOpt :: RegexOptions regex compOpt execOpt => compOpt
- Text.Regex.PDeriv.ByteString.Posix: defaultExecOpt :: (RegexOptions regex compOpt execOpt) => execOpt
+ Text.Regex.PDeriv.ByteString.Posix: defaultExecOpt :: RegexOptions regex compOpt execOpt => execOpt
- Text.Regex.PDeriv.ByteString.RightToLeft: defaultCompOpt :: (RegexOptions regex compOpt execOpt) => compOpt
+ Text.Regex.PDeriv.ByteString.RightToLeft: defaultCompOpt :: RegexOptions regex compOpt execOpt => compOpt
- Text.Regex.PDeriv.ByteString.RightToLeft: defaultExecOpt :: (RegexOptions regex compOpt execOpt) => execOpt
+ Text.Regex.PDeriv.ByteString.RightToLeft: defaultExecOpt :: RegexOptions regex compOpt execOpt => execOpt
- Text.Regex.PDeriv.ByteString.TwoPasses: defaultCompOpt :: (RegexOptions regex compOpt execOpt) => compOpt
+ Text.Regex.PDeriv.ByteString.TwoPasses: defaultCompOpt :: RegexOptions regex compOpt execOpt => compOpt
- Text.Regex.PDeriv.ByteString.TwoPasses: defaultExecOpt :: (RegexOptions regex compOpt execOpt) => execOpt
+ Text.Regex.PDeriv.ByteString.TwoPasses: defaultExecOpt :: RegexOptions regex compOpt execOpt => execOpt
- Text.Regex.PDeriv.Common: isEmpty :: (IsEmpty a) => a -> Bool
+ Text.Regex.PDeriv.Common: isEmpty :: IsEmpty a => a -> Bool
- Text.Regex.PDeriv.Common: isGreedy :: (IsGreedy a) => a -> Bool
+ Text.Regex.PDeriv.Common: isGreedy :: IsGreedy a => a -> Bool
- Text.Regex.PDeriv.Dictionary: fromList :: (Key k) => [(k, a)] -> Dictionary a
+ Text.Regex.PDeriv.Dictionary: fromList :: Key k => [(k, a)] -> Dictionary a
- Text.Regex.PDeriv.Dictionary: fromListNotOverwrite :: (Key k) => [(k, a)] -> Dictionary a
+ Text.Regex.PDeriv.Dictionary: fromListNotOverwrite :: Key k => [(k, a)] -> Dictionary a
- Text.Regex.PDeriv.Dictionary: hash :: (Key a) => a -> [Int]
+ Text.Regex.PDeriv.Dictionary: hash :: Key a => a -> [Int]
- Text.Regex.PDeriv.Dictionary: insert :: (Key k) => k -> a -> Dictionary a -> Dictionary a
+ Text.Regex.PDeriv.Dictionary: insert :: Key k => k -> a -> Dictionary a -> Dictionary a
- Text.Regex.PDeriv.Dictionary: insertNotOverwrite :: (Key k) => k -> a -> Dictionary a -> Dictionary a
+ Text.Regex.PDeriv.Dictionary: insertNotOverwrite :: Key k => k -> a -> Dictionary a -> Dictionary a
- Text.Regex.PDeriv.Dictionary: lookup :: (Key k) => k -> Dictionary a -> Maybe a
+ Text.Regex.PDeriv.Dictionary: lookup :: Key k => k -> Dictionary a -> Maybe a
- Text.Regex.PDeriv.Dictionary: lookupAll :: (Key k) => k -> Dictionary a -> [a]
+ Text.Regex.PDeriv.Dictionary: lookupAll :: Key k => k -> Dictionary a -> [a]
- Text.Regex.PDeriv.Dictionary: update :: (Key k) => k -> a -> Dictionary a -> Dictionary a
+ Text.Regex.PDeriv.Dictionary: update :: Key k => k -> a -> Dictionary a -> Dictionary a
- Text.Regex.PDeriv.IntPattern: nub2 :: (Eq a) => [(a, b)] -> [(a, b)]
+ Text.Regex.PDeriv.IntPattern: nub2 :: Eq a => [(a, b)] -> [(a, b)]
- Text.Regex.PDeriv.Nfa: empty :: (Nfa s a) => s -> Bool
+ Text.Regex.PDeriv.Nfa: empty :: Nfa s a => s -> Bool
- Text.Regex.PDeriv.Nfa: pDeriv :: (Nfa s a) => s -> a -> [s]
+ Text.Regex.PDeriv.Nfa: pDeriv :: Nfa s a => s -> a -> [s]
- Text.Regex.PDeriv.Nfa: sigma :: (Nfa s a) => s -> [a]
+ Text.Regex.PDeriv.Nfa: sigma :: Nfa s a => s -> [a]
- Text.Regex.PDeriv.Pretty: pretty :: (Pretty a) => a -> String
+ Text.Regex.PDeriv.Pretty: pretty :: Pretty a => a -> String
- Text.Regex.PDeriv.Word: append :: (Word a) => a -> a -> a
+ Text.Regex.PDeriv.Word: append :: Word a => a -> a -> a
- Text.Regex.PDeriv.Word: drop :: (Word a) => Int -> a -> a
+ Text.Regex.PDeriv.Word: drop :: Word a => Int -> a -> a
- Text.Regex.PDeriv.Word: empty :: (Word a) => a
+ Text.Regex.PDeriv.Word: empty :: Word a => a
- Text.Regex.PDeriv.Word: length :: (Word a) => a -> Int
+ Text.Regex.PDeriv.Word: length :: Word a => a -> Int
- Text.Regex.PDeriv.Word: reverse :: (Word a) => a -> a
+ Text.Regex.PDeriv.Word: reverse :: Word a => a -> a
- Text.Regex.PDeriv.Word: take :: (Word a) => Int -> a -> a
+ Text.Regex.PDeriv.Word: take :: Word a => Int -> a -> a
- Text.Regex.PDeriv.Word: uncons :: (Word a) => a -> Maybe (Char, a)
+ Text.Regex.PDeriv.Word: uncons :: Word a => a -> Maybe (Char, a)
Files
- Text/Regex/PDeriv/ByteString/LeftToRight.lhs +3/−3
- Text/Regex/PDeriv/ByteString/LeftToRightD.lhs +3/−3
- Text/Regex/PDeriv/ByteString/Posix.lhs +9/−6
- Text/Regex/PDeriv/ByteString/RightToLeft.lhs +3/−3
- Text/Regex/PDeriv/ByteString/TwoPasses.lhs +3/−3
- Text/Regex/PDeriv/Common.lhs +10/−0
- Text/Regex/PDeriv/Translate.lhs +4/−4
- regex-pderiv.cabal +1/−1
Text/Regex/PDeriv/ByteString/LeftToRight.lhs view
@@ -34,7 +34,7 @@ > import Text.Regex.PDeriv.RE > import Text.Regex.PDeriv.Pretty (Pretty(..))-> import Text.Regex.PDeriv.Common (Range, Letter, IsEmpty(..), my_hash, my_lookup, GFlag(..), IsEmpty(..), nub2)+> import Text.Regex.PDeriv.Common (Range, Letter, IsEmpty(..), my_hash, my_lookup, GFlag(..), IsEmpty(..), nub2, minBinder, maxBinder) > import Text.Regex.PDeriv.IntPattern (Pat(..), pdPat, pdPat0, toBinder, Binder(..), strip, listifyBinder) > import Text.Regex.PDeriv.Parse > import qualified Text.Regex.PDeriv.Dictionary as D (Dictionary(..), Key(..), insertNotOverwrite, lookupAll, empty, isIn, nub)@@ -328,8 +328,8 @@ > case greedyPatMatchCompiled r bs of > Nothing -> Right (Nothing) > Just env ->-> let pre = case lookup (-1) env of { Just w -> w ; Nothing -> S.empty }-> post = case lookup (-2) env of { Just w -> w ; Nothing -> S.empty }+> let pre = case lookup minBinder env of { Just w -> w ; Nothing -> S.empty }+> post = case lookup maxBinder env of { Just w -> w ; Nothing -> S.empty } > full_len = S.length bs > pre_len = S.length pre > post_len = S.length post
Text/Regex/PDeriv/ByteString/LeftToRightD.lhs view
@@ -34,7 +34,7 @@ > import Text.Regex.PDeriv.RE > import Text.Regex.PDeriv.Pretty (Pretty(..))-> import Text.Regex.PDeriv.Common (Range, Letter, IsEmpty(..), my_hash, my_lookup, GFlag(..), IsEmpty(..), nub2)+> import Text.Regex.PDeriv.Common (Range, Letter, IsEmpty(..), my_hash, my_lookup, GFlag(..), IsEmpty(..), nub2, minBinder, maxBinder) > import Text.Regex.PDeriv.IntPattern (Pat(..), pdPat, pdPat0, toBinder, Binder(..), strip, listifyBinder) > import Text.Regex.PDeriv.Parse > import qualified Text.Regex.PDeriv.Dictionary as D (Dictionary(..), Key(..), insert, insertNotOverwrite, lookupAll, empty, isIn, nub)@@ -402,8 +402,8 @@ > case greedyPatMatchCompiled r bs of > Nothing -> Right (Nothing) > Just env ->-> let pre = case lookup (-1) env of { Just w -> w ; Nothing -> S.empty }-> post = case lookup (-2) env of { Just w -> w ; Nothing -> S.empty }+> let pre = case lookup minBinder env of { Just w -> w ; Nothing -> S.empty }+> post = case lookup maxBinder env of { Just w -> w ; Nothing -> S.empty } > full_len = S.length bs > pre_len = S.length pre > post_len = S.length post
Text/Regex/PDeriv/ByteString/Posix.lhs view
@@ -36,7 +36,7 @@ > import Text.Regex.PDeriv.RE > import Text.Regex.PDeriv.Pretty (Pretty(..))-> import Text.Regex.PDeriv.Common (Range, Letter, IsEmpty(..), my_hash, my_lookup, GFlag(..), IsEmpty(..), IsGreedy(..), nub2)+> import Text.Regex.PDeriv.Common (Range, Letter, IsEmpty(..), my_hash, my_lookup, GFlag(..), IsEmpty(..), IsGreedy(..), nub2, minBinder, maxBinder) > import Text.Regex.PDeriv.IntPattern (Pat(..), pdPat, toBinder, Binder(..), strip, listifyBinder) > import Text.Regex.PDeriv.Parse > import qualified Text.Regex.PDeriv.Dictionary as D (Dictionary(..), Key(..), insertNotOverwrite, lookupAll, empty, isIn, nub)@@ -424,8 +424,8 @@ > case posixPatMatchCompiled r bs of > Nothing -> Right (Nothing) > Just env ->-> let pre = case lookup (-1) env of { Just w -> w ; Nothing -> S.empty }-> post = case lookup (-2) env of { Just w -> w ; Nothing -> S.empty }+> let pre = case lookup minBinder env of { Just w -> w ; Nothing -> S.empty }+> post = case lookup maxBinder env of { Just w -> w ; Nothing -> S.empty } > full_len = S.length bs > pre_len = S.length pre > post_len = S.length post@@ -503,9 +503,9 @@ > in io `seq` allbinders `seq` map (binderToMatchArray l) allbinders > binderToMatchArray l b = -> let subPatB = filter (\(x,_) -> x > 0) (listifyBinder b)-> mbPrefixB = IM.lookup (-1) b-> mbSubfixB = IM.lookup (-2) b+> let subPatB = filter (\(x,_) -> x > minBinder && x < maxBinder) (listifyBinder b)+> mbPrefixB = IM.lookup minBinder b+> mbSubfixB = IM.lookup maxBinder b > mainB = case (mbPrefixB, mbSubfixB) of > (Just [(_,x)], Just [(y,_)]) -> (x + 1, y - (x + 1)) > (Just [(_,x)], _) -> (x + 1, l - (x + 1))@@ -607,3 +607,6 @@ > Right r64 = compile defaultCompOpt defaultExecOpt (S.pack "^(a*?)(a*)(a*?)$") +> Right up25 = compile defaultCompOpt defaultExecOpt (S.pack "^(.*?)(a|ab|ba)(.*)$")+> Right up26 = compile defaultCompOpt defaultExecOpt (S.pack "(a|ab|ba)")+> s25 = S.pack "aba"
Text/Regex/PDeriv/ByteString/RightToLeft.lhs view
@@ -31,7 +31,7 @@ > import Text.Regex.PDeriv.RE > import Text.Regex.PDeriv.Pretty (Pretty(..))-> import Text.Regex.PDeriv.Common (Range, Letter, IsEmpty(..), my_hash, my_lookup, GFlag(..), IsGreedy(..), nub3) +> import Text.Regex.PDeriv.Common (Range, Letter, IsEmpty(..), my_hash, my_lookup, GFlag(..), IsGreedy(..), nub3, minBinder, maxBinder) > import Text.Regex.PDeriv.IntPattern (Pat(..), pdPat, pdPat0, toBinder, Binder(..), strip, listifyBinder) > import Text.Regex.PDeriv.Parse > import qualified Text.Regex.PDeriv.Dictionary as D (Dictionary(..), Key(..), insertNotOverwrite, lookupAll, empty, isIn, nub)@@ -246,8 +246,8 @@ > case greedyPatMatchCompiled r bs of > Nothing -> Right Nothing > Just env ->-> let pre = case lookup (-1) env of { Just w -> w ; Nothing -> S.empty }-> post = case lookup (-2) env of { Just w -> w ; Nothing -> S.empty }+> let pre = case lookup minBinder env of { Just w -> w ; Nothing -> S.empty }+> post = case lookup maxBinder env of { Just w -> w ; Nothing -> S.empty } > full_len = S.length bs > pre_len = S.length pre > post_len = S.length post
Text/Regex/PDeriv/ByteString/TwoPasses.lhs view
@@ -33,7 +33,7 @@ > import Text.Regex.PDeriv.RE > import Text.Regex.PDeriv.Pretty (Pretty(..))-> import Text.Regex.PDeriv.Common (Range, Letter, IsEmpty(..), my_hash, my_lookup, GFlag(..), IsGreedy(..), nub2)+> import Text.Regex.PDeriv.Common (Range, Letter, IsEmpty(..), my_hash, my_lookup, GFlag(..), IsGreedy(..), nub2, minBinder, maxBinder) > import Text.Regex.PDeriv.IntPattern (Pat(..), pdPat, pdPat0, toBinder, Binder(..), strip, listifyBinder) > import Text.Regex.PDeriv.Parse > import qualified Text.Regex.PDeriv.Dictionary as D (Dictionary(..), Key(..), insertNotOverwrite, lookupAll, empty, isIn, nub)@@ -275,8 +275,8 @@ > case greedyPatMatchCompiled r bs of > Nothing -> Right (Nothing) > Just env ->-> let pre = case lookup (-1) env of { Just w -> w ; Nothing -> S.empty }-> post = case lookup (-2) env of { Just w -> w ; Nothing -> S.empty }+> let pre = case lookup minBinder env of { Just w -> w ; Nothing -> S.empty }+> post = case lookup maxBinder env of { Just w -> w ; Nothing -> S.empty } > full_len = S.length bs > pre_len = S.length pre > post_len = S.length post
Text/Regex/PDeriv/Common.lhs view
@@ -9,6 +9,8 @@ > , IsGreedy (..) > , nub2 > , nub3+> , minBinder+> , maxBinder > ) where > import Data.Char (ord)@@ -122,4 +124,12 @@ > Nothing -> (im', x:xs') +The smallest binder index capturing the prefix of the unanchored regex +> minBinder :: Int+> minBinder = 0++The largest binder index capturing for the suffix of the unanchored regex++> maxBinder :: Int+> maxBinder = 2147483647
Text/Regex/PDeriv/Translate.lhs view
@@ -73,7 +73,6 @@ > } - > -- | Translating external pattern to internal pattern > translate :: EPat -> Pat > translate epat = case runState (trans epat) initTState of@@ -82,9 +81,10 @@ > hasAnchorE = anchorEnd state > in case (hasAnchorS, hasAnchorE) of > (True, True) -> pat -- PVar 0 [] pat -> (True, False) -> PPair pat (PVar (-2) [] (PE (Star Any Greedy)))-> (False, True) -> PPair (PVar (-1) [] (PE (Star Any NotGreedy))) pat-> (False, False) -> PPair (PVar (-1) [] (PE (Star Any NotGreedy))) (PPair pat (PVar (-2) [] (PE (Star Any Greedy))))+> (True, False) -> PPair pat (PVar maxBinder [] (PE (Star Any NotGreedy)))+> (False, True) -> PPair (PVar minBinder [] (PE (Star Any NotGreedy))) pat+> (False, False) -> PPair (PVar minBinder [] (PE (Star Any NotGreedy))) (PPair pat (PVar maxBinder [] (PE (Star Any NotGreedy))))+> -- (False, False) -> (PPair (PPair (PVar (-1) [] (PE (Star Any NotGreedy))) pat) (PVar (-2) [] (PE (Star Any Greedy)))) > {-| 'trans' The top level translation scheme e ~> p > There are two sub rules.
regex-pderiv.cabal view
@@ -1,5 +1,5 @@ Name: regex-pderiv-Version: 0.0.8.1+Version: 0.0.8.2 License: BSD3 License-File: LICENSE Copyright: Copyright (c) 2010, Kenny Zhuo Ming Lu and Martin Sulzmann