Skip to content

Commit

Permalink
Fix ClassCastException in RegexASTBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
jirkamarsik committed Jun 21, 2022
1 parent 9335d8c commit 195c1e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -526,4 +526,10 @@ public void nfaTraversalTests() {
test("()*", "", "", 0, true, 0, 0, 0, 0);
test("(a|)*", "", "a", 0, true, 0, 1, 1, 1);
}

@Test
public void gr39214() {
// Compiling a Regexp with a backreference inside an atomic group should not crash.
test("()(?>\\1)", "", "", 0, true, 0, 0, 0, 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ private static boolean isNestedBackReference(BackReference backReference) {
if (parent.isRoot()) {
return false;
}
if (parent.isLookAroundAssertion()) {
if (parent.isSubtreeRoot()) {
parent = parent.getParent();
}
parent = parent.getParent();
Expand Down

0 comments on commit 195c1e8

Please sign in to comment.