mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
starting regex support
This commit is contained in:
parent
4c34629806
commit
04803d7a3b
4 changed files with 157 additions and 5 deletions
|
@ -38,6 +38,9 @@ str_decl_plugin::str_decl_plugin():
|
|||
m_replace_decl(0),
|
||||
m_re_str2regex_decl(0),
|
||||
m_re_regexin_decl(0),
|
||||
m_re_regexconcat_decl(0),
|
||||
m_re_regexstar_decl(0),
|
||||
m_re_regexunion_decl(0),
|
||||
m_arith_plugin(0),
|
||||
m_arith_fid(0),
|
||||
m_int_sort(0){
|
||||
|
@ -63,6 +66,9 @@ void str_decl_plugin::finalize(void) {
|
|||
DEC_REF(m_replace_decl);
|
||||
DEC_REF(m_re_str2regex_decl);
|
||||
DEC_REF(m_re_regexin_decl);
|
||||
DEC_REF(m_re_regexconcat_decl);
|
||||
DEC_REF(m_re_regexstar_decl);
|
||||
DEC_REF(m_re_regexunion_decl);
|
||||
DEC_REF(m_int_sort);
|
||||
}
|
||||
|
||||
|
@ -139,6 +145,15 @@ void str_decl_plugin::set_manager(ast_manager * m, family_id id) {
|
|||
m_re_regexin_decl = m->mk_func_decl(symbol("RegexIn"), s, re, boolT, func_decl_info(id, OP_RE_REGEXIN));
|
||||
m_manager->inc_ref(m_re_regexin_decl);
|
||||
|
||||
m_re_regexconcat_decl = m->mk_func_decl(symbol("RegexConcat"), re, re, re, func_decl_info(id, OP_RE_REGEXCONCAT));
|
||||
m_manager->inc_ref(m_re_regexconcat_decl);
|
||||
|
||||
m_re_regexstar_decl = m->mk_func_decl(symbol("RegexStar"), re, re, func_decl_info(id, OP_RE_REGEXSTAR));
|
||||
m_manager->inc_ref(m_re_regexstar_decl);
|
||||
|
||||
m_re_regexunion_decl = m->mk_func_decl(symbol("RegexUnion"), re, re, re, func_decl_info(id, OP_RE_REGEXUNION));
|
||||
m_manager->inc_ref(m_re_regexunion_decl);
|
||||
|
||||
}
|
||||
|
||||
decl_plugin * str_decl_plugin::mk_fresh() {
|
||||
|
@ -168,6 +183,9 @@ func_decl * str_decl_plugin::mk_func_decl(decl_kind k) {
|
|||
case OP_STR_REPLACE: return m_replace_decl;
|
||||
case OP_RE_STR2REGEX: return m_re_str2regex_decl;
|
||||
case OP_RE_REGEXIN: return m_re_regexin_decl;
|
||||
case OP_RE_REGEXCONCAT: return m_re_regexconcat_decl;
|
||||
case OP_RE_REGEXSTAR: return m_re_regexstar_decl;
|
||||
case OP_RE_REGEXUNION: return m_re_regexunion_decl;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
@ -235,6 +253,9 @@ void str_decl_plugin::get_op_names(svector<builtin_name> & op_names, symbol cons
|
|||
op_names.push_back(builtin_name("Replace", OP_STR_REPLACE));
|
||||
op_names.push_back(builtin_name("Str2Reg", OP_RE_STR2REGEX));
|
||||
op_names.push_back(builtin_name("RegexIn", OP_RE_REGEXIN));
|
||||
op_names.push_back(builtin_name("RegexConcat", OP_RE_REGEXCONCAT));
|
||||
op_names.push_back(builtin_name("RegexStar", OP_RE_REGEXSTAR));
|
||||
op_names.push_back(builtin_name("RegexUnion", OP_RE_REGEXUNION));
|
||||
}
|
||||
|
||||
void str_decl_plugin::get_sort_names(svector<builtin_name> & sort_names, symbol const & logic) {
|
||||
|
|
|
@ -44,6 +44,9 @@ enum str_op_kind {
|
|||
// regular expression operators
|
||||
OP_RE_STR2REGEX,
|
||||
OP_RE_REGEXIN,
|
||||
OP_RE_REGEXCONCAT,
|
||||
OP_RE_REGEXSTAR,
|
||||
OP_RE_REGEXUNION,
|
||||
// end
|
||||
LAST_STR_OP
|
||||
};
|
||||
|
@ -69,6 +72,9 @@ protected:
|
|||
|
||||
func_decl * m_re_str2regex_decl;
|
||||
func_decl * m_re_regexin_decl;
|
||||
func_decl * m_re_regexconcat_decl;
|
||||
func_decl * m_re_regexstar_decl;
|
||||
func_decl * m_re_regexunion_decl;
|
||||
|
||||
arith_decl_plugin * m_arith_plugin;
|
||||
family_id m_arith_fid;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue