regex-tdfa-1.3.0: Replaces/Enhances Text.Regex

Safe HaskellNone
LanguageHaskell98

Text.Regex.TDFA.Common

Description

Common provides simple functions to the backend. It defines most of the data types. All modules should call error via the common_error function below.

Synopsis

Documentation

look :: Int -> IntMap a -> a Source #

on :: (t1 -> t1 -> t2) -> (t -> t1) -> t -> t -> t2 Source #

norep :: Eq a => [a] -> [a] Source #

after sort or sortBy the use of 'nub'\/'nubBy' can be replaced by 'norep'\/'norepBy'

norepBy :: (a -> a -> Bool) -> [a] -> [a] Source #

after sort or sortBy the use of 'nub'\/'nubBy' can be replaced by 'norep'\/'norepBy'

mapFst :: Functor f => (t -> t2) -> f (t, t1) -> f (t2, t1) Source #

mapSnd :: Functor f => (t1 -> t2) -> f (t, t1) -> f (t, t2) Source #

fst3 :: (a, b, c) -> a Source #

snd3 :: (a, b, c) -> b Source #

thd3 :: (a, b, c) -> c Source #

newtype DoPa Source #

Used to track elements of the pattern that accept characters or are anchors

Constructors

DoPa 

Fields

Instances
Enum DoPa Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

succ :: DoPa -> DoPa #

pred :: DoPa -> DoPa #

toEnum :: Int -> DoPa #

fromEnum :: DoPa -> Int #

enumFrom :: DoPa -> [DoPa] #

enumFromThen :: DoPa -> DoPa -> [DoPa] #

enumFromTo :: DoPa -> DoPa -> [DoPa] #

enumFromThenTo :: DoPa -> DoPa -> DoPa -> [DoPa] #

Eq DoPa Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

(==) :: DoPa -> DoPa -> Bool #

(/=) :: DoPa -> DoPa -> Bool #

Ord DoPa Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

compare :: DoPa -> DoPa -> Ordering #

(<) :: DoPa -> DoPa -> Bool #

(<=) :: DoPa -> DoPa -> Bool #

(>) :: DoPa -> DoPa -> Bool #

(>=) :: DoPa -> DoPa -> Bool #

max :: DoPa -> DoPa -> DoPa #

min :: DoPa -> DoPa -> DoPa #

Show DoPa Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

showsPrec :: Int -> DoPa -> ShowS #

show :: DoPa -> String #

showList :: [DoPa] -> ShowS #

data CompOption Source #

Control whether the pattern is multiline or case-sensitive like Text.Regex and whether to capture the subgroups (\1, \2, etc). Controls enabling extra anchor syntax.

Constructors

CompOption 

Fields

  • caseSensitive :: Bool

    True in blankCompOpt and defaultCompOpt

  • multiline :: Bool

    False in blankCompOpt, True in defaultCompOpt. Compile for newline-sensitive matching. "By default, newline is a completely ordinary character with no special meaning in either REs or strings. With this flag, inverted bracket expressions and . never match newline, a ^ anchor matches the null string after any newline in the string in addition to its normal function, and the $ anchor matches the null string before any newline in the string in addition to its normal function."

  • rightAssoc :: Bool

    True (and therefore Right associative) in blankCompOpt and defaultCompOpt

  • newSyntax :: Bool

    False in blankCompOpt, True in defaultCompOpt. Add the extended non-POSIX syntax described in Text.Regex.TDFA haddock documentation.

  • lastStarGreedy :: Bool

    False by default. This is POSIX correct but it takes space and is slower. Setting this to true will improve performance, and should be done if you plan to set the captureGroups execoption to False.

Instances
Read CompOption Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Show CompOption Source # 
Instance details

Defined in Text.Regex.TDFA.Common

RegexOptions Regex CompOption ExecOption Source # 
Instance details

Defined in Text.Regex.TDFA.Common

RegexMaker Regex CompOption ExecOption String Source # 
Instance details

Defined in Text.Regex.TDFA.String

RegexMaker Regex CompOption ExecOption ByteString Source # 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexMaker Regex CompOption ExecOption ByteString Source # 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexMaker Regex CompOption ExecOption (Seq Char) Source # 
Instance details

Defined in Text.Regex.TDFA.Sequence

data ExecOption Source #

Constructors

ExecOption 

Fields

Instances
Read ExecOption Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Show ExecOption Source # 
Instance details

Defined in Text.Regex.TDFA.Common

RegexOptions Regex CompOption ExecOption Source # 
Instance details

Defined in Text.Regex.TDFA.Common

RegexMaker Regex CompOption ExecOption String Source # 
Instance details

Defined in Text.Regex.TDFA.String

RegexMaker Regex CompOption ExecOption ByteString Source # 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexMaker Regex CompOption ExecOption ByteString Source # 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexMaker Regex CompOption ExecOption (Seq Char) Source # 
Instance details

Defined in Text.Regex.TDFA.Sequence

type Tag = Int Source #

Used by implementation to name certain Postions during matching. Identity of Position tag to set during a transition

data OP Source #

Internal use to indicate type of tag and preference for larger or smaller Positions

Constructors

Maximize 
Minimize 
Orbit 
Ignore 
Instances
Eq OP Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

(==) :: OP -> OP -> Bool #

(/=) :: OP -> OP -> Bool #

Show OP Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

showsPrec :: Int -> OP -> ShowS #

show :: OP -> String #

showList :: [OP] -> ShowS #

type Index = Int Source #

Internal NFA node identity number

type SetIndex = IntSet Source #

Internal DFA identity is this Set of NFA Index

type Position = Int Source #

Index into the text being searched

type GroupIndex = Int Source #

GroupIndex is for indexing submatches from capturing parenthesized groups (PGroup/Group)

data GroupInfo Source #

GroupInfo collects the parent and tag information for an instance of a group

Instances
Show GroupInfo Source # 
Instance details

Defined in Text.Regex.TDFA.Common

data Regex Source #

The TDFA backend specific Regex type, used by this module's RegexOptions and RegexMaker

Constructors

Regex 

Fields

Instances
RegexLike Regex String Source # 
Instance details

Defined in Text.Regex.TDFA.String

RegexLike Regex ByteString Source # 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexLike Regex ByteString Source # 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexOptions Regex CompOption ExecOption Source # 
Instance details

Defined in Text.Regex.TDFA.Common

RegexContext Regex String String Source # 
Instance details

Defined in Text.Regex.TDFA.String

Methods

match :: Regex -> String -> String #

matchM :: MonadFail m => Regex -> String -> m String #

RegexContext Regex ByteString ByteString Source # 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexContext Regex ByteString ByteString Source # 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexMaker Regex CompOption ExecOption String Source # 
Instance details

Defined in Text.Regex.TDFA.String

RegexMaker Regex CompOption ExecOption ByteString Source # 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexMaker Regex CompOption ExecOption ByteString Source # 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexMaker Regex CompOption ExecOption (Seq Char) Source # 
Instance details

Defined in Text.Regex.TDFA.Sequence

RegexLike Regex (Seq Char) Source # 
Instance details

Defined in Text.Regex.TDFA.Sequence

RegexContext Regex (Seq Char) (Seq Char) Source # 
Instance details

Defined in Text.Regex.TDFA.Sequence

Methods

match :: Regex -> Seq Char -> Seq Char #

matchM :: MonadFail m => Regex -> Seq Char -> m (Seq Char) #

data QNFA Source #

Internal NFA node type

Constructors

QNFA 

Fields

Instances
Show QNFA Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

showsPrec :: Int -> QNFA -> ShowS #

show :: QNFA -> String #

showList :: [QNFA] -> ShowS #

data QT Source #

Internal to QNFA type.

Constructors

Simple 

Fields

Testing 

Fields

Instances
Eq QT Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

(==) :: QT -> QT -> Bool #

(/=) :: QT -> QT -> Bool #

Show QT Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

showsPrec :: Int -> QT -> ShowS #

show :: QT -> String #

showList :: [QT] -> ShowS #

type QTrans = IntMap [TagCommand] Source #

Internal type to represent the tagged transition from one QNFA to another (or itself). The key is the Index of the destination QNFA.

data WhichTest Source #

Known predicates, just Beginning of Line (^) and End of Line ($). Also support for GNU extensions is being added: \` beginning of buffer, \' end of buffer, \< and \> for begin and end of words, \b and \B for word boundary and not word boundary.

data TagTask Source #

The things that can be done with a Tag. TagTask and ResetGroupStopTask are for tags with Maximize or Minimize OP values. ResetOrbitTask and EnterOrbitTask and LeaveOrbitTask are for tags with Orbit OP value.

Instances
Eq TagTask Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

(==) :: TagTask -> TagTask -> Bool #

(/=) :: TagTask -> TagTask -> Bool #

Show TagTask Source # 
Instance details

Defined in Text.Regex.TDFA.Common

type TagTasks = [(Tag, TagTask)] Source #

Ordered list of tags and their associated Task

data TagUpdate Source #

When attached to a QTrans the TagTask can be done before or after accepting the character.

Instances
Eq TagUpdate Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Show TagUpdate Source # 
Instance details

Defined in Text.Regex.TDFA.Common

type TagList = [(Tag, TagUpdate)] Source #

Ordered list of tags and their associated update operation.

type TagCommand = (DoPa, TagList) Source #

A TagList and the location of the item in the original pattern that is being accepted.

type WinTags = TagList Source #

Ordered list of tags and their associated update operation to perform on an empty transition to the virtual winning state.

data DFA Source #

Internal DFA node, identified by the Set of indices of the QNFA nodes it represents.

Constructors

DFA 

Fields

Instances
Show DFA Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

showsPrec :: Int -> DFA -> ShowS #

show :: DFA -> String #

showList :: [DFA] -> ShowS #

data Transition Source #

Constructors

Transition 

Fields

data DT Source #

Internal to the DFA node

Constructors

Simple' 

Fields

Testing' 

Fields

Instances
Show DT Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

showsPrec :: Int -> DT -> ShowS #

show :: DT -> String #

showList :: [DT] -> ShowS #

type DTrans = IntMap (IntMap (DoPa, Instructions)) Source #

Internal type to repesent the commands for the tagged transition. The outer IntMap is for the destination Index and the inner IntMap is for the Source Index. This is convenient since all runtime data going to the same destination must be compared to find the best.

A Destination IntMap entry may have an empty Source IntMap if and only if the destination is the starting index and the NFA/DFA. This instructs the matching engine to spawn a new entry starting at the post-update position.

type DTrans' = [(Index, [(Index, (DoPa, ([(Tag, (Position, Bool))], [String])))])] Source #

Internal convenience type for the text display code

data Orbits Source #

Positions for which a * was re-started while looping. Need to append locations at back but compare starting with front, so use Seq as a Queue. The initial position is saved in basePos (and a Maximize Tag), the middle positions in the Seq, and the final position is NOT saved in the Orbits (only in a Maximize Tag).

The orderinal code is being written XXX TODO document it.

Constructors

Orbits 
Instances
Show Orbits Source # 
Instance details

Defined in Text.Regex.TDFA.Common

data Instructions Source #

The newPos and newFlags lists in Instructions are sorted by, and unique in, the Tag values

Constructors

Instructions 
Instances
Show Instructions Source # 
Instance details

Defined in Text.Regex.TDFA.Common

data Action Source #

Constructors

SetPre 
SetPost 
SetVal Int 
Instances
Eq Action Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

(==) :: Action -> Action -> Bool #

(/=) :: Action -> Action -> Bool #

Show Action Source # 
Instance details

Defined in Text.Regex.TDFA.Common