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