regex-tdfa-1.3.2.5: Pure Haskell Tagged DFA Backend for "Text.Regex" (regex-base)

Safe Haskell | None
Language | Haskell2010

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

- look :: Int -> IntMap a -> a
- common_error :: String -> String -> a
- on :: (t1 -> t1 -> t2) -> (t -> t1) -> t -> t -> t2
- norep :: Eq a => [a] -> [a]
- norepBy :: (a -> a -> Bool) -> [a] -> [a]
- 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
- flipOrder :: Ordering -> Ordering
- noWin :: WinTags -> Bool
- newtype DoPa = DoPa {
  - dopaIndex :: Int
  }
- data CompOption = CompOption {
  - caseSensitive :: Bool
  - multiline :: Bool
  - rightAssoc :: Bool
  - newSyntax :: Bool
  - lastStarGreedy :: Bool
  }
- data ExecOption = ExecOption {
  - captureGroups :: Bool
  }
- type Tag = Int
- data OP
  - = Maximize
  - | Minimize
  - | Orbit
  - | Ignore
- type Index = Int
- type SetIndex = IntSet
- type Position = Int
- type GroupIndex = Int
- data GroupInfo = GroupInfo {
  - thisIndex :: GroupIndex
  - parentIndex :: GroupIndex
  - startTag :: Tag
  - stopTag :: Tag
  - flagTag :: Tag
  }
- data Regex = Regex {
  - regex_dfa :: DFA
  - regex_init :: Index
  - regex_b_index :: (Index, Index)
  - regex_b_tags :: (Tag, Tag)
  - regex_trie :: TrieSet DFA
  - regex_tags :: Array Tag OP
  - regex_groups :: Array GroupIndex [GroupInfo]
  - regex_isFrontAnchored :: Bool
  - regex_compOptions :: CompOption
  - regex_execOptions :: ExecOption
  }
- data WinEmpty
  - = WinEmpty Instructions
  - | WinTest WhichTest (Maybe WinEmpty) (Maybe WinEmpty)
- data QNFA = QNFA {
  - q_id :: Index
  - q_qt :: QT
  }
- data QT
  - = Simple {
    - qt_win :: WinTags
    - qt_trans :: CharMap QTrans
    - qt_other :: QTrans
    }
  - | Testing {
    - qt_test :: WhichTest
    - qt_dopas :: EnumSet DoPa
    - qt_a :: QT
    - qt_b :: QT
    }
- type QTrans = IntMap [TagCommand]
- data WhichTest
  - = Test_BOL
  - | Test_EOL
  - | Test_BOB
  - | Test_EOB
  - | Test_BOW
  - | Test_EOW
  - | Test_EdgeWord
  - | Test_NotEdgeWord
- data TagTask
  - = TagTask
  - | ResetGroupStopTask
  - | SetGroupStopTask
  - | ResetOrbitTask
  - | EnterOrbitTask
  - | LeaveOrbitTask
- type TagTasks = [(Tag, TagTask)]
- data TagUpdate
  - = PreUpdate TagTask
  - | PostUpdate TagTask
- type TagList = [(Tag, TagUpdate)]
- type TagCommand = (DoPa, TagList)
- type WinTags = TagList
- data DFA = DFA {
  - d_id :: SetIndex
  - d_dt :: DT
  }
- data Transition = Transition {
  - trans_many :: DFA
  - trans_single :: DFA
  - trans_how :: DTrans
  }
- data DT
  - = Simple' {
    - dt_win :: IntMap Instructions
    - dt_trans :: CharMap Transition
    - dt_other :: Transition
    }
  - | Testing' {
    - dt_test :: WhichTest
    - dt_dopas :: EnumSet DoPa
    - dt_a :: DT
    - dt_b :: DT
    }
- type DTrans = IntMap (IntMap (DoPa, Instructions))
- type DTrans' = [(Index, [(Index, (DoPa, ([(Tag, (Position, Bool))], [String])))])]
- data Orbits = Orbits {
  - inOrbit :: !Bool
  - basePos :: Position
  - ordinal :: Maybe Int
  - getOrbits :: !(Seq Position)
  }
- data Instructions = Instructions {
  - newPos :: ![(Tag, Action)]
  - newOrbits :: !(Maybe (Position -> OrbitTransformer))
  }
- data Action
  - = SetPre
  - | SetPost
  - | SetVal Int
