mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 19:35:50 +00:00
overhaul of error messages. Add warning in dimacs conversion
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
e622022bf9
commit
1eb8ccad59
31 changed files with 298 additions and 313 deletions
|
@ -30,15 +30,6 @@ Revision History:
|
|||
|
||||
extern "C" {
|
||||
|
||||
|
||||
Z3_string Z3_API Z3_get_parser_error(Z3_context c) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_get_parser_error(c);
|
||||
RESET_ERROR_CODE();
|
||||
return mk_c(c)->m_parser_error_buffer.c_str();
|
||||
Z3_CATCH_RETURN("");
|
||||
}
|
||||
|
||||
// ---------------
|
||||
// Support for SMTLIB2
|
||||
|
||||
|
@ -70,16 +61,14 @@ extern "C" {
|
|||
try {
|
||||
if (!parse_smt2_commands(*ctx.get(), is)) {
|
||||
ctx = nullptr;
|
||||
mk_c(c)->m_parser_error_buffer = errstrm.str();
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR);
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR, errstrm.str().c_str());
|
||||
return of_ast_vector(v);
|
||||
}
|
||||
}
|
||||
catch (z3_exception& e) {
|
||||
errstrm << e.msg();
|
||||
mk_c(c)->m_parser_error_buffer = errstrm.str();
|
||||
ctx = nullptr;
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR);
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR, errstrm.str().c_str());
|
||||
return of_ast_vector(v);
|
||||
}
|
||||
ptr_vector<expr>::const_iterator it = ctx->begin_assertions();
|
||||
|
@ -118,7 +107,7 @@ extern "C" {
|
|||
LOG_Z3_parse_smtlib2_string(c, file_name, num_sorts, sort_names, sorts, num_decls, decl_names, decls);
|
||||
std::ifstream is(file_name);
|
||||
if (!is) {
|
||||
SET_ERROR_CODE(Z3_FILE_ACCESS_ERROR);
|
||||
SET_ERROR_CODE(Z3_FILE_ACCESS_ERROR, nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
Z3_ast_vector r = parse_smtlib2_stream(false, c, is, num_sorts, sort_names, sorts, num_decls, decl_names, decls);
|
||||
|
@ -141,15 +130,13 @@ extern "C" {
|
|||
ctx->set_diagnostic_stream(ous);
|
||||
try {
|
||||
if (!parse_smt2_commands(*ctx.get(), is)) {
|
||||
mk_c(c)->m_parser_error_buffer = ous.str();
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR);
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR, ous.str().c_str());
|
||||
RETURN_Z3(mk_c(c)->mk_external_string(ous.str()));
|
||||
}
|
||||
}
|
||||
catch (z3_exception& e) {
|
||||
if (ous.str().empty()) ous << e.msg();
|
||||
mk_c(c)->m_parser_error_buffer = ous.str();
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR);
|
||||
SET_ERROR_CODE(Z3_PARSER_ERROR, ous.str().c_str());
|
||||
RETURN_Z3(mk_c(c)->mk_external_string(ous.str()));
|
||||
}
|
||||
RETURN_Z3(mk_c(c)->mk_external_string(ous.str()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue