don't give group numbers to non-capturing groups

This commit is contained in:
Erik Krogh Kristensen
2021-09-20 14:23:16 +02:00
parent c40ffab093
commit fd64ff9ef1

View File

@@ -462,6 +462,7 @@ abstract class RegexString extends Expr {
/** Gets the number of the group in start,end */ /** Gets the number of the group in start,end */
int getGroupNumber(int start, int end) { int getGroupNumber(int start, int end) {
this.group(start, end) and this.group(start, end) and
not this.non_capturing_group_start(start, _) and
result = result =
count(int i | this.group(i, _) and i < start and not this.non_capturing_group_start(i, _)) + 1 count(int i | this.group(i, _) and i < start and not this.non_capturing_group_start(i, _)) + 1
} }