- type OrbitTransformer = OrbitLog -> OrbitLog
- type OrbitLog = IntMap Orbits
- showQT :: QT -> String
- indent :: [String] -> String
- showDT :: DT -> String
- seeDTrans :: DTrans -> String

# Documentation

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

common_error :: String -> String -> 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` or `nubBy` can be replaced by `norep` or `norepBy`.

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

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

flipOrder :: Ordering -> Ordering Source #

noWin :: WinTags -> Bool Source #

newtype DoPa Source #

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

Constructors

DoPa |

Fields

- dopaIndex :: Int

#### Instances

Instances details

Enum DoPa Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods succ :: DoPa -> DoPa Source # pred :: DoPa -> DoPa Source # toEnum :: Int -> DoPa Source # fromEnum :: DoPa -> Int Source # enumFrom :: DoPa -> [DoPa] Source # enumFromThen :: DoPa -> DoPa -> [DoPa] Source # enumFromTo :: DoPa -> DoPa -> [DoPa] Source # enumFromThenTo :: DoPa -> DoPa -> DoPa -> [DoPa] Source #
Show DoPa Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> DoPa -> ShowS Source # show :: DoPa -> String Source # showList :: [DoPa] -> ShowS Source #
Eq DoPa Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods (==) :: DoPa -> DoPa -> Bool Source # (/=) :: DoPa -> DoPa -> Bool Source #
Ord DoPa Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods compare :: DoPa -> DoPa -> Ordering Source # (<) :: DoPa -> DoPa -> Bool Source # (<=) :: DoPa -> DoPa -> Bool Source # (>) :: DoPa -> DoPa -> Bool Source # (>=) :: DoPa -> DoPa -> Bool Source # max :: DoPa -> DoPa -> DoPa Source # min :: DoPa -> DoPa -> DoPa Source #

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.

  From regexp man page: "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`. Enables 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

Instances details

Read CompOption Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods readsPrec :: Int -> ReadS CompOption Source # readList :: ReadS [CompOption] Source # readPrec :: ReadPrec CompOption Source # readListPrec :: ReadPrec [CompOption] Source #
Show CompOption Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> CompOption -> ShowS Source # show :: CompOption -> String Source # showList :: [CompOption] -> ShowS Source #
RegexOptions Regex CompOption ExecOption Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods blankCompOpt :: CompOption Source # blankExecOpt :: ExecOption Source # defaultCompOpt :: CompOption Source # defaultExecOpt :: ExecOption Source # setExecOpts :: ExecOption -> Regex -> Regex Source # getExecOpts :: Regex -> ExecOption Source #
RegexMaker Regex CompOption ExecOption ByteString Source # |
Instance details Defined in Text.Regex.TDFA.ByteString Methods makeRegex :: ByteString -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> ByteString -> Regex Source # makeRegexM :: MonadFail m => ByteString -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> ByteString -> m Regex Source #
RegexMaker Regex CompOption ExecOption ByteString Source # |
Instance details Defined in Text.Regex.TDFA.ByteString.Lazy Methods makeRegex :: ByteString -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> ByteString -> Regex Source # makeRegexM :: MonadFail m => ByteString -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> ByteString -> m Regex Source #
RegexMaker Regex CompOption ExecOption Text Source # | Since: 1.3.1
Instance details Defined in Text.Regex.TDFA.Text Methods makeRegex :: Text -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> Text -> Regex Source # makeRegexM :: MonadFail m => Text -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> Text -> m Regex Source #
RegexMaker Regex CompOption ExecOption Text Source # | Since: 1.3.1
Instance details Defined in Text.Regex.TDFA.Text.Lazy Methods makeRegex :: Text -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> Text -> Regex Source # makeRegexM :: MonadFail m => Text -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> Text -> m Regex Source #
RegexMaker Regex CompOption ExecOption String Source # |
Instance details Defined in Text.Regex.TDFA.String Methods makeRegex :: String -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> String -> Regex Source # makeRegexM :: MonadFail m => String -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> String -> m Regex Source #
RegexMaker Regex CompOption ExecOption (Seq Char) Source # |
Instance details Defined in Text.Regex.TDFA.Sequence Methods makeRegex :: Seq Char -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> Seq Char -> Regex Source # makeRegexM :: MonadFail m => Seq Char -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> Seq Char -> m Regex Source #

data ExecOption Source #

Constructors

ExecOption |

Fields

- captureGroups :: Bool

  True by default. Set to False to improve speed (and space).

#### Instances

