From 198a2c12a7715e0698dee283e5f3eba7007e8011 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Thu, 30 Jan 2025 10:25:24 -0500 Subject: [PATCH] Renamed variable to avoid conflicting with type name --- regex/compile.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/regex/compile.go b/regex/compile.go index 80a5fce..b5e9f43 100644 --- a/regex/compile.go +++ b/regex/compile.go @@ -1065,7 +1065,7 @@ func thompson(re []postfixNode) (Reg, error) { if c.endReps != -1 && c.endReps < c.startReps { return Reg{}, fmt.Errorf("numeric specifier - start greater than end") } - state := mustPop(&nfa) + poppedState := mustPop(&nfa) var stateToAdd *State = nil // Take advantage of the following facts: // a{5} == aaaaa @@ -1080,17 +1080,17 @@ func thompson(re []postfixNode) (Reg, error) { // b. Encode the logic while parsing the string (shunting-yard). If I can expand the numeric specifier // at this point, I can leave thompson untouched. for i := 0; i < c.startReps; i++ { // Case 1 - stateToAdd = concatenate(stateToAdd, cloneState(state)) + stateToAdd = concatenate(stateToAdd, cloneState(poppedState)) } if c.endReps == infinite_reps { // Case 3 - s2, err := kleene(*state) + s2, err := kleene(*poppedState) if err != nil { return Reg{}, err } stateToAdd = concatenate(stateToAdd, s2) } else { // Case 2 for i := c.startReps; i < c.endReps; i++ { - stateToAdd = concatenate(stateToAdd, question(cloneState(state))) + stateToAdd = concatenate(stateToAdd, question(cloneState(poppedState))) } } nfa = append(nfa, stateToAdd)