3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 11:55:51 +00:00

add tokens to parse strings

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2015-12-04 12:09:15 -08:00
parent 4bbe1d4674
commit 75c935a4cb
3 changed files with 174 additions and 16 deletions

View file

@ -24,7 +24,8 @@ Revision History:
enum seq_sort_kind {
SEQ_SORT,
RE_SORT
RE_SORT,
STRING_SORT
};
enum seq_op_kind {
@ -60,6 +61,35 @@ enum seq_op_kind {
OP_RE_OF_SEQ,
OP_RE_OF_PRED,
OP_RE_MEMBER,
// string specific operators.
OP_STRING_CONST,
OP_STRING_CONCAT,
OP_STRING_LENGTH,
OP_STRING_SUBSTR,
OP_STRING_STRCTN,
OP_STRING_CHARAT,
OP_STRING_STRIDOF,
OP_STRING_STRREPL,
OP_STRING_PREFIX,
OP_STRING_SUFFIX,
OP_STRING_ITOS,
OP_STRING_STOI,
//OP_STRING_U16TOS,
//OP_STRING_STOU16,
//OP_STRING_U32TOS,
//OP_STRING_STOU32,
OP_STRING_IN_REGEXP,
OP_STRING_TO_REGEXP,
OP_REGEXP_CONCAT,
OP_REGEXP_UNION,
OP_REGEXP_INTER,
OP_REGEXP_STAR,
OP_REGEXP_PLUS,
OP_REGEXP_OPT,
OP_REGEXP_RANGE,
OP_REGEXP_LOOP,
LAST_SEQ_OP
};
@ -83,7 +113,9 @@ class seq_decl_plugin : public decl_plugin {
};
ptr_vector<psig> m_sigs;
bool m_init;
bool m_init;
symbol m_stringc_sym;
sort* m_string;
void match(psig& sig, unsigned dsz, sort* const* dom, sort* range, sort_ref& rng);
@ -95,6 +127,8 @@ class seq_decl_plugin : public decl_plugin {
void init();
virtual void set_manager(ast_manager * m, family_id id);
public:
seq_decl_plugin();
@ -116,7 +150,20 @@ public:
virtual bool is_unique_value(app * e) const { return is_value(e); }
app* mk_string(symbol const& s);
};
class seq_util {
ast_manager& m;
seq_decl_plugin& seq;
public:
seq_util(ast_manager& m):
m(m),
seq(*static_cast<seq_decl_plugin*>(m.get_plugin(m.mk_family_id("seq")))) {
}
~seq_util() {}
app* mk_string(symbol const& s);
};
#endif /* SEQ_DECL_PLUGIN_H_ */