On Mon, Dec 21, 2020 at 02:08:11PM +0100, Mojca Miklavec wrote:
Is this a deliberate choice, a limitation of the grammar expressiveness, some misuse on my side that could/should/needs to be implemented in a different way, or does it count as a "bug" on the lpeg side?
That’s definitely the way parsing expression grammars work. Or rather: that’s the way LPeg (the only parsing expression grammar) works :-)
For example, I wouldn't expect a regexp "b+b" to fail on "bbb" just because "b+" would eat all three "b"s at once (the regexp "b+b" in fact finds "bbb", and I would expect a less-than-totally-greedy hit with lpeg as well). Or is my reasoning wrong here?
Your reasoning is correct, but applies to regular expressions, not parsing-expression grammars. Arthur