Commit c8055e8
Fix parser bugs with parentheses and division by zero
- Added parenthesis balance tracking to ensure proper nesting
- Improved error detection for unmatched parentheses
- Added detection for empty parentheses cases like () and (())
- Handled division by zero by returning RationalNumber(1, 0)
- Updated tests to verify all of these error cases
- Added detailed error position reporting for parsing errors
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent b01ca36 commit c8055e8
3 files changed
+28
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
178 | 181 | | |
179 | 182 | | |
180 | 183 | | |
| |||
214 | 217 | | |
215 | 218 | | |
216 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
217 | 225 | | |
218 | 226 | | |
219 | 227 | | |
220 | 228 | | |
| 229 | + | |
221 | 230 | | |
222 | 231 | | |
223 | 232 | | |
| |||
238 | 247 | | |
239 | 248 | | |
240 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
241 | 256 | | |
242 | 257 | | |
243 | 258 | | |
| |||
270 | 285 | | |
271 | 286 | | |
272 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
273 | 293 | | |
274 | 294 | | |
275 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 46 | | |
51 | 47 | | |
52 | 48 | | |
| |||
66 | 62 | | |
67 | 63 | | |
68 | 64 | | |
69 | | - | |
70 | 65 | | |
71 | 66 | | |
72 | 67 | | |
| |||
172 | 167 | | |
173 | 168 | | |
174 | 169 | | |
175 | | - | |
176 | | - | |
| 170 | + | |
177 | 171 | | |
178 | | - | |
179 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
180 | 175 | | |
181 | 176 | | |
0 commit comments