Skip to content

Commit

Permalink
add missing return
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Jan 8, 2025
1 parent 1cb126f commit c1a62d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
10 changes: 1 addition & 9 deletions src/ast/converters/expr_inverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,15 +882,7 @@ class seq_expr_inverter : public iexpr_inverter {
return false;
case OP_SEQ_IN_RE:
if (uncnstr(args[0]) && seq.re.is_ground(args[1]) && seq.is_string(args[0]->get_sort())) {
#if 0
//
// requires auxiliary functions
// some_string_in_re.
// A preliminary implementation exists in sls_seq_plugin.cpp
// it should be moved to seq_rewriter and made agnostic to m_chars.
// maybe use backtracking for better covereage: when some_string_in_re
// fails it doesn't necessarily mean that the regex is empty.
//
#if 1
zstring s1, s2;
expr* re = args[1];
expr_ref not_re(seq.re.mk_complement(re), m);
Expand Down
17 changes: 9 additions & 8 deletions src/ast/rewriter/seq_rewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6153,6 +6153,7 @@ bool seq_rewriter::some_string_in_re(expr* r, zstring& s) {
expr_mark visited;
unsigned_vector str;
expr_ref_vector pinned(m());

if (!some_string_in_re(pinned, visited, r, str))
return false;
s = zstring(str.size(), str.data());
Expand Down Expand Up @@ -6198,29 +6199,29 @@ bool seq_rewriter::append_char(expr_ref_vector& pinned, expr_mark& visited, buff
if (append_char(pinned, visited, exclude, el, str))
return true;
exclude.pop_back();
return false;
}

if (is_ground(r)) {
// ensure selected character is not in exclude
unsigned ch = 'a';
bool at_base = false;
bool wrapped = false;
while (true) {
bool found = false;
for (auto [l, h] : exclude) {
if (l <= ch && ch <= h) {
found = true;
ch = h + 1;
break;
}
}
if (!found)
break;
if (ch == zstring::unicode_max_char() + 1) {
if (at_base)
return false;
ch = 0;
at_base = true;
}
if (ch != zstring::unicode_max_char() + 1)
continue;
if (wrapped)
return false;
ch = 0;
wrapped = true;
}
str.push_back(ch);
if (some_string_in_re(pinned, visited, r, str))
Expand Down

0 comments on commit c1a62d3

Please sign in to comment.