}
// Make the datatypes.
- vector<CVC4::DatatypeType> dtts;
- d_em->mkMutualDatatypeTypes(dv, dtts);
+ vector<CVC4::DatatypeType> dtts = d_em->mkMutualDatatypeTypes(dv);
// Post-process to register the names of everything with this validity checker.
// This is necessary for the compatibility layer because cons/sel operations are
// code anyway.
vector<Datatype> datatypes;
datatypes.push_back(datatype);
- std::vector<DatatypeType> result;
- mkMutualDatatypeTypes(datatypes, result);
+ std::vector<DatatypeType> result = mkMutualDatatypeTypes(datatypes);
Assert(result.size() == 1);
return result.front();
}
-void ExprManager::mkMutualDatatypeTypes(std::vector<Datatype>& datatypes, std::vector<DatatypeType>& dtts) {
+std::vector<DatatypeType> ExprManager::mkMutualDatatypeTypes(std::vector<Datatype>& datatypes) {
std::set<Type> unresolvedTypes;
- return mkMutualDatatypeTypes(datatypes, unresolvedTypes, dtts);
+ return mkMutualDatatypeTypes(datatypes, unresolvedTypes);
}
-void ExprManager::mkMutualDatatypeTypes(std::vector<Datatype>& datatypes, std::set<Type>& unresolvedTypes, std::vector<DatatypeType>& dtts) {
+std::vector<DatatypeType> ExprManager::mkMutualDatatypeTypes(std::vector<Datatype>& datatypes, std::set<Type>& unresolvedTypes) {
NodeManagerScope nms(d_nodeManager);
std::map<std::string, DatatypeType> nameResolutions;
+ std::vector<DatatypeType> dtts;
Trace("ajr-temp") << "Build datatypes..." << std::endl;
//have to build deep copy so that datatypes will live in NodeManager
}
Trace("ajr-temp") << "Finish..." << std::endl;
+ return dtts;
}
void ExprManager::checkResolvedDatatype(DatatypeType dtt) const {
* Make a set of types representing the given datatypes, which may be
* mutually recursive.
*/
- void mkMutualDatatypeTypes(std::vector<Datatype>& datatypes, std::vector<DatatypeType>& dtts);
+ std::vector<DatatypeType> mkMutualDatatypeTypes(std::vector<Datatype>& datatypes);
/**
* Make a set of types representing the given datatypes, which may
* then no complicated Type needs to be created, and the above,
* simpler form of mkMutualDatatypeTypes() is enough.
*/
- void mkMutualDatatypeTypes(std::vector<Datatype>& datatypes, std::set<Type>& unresolvedTypes, std::vector<DatatypeType>& dtts);
+ std::vector<DatatypeType> mkMutualDatatypeTypes(std::vector<Datatype>& datatypes, std::set<Type>& unresolvedTypes);
/**
* Make a type representing a constructor with the given parameterization.
friend Expr ExprManager::mkVar(Type, uint32_t flags);
// friend so it can access NodeManager's d_listeners and notify clients
- friend void ExprManager::mkMutualDatatypeTypes(std::vector<Datatype>&, std::set<Type>&, std::vector<DatatypeType>&);
+ friend std::vector<DatatypeType> ExprManager::mkMutualDatatypeTypes(std::vector<Datatype>&, std::set<Type>&);
/** Predicate for use with STL algorithms */
struct NodeValueReferenceCountNonZero {
( COMMA datatypeDef[dts] )*
END_TOK
{ PARSER_STATE->popScope();
- std::vector<DatatypeType> dtts;
- PARSER_STATE->mkMutualDatatypeTypes(dts, dtts);
- cmd = new DatatypeDeclarationCommand(dtts); }
+ cmd = new DatatypeDeclarationCommand(PARSER_STATE->mkMutualDatatypeTypes(dts)); }
| CONTEXT_TOK
( ( str[s] | IDENTIFIER { s = AntlrInput::tokenText($IDENTIFIER); } )
return d_unresolved.find(getSort(name)) != d_unresolved.end();
}
-void Parser::mkMutualDatatypeTypes(std::vector<Datatype>& datatypes, std::vector<DatatypeType>& types) {
+std::vector<DatatypeType>
+Parser::mkMutualDatatypeTypes(std::vector<Datatype>& datatypes) {
try {
- d_exprManager->mkMutualDatatypeTypes(datatypes, d_unresolved, types);
+ std::vector<DatatypeType> types =
+ d_exprManager->mkMutualDatatypeTypes(datatypes, d_unresolved);
assert(datatypes.size() == types.size());
throw ParserException(dt.getName() + " is not well-founded");
}
}
+
+ return types;
} catch(IllegalArgumentException& ie) {
throw ParserException(ie.getMessage());
}
/**
* Create sorts of mutually-recursive datatypes.
*/
- void mkMutualDatatypeTypes(std::vector<Datatype>& datatypes, std::vector<DatatypeType>& dtts);
+ std::vector<DatatypeType>
+ mkMutualDatatypeTypes(std::vector<Datatype>& datatypes);
/**
* Add an operator to the current legal set.
Debug("parser-sygus") << " " << i << " : " << datatypes[i].getName() << std::endl;
}
seq = new CommandSequence();
- std::vector<DatatypeType> datatypeTypes;
- PARSER_STATE->mkMutualDatatypeTypes(datatypes, datatypeTypes);
+ std::vector<DatatypeType> datatypeTypes = PARSER_STATE->mkMutualDatatypeTypes(datatypes);
seq->addCommand(new DatatypeDeclarationCommand(datatypeTypes));
std::map<DatatypeType, Expr> evals;
if( sorts[0]!=range ){
datatypesDefCommand[bool isCo, CVC4::Command*& cmd]
@declarations {
std::vector<CVC4::Datatype> dts;
- std::vector<CVC4::DatatypeType> dtts;
std::string name;
std::vector<Type> sorts;
}
RPAREN_TOK
LPAREN_TOK ( LPAREN_TOK datatypeDef[isCo, dts, sorts] RPAREN_TOK )+ RPAREN_TOK
{ PARSER_STATE->popScope();
- PARSER_STATE->mkMutualDatatypeTypes(dts, dtts);
- cmd = new DatatypeDeclarationCommand(dtts); }
+ cmd = new DatatypeDeclarationCommand(PARSER_STATE->mkMutualDatatypeTypes(dts)); }
;
rewriterulesCommand[CVC4::Command*& cmd]
}
newDt.addConstructor(ctor);
}
- vector<DatatypeType> newDttVector;
- NodeManager::currentNM()->toExprManager()->mkMutualDatatypeTypes(newDtVector, unresolvedTypes, newDttVector);
+ vector<DatatypeType> newDttVector =
+ NodeManager::currentNM()->toExprManager()->mkMutualDatatypeTypes(newDtVector, unresolvedTypes);
DatatypeType& newDtt = newDttVector.front();
const Datatype& newD = newDtt.getDatatype();
for(c = dt.begin(); c != dt.end(); ++c) {