Clone 'isBackreference' and 'referredGroup' NFA fields, because they aren't thread variables
This commit is contained in:
@@ -45,10 +45,10 @@ type nfaState struct {
|
|||||||
groupBegin bool // Whether or not the node starts a capturing group
|
groupBegin bool // Whether or not the node starts a capturing group
|
||||||
groupEnd bool // Whether or not the node ends a capturing group
|
groupEnd bool // Whether or not the node ends a capturing group
|
||||||
groupNum int // Which capturing group the node starts / ends
|
groupNum int // Which capturing group the node starts / ends
|
||||||
// The following properties depend on the current match - I should think about resetting them for every match.
|
|
||||||
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.
|
|
||||||
isBackreference bool // Whether or not current node is backreference
|
isBackreference bool // Whether or not current node is backreference
|
||||||
referredGroup int // If current node is a backreference, the node that it points to
|
referredGroup int // If current node is a backreference, the node that it points to
|
||||||
|
// The following properties depend on the current match - I should think about resetting them for every match.
|
||||||
|
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.
|
||||||
threadBackref int // If current node is a backreference, how many characters to look forward into the referred group
|
threadBackref int // If current node is a backreference, how many characters to look forward into the referred group
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,6 +86,8 @@ func cloneStateHelper(stateToClone *nfaState, cloneMap map[*nfaState]*nfaState)
|
|||||||
groupEnd: stateToClone.groupEnd,
|
groupEnd: stateToClone.groupEnd,
|
||||||
groupBegin: stateToClone.groupBegin,
|
groupBegin: stateToClone.groupBegin,
|
||||||
groupNum: stateToClone.groupNum,
|
groupNum: stateToClone.groupNum,
|
||||||
|
isBackreference: stateToClone.isBackreference,
|
||||||
|
referredGroup: stateToClone.referredGroup,
|
||||||
}
|
}
|
||||||
cloneMap[stateToClone] = clone
|
cloneMap[stateToClone] = clone
|
||||||
for i, s := range stateToClone.output {
|
for i, s := range stateToClone.output {
|
||||||
|
Reference in New Issue
Block a user