src/java.base/share/classes/java/util/regex/Matcher.java
Print this page
*** 24,33 ****
--- 24,34 ----
*/
package java.util.regex;
import java.util.ConcurrentModificationException;
+ import java.util.HashSet;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Spliterator;
import java.util.Spliterators;
*** 176,185 ****
--- 177,194 ----
* so they rely on this field to hold state during a match.
*/
int[] locals;
/**
+ * Storage used by top greedy Loop node to store a specific hash set to
+ * keep the beginning index of the failed repetition match. The nodes
+ * themselves are stateless, so they rely on this field to hold state
+ * during a match.
+ */
+ HashSetInt[] localsPos;
+
+ /**
* Boolean indicating whether or not more input could change
* the results of the last match.
*
* If hitEnd is true, and a match was found, then more input
* might cause a different match to be found.
*** 237,246 ****
--- 246,256 ----
// Allocate state storage
int parentGroupCount = Math.max(parent.capturingGroupCount, 10);
groups = new int[parentGroupCount * 2];
locals = new int[parent.localCount];
+ localsPos = new HashSetInt[parent.localTGRGroupCount];
// Put fields into initial states
reset();
}
*** 373,382 ****
--- 383,393 ----
locals = new int[newPattern.localCount];
for (int i = 0; i < groups.length; i++)
groups[i] = -1;
for (int i = 0; i < locals.length; i++)
locals[i] = -1;
+ localsPos = new HashSetInt[parentPattern.localTGRGroupCount];
modCount++;
return this;
}
/**