mirror of
https://github.com/Z3Prover/z3
synced 2025-05-08 16:25:48 +00:00
working on new parameter framework
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
be5f933201
commit
589f096e6e
36 changed files with 436 additions and 377 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,6 @@ Revision History:
|
|||
|
||||
#include"cmd_context.h"
|
||||
|
||||
bool parse_smt2_commands(cmd_context & ctx, std::istream & is, bool interactive = false);
|
||||
bool parse_smt2_commands(cmd_context & ctx, std::istream & is, bool interactive = false, params_ref const & p = params_ref());
|
||||
|
||||
#endif
|
||||
|
|
|
@ -17,6 +17,7 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include"smt2scanner.h"
|
||||
#include"parser_params.hpp"
|
||||
|
||||
namespace smt2 {
|
||||
|
||||
|
@ -241,7 +242,7 @@ namespace smt2 {
|
|||
}
|
||||
}
|
||||
|
||||
scanner::scanner(cmd_context & ctx, std::istream& stream, bool interactive):
|
||||
scanner::scanner(cmd_context & ctx, std::istream& stream, bool interactive, params_ref const & _p):
|
||||
m_ctx(ctx),
|
||||
m_interactive(interactive),
|
||||
m_spos(0),
|
||||
|
@ -253,6 +254,10 @@ namespace smt2 {
|
|||
m_bend(0),
|
||||
m_stream(stream),
|
||||
m_cache_input(false) {
|
||||
|
||||
parser_params p(_p);
|
||||
m_smtlib2_compliant = p.smt2_compliant();
|
||||
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
m_normalized[i] = (char) i;
|
||||
}
|
||||
|
@ -325,7 +330,7 @@ namespace smt2 {
|
|||
case '#':
|
||||
return read_bv_literal();
|
||||
case '-':
|
||||
if (m_ctx.is_smtlib2_compliant())
|
||||
if (m_smtlib2_compliant)
|
||||
return read_symbol();
|
||||
else
|
||||
return read_signed_number();
|
||||
|
|
|
@ -55,6 +55,8 @@ namespace smt2 {
|
|||
svector<char> m_cache;
|
||||
svector<char> m_cache_result;
|
||||
|
||||
bool m_smtlib2_compliant;
|
||||
|
||||
char curr() const { return m_curr; }
|
||||
void new_line() { m_line++; m_spos = 0; }
|
||||
void next();
|
||||
|
@ -74,7 +76,7 @@ namespace smt2 {
|
|||
EOF_TOKEN
|
||||
};
|
||||
|
||||
scanner(cmd_context & ctx, std::istream& stream, bool interactive = false);
|
||||
scanner(cmd_context & ctx, std::istream& stream, bool interactive = false, params_ref const & p = params_ref());
|
||||
|
||||
~scanner() {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue