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

Text.Regex.TDFA.TNFA

Description

Text.Regex.TDFA.TNFA converts the CorePattern Q/P data (and its Pattern leafs) to a QNFA tagged non-deterministic finite automata.

This holds every possible way to follow one state by another, while in the DFA these will be reduced by picking a single best transition for each (source,destination) pair. The transitions are heavily and often redundantly annotated with tasks to perform, and this redundancy is reduced when picking the best transition. So far, keeping all this information has helped fix bugs in both the design and implementation.

The QNFA for a Pattern with a starTraned Q/P form with N one character accepting leaves has at most N+1 nodes. These nodes represent the future choices after accepting a leaf. The processing of Or nodes often reduces this number by sharing at the end of the different paths. Turning off capturing while compiling the pattern may (future extension) reduce this further for some patterns by processing Star with optimizations. This compact design also means that tags are assigned not just to be updated before taking a transition (PreUpdate) but also after the transition (PostUpdate).

Uses recursive do notation.

Synopsis

Documentation

data QNFA Source #

Internal NFA node type.

Constructors

QNFA 

Fields

Instances

Instances details
Show QNFA Source # 
Instance details

Defined in Text.Regex.TDFA.Common

data QT Source #

Internal to QNFA type.

Constructors

Simple 

Fields

Testing 

Fields

Instances

Instances details
Eq QT Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

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

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

Show QT Source # 
Instance details

Defined in Text.Regex.TDFA.Common

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 TagUpdate Source #

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

Instances

Instances details
Eq TagUpdate Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Show TagUpdate Source # 
Instance details

Defined in Text.Regex.TDFA.Common