return Type(d_nodeManager, new TypeNode(d_nodeManager->mkTesterType(*domain.d_typeNode)));
}
-SortType ExprManager::mkSort(const std::string& name) const {
+SortType ExprManager::mkSort(const std::string& name, uint32_t flags) const {
NodeManagerScope nms(d_nodeManager);
- return SortType(Type(d_nodeManager, new TypeNode(d_nodeManager->mkSort(name))));
+ return SortType(Type(d_nodeManager, new TypeNode(d_nodeManager->mkSort(name, flags))));
}
SortConstructorType ExprManager::mkSortConstructor(const std::string& name,
/** Make a type representing a tester with the given parameterization. */
TesterType mkTesterType(Type domain) const;
+ /** Bits for use in mkSort() flags. */
+ enum {
+ SORT_FLAG_NONE = 0,
+ SORT_FLAG_PLACEHOLDER = 1
+ };/* enum */
+
/** Make a new sort with the given name. */
- SortType mkSort(const std::string& name) const;
+ SortType mkSort(const std::string& name, uint32_t flags = SORT_FLAG_NONE) const;
/** Make a sort constructor from a name and arity. */
SortConstructorType mkSortConstructor(const std::string& name,
class NodeManagerListener {
public:
virtual ~NodeManagerListener() { }
- virtual void nmNotifyNewSort(TypeNode tn) { }
+ virtual void nmNotifyNewSort(TypeNode tn, uint32_t flags) { }
virtual void nmNotifyNewSortConstructor(TypeNode tn) { }
- virtual void nmNotifyInstantiateSortConstructor(TypeNode ctor, TypeNode sort) { }
+ virtual void nmNotifyInstantiateSortConstructor(TypeNode ctor, TypeNode sort, uint32_t flags) { }
virtual void nmNotifyNewDatatypes(const std::vector<DatatypeType>& datatypes) { }
virtual void nmNotifyNewVar(TNode n, uint32_t flags) { }
virtual void nmNotifyNewSkolem(TNode n, const std::string& comment, uint32_t flags) { }
inline TypeNode mkTesterType(TypeNode domain);
/** Make a new (anonymous) sort of arity 0. */
- inline TypeNode mkSort();
+ inline TypeNode mkSort(uint32_t flags = ExprManager::SORT_FLAG_NONE);
/** Make a new sort with the given name of arity 0. */
- inline TypeNode mkSort(const std::string& name);
+ inline TypeNode mkSort(const std::string& name, uint32_t flags = ExprManager::SORT_FLAG_NONE);
/** Make a new sort by parameterizing the given sort constructor. */
inline TypeNode mkSort(TypeNode constructor,
- const std::vector<TypeNode>& children);
+ const std::vector<TypeNode>& children,
+ uint32_t flags = ExprManager::SORT_FLAG_NONE);
/** Make a new sort with the given name and arity. */
inline TypeNode mkSortConstructor(const std::string& name, size_t arity);
}
}
-inline TypeNode NodeManager::mkSort() {
+inline TypeNode NodeManager::mkSort(uint32_t flags) {
NodeBuilder<1> nb(this, kind::SORT_TYPE);
Node sortTag = NodeBuilder<0>(this, kind::SORT_TAG);
nb << sortTag;
TypeNode tn = nb.constructTypeNode();
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
- (*i)->nmNotifyNewSort(tn);
+ (*i)->nmNotifyNewSort(tn, flags);
}
return tn;
}
-inline TypeNode NodeManager::mkSort(const std::string& name) {
+inline TypeNode NodeManager::mkSort(const std::string& name, uint32_t flags) {
NodeBuilder<1> nb(this, kind::SORT_TYPE);
Node sortTag = NodeBuilder<0>(this, kind::SORT_TAG);
nb << sortTag;
TypeNode tn = nb.constructTypeNode();
setAttribute(tn, expr::VarNameAttr(), name);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
- (*i)->nmNotifyNewSort(tn);
+ (*i)->nmNotifyNewSort(tn, flags);
}
return tn;
}
inline TypeNode NodeManager::mkSort(TypeNode constructor,
- const std::vector<TypeNode>& children) {
+ const std::vector<TypeNode>& children,
+ uint32_t flags) {
Assert(constructor.getKind() == kind::SORT_TYPE &&
constructor.getNumChildren() == 0,
"expected a sort constructor");
TypeNode type = nb.constructTypeNode();
setAttribute(type, expr::VarNameAttr(), name);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
- (*i)->nmNotifyInstantiateSortConstructor(constructor, type);
+ (*i)->nmNotifyInstantiateSortConstructor(constructor, type, flags);
}
return type;
}
* below. */
: identifier[id,CHECK_NONE,SYM_SORT] { PARSER_STATE->pushScope(); }
( LBRACKET identifier[id2,CHECK_UNDECLARED,SYM_SORT] {
- t = PARSER_STATE->mkSort(id2);
+ t = PARSER_STATE->mkSort(id2, ExprManager::SORT_FLAG_PLACEHOLDER);
params.push_back( t );
}
( COMMA identifier[id2,CHECK_UNDECLARED,SYM_SORT] {
- t = PARSER_STATE->mkSort(id2);
+ t = PARSER_STATE->mkSort(id2, ExprManager::SORT_FLAG_PLACEHOLDER);
params.push_back( t ); }
)* RBRACKET
)?
- { datatypes.push_back(Datatype(id,params));
+ { datatypes.push_back(Datatype(id, params));
if(!PARSER_STATE->isUnresolvedType(id)) {
// if not unresolved, must be undeclared
PARSER_STATE->checkDeclaration(id, CHECK_UNDECLARED, SYM_SORT);
}
SortType
-Parser::mkSort(const std::string& name) {
+Parser::mkSort(const std::string& name, uint32_t flags) {
Debug("parser") << "newSort(" << name << ")" << std::endl;
- Type type = d_exprManager->mkSort(name);
+ Type type = d_exprManager->mkSort(name, flags);
defineType(name, type);
return type;
}
}
SortType Parser::mkUnresolvedType(const std::string& name) {
- SortType unresolved = mkSort(name);
+ SortType unresolved = mkSort(name, ExprManager::SORT_FLAG_PLACEHOLDER);
d_unresolved.insert(unresolved);
return unresolved;
}
/**
* Creates a new sort with the given name.
*/
- SortType mkSort(const std::string& name);
+ SortType mkSort(const std::string& name,
+ uint32_t flags = ExprManager::SORT_FLAG_NONE);
/**
* Creates a new sort constructor with the given name and arity.
d_smt.d_nodeManager->unsubscribeEvents(this);
}
- void nmNotifyNewSort(TypeNode tn) {
+ void nmNotifyNewSort(TypeNode tn, uint32_t flags) {
DeclareTypeCommand c(tn.getAttribute(expr::VarNameAttr()),
0,
tn.toType());
- d_smt.addToModelCommandAndDump(c);
+ if((flags & ExprManager::SORT_FLAG_PLACEHOLDER) == 0) {
+ d_smt.addToModelCommandAndDump(c, flags);
+ }
}
void nmNotifyNewSortConstructor(TypeNode tn) {
* Add to Model command. This is used for recording a command
* that should be reported during a get-model call.
*/
- void addToModelCommandAndDump(const Command& c, uint32_t flags = ExprManager::VAR_FLAG_NONE, bool userVisible = true, const char* dumpTag = "declarations");
+ void addToModelCommandAndDump(const Command& c, uint32_t flags = 0, bool userVisible = true, const char* dumpTag = "declarations");
/**
* Get the model (only if immediately preceded by a SAT