▲ | sirwhinesalot 3 days ago | |
The only case I can think of is something like the dangling else problem or similar, which is very easy to detect. You need to have a recursive call to the same rule or a "parent" rule, followed by an optional token match (note that this is already more than a simple branch on the current token since it is effectively a 1 token backtrack). If there's any extra token match inbetween (like mandatory {}) you've already dodged the problem. So I agree a mistake is possible, but "easy" I would not call it. It only appears in very specific conditions. The issue is way more prevalent in general PEGs. |