Improved submatch tracking by storing all group indices as a part of the state, which is viewed as a 'thread'
This commit is contained in:
3
nfa.go
3
nfa.go
@@ -33,10 +33,11 @@ type State struct {
|
||||
except []rune // Only valid if allChars is true - match all characters _except_ the ones in this block. Useful for inverting character classes.
|
||||
lookaroundRegex string // Only for lookaround states - Contents of the regex that the lookaround state holds
|
||||
lookaroundNFA *State // Holds the NFA of the lookaroundRegex - if it exists
|
||||
lookaroundNumCaptureGroups int // Number of capturing groups if current node is a lookaround
|
||||
lookaroundNumCaptureGroups int // Number of capturing groups in lookaround regex if current node is a lookaround
|
||||
groupBegin bool // Whether or not the node starts a capturing group
|
||||
groupEnd bool // Whether or not the node ends a capturing group
|
||||
groupNum int // Which capturing group the node starts / ends
|
||||
threadGroups []Group // Assuming that a state is part of a 'thread' in the matching process, this array stores the indices of capturing groups in the current thread. As matches are found for this state, its groups will be copied over.
|
||||
}
|
||||
|
||||
// Clones the NFA starting from the given state.
|
||||
|
Reference in New Issue
Block a user