GoalScope — basic_calculator (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
<code>↵ def basic_calculator(s):↵ """Evaluate a simple expression with +, -, and ()"""↵ def calc(it):↵ stack = []↵ sign = '+'↵ num = 0 while it < len(s):↵ if s[it].isdigit():↵ num = num * 10 + int(s[it])↵ if s[it] == '(':↵ num, it = calc(it + 1)↵ if it == len(s) - 1 or s[it] in '+-()':↵ if sign == '+':↵ stack.append(num)↵ elif sign == '-':↵ stack.append(-num)↵ sign = s[it]↵ num = 0 if s[it] == ')':↵ break it += 1 return sum(stack), it↵ ↵ return calc(0)[0]↵ </code>