mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
Merge branch 'develop' into upstream-master
Conflicts: .gitignore README src/ast/ast_smt2_pp.h src/ast/ast_smt_pp.cpp src/ast/reg_decl_plugins.cpp src/cmd_context/cmd_context.cpp src/parsers/smt2/smt2parser.cpp
This commit is contained in:
commit
d79837eed0
17 changed files with 5647 additions and 8 deletions
|
@ -17,6 +17,7 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include<sstream>
|
||||
#include<cstring>
|
||||
#include"ast.h"
|
||||
#include"ast_pp.h"
|
||||
#include"ast_ll_pp.h"
|
||||
|
@ -58,6 +59,7 @@ parameter& parameter::operator=(parameter const& other) {
|
|||
case PARAM_SYMBOL: new (m_symbol) symbol(other.get_symbol()); break;
|
||||
case PARAM_RATIONAL: new (m_rational) rational(other.get_rational()); break;
|
||||
case PARAM_DOUBLE: m_dval = other.m_dval; break;
|
||||
case PARAM_STRING: m_string = other.m_string; break;
|
||||
case PARAM_EXTERNAL: m_ext_id = other.m_ext_id; break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -90,6 +92,7 @@ bool parameter::operator==(parameter const & p) const {
|
|||
case PARAM_SYMBOL: return get_symbol() == p.get_symbol();
|
||||
case PARAM_RATIONAL: return get_rational() == p.get_rational();
|
||||
case PARAM_DOUBLE: return m_dval == p.m_dval;
|
||||
case PARAM_STRING: return (m_string == NULL && p.m_string == NULL) || strcmp(m_string, p.m_string)==0;
|
||||
case PARAM_EXTERNAL: return m_ext_id == p.m_ext_id;
|
||||
default: UNREACHABLE(); return false;
|
||||
}
|
||||
|
@ -103,6 +106,7 @@ unsigned parameter::hash() const {
|
|||
case PARAM_SYMBOL: b = get_symbol().hash(); break;
|
||||
case PARAM_RATIONAL: b = get_rational().hash(); break;
|
||||
case PARAM_DOUBLE: b = static_cast<unsigned>(m_dval); break;
|
||||
case PARAM_STRING: /* TODO */ b = 42; break;
|
||||
case PARAM_EXTERNAL: b = m_ext_id; break;
|
||||
}
|
||||
return (b << 2) | m_kind;
|
||||
|
@ -115,6 +119,7 @@ std::ostream& parameter::display(std::ostream& out) const {
|
|||
case PARAM_RATIONAL: return out << get_rational();
|
||||
case PARAM_AST: return out << "#" << get_ast()->get_id();
|
||||
case PARAM_DOUBLE: return out << m_dval;
|
||||
case PARAM_STRING: return out << m_string;
|
||||
case PARAM_EXTERNAL: return out << "@" << m_ext_id;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
PARAM_SYMBOL,
|
||||
PARAM_RATIONAL,
|
||||
PARAM_DOUBLE,
|
||||
PARAM_STRING,
|
||||
// PARAM_EXTERNAL is used for handling decl_plugin specific parameters.
|
||||
// For example, it is used for handling mpf numbers in float_decl_plugin,
|
||||
// and irrational algebraic numbers in arith_decl_plugin.
|
||||
|
@ -105,6 +106,7 @@ private:
|
|||
char m_symbol[sizeof(symbol)]; // for PARAM_SYMBOL
|
||||
char m_rational[sizeof(rational)]; // for PARAM_RATIONAL
|
||||
double m_dval; // for PARAM_DOUBLE (remark: this is not used in float_decl_plugin)
|
||||
const char* m_string; // for PARAM_STRING
|
||||
unsigned m_ext_id; // for PARAM_EXTERNAL
|
||||
};
|
||||
|
||||
|
@ -117,6 +119,9 @@ public:
|
|||
explicit parameter(symbol const & s): m_kind(PARAM_SYMBOL) { new (m_symbol) symbol(s); }
|
||||
explicit parameter(rational const & r): m_kind(PARAM_RATIONAL) { new (m_rational) rational(r); }
|
||||
explicit parameter(double d):m_kind(PARAM_DOUBLE), m_dval(d) {}
|
||||
explicit parameter(const char *s):m_kind(PARAM_STRING), m_string(s) {
|
||||
TRACE("parse_string", tout << "parameter(const char *): " << s << "\n";);
|
||||
}
|
||||
explicit parameter(unsigned ext_id, bool):m_kind(PARAM_EXTERNAL), m_ext_id(ext_id) {}
|
||||
parameter(parameter const&);
|
||||
|
||||
|
@ -130,6 +135,7 @@ public:
|
|||
bool is_symbol() const { return m_kind == PARAM_SYMBOL; }
|
||||
bool is_rational() const { return m_kind == PARAM_RATIONAL; }
|
||||
bool is_double() const { return m_kind == PARAM_DOUBLE; }
|
||||
bool is_string() const { return m_kind == PARAM_STRING; }
|
||||
bool is_external() const { return m_kind == PARAM_EXTERNAL; }
|
||||
|
||||
bool is_int(int & i) const { return is_int() && (i = get_int(), true); }
|
||||
|
@ -137,6 +143,7 @@ public:
|
|||
bool is_symbol(symbol & s) const { return is_symbol() && (s = get_symbol(), true); }
|
||||
bool is_rational(rational & r) const { return is_rational() && (r = get_rational(), true); }
|
||||
bool is_double(double & d) const { return is_double() && (d = get_double(), true); }
|
||||
// TODO is_string(char*)
|
||||
bool is_external(unsigned & id) const { return is_external() && (id = get_ext_id(), true); }
|
||||
|
||||
/**
|
||||
|
@ -156,6 +163,7 @@ public:
|
|||
symbol const & get_symbol() const { SASSERT(is_symbol()); return *(reinterpret_cast<const symbol *>(m_symbol)); }
|
||||
rational const & get_rational() const { SASSERT(is_rational()); return *(reinterpret_cast<const rational *>(m_rational)); }
|
||||
double get_double() const { SASSERT(is_double()); return m_dval; }
|
||||
const char * get_string() const { SASSERT(is_string()); return m_string; }
|
||||
unsigned get_ext_id() const { SASSERT(is_external()); return m_ext_id; }
|
||||
|
||||
bool operator==(parameter const & p) const;
|
||||
|
|
|
@ -304,6 +304,18 @@ format * smt2_pp_environment::mk_float(rational const & val) const {
|
|||
return mk_string(get_manager(), s.c_str());
|
||||
}
|
||||
|
||||
format * smt2_pp_environment::pp_str_literal(app * t) {
|
||||
TRACE("parse_string", tout << "pp_str_literal\n";);
|
||||
str_util & u = get_strutil();
|
||||
SASSERT(u.is_string(t));
|
||||
const char * val;
|
||||
u.is_string(t, &val);
|
||||
ast_manager & m = get_manager();
|
||||
string_buffer<> buf;
|
||||
buf << "\"" << val << "\"";
|
||||
return mk_string(m, buf.c_str());
|
||||
}
|
||||
|
||||
format * smt2_pp_environment::pp_arith_literal(app * t, bool decimal, unsigned decimal_prec) {
|
||||
arith_util & u = get_autil();
|
||||
SASSERT(u.is_numeral(t) || u.is_irrational_algebraic_numeral(t));
|
||||
|
@ -614,6 +626,9 @@ class smt2_printer {
|
|||
else if (m_env.get_dlutil().is_numeral(c)) {
|
||||
f = m_env.pp_datalog_literal(c);
|
||||
}
|
||||
else if (m_env.get_strutil().is_string(c)) {
|
||||
f = m_env.pp_str_literal(c);
|
||||
}
|
||||
else {
|
||||
buffer<symbol> names;
|
||||
if (m().is_label_lit(c, names)) {
|
||||
|
|
|
@ -30,6 +30,7 @@ Revision History:
|
|||
#include"fpa_decl_plugin.h"
|
||||
#include"dl_decl_plugin.h"
|
||||
#include"seq_decl_plugin.h"
|
||||
#include"str_decl_plugin.h"
|
||||
#include"smt2_util.h"
|
||||
|
||||
class smt2_pp_environment {
|
||||
|
@ -49,12 +50,14 @@ public:
|
|||
virtual array_util & get_arutil() = 0;
|
||||
virtual fpa_util & get_futil() = 0;
|
||||
virtual seq_util & get_sutil() = 0;
|
||||
virtual str_util & get_strutil() = 0;
|
||||
virtual datalog::dl_decl_util& get_dlutil() = 0;
|
||||
virtual bool uses(symbol const & s) const = 0;
|
||||
virtual format_ns::format * pp_fdecl(func_decl * f, unsigned & len);
|
||||
virtual format_ns::format * pp_bv_literal(app * t, bool use_bv_lits, bool bv_neg);
|
||||
virtual format_ns::format * pp_arith_literal(app * t, bool decimal, unsigned prec);
|
||||
virtual format_ns::format * pp_float_literal(app * t, bool use_bv_lits, bool use_float_real_lits);
|
||||
virtual format_ns::format * pp_str_literal(app * t);
|
||||
virtual format_ns::format * pp_datalog_literal(app * t);
|
||||
virtual format_ns::format * pp_string_literal(app * t);
|
||||
virtual format_ns::format * pp_sort(sort * s);
|
||||
|
@ -74,15 +77,17 @@ class smt2_pp_environment_dbg : public smt2_pp_environment {
|
|||
array_util m_arutil;
|
||||
fpa_util m_futil;
|
||||
seq_util m_sutil;
|
||||
str_util m_strutil;
|
||||
datalog::dl_decl_util m_dlutil;
|
||||
public:
|
||||
smt2_pp_environment_dbg(ast_manager & m):m_manager(m), m_autil(m), m_bvutil(m), m_arutil(m), m_futil(m), m_sutil(m), m_dlutil(m) {}
|
||||
smt2_pp_environment_dbg(ast_manager & m):m_manager(m), m_autil(m), m_bvutil(m), m_arutil(m), m_futil(m), m_sutil(m), m_strutil(m), m_dlutil(m) {}
|
||||
virtual ast_manager & get_manager() const { return m_manager; }
|
||||
virtual arith_util & get_autil() { return m_autil; }
|
||||
virtual bv_util & get_bvutil() { return m_bvutil; }
|
||||
virtual seq_util & get_sutil() { return m_sutil; }
|
||||
virtual array_util & get_arutil() { return m_arutil; }
|
||||
virtual fpa_util & get_futil() { return m_futil; }
|
||||
virtual str_util & get_strutil() { return m_strutil; }
|
||||
virtual datalog::dl_decl_util& get_dlutil() { return m_dlutil; }
|
||||
virtual bool uses(symbol const & s) const { return false; }
|
||||
};
|
||||
|
|
|
@ -24,6 +24,7 @@ Revision History:
|
|||
#include"ast_smt_pp.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"str_decl_plugin.h"
|
||||
#include"array_decl_plugin.h"
|
||||
#include"datatype_decl_plugin.h"
|
||||
#include"fpa_decl_plugin.h"
|
||||
|
@ -164,8 +165,10 @@ class smt_printer {
|
|||
bv_util m_bvutil;
|
||||
seq_util m_sutil;
|
||||
fpa_util m_futil;
|
||||
str_util m_strutil;
|
||||
family_id m_basic_fid;
|
||||
family_id m_bv_fid;
|
||||
family_id m_str_fid;
|
||||
family_id m_arith_fid;
|
||||
family_id m_array_fid;
|
||||
family_id m_dt_fid;
|
||||
|
@ -406,6 +409,7 @@ class smt_printer {
|
|||
|
||||
void visit_app(app* n) {
|
||||
rational val;
|
||||
const char *str;
|
||||
bool is_int, pos;
|
||||
buffer<symbol> names;
|
||||
unsigned bv_size;
|
||||
|
@ -469,6 +473,9 @@ class smt_printer {
|
|||
m_out << ") bv1[1])";
|
||||
}
|
||||
}
|
||||
else if (m_strutil.is_string(n, &str)) {
|
||||
m_out << "\"" << str << "\"";
|
||||
}
|
||||
else if (m_manager.is_label(n, pos, names) && names.size() >= 1) {
|
||||
if (m_is_smt2) {
|
||||
m_out << "(! ";
|
||||
|
@ -832,6 +839,7 @@ public:
|
|||
m_bvutil(m),
|
||||
m_sutil(m),
|
||||
m_futil(m),
|
||||
m_strutil(m),
|
||||
m_logic(logic),
|
||||
m_AUFLIRA("AUFLIRA"),
|
||||
// It's much easier to read those testcases with that.
|
||||
|
@ -844,6 +852,7 @@ public:
|
|||
m_bv_fid = m.mk_family_id("bv");
|
||||
m_arith_fid = m.mk_family_id("arith");
|
||||
m_array_fid = m.mk_family_id("array");
|
||||
m_str_fid = m.mk_family_id("str");
|
||||
m_dt_fid = m.mk_family_id("datatype");
|
||||
m_fpa_fid = m.mk_family_id("fpa");
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ Revision History:
|
|||
#include"seq_decl_plugin.h"
|
||||
#include"pb_decl_plugin.h"
|
||||
#include"fpa_decl_plugin.h"
|
||||
#include"str_decl_plugin.h"
|
||||
|
||||
void reg_decl_plugins(ast_manager & m) {
|
||||
if (!m.get_plugin(m.mk_family_id(symbol("arith")))) {
|
||||
|
@ -52,4 +53,7 @@ void reg_decl_plugins(ast_manager & m) {
|
|||
if (!m.get_plugin(m.mk_family_id(symbol("pb")))) {
|
||||
m.register_plugin(symbol("pb"), alloc(pb_decl_plugin));
|
||||
}
|
||||
if (!m.get_plugin(m.mk_family_id(symbol("str")))) {
|
||||
m.register_plugin(symbol("str"), alloc(str_decl_plugin));
|
||||
}
|
||||
}
|
||||
|
|
185
src/ast/str_decl_plugin.cpp
Normal file
185
src/ast/str_decl_plugin.cpp
Normal file
|
@ -0,0 +1,185 @@
|
|||
/*++
|
||||
Module Name:
|
||||
|
||||
str_decl_plugin.h
|
||||
|
||||
Abstract:
|
||||
|
||||
<abstract>
|
||||
|
||||
Author:
|
||||
|
||||
Murphy Berzish (mtrberzi) 2015-09-02.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#include<sstream>
|
||||
#include"str_decl_plugin.h"
|
||||
#include"string_buffer.h"
|
||||
#include"warning.h"
|
||||
#include"ast_pp.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
|
||||
str_decl_plugin::str_decl_plugin():
|
||||
m_strv_sym("String"),
|
||||
m_str_decl(0),
|
||||
m_concat_decl(0),
|
||||
m_length_decl(0),
|
||||
m_arith_plugin(0),
|
||||
m_arith_fid(0),
|
||||
m_int_sort(0){
|
||||
}
|
||||
|
||||
str_decl_plugin::~str_decl_plugin(){
|
||||
}
|
||||
|
||||
void str_decl_plugin::finalize(void) {
|
||||
#define DEC_REF(decl) if (decl) { m_manager->dec_ref(decl); } ((void) 0)
|
||||
DEC_REF(m_str_decl);
|
||||
DEC_REF(m_concat_decl);
|
||||
DEC_REF(m_length_decl);
|
||||
DEC_REF(m_int_sort);
|
||||
}
|
||||
|
||||
void str_decl_plugin::set_manager(ast_manager * m, family_id id) {
|
||||
decl_plugin::set_manager(m, id);
|
||||
m_str_decl = m->mk_sort(symbol("String"), sort_info(id, STRING_SORT));
|
||||
m->inc_ref(m_str_decl);
|
||||
sort * s = m_str_decl;
|
||||
|
||||
SASSERT(m_manager->has_plugin(symbol("arith")));
|
||||
m_arith_fid = m_manager->mk_family_id("arith");
|
||||
m_arith_plugin = static_cast<arith_decl_plugin*>(m_manager->get_plugin(m_arith_fid));
|
||||
SASSERT(m_arith_plugin);
|
||||
|
||||
m_int_sort = m_manager->mk_sort(m_arith_fid, INT_SORT);
|
||||
SASSERT(m_int_sort != 0); // arith_decl_plugin must be installed before str_decl_plugin.
|
||||
m_manager->inc_ref(m_int_sort);
|
||||
sort * i = m_int_sort;
|
||||
|
||||
#define MK_OP(FIELD, NAME, KIND, SORT) \
|
||||
FIELD = m->mk_func_decl(symbol(NAME), SORT, SORT, SORT, func_decl_info(id, KIND)); \
|
||||
m->inc_ref(FIELD)
|
||||
|
||||
MK_OP(m_concat_decl, "Concat", OP_STRCAT, s);
|
||||
|
||||
m_length_decl = m->mk_func_decl(symbol("Length"), s, i, func_decl_info(id, OP_STRLEN)); m_manager->inc_ref(m_length_decl);
|
||||
}
|
||||
|
||||
decl_plugin * str_decl_plugin::mk_fresh() {
|
||||
return alloc(str_decl_plugin);
|
||||
}
|
||||
|
||||
sort * str_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) {
|
||||
switch (k) {
|
||||
case STRING_SORT: return m_str_decl;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
func_decl * str_decl_plugin::mk_func_decl(decl_kind k) {
|
||||
switch(k) {
|
||||
case OP_STRCAT: return m_concat_decl;
|
||||
case OP_STRLEN: return m_length_decl;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
func_decl * str_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
||||
unsigned arity, sort * const * domain, sort * range) {
|
||||
if (k == OP_STR) {
|
||||
m_manager->raise_exception("OP_STR not yet implemented in mk_func_decl!");
|
||||
return 0;
|
||||
}
|
||||
if (arity == 0) {
|
||||
m_manager->raise_exception("no arguments supplied to string operator");
|
||||
return 0;
|
||||
}
|
||||
return mk_func_decl(k);
|
||||
}
|
||||
|
||||
app * str_decl_plugin::mk_string(std::string & val) {
|
||||
std::map<std::string, app*>::iterator it = string_cache.find(val);
|
||||
//if (it == string_cache.end()) {
|
||||
if (true) {
|
||||
char * new_buffer = alloc_svect(char, (val.length() + 1));
|
||||
strcpy(new_buffer, val.c_str());
|
||||
parameter p[1] = {parameter(new_buffer)};
|
||||
func_decl * d;
|
||||
d = m_manager->mk_const_decl(m_strv_sym, m_str_decl, func_decl_info(m_family_id, OP_STR, 1, p));
|
||||
app * str = m_manager->mk_const(d);
|
||||
string_cache[val] = str;
|
||||
return str;
|
||||
} else {
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
|
||||
app * str_decl_plugin::mk_string(const char * val) {
|
||||
std::string key(val);
|
||||
return mk_string(key);
|
||||
}
|
||||
|
||||
app * str_decl_plugin::mk_fresh_string() {
|
||||
// cheating.
|
||||
// take the longest string in the cache, append the letter "A", and call it fresh.
|
||||
std::string longestString = "";
|
||||
std::map<std::string, app*>::iterator it = string_cache.begin();
|
||||
for (; it != string_cache.end(); ++it) {
|
||||
if (it->first.length() > longestString.length()) {
|
||||
longestString = it->first;
|
||||
}
|
||||
}
|
||||
longestString += "A";
|
||||
return mk_string(longestString);
|
||||
}
|
||||
|
||||
void str_decl_plugin::get_op_names(svector<builtin_name> & op_names, symbol const & logic) {
|
||||
op_names.push_back(builtin_name("Concat", OP_STRCAT));
|
||||
op_names.push_back(builtin_name("Length", OP_STRLEN));
|
||||
}
|
||||
|
||||
void str_decl_plugin::get_sort_names(svector<builtin_name> & sort_names, symbol const & logic) {
|
||||
sort_names.push_back(builtin_name("String", STRING_SORT));
|
||||
}
|
||||
|
||||
bool str_decl_plugin::is_value(app * e) const {
|
||||
if (e->get_family_id() != m_family_id) {
|
||||
return false;
|
||||
}
|
||||
switch (e->get_decl_kind()) {
|
||||
case OP_STR:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool str_recognizers::is_string(expr const * n, const char ** val) const {
|
||||
if (!is_app_of(n, m_afid, OP_STR))
|
||||
return false;
|
||||
func_decl * decl = to_app(n)->get_decl();
|
||||
*val = decl->get_parameter(0).get_string();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool str_recognizers::is_string(expr const * n) const {
|
||||
const char * tmp = 0;
|
||||
return is_string(n, & tmp);
|
||||
}
|
||||
|
||||
std::string str_recognizers::get_string_constant_value(expr const *n) const {
|
||||
const char * cstr = 0;
|
||||
bool isString = is_string(n, & cstr);
|
||||
SASSERT(isString);
|
||||
std::string strval(cstr);
|
||||
return strval;
|
||||
}
|
||||
|
||||
str_util::str_util(ast_manager &m) :
|
||||
str_recognizers(m.mk_family_id(symbol("str"))),
|
||||
m_manager(m) {
|
||||
SASSERT(m.has_plugin(symbol("str")));
|
||||
m_plugin = static_cast<str_decl_plugin*>(m.get_plugin(m.mk_family_id(symbol("str"))));
|
||||
}
|
109
src/ast/str_decl_plugin.h
Normal file
109
src/ast/str_decl_plugin.h
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*++
|
||||
Module Name:
|
||||
|
||||
str_decl_plugin.h
|
||||
|
||||
Abstract:
|
||||
|
||||
<abstract>
|
||||
|
||||
Author:
|
||||
|
||||
Murphy Berzish (mtrberzi) 2015-09-02.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#ifndef _STR_DECL_PLUGIN_H_
|
||||
#define _STR_DECL_PLUGIN_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include<map>
|
||||
|
||||
enum str_sort_kind {
|
||||
STRING_SORT,
|
||||
};
|
||||
|
||||
enum str_op_kind {
|
||||
OP_STR, /* string constants */
|
||||
//
|
||||
OP_STRCAT,
|
||||
OP_STRLEN,
|
||||
LAST_STR_OP
|
||||
};
|
||||
|
||||
class str_decl_plugin : public decl_plugin {
|
||||
protected:
|
||||
symbol m_strv_sym;
|
||||
sort * m_str_decl;
|
||||
|
||||
func_decl * m_concat_decl;
|
||||
func_decl * m_length_decl;
|
||||
|
||||
arith_decl_plugin * m_arith_plugin;
|
||||
family_id m_arith_fid;
|
||||
sort * m_int_sort;
|
||||
|
||||
std::map<std::string, app*> string_cache;
|
||||
|
||||
virtual void set_manager(ast_manager * m, family_id id);
|
||||
|
||||
func_decl * mk_func_decl(decl_kind k);
|
||||
public:
|
||||
str_decl_plugin();
|
||||
virtual ~str_decl_plugin();
|
||||
virtual void finalize();
|
||||
|
||||
virtual decl_plugin * mk_fresh();
|
||||
virtual sort * mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters);
|
||||
virtual func_decl * mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
|
||||
unsigned arity, sort * const * domain, sort * range);
|
||||
|
||||
app * mk_string(const char * val);
|
||||
app * mk_string(std::string & val);
|
||||
app * mk_fresh_string();
|
||||
|
||||
virtual void get_op_names(svector<builtin_name> & op_names, symbol const & logic);
|
||||
virtual void get_sort_names(svector<builtin_name> & sort_names, symbol const & logic);
|
||||
|
||||
virtual bool is_value(app * e) const;
|
||||
virtual bool is_unique_value(app * e) const { return is_value(e); }
|
||||
// TODO
|
||||
};
|
||||
|
||||
class str_recognizers {
|
||||
family_id m_afid;
|
||||
public:
|
||||
str_recognizers(family_id fid):m_afid(fid) {}
|
||||
family_id get_fid() const { return m_afid; }
|
||||
family_id get_family_id() const { return get_fid(); }
|
||||
|
||||
bool is_string(expr const * n, const char ** val) const;
|
||||
bool is_string(expr const * n) const;
|
||||
|
||||
std::string get_string_constant_value(expr const *n) const;
|
||||
// TODO
|
||||
};
|
||||
|
||||
class str_util : public str_recognizers {
|
||||
ast_manager & m_manager;
|
||||
str_decl_plugin * m_plugin;
|
||||
public:
|
||||
str_util(ast_manager & m);
|
||||
ast_manager & get_manager() const { return m_manager; }
|
||||
str_decl_plugin & plugin() { return *m_plugin; }
|
||||
|
||||
app * mk_string(const char * val) {
|
||||
return m_plugin->mk_string(val);
|
||||
}
|
||||
app * mk_string(std::string & val) {
|
||||
return m_plugin->mk_string(val);
|
||||
}
|
||||
app * mk_fresh_string() {
|
||||
return m_plugin->mk_fresh_string();
|
||||
}
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif /* _STR_DECL_PLUGIN_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue