regex-tdfa-1.3.2.2: Pure Haskell Tagged DFA Backend for "Text.Regex" (regex-base)
Safe HaskellNone
LanguageHaskell2010

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 #

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

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

After sort or sortBy the use of nub or nubBy can be replaced by norep or norepBy.

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

After sort or sortBy the use of nub or nubBy can be replaced by norep or norepBy.

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

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

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

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

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

newtype DoPa #

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

Constructors

DoPa 

Fields

Instances

Instances details
Enum DoPa # 
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] #

Show DoPa # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

showsPrec :: Int -> DoPa -> ShowS #

show :: DoPa -> String #

showList :: [DoPa] -> ShowS #

Eq DoPa # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

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

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

Ord DoPa # 
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 #

data CompOption #

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

Instances

Instances details
Read CompOption # 
Instance details

Defined in Text.Regex.TDFA.Common

Show CompOption # 
Instance details

Defined in Text.Regex.TDFA.Common

RegexOptions Regex CompOption ExecOption # 
Instance details

Defined in Text.Regex.TDFA.Common

RegexMaker Regex CompOption ExecOption ByteString # 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexMaker Regex CompOption ExecOption ByteString # 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexMaker Regex CompOption ExecOption Text #

Since: 1.3.1

Instance details

Defined in Text.Regex.TDFA.Text

RegexMaker Regex CompOption ExecOption Text #

Since: 1.3.1

Instance details

Defined in Text.Regex.TDFA.Text.Lazy

RegexMaker Regex CompOption ExecOption String # 
Instance details

Defined in Text.Regex.TDFA.String

RegexMaker Regex CompOption ExecOption (Seq Char) # 
Instance details

Defined in Text.Regex.TDFA.Sequence

data ExecOption #

Constructors

ExecOption 

Fields

Instances

Instances details
Read ExecOption # 
Instance details

Defined in Text.Regex.TDFA.Common

Show ExecOption # 
Instance details

Defined in Text.Regex.TDFA.Common

RegexOptions Regex CompOption ExecOption # 
Instance details

Defined in Text.Regex.TDFA.Common

RegexMaker Regex CompOption ExecOption ByteString # 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexMaker Regex CompOption ExecOption ByteString # 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexMaker Regex CompOption ExecOption Text #

Since: 1.3.1

Instance details

Defined in Text.Regex.TDFA.Text

RegexMaker Regex CompOption ExecOption Text #

Since: 1.3.1

Instance details

Defined in Text.Regex.TDFA.Text.Lazy

RegexMaker Regex CompOption ExecOption String # 
Instance details

Defined in Text.Regex.TDFA.String

RegexMaker Regex CompOption ExecOption (Seq Char) # 
Instance details

Defined in Text.Regex.TDFA.Sequence

type Tag = Int #

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

data OP #

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

Constructors

Maximize 
Minimize 
Orbit 
Ignore 

Instances

Instances details
Show OP # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

showsPrec :: Int -> OP -> ShowS #

show :: OP -> String #

showList :: [OP] -> ShowS #

Eq OP # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

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

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

type Index = Int #

Internal NFA node identity number.

type SetIndex = IntSet #

Internal DFA identity is this Set of NFA Index.

type Position = Int #

Index into the text being searched.

type GroupIndex = Int #

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

data GroupInfo #

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

Instances

Instances details
Show GroupInfo # 
Instance details

Defined in Text.Regex.TDFA.Common

data Regex #

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

Constructors

Regex 

Fields

Instances

Instances details
RegexLike Regex ByteString # 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexLike Regex ByteString # 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexLike Regex Text #

Since: 1.3.1

Instance details

Defined in Text.Regex.TDFA.Text

RegexLike Regex Text #

Since: 1.3.1

Instance details

Defined in Text.Regex.TDFA.Text.Lazy

RegexLike Regex String # 
Instance details

Defined in Text.Regex.TDFA.String

RegexContext Regex ByteString ByteString # 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexContext Regex ByteString ByteString # 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexContext Regex Text Text #

Since: 1.3.1

Instance details

Defined in Text.Regex.TDFA.Text

Methods

