summaryrefslogtreecommitdiff
path: root/src/theory/strings/regexp_operation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/theory/strings/regexp_operation.cpp')
-rw-r--r--src/theory/strings/regexp_operation.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/theory/strings/regexp_operation.cpp b/src/theory/strings/regexp_operation.cpp
index 0360228c6..0d422e823 100644
--- a/src/theory/strings/regexp_operation.cpp
+++ b/src/theory/strings/regexp_operation.cpp
@@ -850,14 +850,18 @@ void RegExpOpr::simplifyNRegExp( Node s, Node r, std::vector< Node > &new_nodes
{
b1 = reLength;
}
- Node s1 = nm->mkNode(STRING_SUBSTR, s, d_zero, b1);
- Node s2 = nm->mkNode(STRING_SUBSTR, s, b1, nm->mkNode(MINUS, lens, b1));
- if (indexRm != 0)
+ Node s1;
+ Node s2;
+ if (indexRm == 0)
{
- // swap if we are removing from the end
- Node sswap = s1;
- s1 = s2;
- s2 = sswap;
+ s1 = nm->mkNode(STRING_SUBSTR, s, d_zero, b1);
+ s2 = nm->mkNode(STRING_SUBSTR, s, b1, nm->mkNode(MINUS, lens, b1));
+ }
+ else
+ {
+ s1 = nm->mkNode(STRING_SUBSTR, s, nm->mkNode(MINUS, lens, b1), b1);
+ s2 =
+ nm->mkNode(STRING_SUBSTR, s, d_zero, nm->mkNode(MINUS, lens, b1));
}
Node s1r1 = nm->mkNode(STRING_IN_REGEXP, s1, r[indexRm]).negate();
std::vector<Node> nvec;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback