Use pointers instead of values

implementPCREMatchingRules
Aadhavan Srinivasan 1 month ago
parent ed4ffde64e
commit 8534174ea1

@ -987,7 +987,8 @@ func thompson(re []postfixNode) (Reg, error) {
if c.nodetype == charclassNode { // A Character class consists of all the nodes in it, alternated
// Map the list of nodes to a list of states, each state containing the contents of a specific node
states := funcMap(c.nodeContents, func(node postfixNode) *nfaState {
s := newState()
s := &nfaState{}
s.output = append(s.output, s)
nodeContents := node.contents
if caseInsensitive {
nodeContents = slices.Concat(funcMap(nodeContents, func(r rune) []rune {
@ -1001,7 +1002,7 @@ func thompson(re []postfixNode) (Reg, error) {
return n.contents
})...)
}
return &s
return s
})
// Reduce the list of states down to a single state by alternating them
toAdd := funcReduce(states, func(s1 *nfaState, s2 *nfaState) *nfaState {

Loading…
Cancel
Save