regex-dfa-0.91: Replaces/Enhances Text.RegexContentsIndex
Text.Regex.DFA.Transitions
Synopsis
noLoop :: Pattern -> Pattern
topNoLoop :: Pattern -> Pattern
starTrans :: Pattern -> Pattern
simplify :: Pattern -> Pattern
canMatchNull :: Pattern -> Bool
cannotMatchNull :: Pattern -> Bool
stateAn :: Pattern -> [(Int, DoPa, Int)]
Documentation
noLoop :: Pattern -> Pattern
Change a pattern so it will not loop in the DFA construction. Previously have used starTrans on the Pattern. The problems comes from PStar applied to a pattern which may match 0 characters. This *will* return a safe pattern, which can match null if and only if the input pattern could.
topNoLoop :: Pattern -> Pattern
topNoLoop descends, looking for PStar, for which it calls breakLoop. This *will* return a safe pattern, which can match null if and only if the input pattern could.
starTrans :: Pattern -> Pattern
starTrans replaces PQuest,PPlus,PBound,PGroup with combinations of PEmpty,POr,PConcat,PStar. Malformed limits on the PBound will be replaced with PEmpty rather than calling error. This will also simplify the resulting Pattern as it works.
simplify :: Pattern -> Pattern
canMatchNull :: Pattern -> Bool
cannotMatchNull :: Pattern -> Bool
stateAn :: Pattern -> [(Int, DoPa, Int)]
I did this overly cleverly. It descends the Pattern depth first and computes what is nullable along with creating id numbers for the DFA states. This works, but amusingly required mdo. The main output is funnel out via the tell to the WriterT and is the NFA state before, the DoPa index of the transition character,
Produced by Haddock version 0.8