@@ -1922,11 +1922,17 @@ namespace smt {
1922
1922
} else if (u.re.is_loop(a_regex)) {
1923
1923
expr * body;
1924
1924
unsigned lo, hi;
1925
- u.re.is_loop(a_regex, body, lo, hi);
1926
- rational rLo(lo);
1927
- rational rHi(hi);
1928
- zstring bodyStr = get_std_regex_str(body);
1929
- return zstring("(") + bodyStr + zstring("{") + zstring(rLo.to_string().c_str()) + zstring(",") + zstring(rHi.to_string().c_str()) + zstring("})");
1925
+ // There are two variants of loop: a 2-argument version and a 3-argument version.
1926
+ if (u.re.is_loop(a_regex, body, lo, hi)) {
1927
+ rational rLo(lo);
1928
+ rational rHi(hi);
1929
+ zstring bodyStr = get_std_regex_str(body);
1930
+ return zstring("(") + bodyStr + zstring("{") + zstring(rLo.to_string().c_str()) + zstring(",") + zstring(rHi.to_string().c_str()) + zstring("})");
1931
+ } else if (u.re.is_loop(a_regex, body, lo)) {
1932
+ rational rLo(lo);
1933
+ zstring bodyStr = get_std_regex_str(body);
1934
+ return zstring("(") + bodyStr + zstring("{") + zstring(rLo.to_string().c_str()) + zstring("+") + zstring("})");
1935
+ }
1930
1936
} else if (u.re.is_full_seq(a_regex)) {
1931
1937
return zstring("(.*)");
1932
1938
} else if (u.re.is_full_char(a_regex)) {
@@ -6732,7 +6738,7 @@ namespace smt {
6732
6738
} else if (u.re.is_star(re, sub1) || u.re.is_plus(re, sub1)) {
6733
6739
unsigned cx = estimate_regex_complexity(sub1);
6734
6740
return _qmul(2, cx);
6735
- } else if (u.re.is_loop(re, sub1, lo, hi)) {
6741
+ } else if (u.re.is_loop(re, sub1, lo, hi) || u.re.is_loop(re, sub1, lo) ) {
6736
6742
unsigned cx = estimate_regex_complexity(sub1);
6737
6743
return _qadd(lo, cx);
6738
6744
} else if (u.re.is_range(re, sub1, sub2)) {
@@ -6775,7 +6781,7 @@ namespace smt {
6775
6781
unsigned cx1 = estimate_regex_complexity_under_complement(sub1);
6776
6782
unsigned cx2 = estimate_regex_complexity_under_complement(sub2);
6777
6783
return _qmul(cx1, cx2);
6778
- } else if (u.re.is_star(re, sub1) || u.re.is_plus(re, sub1) || u.re.is_loop(re, sub1, lo, hi)) {
6784
+ } else if (u.re.is_star(re, sub1) || u.re.is_plus(re, sub1) || u.re.is_loop(re, sub1, lo, hi) || u.re.is_loop(re, sub1, lo) ) {
6779
6785
unsigned cx = estimate_regex_complexity_under_complement(sub1);
6780
6786
return _qmul(2, cx);
6781
6787
} else if (u.re.is_range(re, sub1, sub2)) {
@@ -6831,7 +6837,7 @@ namespace smt {
6831
6837
} else if (u.re.is_complement(re)) {
6832
6838
// TODO can we do better?
6833
6839
return false;
6834
- } else if (u.re.is_loop(re, sub1, lo, hi)) {
6840
+ } else if (u.re.is_loop(re, sub1, lo, hi) || u.re.is_loop(re, sub1, lo) ) {
6835
6841
return check_regex_length_linearity_helper(sub1, already_star);
6836
6842
} else {
6837
6843
TRACE("str", tout << "WARNING: unknown regex term " << mk_pp(re, get_manager()) << std::endl;);
0 commit comments