|
|
|
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 {} | | data CompOption = CompOption {} | | data ExecOption = ExecOption {} | | type Tag = Int | | | | type Index = Int | | type SetIndex = IntSet | | type Position = Int | | type GroupIndex = Int | | data GroupInfo = GroupInfo {} | | data Regex = Regex {} | | | | data QNFA = QNFA {} | | | | type QTrans = IntMap [TagCommand] | | | | | | type TagTasks = [(Tag, TagTask)] | | | | type TagList = [(Tag, TagUpdate)] | | type TagCommand = (DoPa, TagList) | | type WinTags = TagList | | data DFA = DFA {} | | data Transition = Transition {} | | | | type DTrans = IntMap (IntMap (DoPa, Instructions)) | | type DTrans' = [(Index, [(Index, (DoPa, ([(Tag, (Position, Bool))], [String])))])] | | data Orbits = Orbits {} | | data Instructions = Instructions {} | | | | type OrbitTransformer = OrbitLog -> OrbitLog | | type OrbitLog = IntMap Orbits | | showQT :: QT -> String | | indent :: [String] -> String | | showDT :: DT -> String | | seeDTrans :: DTrans -> String |
|
|
Documentation |
|
|
|
|
|
on :: (t1 -> t1 -> t2) -> (t -> t1) -> t -> t -> t2 | Source |
|
|
|
after sort or sortBy the use of nubnubBy can be replaced by norepnorepBy
|
|
|
after sort or sortBy the use of nubnubBy can be replaced by norepnorepBy
|
|
mapFst :: Functor f => (t -> t2) -> f (t, t1) -> f (t2, t1) | Source |
|
|
mapSnd :: Functor f => (t1 -> t2) -> f (t, t1) -> f (t, t2) | Source |
|
|
|
|
|
|
|
|
|
|
|
|
|
Used to track elements of the pattern that accept characters or
are anchors
| Constructors | |
|
|
|
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 | |
|
|
|
Constructors | ExecOption | | captureGroups :: Bool | True by default. Set to False to improve speed (and space).
|
|
|
|
|
|
Used by implementation to name certain Postions during
matching. Identity of Position tag to set during a transition
|
|
|
Internal use to indicate type of tag and preference for larger or smaller Positions
| Constructors | Maximize | | Minimize | | Orbit | | Ignore | |
|
|
|
|
Internal NFA node identity number
|
|
|
Internal DFA identity is this Set of NFA Index
|
|
|
Index into the text being searched
|
|
|
GroupIndex is for indexing submatches from capturing
parenthesized groups (PGroup/Group)
|
|
|
GroupInfo collects the parent and tag information for an instance
of a group
| Constructors | |
|
|
|
The TDFA backend specific Regex type, used by this module's RegexOptions and RegexMaker
| Constructors | Regex | | 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 | |
|
|
|
|
|
|
|
|
Internal NFA node type
| Constructors | |
|
|
|
Internal to QNFA type.
| Constructors | Simple | | 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 | | 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
|
|
|
|
|
|
Internal type to represent the tagged transition from one QNFA to
another (or itself). The key is the Index of the destination QNFA.
|
|
|
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 | | Test_EOL | | Test_BOB | | Test_EOB | | Test_BOW | | Test_EOW | | Test_EdgeWord | | Test_NotEdgeWord | |
|
|
|
|
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 | |
|
|
|
|
Ordered list of tags and their associated Task
|
|
|
When attached to a QTrans the TagTask can be done before or after
accepting the character.
| Constructors | |
|
|
|
Ordered list of tags and their associated update operation.
|
|
|
A TagList and the location of the item in the original pattern
that is being accepted.
|
|
|
Ordered list of tags and their associated update operation to
perform on an empty transition to the virtual winning state.
|
|
|
Internal DFA node, identified by the Set of indices of the QNFA
nodes it represents.
| Constructors | |
|
|
|
Constructors | Transition | | 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
|
|
|
|
|
|
Internal to the DFA node
| Constructors | Simple' | | | Testing' | | 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
|
|
|
|
|
|
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.
|
|
|
Internal convenience type for the text display code
|
|
|
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 | |
|
|
|
The newPos and newFlags lists in Instructions are sorted by, and unique in, the Tag values
| Constructors | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Produced by Haddock version 2.6.1 |