From ffad976484e3836ea0ca988db2651374ff263c7e Mon Sep 17 00:00:00 2001 From: Jirka Marsik Date: Tue, 6 Feb 2024 15:48:59 +0100 Subject: [PATCH] Use quantifier's zeroWidthIndex, not the guard's index --- .../parser/ast/visitors/NFATraversalRegexASTVisitor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/regex/src/com.oracle.truffle.regex/src/com/oracle/truffle/regex/tregex/parser/ast/visitors/NFATraversalRegexASTVisitor.java b/regex/src/com.oracle.truffle.regex/src/com/oracle/truffle/regex/tregex/parser/ast/visitors/NFATraversalRegexASTVisitor.java index e893a783b1ea..1c95cf1a7ace 100644 --- a/regex/src/com.oracle.truffle.regex/src/com/oracle/truffle/regex/tregex/parser/ast/visitors/NFATraversalRegexASTVisitor.java +++ b/regex/src/com.oracle.truffle.regex/src/com/oracle/truffle/regex/tregex/parser/ast/visitors/NFATraversalRegexASTVisitor.java @@ -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; } @@ -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();