Instances details

Read ExecOption Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods readsPrec :: Int -> ReadS ExecOption Source # readList :: ReadS [ExecOption] Source # readPrec :: ReadPrec ExecOption Source # readListPrec :: ReadPrec [ExecOption] Source #
Show ExecOption Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> ExecOption -> ShowS Source # show :: ExecOption -> String Source # showList :: [ExecOption] -> ShowS Source #
RegexOptions Regex CompOption ExecOption Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods blankCompOpt :: CompOption Source # blankExecOpt :: ExecOption Source # defaultCompOpt :: CompOption Source # defaultExecOpt :: ExecOption Source # setExecOpts :: ExecOption -> Regex -> Regex Source # getExecOpts :: Regex -> ExecOption Source #
RegexMaker Regex CompOption ExecOption ByteString Source # |
Instance details Defined in Text.Regex.TDFA.ByteString Methods makeRegex :: ByteString -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> ByteString -> Regex Source # makeRegexM :: MonadFail m => ByteString -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> ByteString -> m Regex Source #
RegexMaker Regex CompOption ExecOption ByteString Source # |
Instance details Defined in Text.Regex.TDFA.ByteString.Lazy Methods makeRegex :: ByteString -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> ByteString -> Regex Source # makeRegexM :: MonadFail m => ByteString -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> ByteString -> m Regex Source #
RegexMaker Regex CompOption ExecOption Text Source # | Since: 1.3.1
Instance details Defined in Text.Regex.TDFA.Text Methods makeRegex :: Text -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> Text -> Regex Source # makeRegexM :: MonadFail m => Text -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> Text -> m Regex Source #
RegexMaker Regex CompOption ExecOption Text Source # | Since: 1.3.1
Instance details Defined in Text.Regex.TDFA.Text.Lazy Methods makeRegex :: Text -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> Text -> Regex Source # makeRegexM :: MonadFail m => Text -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> Text -> m Regex Source #
RegexMaker Regex CompOption ExecOption String Source # |
Instance details Defined in Text.Regex.TDFA.String Methods makeRegex :: String -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> String -> Regex Source # makeRegexM :: MonadFail m => String -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> String -> m Regex Source #
RegexMaker Regex CompOption ExecOption (Seq Char) Source # |
Instance details Defined in Text.Regex.TDFA.Sequence Methods makeRegex :: Seq Char -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> Seq Char -> Regex Source # makeRegexM :: MonadFail m => Seq Char -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> Seq Char -> m Regex Source #

type Tag = Int Source #

Used by implementation to name certain `Position`s 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 `Position`s.

Constructors

Maximize |
Minimize |
Orbit |
Ignore |

#### Instances

Instances details

