CVC5_API_TRY_CATCH_END;
}
+Term Solver::mkRegexpAll() const
+{
+ CVC5_API_TRY_CATCH_BEGIN;
+ //////// all checks before this line
+ Node res = d_nodeMgr->mkNode(
+ cvc5::kind::REGEXP_STAR,
+ d_nodeMgr->mkNode(cvc5::kind::REGEXP_ALLCHAR, std::vector<cvc5::Node>()));
+ (void)res.getType(true); /* kick off type checking */
+ return Term(this, res);
+ ////////
+ CVC5_API_TRY_CATCH_END;
+}
+
Term Solver::mkRegexpNone() const
{
CVC5_API_TRY_CATCH_BEGIN;
Term mkReal(int64_t num, int64_t den) const;
/**
- * Create a regular expression none (re.none) term.
- * @return the empty term
+ * Create a regular expression all (re.all) term.
+ * @return the all term
*/
- Term mkRegexpNone() const;
+ Term mkRegexpAll() const;
/**
* Create a regular expression allchar (re.allchar) term.
- * @return the sigma term
+ * @return the allchar term
*/
Term mkRegexpAllchar() const;
+ /**
+ * Create a regular expression none (re.none) term.
+ * @return the none term
+ */
+ Term mkRegexpNone() const;
+
/**
* Create a constant representing an empty set of the given sort.
* @param sort the sort of the set elements.
private native long mkReal(long pointer, long num, long den);
/**
- * Create a regular expression empty term.
- * @return the empty term
+ * Create a regular expression none (re.none) term.
+ * @return the none term
*/
public Term mkRegexpNone()
{
private native long mkRegexpNone(long pointer);
/**
- * Create a regular expression sigma term.
- * @return the sigma term
+ * Create a regular expression all (re.all) term.
+ * @return the all term
+ */
+ public Term mkRegexpAll()
+ {
+ long termPointer = mkRegexpAll(pointer);
+ return new Term(this, termPointer);
+ }
+
+ private native long mkRegexpAll(long pointer);
+
+ /**
+ * Create a regular expression allchar (re.allchar) term.
+ * @return the allchar term
*/
public Term mkRegexpAllchar()
{
CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
}
+/*
+ * Class: io_github_cvc5_api_Solver
+ * Method: mkRegexpAll
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_io_github_cvc5_api_Solver_mkRegexpAll(JNIEnv* env, jobject, jlong pointer)
+{
+ CVC5_JAVA_API_TRY_CATCH_BEGIN;
+ Solver* solver = reinterpret_cast<Solver*>(pointer);
+ Term* retPointer = new Term(solver->mkRegexpAll());
+ return reinterpret_cast<jlong>(retPointer);
+ CVC5_JAVA_API_TRY_CATCH_END_RETURN(env, 0);
+}
+
/*
* Class: io_github_cvc5_api_Solver
* Method: mkRegexpAllchar
Term mkInteger(const uint64_t i) except +
Term mkInteger(const string& s) except +
Term mkReal(const string& s) except +
- Term mkRegexpNone() except +
+ Term mkRegexpAll() except +
Term mkRegexpAllchar() except +
+ Term mkRegexpNone() except +
Term mkEmptySet(Sort s) except +
Term mkEmptyBag(Sort s) except +
Term mkSepEmp() except +
term.cterm = self.csolver.mkReal("{}/{}".format(val, den).encode())
return term
- def mkRegexpNone(self):
- """Create a regular expression empty term.
+ def mkRegexpAll(self):
+ """Create a regular expression all (re.all) term.
- :return: the empty term
+ :return: the all term
"""
cdef Term term = Term(self)
- term.cterm = self.csolver.mkRegexpNone()
+ term.cterm = self.csolver.mkRegexpAll()
return term
def mkRegexpAllchar(self):
- """Create a regular expression sigma term.
+ """Create a regular expression allchar (re.allchar) term.
- :return: the sigma term
+ :return: the allchar term
"""
cdef Term term = Term(self)
term.cterm = self.csolver.mkRegexpAllchar()
return term
+ def mkRegexpNone(self):
+ """Create a regular expression none (re.none) term.
+
+ :return: the none term
+ """
+ cdef Term term = Term(self)
+ term.cterm = self.csolver.mkRegexpNone()
+ return term
+
def mkEmptySet(self, Sort s):
"""Create a constant representing an empty set of the given sort.
}
void Smt2::addStringOperators() {
- defineVar(
- "re.all",
- getSolver()->mkTerm(api::REGEXP_STAR, getSolver()->mkRegexpAllchar()));
+ defineVar("re.all", getSolver()->mkRegexpAll());
addOperator(api::STRING_CONCAT, "str.++");
addOperator(api::STRING_LENGTH, "str.len");
addOperator(api::STRING_SUBSTR, "str.substr");
ASSERT_NO_THROW(d_solver.mkReal(val4, val4));
}
-TEST_F(TestApiBlackSolver, mkRegexpNone)
+TEST_F(TestApiBlackSolver, mkRegexpAll)
{
Sort strSort = d_solver.getStringSort();
Term s = d_solver.mkConst(strSort, "s");
- ASSERT_NO_THROW(
- d_solver.mkTerm(STRING_IN_REGEXP, s, d_solver.mkRegexpNone()));
+ ASSERT_NO_THROW(d_solver.mkTerm(STRING_IN_REGEXP, s, d_solver.mkRegexpAll()));
}
TEST_F(TestApiBlackSolver, mkRegexpAllchar)
d_solver.mkTerm(STRING_IN_REGEXP, s, d_solver.mkRegexpAllchar()));
}
+TEST_F(TestApiBlackSolver, mkRegexpNone)
+{
+ Sort strSort = d_solver.getStringSort();
+ Term s = d_solver.mkConst(strSort, "s");
+ ASSERT_NO_THROW(
+ d_solver.mkTerm(STRING_IN_REGEXP, s, d_solver.mkRegexpNone()));
+}
+
TEST_F(TestApiBlackSolver, mkSepEmp) { ASSERT_NO_THROW(d_solver.mkSepEmp()); }
TEST_F(TestApiBlackSolver, mkSepNil)
assertDoesNotThrow(() -> d_solver.mkTerm(STRING_IN_REGEXP, s, d_solver.mkRegexpNone()));
}
+ @Test void mkRegexpAll()
+ {
+ Sort strSort = d_solver.getStringSort();
+ Term s = d_solver.mkConst(strSort, "s");
+ assertDoesNotThrow(() -> d_solver.mkTerm(STRING_IN_REGEXP, s, d_solver.mkRegexpAll()));
+ }
+
@Test void mkRegexpAllchar()
{
Sort strSort = d_solver.getStringSort();
solver.mkReal(val4, val4)
-def test_mk_regexp_empty(solver):
+def test_mk_regexp_none(solver):
strSort = solver.getStringSort()
s = solver.mkConst(strSort, "s")
solver.mkTerm(kinds.StringInRegexp, s, solver.mkRegexpNone())
-def test_mk_regexp_sigma(solver):
+def test_mk_regexp_all(solver):
+ strSort = solver.getStringSort()
+ s = solver.mkConst(strSort, "s")
+ solver.mkTerm(kinds.StringInRegexp, s, solver.mkRegexpAll())
+
+
+def test_mk_regexp_allchar(solver):
strSort = solver.getStringSort()
s = solver.mkConst(strSort, "s")
solver.mkTerm(kinds.StringInRegexp, s, solver.mkRegexpAllchar())