Repository navigation
Commit cafada6
committed
yeast: Explicitly warn on nested captured repetitions
This is a weird pattern (that we don't use) that had weird semantics
previously.
A minimal example would be something like
```
((item)* (separator))* @Items
```
Here, it's not really clear what @Items should be capturing. The current
implementation (post-AST rewrite) simply panics at compile-time, with a
message that may or may not be helpful. As the Copilot review correctly
points out, this is a regression compared to the previous behaviour
(which dealt with the issue by just throwing away the `(item)*` bit).
This compiled, but I don't think the old behaviour is particularly
sensible either.
For that reason, we now explicitly warn that capturing a group
containing a nested repetition is an error.
At present, we never employ the above pattern in our code. If this
changes, then we'll likely want to provide a sensible semantics for this
case rather than just panicking.1 parent 2853b34 commit cafada6
1 file changed
Lines changed: 25 additions & 0 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
233 | 245 | | |
234 | 246 | | |
235 | 247 | | |
| |||
525 | 537 | | |
526 | 538 | | |
527 | 539 | | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
528 | 553 | | |
0 commit comments