From 8d6e1a41a5b9d8ec673b50ffafb4b5c5041630a5 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Mon, 16 Dec 2024 22:58:39 -0500 Subject: [PATCH] Fixed bug where a repeated capturing group eg. (a){3} wouldn't capture only the last iteration, like it should --- main.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 94c43ba..602008e 100644 --- a/main.go +++ b/main.go @@ -382,11 +382,8 @@ func shuntingYard(re string) []postfixNode { } idx := len(outQueue) - 1 - // Get the most recently added non-paren node - for node := outQueue[idx]; idx >= 0 && (node.nodetype == RPAREN || node.nodetype == LPAREN); node = outQueue[idx] { - idx-- - } - if idx < 0 { + // Get the last added node + if idx < 0 || outQueue[idx].nodetype == LPAREN { panic("Numeric specifier with no content.") } outQueue[idx].startReps = startRangeNum