}
case kind::REGEXP_INTER: {
//TODO: Overapproximation for now
- for(unsigned i=0; i<r.getNumChildren(); i++) {
- getCharSet(r[i], cset, vset);
- }
+ //for(unsigned i=0; i<r.getNumChildren(); i++) {
+ //getCharSet(r[i], cset, vset);
+ //}
+ getCharSet(r[0], cset, vset);
break;
}
case kind::REGEXP_STAR: {
rNode = d_emptyRegexp;
}
} else if(r1 == r2) {
- rNode = convert1(cnt, r1);
+ rNode = r1; //convert1(cnt, r1);
} else {
PairNodes p(r1, r2);
std::map< PairNodes, Node >::const_iterator itrcache = cache.find(p);
PairNodes p(r1, r2);
cache2[ p ] = NodeManager::currentNM()->mkNode(kind::REGEXP_RV, NodeManager::currentNM()->mkConst(CVC4::Rational(cnt)));
Node rt = intersectInternal2(r1l, r2l, cache2, spflag, cnt+1);
- rt = convert1(cnt, rt);
if(spflag) {
//TODO:
return Node::null();
rNode = vec_nodes.size()==0 ? d_emptyRegexp : vec_nodes.size()==1 ? vec_nodes[0] :
NodeManager::currentNM()->mkNode(kind::REGEXP_UNION, vec_nodes);
rNode = Rewriter::rewrite( rNode );
+ rNode = convert1(cnt, rNode);
+ rNode = Rewriter::rewrite( rNode );
} else {
//TODO: non-empty var set
spflag = true;
if(!preNode.isNull()) {
if(tmpNode[0].getKind() == kind::STRING_TO_REGEXP) {
preNode = rewriteConcatString(
- NodeManager::currentNM()->mkNode( kind::STRING_CONCAT, preNode, tmpNode[0][0] ) );
+ NodeManager::currentNM()->mkNode( kind::STRING_CONCAT, preNode, tmpNode[0][0] ) );
node_vec.push_back( NodeManager::currentNM()->mkNode( kind::STRING_TO_REGEXP, preNode ) );
preNode = Node::null();
} else {
retNode = NodeManager::currentNM()->mkNode( kind::REGEXP_EMPTY, nvec );
} else {
if(!preNode.isNull()) {
- node_vec.push_back( NodeManager::currentNM()->mkNode( kind::STRING_TO_REGEXP, preNode ) );
+ bool bflag = (preNode.getKind() == kind::CONST_STRING && preNode.getConst<String>().isEmptyString() );
+ if(node_vec.empty() || !bflag ) {
+ node_vec.push_back( NodeManager::currentNM()->mkNode( kind::STRING_TO_REGEXP, preNode ) );
+ }
}
if(node_vec.size() > 1) {
retNode = NodeManager::currentNM()->mkNode(kind::REGEXP_CONCAT, node_vec);
Node retNode = node;
std::vector<Node> node_vec;
bool flag = false;
+ //bool allflag = false;
for(unsigned i=0; i<node.getNumChildren(); ++i) {
if(node[i].getKind() == kind::REGEXP_UNION) {
Node tmpNode = prerewriteOrRegExp( node[i] );
} else if(node.getKind() == kind::REGEXP_STAR) {
if(node[0].getKind() == kind::REGEXP_STAR) {
retNode = node[0];
+ } else if(node[0].getKind() == kind::STRING_TO_REGEXP && node[0][0].getKind() == kind::CONST_STRING && node[0][0].getConst<String>().isEmptyString()) {
+ retNode = node[0];
}
} else if(node.getKind() == kind::REGEXP_PLUS) {
retNode = NodeManager::currentNM()->mkNode( kind::REGEXP_CONCAT, node[0],