mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
theory_str Substr support WIP
This commit is contained in:
parent
be5bf7fb80
commit
fb20951064
4 changed files with 58 additions and 0 deletions
|
@ -33,6 +33,7 @@ str_decl_plugin::str_decl_plugin():
|
|||
m_indexof_decl(0),
|
||||
m_indexof2_decl(0),
|
||||
m_lastindexof_decl(0),
|
||||
m_substr_decl(0),
|
||||
m_arith_plugin(0),
|
||||
m_arith_fid(0),
|
||||
m_int_sort(0){
|
||||
|
@ -53,6 +54,7 @@ void str_decl_plugin::finalize(void) {
|
|||
DEC_REF(m_indexof_decl);
|
||||
DEC_REF(m_indexof2_decl);
|
||||
DEC_REF(m_lastindexof_decl);
|
||||
DEC_REF(m_substr_decl);
|
||||
DEC_REF(m_int_sort);
|
||||
}
|
||||
|
||||
|
@ -106,6 +108,12 @@ void str_decl_plugin::set_manager(ast_manager * m, family_id id) {
|
|||
|
||||
m_lastindexof_decl = m->mk_func_decl(symbol("LastIndexof"), s, s, i, func_decl_info(id, OP_STR_LASTINDEXOF));
|
||||
m_manager->inc_ref(m_lastindexof_decl);
|
||||
|
||||
{
|
||||
sort * d[3] = {s, i, i };
|
||||
m_substr_decl = m->mk_func_decl(symbol("Substring"), 3, d, s, func_decl_info(id, OP_STR_SUBSTR));
|
||||
m_manager->inc_ref(m_substr_decl);
|
||||
}
|
||||
}
|
||||
|
||||
decl_plugin * str_decl_plugin::mk_fresh() {
|
||||
|
@ -130,6 +138,7 @@ func_decl * str_decl_plugin::mk_func_decl(decl_kind k) {
|
|||
case OP_STR_INDEXOF: return m_indexof_decl;
|
||||
case OP_STR_INDEXOF2: return m_indexof2_decl;
|
||||
case OP_STR_LASTINDEXOF: return m_lastindexof_decl;
|
||||
case OP_STR_SUBSTR: return m_substr_decl;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
@ -193,6 +202,7 @@ void str_decl_plugin::get_op_names(svector<builtin_name> & op_names, symbol cons
|
|||
op_names.push_back(builtin_name("Indexof", OP_STR_INDEXOF));
|
||||
op_names.push_back(builtin_name("Indexof2", OP_STR_INDEXOF2));
|
||||
op_names.push_back(builtin_name("LastIndexof", OP_STR_LASTINDEXOF));
|
||||
op_names.push_back(builtin_name("Substring", OP_STR_SUBSTR));
|
||||
}
|
||||
|
||||
void str_decl_plugin::get_sort_names(svector<builtin_name> & sort_names, symbol const & logic) {
|
||||
|
|
|
@ -38,6 +38,7 @@ enum str_op_kind {
|
|||
OP_STR_INDEXOF,
|
||||
OP_STR_INDEXOF2,
|
||||
OP_STR_LASTINDEXOF,
|
||||
OP_STR_SUBSTR,
|
||||
// end
|
||||
LAST_STR_OP
|
||||
};
|
||||
|
@ -57,6 +58,7 @@ protected:
|
|||
func_decl * m_indexof_decl;
|
||||
func_decl * m_indexof2_decl;
|
||||
func_decl * m_lastindexof_decl;
|
||||
func_decl * m_substr_decl;
|
||||
|
||||
arith_decl_plugin * m_arith_plugin;
|
||||
family_id m_arith_fid;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue