yeast: Explicitly warn on nested captured repetitions · github/codeql@324de63 · GitHub
Skip to content

Commit 324de63

Browse files
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

‎shared/yeast-macros/src/rule_parse.rs‎

Lines changed: 25 additions & 0 deletions

0 commit comments

Comments
 (0)