Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Irregal capture after recursive match #48
Thank you very much for maintaining the excellent library.
I found the latest version of Onigmo suffers from the following incorrect behavior when used with a recursive expression.
It seems that
Sorry for the very late response.
I'm trying to investigate this, but I haven't found the cause yet.
I think I understand what happens with the second example.
Capturing happens three times:
Matching sequence is the following:
Finally, the last captured position of start and end will be returned.
I'm not sure this can be easily implemented. Also not sure this doesn't break existing behavior for non-nested capturing.
Thank you very much for your detailed investigation.
I imagine that if we push the start and end positions on the nest-level stack and pop them from it at the nest-level switching, the problem will be solved. Note that it does not affect non-nested capturing.
I'm afraid the first one should have been fixed in the same manner.
I do not know how difficult to implement it though...
I found a better solution for this.
Difference between 1 and 2 is whether captured groups are directly called or not.
Now, with the commit 4bd79e2, captured groups which are called indirectly are also handled as if they are called directly.
BTW, I'm not sure both