3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-18 02:16:40 +00:00

working on new parameter framework

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2012-12-01 15:54:34 -08:00
parent be5f933201
commit 589f096e6e
36 changed files with 436 additions and 377 deletions

View file

@ -28,7 +28,7 @@ Revision History:
#include"rewriter.h"
#include"has_free_vars.h"
#include"ast_smt2_pp.h"
#include"front_end_params.h"
#include"parser_params.hpp"
namespace smt2 {
typedef cmd_exception parser_exception;
@ -106,9 +106,14 @@ namespace smt2 {
ast_manager & m() const { return m_ctx.m(); }
pdecl_manager & pm() const { return m_ctx.pm(); }
sexpr_manager & sm() const { return m_ctx.sm(); }
bool m_ignore_user_patterns;
bool m_ignore_bad_patterns;
bool m_display_error_for_vs;
bool ignore_user_patterns() const { return m_ctx.params().m_ignore_user_patterns; }
bool ignore_bad_patterns() const { return m_ctx.params().m_ignore_bad_patterns; }
bool ignore_user_patterns() const { return m_ignore_user_patterns; }
bool ignore_bad_patterns() const { return m_ignore_bad_patterns; }
bool use_vs_format() const { return m_display_error_for_vs; }
struct psort_frame {
psort_decl * m_decl;
@ -383,8 +388,6 @@ namespace smt2 {
void check_int(char const * msg) { if (!curr_is_int()) throw parser_exception(msg); }
void check_float(char const * msg) { if (!curr_is_float()) throw parser_exception(msg); }
bool use_vs_format() const { return m_ctx.params().m_display_error_for_vs; }
void error(unsigned line, unsigned pos, char const * msg) {
if (use_vs_format()) {
m_ctx.diagnostic_stream() << "Z3(" << line << ", " << pos << "): ERROR: " << msg;
@ -2354,9 +2357,9 @@ namespace smt2 {
}
public:
parser(cmd_context & ctx, std::istream & is, bool interactive):
parser(cmd_context & ctx, std::istream & is, bool interactive, params_ref const & _p):
m_ctx(ctx),
m_scanner(ctx, is, interactive),
m_scanner(ctx, is, interactive, _p),
m_curr(scanner::NULL_TOKEN),
m_curr_cmd(0),
m_num_bindings(0),
@ -2393,6 +2396,11 @@ namespace smt2 {
m_num_open_paren(0) {
// the following assertion does not hold if ctx was already attached to an AST manager before the parser object is created.
// SASSERT(!m_ctx.has_manager());
parser_params p(_p);
m_ignore_user_patterns = p.ignore_user_patterns();
m_ignore_bad_patterns = p.ignore_bad_patterns();
m_display_error_for_vs = p.error_for_visual_studio();
}
~parser() {
@ -2487,8 +2495,8 @@ namespace smt2 {
};
};
bool parse_smt2_commands(cmd_context & ctx, std::istream & is, bool interactive) {
smt2::parser p(ctx, is, interactive);
bool parse_smt2_commands(cmd_context & ctx, std::istream & is, bool interactive, params_ref const & ps) {
smt2::parser p(ctx, is, interactive, ps);
return p();
}