Show OP Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> OP -> ShowS Source # show :: OP -> String Source # showList :: [OP] -> ShowS Source #
Eq OP Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods (==) :: OP -> OP -> Bool Source # (/=) :: OP -> OP -> Bool Source #

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` or `Group`).

data GroupInfo Source #

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

Constructors

GroupInfo |

Fields

- thisIndex :: GroupIndex
- parentIndex :: GroupIndex
- startTag :: Tag
- stopTag :: Tag
- flagTag :: Tag

#### Instances

Instances details

Show GroupInfo Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> GroupInfo -> ShowS Source # show :: GroupInfo -> String Source # showList :: [GroupInfo] -> ShowS Source #

data Regex Source #

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

Constructors

Regex |

Fields

- regex_dfa :: DFA

  starting DFA state

- regex_init :: Index

  index of starting state

- regex_b_index :: (Index, Index)

  indexes of smallest and largest states

- regex_b_tags :: (Tag, Tag)

  indexes of smallest and largest tags

- regex_trie :: TrieSet DFA

  All DFA states

- regex_tags :: Array Tag OP

  information about each tag

- regex_groups :: Array GroupIndex [GroupInfo]

  information about each group

- regex_isFrontAnchored :: Bool

  used for optimizing execution

- regex_compOptions :: CompOption
- regex_execOptions :: ExecOption

#### Instances

Instances details

RegexLike Regex ByteString Source # |

Instance details

Defined in Text.Regex.TDFA.ByteString

Methods

matchOnce :: Regex -> ByteString -> Maybe MatchArray Source #

matchAll :: Regex -> ByteString -> [MatchArray] Source #

matchCount :: Regex -> ByteString -> Int Source #

matchTest :: Regex -> ByteString -> Bool Source #

matchAllText :: Regex -> ByteString -> [MatchText ByteString] Source #

matchOnceText :: Regex -> ByteString -> Maybe (ByteString, MatchText ByteString, ByteString) Source #

RegexLike Regex ByteString Source # |

Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

Methods

matchOnce :: Regex -> ByteString -> Maybe MatchArray Source #

matchAll :: Regex -> ByteString -> [MatchArray] Source #

matchCount :: Regex -> ByteString -> Int Source #

matchTest :: Regex -> ByteString -> Bool Source #

matchAllText :: Regex -> ByteString -> [MatchText ByteString] Source #

matchOnceText :: Regex -> ByteString -> Maybe (ByteString, MatchText ByteString, ByteString) Source #

RegexLike Regex Text Source # | Since: 1.3.1
Instance details Defined in Text.Regex.TDFA.Text Methods matchOnce :: Regex -> Text -> Maybe MatchArray Source # matchAll :: Regex -> Text -> [MatchArray] Source # matchCount :: Regex -> Text -> Int Source # matchTest :: Regex -> Text -> Bool Source # matchAllText :: Regex -> Text -> [MatchText Text] Source # matchOnceText :: Regex -> Text -> Maybe (Text, MatchText Text, Text) Source #
RegexLike Regex Text Source # | Since: 1.3.1
Instance details Defined in Text.Regex.TDFA.Text.Lazy Methods matchOnce :: Regex -> Text -> Maybe MatchArray Source # matchAll :: Regex -> Text -> [MatchArray] Source # matchCount :: Regex -> Text -> Int Source # matchTest :: Regex -> Text -> Bool Source # matchAllText :: Regex -> Text -> [MatchText Text] Source # matchOnceText :: Regex -> Text -> Maybe (Text, MatchText Text, Text) Source #
RegexLike Regex String Source # |

Instance details

Defined in Text.Regex.TDFA.String

Methods

matchOnce :: Regex -> String -> Maybe MatchArray Source #

matchAll :: Regex -> String -> [MatchArray] Source #

matchCount :: Regex -> String -> Int Source #

matchTest :: Regex -> String -> Bool Source #

matchAllText :: Regex -> String -> [MatchText String] Source #

matchOnceText :: Regex -> String -> Maybe (String, MatchText String, String) Source #

RegexContext Regex ByteString ByteString Source # |
Instance details Defined in Text.Regex.TDFA.ByteString Methods match :: Regex -> ByteString -> ByteString Source # matchM :: MonadFail m => Regex -> ByteString -> m ByteString Source #
RegexContext Regex ByteString ByteString Source # |
Instance details Defined in Text.Regex.TDFA.ByteString.Lazy Methods match :: Regex -> ByteString -> ByteString Source # matchM :: MonadFail m => Regex -> ByteString -> m ByteString Source #
RegexContext Regex Text Text Source # | Since: 1.3.1
Instance details Defined in Text.Regex.TDFA.Text Methods match :: Regex -> Text -> Text Source # matchM :: MonadFail m => Regex -> Text -> m Text Source #
RegexContext Regex Text Text Source # | Since: 1.3.1
Instance details Defined in Text.Regex.TDFA.Text.Lazy Methods match :: Regex -> Text -> Text Source # matchM :: MonadFail m => Regex -> Text -> m Text Source #
RegexContext Regex String String Source # |
Instance details Defined in Text.Regex.TDFA.String Methods match :: Regex -> String -> String Source # matchM :: MonadFail m => Regex -> String -> m String Source #
RegexOptions Regex CompOption ExecOption Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods blankCompOpt :: CompOption Source # blankExecOpt :: ExecOption Source # defaultCompOpt :: CompOption Source # defaultExecOpt :: ExecOption Source # setExecOpts :: ExecOption -> Regex -> Regex Source # getExecOpts :: Regex -> ExecOption Source #
RegexMaker Regex CompOption ExecOption ByteString Source # |
Instance details Defined in Text.Regex.TDFA.ByteString Methods makeRegex :: ByteString -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> ByteString -> Regex Source # makeRegexM :: MonadFail m => ByteString -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> ByteString -> m Regex Source #
RegexMaker Regex CompOption ExecOption ByteString Source # |
Instance details Defined in Text.Regex.TDFA.ByteString.Lazy Methods makeRegex :: ByteString -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> ByteString -> Regex Source # makeRegexM :: MonadFail m => ByteString -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> ByteString -> m Regex Source #
RegexMaker Regex CompOption ExecOption Text Source # | Since: 1.3.1
Instance details Defined in Text.Regex.TDFA.Text Methods makeRegex :: Text -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> Text -> Regex Source # makeRegexM :: MonadFail m => Text -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> Text -> m Regex Source #
RegexMaker Regex CompOption ExecOption Text Source # | Since: 1.3.1
Instance details Defined in Text.Regex.TDFA.Text.Lazy Methods makeRegex :: Text -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> Text -> Regex Source # makeRegexM :: MonadFail m => Text -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> Text -> m Regex Source #
RegexMaker Regex CompOption ExecOption String Source # |
Instance details Defined in Text.Regex.TDFA.String Methods makeRegex :: String -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> String -> Regex Source # makeRegexM :: MonadFail m => String -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> String -> m Regex Source #
RegexMaker Regex CompOption ExecOption (Seq Char) Source # |
Instance details Defined in Text.Regex.TDFA.Sequence Methods makeRegex :: Seq Char -> Regex Source # makeRegexOpts :: CompOption -> ExecOption -> Seq Char -> Regex Source # makeRegexM :: MonadFail m => Seq Char -> m Regex Source # makeRegexOptsM :: MonadFail m => CompOption -> ExecOption -> Seq Char -> m Regex Source #
RegexLike Regex (Seq Char) Source # |

Instance details

Defined in Text.Regex.TDFA.Sequence

Methods

matchOnce :: Regex -> Seq Char -> Maybe MatchArray Source #

matchAll :: Regex -> Seq Char -> [MatchArray] Source #

matchCount :: Regex -> Seq Char -> Int Source #

matchTest :: Regex -> Seq Char -> Bool Source #

matchAllText :: Regex -> Seq Char -> [MatchText (Seq Char)] Source #

matchOnceText :: Regex -> Seq Char -> Maybe (Seq Char, MatchText (Seq Char), Seq Char) Source #

RegexContext Regex (Seq Char) (Seq Char) Source # |
Instance details Defined in Text.Regex.TDFA.Sequence Methods match :: Regex -> Seq Char -> Seq Char Source # matchM :: MonadFail m => Regex -> Seq Char -> m (Seq Char) Source #

data WinEmpty Source #

Constructors

WinEmpty Instructions |
WinTest WhichTest (Maybe WinEmpty) (Maybe WinEmpty) |

#### Instances

Instances details

Show WinEmpty Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> WinEmpty -> ShowS Source # show :: WinEmpty -> String Source # showList :: [WinEmpty] -> ShowS Source #

data QNFA Source #

Internal NFA node type.

Constructors

QNFA |

Fields

- q_id :: Index
- q_qt :: QT

#### Instances

Instances details

Show QNFA Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> QNFA -> ShowS Source # show :: QNFA -> String Source # showList :: [QNFA] -> ShowS Source #

data QT Source #

Internal to `QNFA` type.

Constructors

Simple |

Fields

- qt_win :: WinTags

  empty transitions to the virtual winning state

- qt_trans :: CharMap QTrans

  all ways to leave this QNFA to other or the same QNFA

- qt_other :: QTrans

  default ways to leave this QNFA to other or the same QNFA

Testing |

Fields

- qt_test :: WhichTest

  The test to perform

- qt_dopas :: EnumSet DoPa

  location(s) of the anchor(s) in the original regexp

- qt_a :: QT

  use qt_a if test is True, else use qt_b

- qt_b :: QT

  use qt_a if test is True, else use qt_b

#### Instances

Instances details

Show QT Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> QT -> ShowS Source # show :: QT -> String Source # showList :: [QT] -> ShowS Source #
Eq QT Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods (==) :: QT -> QT -> Bool Source # (/=) :: QT -> QT -> Bool Source #

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.

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

#### Instances

Instances details

Enum WhichTest Source # |

Instance details

Defined in Text.Regex.TDFA.Common

Methods

succ :: WhichTest -> WhichTest Source #

pred :: WhichTest -> WhichTest Source #

toEnum :: Int -> WhichTest Source #

fromEnum :: WhichTest -> Int Source #

enumFrom :: WhichTest -> [WhichTest] Source #

enumFromThen :: WhichTest -> WhichTest -> [WhichTest] Source #

enumFromTo :: WhichTest -> WhichTest -> [WhichTest] Source #

enumFromThenTo :: WhichTest -> WhichTest -> WhichTest -> [WhichTest] Source #

Show WhichTest Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> WhichTest -> ShowS Source # show :: WhichTest -> String Source # showList :: [WhichTest] -> ShowS Source #
Eq WhichTest Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods (==) :: WhichTest -> WhichTest -> Bool Source # (/=) :: WhichTest -> WhichTest -> Bool Source #
Ord WhichTest Source # |

Instance details

Defined in Text.Regex.TDFA.Common

Methods

compare :: WhichTest -> WhichTest -> Ordering Source #

(<) :: WhichTest -> WhichTest -> Bool Source #

(<=) :: WhichTest -> WhichTest -> Bool Source #

(>) :: WhichTest -> WhichTest -> Bool Source #

(>=) :: WhichTest -> WhichTest -> Bool Source #

max :: WhichTest -> WhichTest -> WhichTest Source #

min :: WhichTest -> WhichTest -> WhichTest Source #

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.

Constructors

TagTask |
ResetGroupStopTask |
SetGroupStopTask |
ResetOrbitTask |
EnterOrbitTask |
LeaveOrbitTask |

#### Instances

Instances details

Show TagTask Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> TagTask -> ShowS Source # show :: TagTask -> String Source # showList :: [TagTask] -> ShowS Source #
Eq TagTask Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods (==) :: TagTask -> TagTask -> Bool Source # (/=) :: TagTask -> TagTask -> Bool Source #

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.

Constructors

PreUpdate TagTask |
PostUpdate TagTask |

#### Instances

Instances details

Show TagUpdate Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> TagUpdate -> ShowS Source # show :: TagUpdate -> String Source # showList :: [TagUpdate] -> ShowS Source #
Eq TagUpdate Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods (==) :: TagUpdate -> TagUpdate -> Bool Source # (/=) :: TagUpdate -> TagUpdate -> Bool Source #

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

- d_id :: SetIndex
- d_dt :: DT

#### Instances

Instances details

Show DFA Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> DFA -> ShowS Source # show :: DFA -> String Source # showList :: [DFA] -> ShowS Source #

data Transition Source #

Constructors

Transition |

Fields

- trans_many :: DFA

  where to go (maximal), including respawning

- trans_single :: DFA

  where to go, not including respawning

- trans_how :: DTrans

  how to go, including respawning

data DT Source #

Internal to the DFA node

Constructors

Simple' |

Fields

- dt_win :: IntMap Instructions

  Actions to perform to win

- dt_trans :: CharMap Transition

  Transition to accept Char

- dt_other :: Transition

  default accepting transition

Testing' |

Fields

- dt_test :: WhichTest

  The test to perform

- dt_dopas :: EnumSet DoPa

  location(s) of the anchor(s) in the original regexp

- dt_a :: DT

  use dt_a if test is True else use dt_b

- dt_b :: DT

  use dt_a if test is True else use dt_b

#### Instances

Instances details

Show DT Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> DT -> ShowS Source # show :: DT -> String Source # showList :: [DT] -> ShowS Source #

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

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

Constructors

Orbits |

Fields

- inOrbit :: !Bool
- basePos :: Position
- ordinal :: Maybe Int
- getOrbits :: !(Seq Position)

#### Instances

Instances details

Show Orbits Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> Orbits -> ShowS Source # show :: Orbits -> String Source # showList :: [Orbits] -> ShowS Source #

data Instructions Source #

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

Constructors

Instructions |

Fields

- newPos :: ![(Tag, Action)]
- newOrbits :: !(Maybe (Position -> OrbitTransformer))

#### Instances

Instances details

Show Instructions Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> Instructions -> ShowS Source # show :: Instructions -> String Source # showList :: [Instructions] -> ShowS Source #

data Action Source #

Constructors

SetPre |
SetPost |
SetVal Int |

#### Instances

Instances details

Show Action Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods showsPrec :: Int -> Action -> ShowS Source # show :: Action -> String Source # showList :: [Action] -> ShowS Source #
Eq Action Source # |
Instance details Defined in Text.Regex.TDFA.Common Methods (==) :: Action -> Action -> Bool Source # (/=) :: Action -> Action -> Bool Source #

type OrbitTransformer = OrbitLog -> OrbitLog Source #

type OrbitLog = IntMap Orbits Source #

showQT :: QT -> String Source #

indent :: [String] -> String Source #

showDT :: DT -> String Source #

seeDTrans :: DTrans -> String Source #