Skip to content

Commit

Permalink
Use quantifier's zeroWidthIndex, not the guard's index
Browse files Browse the repository at this point in the history
  • Loading branch information
jirkamarsik committed Feb 16, 2024
1 parent c4bdc53 commit ffad976
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ private void pushQuantifierGuard(QuantifierGuard guard) {
boolean keptAliveByCaptureGroups = false;
// Search for the last enterZeroWidth guard of the same group.
QuantifierGuardsLinkedList curGuard = quantifierGuards;
while (curGuard != null && (!(curGuard.getGuard().getKind() == QuantifierGuard.Kind.enterZeroWidth && curGuard.getGuard().getIndex() == guard.getIndex()))) {
while (curGuard != null && (!(curGuard.getGuard().getKind() == QuantifierGuard.Kind.enterZeroWidth && curGuard.getGuard().getQuantifier().getZeroWidthIndex() == guard.getQuantifier().getZeroWidthIndex()))) {
if (ast.getOptions().getFlavor().emptyChecksMonitorCaptureGroups() && curGuard.getGuard().getKind() == QuantifierGuard.Kind.updateCG) {
keptAliveByCaptureGroups = true;
}
Expand Down Expand Up @@ -1126,7 +1126,7 @@ private void pushQuantifierGuard(QuantifierGuard guard) {
// updates in between, then this new enterZeroWidth is redundant.
QuantifierGuardsLinkedList curGuard = quantifierGuards;
while (curGuard != null && (!ast.getOptions().getFlavor().emptyChecksMonitorCaptureGroups() || curGuard.getGuard().getKind() != QuantifierGuard.Kind.updateCG)) {
if (curGuard.getGuard().getKind() == QuantifierGuard.Kind.enterZeroWidth && curGuard.getGuard().getIndex() == guard.getIndex()) {
if (curGuard.getGuard().getKind() == QuantifierGuard.Kind.enterZeroWidth && curGuard.getGuard().getQuantifier().getZeroWidthIndex() == guard.getQuantifier().getZeroWidthIndex()) {
return;
}
curGuard = curGuard.getPrev();
Expand Down

0 comments on commit ffad976

Please sign in to comment.