Repository navigation
Commit 324de63
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 9deb0d7 commit 324de63
1 file changed
Lines changed: 25 additions & 0 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
216 | 228 | | |
217 | 229 | | |
218 | 230 | | |
| |||
539 | 551 | | |
540 | 552 | | |
541 | 553 | | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
542 | 567 | | |
0 commit comments