8225198: Optimize regex tree for greedy quantifiers of type {N,}

Reviewed-by: redestad, bchristi
This commit is contained in:
Ivan Gerasimov 2019-06-04 18:55:53 -07:00
parent 4098f0ecdd
commit 90e6c1cc36
2 changed files with 20 additions and 48 deletions

View file

@ -195,7 +195,13 @@ class PrintPattern {
pstr = gcp.predicate.toString();
else
pstr = "Single \"" + pstr + "\"";
str = name + " " + pstr + ((gcp.cmin == 0) ? "*" : "+");
str = name + " " + pstr;
if (gcp.cmin == 0)
str += "*";
else if (gcp.cmin == 1)
str += "+";
else
str += "{" + gcp.cmin + ",}";
print(node, str, depth);
} else if (node instanceof Pattern.BackRef) {
str = "GroupBackRef " + ((Pattern.BackRef)node).groupIndex / 2;