Reverse the order in which I pop states for alternation, because this messes with the left branch-right branch thing

remotes/origin/implementPCREMatchingRules
Aadhavan Srinivasan 1 month ago
parent de0d7345a8
commit 5563a70568

@ -1059,8 +1059,8 @@ func thompson(re []postfixNode) (Reg, error) {
// '|a'
// '^a|'
// '^|a'
s1, err1 := pop(&nfa)
s2, err2 := pop(&nfa)
s2, err1 := pop(&nfa)
s1, err2 := pop(&nfa)
if err2 != nil || (s2.groupBegin && len(s2.transitions) == 0) { // Doesn't exist, or its just an LPAREN
if err2 == nil { // Roundabout way of saying that this node existed, but it was an LPAREN, so we append it back
nfa = append(nfa, s2)

Loading…
Cancel
Save