Reverse the order in which I pop states for alternation, because this messes with the left branch-right branch thing
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user