From d13b2981520e3d39039e8eb2c3c844de473a1e7c Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Fri, 23 Mar 2018 15:23:00 -0500 Subject: [PATCH] Remove abstract regular expression constant (#1698) --- src/expr/expr.i | 1 - src/expr/expr_manager.i | 1 - src/theory/strings/kinds | 9 +----- .../strings/theory_strings_type_rules.h | 8 ----- src/util/regexp.cpp | 4 --- src/util/regexp.h | 29 ------------------- src/util/regexp.i | 10 ------- 7 files changed, 1 insertion(+), 61 deletions(-) diff --git a/src/expr/expr.i b/src/expr/expr.i index d77981cc4..1d5207c93 100644 --- a/src/expr/expr.i +++ b/src/expr/expr.i @@ -153,7 +153,6 @@ namespace CVC4 { %template(getConstRational) CVC4::Expr::getConst; %template(getConstBitVector) CVC4::Expr::getConst; %template(getConstString) CVC4::Expr::getConst; -%template(getConstRegExp) CVC4::Expr::getConst; %template(getConstEmptySet) CVC4::Expr::getConst; %template(getConstBoolean) CVC4::Expr::getConst; diff --git a/src/expr/expr_manager.i b/src/expr/expr_manager.i index dac3b9312..df99af56d 100644 --- a/src/expr/expr_manager.i +++ b/src/expr/expr_manager.i @@ -71,7 +71,6 @@ %template(mkConst) CVC4::ExprManager::mkConst; %template(mkConst) CVC4::ExprManager::mkConst; %template(mkConst) CVC4::ExprManager::mkConst; -%template(mkConst) CVC4::ExprManager::mkConst; #ifdef SWIGPYTHON /* The python bindings cannot differentiate between bool and other basic * types like enum and int. Therefore, we rename mkConst for the bool diff --git a/src/theory/strings/kinds b/src/theory/strings/kinds index 3a5fd59e9..15dd5b423 100644 --- a/src/theory/strings/kinds +++ b/src/theory/strings/kinds @@ -42,7 +42,7 @@ sort STRING_TYPE \ sort REGEXP_TYPE \ Cardinality::INTEGERS \ well-founded \ - "NodeManager::currentNM()->mkConst(::CVC4::RegExp())" \ + "NodeManager::currentNM()->mkNode(REGEXP_EMPTY, std::vector() )" \ "util/regexp.h" \ "RegExp type" @@ -60,14 +60,7 @@ constant CONST_STRING \ "util/regexp.h" \ "a string of characters" -constant CONST_REGEXP \ - ::CVC4::RegExp \ - ::CVC4::RegExpHashFunction \ - "util/regexp.h" \ - "a regular expression" - typerule CONST_STRING ::CVC4::theory::strings::StringConstantTypeRule -typerule CONST_REGEXP ::CVC4::theory::strings::RegExpConstantTypeRule # equal equal / less than / output operator STRING_TO_REGEXP 1 "convert string to regexp" diff --git a/src/theory/strings/theory_strings_type_rules.h b/src/theory/strings/theory_strings_type_rules.h index 176398776..da1b71fff 100644 --- a/src/theory/strings/theory_strings_type_rules.h +++ b/src/theory/strings/theory_strings_type_rules.h @@ -235,14 +235,6 @@ public: } }; -class RegExpConstantTypeRule { -public: - inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) - { - return nodeManager->regExpType(); - } -}; - class RegExpConcatTypeRule { public: inline static TypeNode computeType(NodeManager* nodeManager, TNode n, bool check) diff --git a/src/util/regexp.cpp b/src/util/regexp.cpp index a7e5131ec..9aaad522a 100644 --- a/src/util/regexp.cpp +++ b/src/util/regexp.cpp @@ -404,8 +404,4 @@ std::ostream &operator<<(std::ostream &os, const String &s) { return os << "\"" << s.toString(true) << "\""; } -std::ostream &operator<<(std::ostream &out, const RegExp &s) { - return out << "regexp(" << s.getType() << ')'; -} - } // namespace CVC4 diff --git a/src/util/regexp.h b/src/util/regexp.h index efbb4579d..42d232259 100644 --- a/src/util/regexp.h +++ b/src/util/regexp.h @@ -197,35 +197,6 @@ struct CVC4_PUBLIC StringHashFunction { std::ostream& operator<<(std::ostream& os, const String& s) CVC4_PUBLIC; -class CVC4_PUBLIC RegExp { - public: - RegExp() : d_type(1) {} - explicit RegExp(const int t) : d_type(t) {} - - bool operator==(const RegExp& y) const { return d_type == y.d_type; } - bool operator!=(const RegExp& y) const { return d_type != y.d_type; } - bool operator<(const RegExp& y) const { return d_type < y.d_type; } - bool operator>(const RegExp& y) const { return d_type > y.d_type; } - bool operator<=(const RegExp& y) const { return d_type <= y.d_type; } - bool operator>=(const RegExp& y) const { return d_type >= y.d_type; } - - int getType() const { return d_type; } - - private: - int d_type; -}; /* class RegExp */ - -/** - * Hash function for the RegExp constants. - */ -struct CVC4_PUBLIC RegExpHashFunction { - inline size_t operator()(const RegExp& s) const { - return (size_t)s.getType(); - } -}; /* struct RegExpHashFunction */ - -std::ostream& operator<<(std::ostream& os, const RegExp& s) CVC4_PUBLIC; - } // namespace CVC4 #endif /* __CVC4__REGEXP_H */ diff --git a/src/util/regexp.i b/src/util/regexp.i index 9f9826663..afc51abd7 100644 --- a/src/util/regexp.i +++ b/src/util/regexp.i @@ -16,19 +16,9 @@ %rename(greater) CVC4::String::operator>(const String&) const; %rename(greaterEqual) CVC4::String::operator>=(const String&) const; -%rename(assign) CVC4::RegExp::operator=(const RegExp&); -%rename(equals) CVC4::RegExp::operator==(const RegExp&) const; -%ignore CVC4::RegExp::operator!=(const RegExp&) const; -%rename(less) CVC4::RegExp::operator<(const RegExp&) const; -%rename(lessEqual) CVC4::RegExp::operator<=(const RegExp&) const; -%rename(greater) CVC4::RegExp::operator>(const RegExp&) const; -%rename(greaterEqual) CVC4::RegExp::operator>=(const RegExp&) const; - %rename(apply) CVC4::strings::StringHashFunction::operator()(const ::CVC4::String&) const; -%rename(apply) CVC4::RegExpHashFunction::operator()(const RegExp&) const; %ignore CVC4::operator<<(std::ostream&, const String&); -%ignore CVC4::operator<<(std::ostream&, const RegExp&); %apply int &OUTPUT { int &c }; %include "util/regexp.h" -- 2.30.2