match :: Regex -> Text -> Text #

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

RegexContext Regex Text Text #

Since: 1.3.1

Instance details

Defined in Text.Regex.TDFA.Text.Lazy

Methods

match :: Regex -> Text -> Text #

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

RegexContext Regex String String # 
Instance details

Defined in Text.Regex.TDFA.String

Methods

match :: Regex -> String -> String #

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

RegexOptions Regex CompOption ExecOption # 
Instance details

Defined in Text.Regex.TDFA.Common

RegexMaker Regex CompOption ExecOption ByteString # 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexMaker Regex CompOption ExecOption ByteString # 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexMaker Regex CompOption ExecOption Text #

Since: 1.3.1

Instance details

Defined in Text.Regex.TDFA.Text

RegexMaker Regex CompOption ExecOption Text #

Since: 1.3.1

Instance details

Defined in Text.Regex.TDFA.Text.Lazy

RegexMaker Regex CompOption ExecOption String # 
Instance details

Defined in Text.Regex.TDFA.String

RegexMaker Regex CompOption ExecOption (Seq Char) # 
Instance details

Defined in Text.Regex.TDFA.Sequence

RegexLike Regex (Seq Char) # 
Instance details

Defined in Text.Regex.TDFA.Sequence

RegexContext Regex (Seq Char) (Seq Char) # 
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 WinEmpty #

Instances

Instances details
Show WinEmpty # 
Instance details

Defined in Text.Regex.TDFA.Common

data QNFA #

Internal NFA node type.

Constructors

QNFA 

Fields

Instances

Instances details
Show QNFA # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

showsPrec :: Int -> QNFA -> ShowS #

show :: QNFA -> String #

showList :: [QNFA] -> ShowS #

data QT #

Internal to QNFA type.

Constructors

Simple 

Fields

Testing 

Fields

Instances

Instances details
Show QT # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

showsPrec :: Int -> QT -> ShowS #

show :: QT -> String #

showList :: [QT] -> ShowS #

Eq QT # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

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

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

type QTrans = IntMap [TagCommand] #

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 #

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.

Constructors

Test_BOL

^ (affected by multiline option)

Test_EOL

$ (affected by multiline option)

Test_BOB

\` beginning of buffer

Test_EOB

\' end ofbuffer

Test_BOW

\< beginning of word

Test_EOW

\> end of word

Test_EdgeWord

\b word boundary

Test_NotEdgeWord

\B not word boundary

data TagTask #

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

Instances details
Show TagTask # 
Instance details

Defined in Text.Regex.TDFA.Common

Eq TagTask # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

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

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

type TagTasks = [(Tag, TagTask)] #

Ordered list of tags and their associated Task.

data TagUpdate #

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

Instances

Instances details
Show TagUpdate # 
Instance details

Defined in Text.Regex.TDFA.Common

Eq TagUpdate # 
Instance details

Defined in Text.Regex.TDFA.Common

type TagList = [(Tag, TagUpdate)] #

Ordered list of tags and their associated update operation.

type TagCommand = (DoPa, TagList) #

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

type WinTags = TagList #

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

data DFA #

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

Constructors

DFA 

Fields

Instances

Instances details
Show DFA # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

showsPrec :: Int -> DFA -> ShowS #

show :: DFA -> String #

showList :: [DFA] -> ShowS #

data Transition #

Constructors

Transition 

Fields

data DT #

Internal to the DFA node

Constructors

Simple' 

Fields

Testing' 

Fields

Instances

Instances details
Show DT # 
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)) #

Internal type to represent 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 or 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])))])] #

Internal convenience type for the text display code.

data Orbits #

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).

Constructors

Orbits 

Instances

Instances details
Show Orbits # 
Instance details

Defined in Text.Regex.TDFA.Common

data Instructions #

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

Constructors

Instructions 

Instances

Instances details
Show Instructions # 
Instance details

Defined in Text.Regex.TDFA.Common

data Action #

Constructors

SetPre 
SetPost 
SetVal Int 

Instances

Instances details
Show Action # 
Instance details

Defined in Text.Regex.TDFA.Common

Eq Action # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

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

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