summaryrefslogtreecommitdiff
path: root/src/theory/strings
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2019-07-30 09:57:33 -0500
committerGitHub <noreply@github.com>2019-07-30 09:57:33 -0500
commitaca0cef5cf1bcb882dce927a64917aa800dd8b27 (patch)
tree5f87b8e6d7737c0e1809cc9b8d8d5f52fe0cfc27 /src/theory/strings
parentc9fa0516fd28b48940edf2a714e33bee6eacc396 (diff)
Minor improvement for rewriter for str.replace (#3124)
Diffstat (limited to 'src/theory/strings')
-rw-r--r--src/theory/strings/theory_strings_rewriter.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/theory/strings/theory_strings_rewriter.cpp b/src/theory/strings/theory_strings_rewriter.cpp
index d720fedc8..aac2477ea 100644
--- a/src/theory/strings/theory_strings_rewriter.cpp
+++ b/src/theory/strings/theory_strings_rewriter.cpp
@@ -2456,14 +2456,20 @@ Node TheoryStringsRewriter::rewriteReplace( Node node ) {
}
else
{
- CVC4::String s1 = s.substr(0, (int)p);
- CVC4::String s3 = s.substr((int)p + (int)t.size());
- Node ns1 = NodeManager::currentNM()->mkConst(::CVC4::String(s1));
- Node ns3 = NodeManager::currentNM()->mkConst(::CVC4::String(s3));
+ String s1 = s.substr(0, (int)p);
+ String s3 = s.substr((int)p + (int)t.size());
std::vector<Node> children;
- children.push_back(ns1);
+ if (s1.size() > 0)
+ {
+ Node ns1 = nm->mkConst(String(s1));
+ children.push_back(ns1);
+ }
children.push_back(node[2]);
- children.push_back(ns3);
+ if (s3.size() > 0)
+ {
+ Node ns3 = nm->mkConst(String(s3));
+ children.push_back(ns3);
+ }
children.insert(children.end(), children0.begin() + 1, children0.end());
Node ret = utils::mkConcat(STRING_CONCAT, children);
return returnRewrite(node, ret, "rpl-const-find");
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback