From 26d3bdca35e0d6c656c53e15edcbc73f09a05c8c Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Fri, 15 Apr 2011 22:17:22 +0000 Subject: [PATCH] parser/driver fixes for last commit --- src/main/interactive_shell.cpp | 2 +- src/main/main.cpp | 4 ++-- src/parser/parser_builder.cpp | 16 ++++++++-------- src/parser/parser_builder.h | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/interactive_shell.cpp b/src/main/interactive_shell.cpp index dc9d0604d..cd7947e2e 100644 --- a/src/main/interactive_shell.cpp +++ b/src/main/interactive_shell.cpp @@ -37,7 +37,7 @@ InteractiveShell::InteractiveShell(ExprManager& exprManager, d_in(*options.in), d_out(*options.out), d_language(options.inputLanguage) { - ParserBuilder parserBuilder(exprManager,INPUT_FILENAME,options); + ParserBuilder parserBuilder(&exprManager,INPUT_FILENAME,options); /* Create parser with bogus input. */ d_parser = parserBuilder.withStringInput("").build(); }/* InteractiveShell::InteractiveShell() */ diff --git a/src/main/main.cpp b/src/main/main.cpp index 56c4bb422..23e6cd2ea 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -259,7 +259,7 @@ int runCvc4(int argc, char* argv[]) { Parser* replayParser = NULL; if( options.replayFilename != "" ) { - ParserBuilder replayParserBuilder(exprMgr, options.replayFilename, options); + ParserBuilder replayParserBuilder(&exprMgr, options.replayFilename, options); if( options.replayFilename == "-") { if( inputFromStdin ) { @@ -288,7 +288,7 @@ int runCvc4(int argc, char* argv[]) { } } else { ParserBuilder parserBuilder = - ParserBuilder(exprMgr, filename, options); + ParserBuilder(&exprMgr, filename, options); if( inputFromStdin ) { parserBuilder.withStreamInput(cin); diff --git a/src/parser/parser_builder.cpp b/src/parser/parser_builder.cpp index 4ecba67c2..38f41f47a 100644 --- a/src/parser/parser_builder.cpp +++ b/src/parser/parser_builder.cpp @@ -31,14 +31,14 @@ namespace CVC4 { namespace parser { -ParserBuilder::ParserBuilder(ExprManager& exprManager, +ParserBuilder::ParserBuilder(ExprManager* exprManager, const std::string& filename) : d_filename(filename), d_exprManager(exprManager) { init(exprManager,filename); } -ParserBuilder::ParserBuilder(ExprManager& exprManager, +ParserBuilder::ParserBuilder(ExprManager* exprManager, const std::string& filename, const Options& options) : d_filename(filename), @@ -47,7 +47,7 @@ ParserBuilder::ParserBuilder(ExprManager& exprManager, withOptions(options); } -void ParserBuilder::init(ExprManager& exprManager, +void ParserBuilder::init(ExprManager* exprManager, const std::string& filename) { d_inputType = FILE_INPUT; d_lang = language::input::LANG_AUTO; @@ -81,13 +81,13 @@ Parser *ParserBuilder::build() Parser *parser = NULL; switch(d_lang) { case language::input::LANG_SMTLIB: - parser = new Smt(&d_exprManager, input, d_strictMode); + parser = new Smt(d_exprManager, input, d_strictMode); break; case language::input::LANG_SMTLIB_V2: - parser = new Smt2(&d_exprManager, input, d_strictMode); + parser = new Smt2(d_exprManager, input, d_strictMode); break; default: - parser = new Parser(&d_exprManager, input, d_strictMode); + parser = new Parser(d_exprManager, input, d_strictMode); } if( d_checksEnabled ) { @@ -104,7 +104,7 @@ ParserBuilder& ParserBuilder::withChecks(bool flag) { return *this; } -ParserBuilder& ParserBuilder::withExprManager(ExprManager& exprManager) { +ParserBuilder& ParserBuilder::withExprManager(ExprManager* exprManager) { d_exprManager = exprManager; return *this; } @@ -131,7 +131,7 @@ ParserBuilder& ParserBuilder::withMmap(bool flag) { } ParserBuilder& ParserBuilder::withOptions(const Options& options) { - return + return withInputLanguage(options.inputLanguage) .withMmap(options.memoryMap) .withChecks(options.semanticChecks) diff --git a/src/parser/parser_builder.h b/src/parser/parser_builder.h index 7debc3cf8..0d01104eb 100644 --- a/src/parser/parser_builder.h +++ b/src/parser/parser_builder.h @@ -64,7 +64,7 @@ class CVC4_PUBLIC ParserBuilder { std::istream *d_streamInput; /** The expression manager */ - ExprManager& d_exprManager; + ExprManager* d_exprManager; /** Should semantic checks be enabled during parsing? */ bool d_checksEnabled; @@ -75,14 +75,14 @@ class CVC4_PUBLIC ParserBuilder { /** Should we memory-map a file input? */ bool d_mmap; - void init(ExprManager& exprManager, const std::string& filename); + void init(ExprManager* exprManager, const std::string& filename); public: /** Create a parser builder using the given ExprManager and filename. */ - ParserBuilder(ExprManager& exprManager, const std::string& filename); + ParserBuilder(ExprManager* exprManager, const std::string& filename); - ParserBuilder(ExprManager& exprManager, const std::string& filename, + ParserBuilder(ExprManager* exprManager, const std::string& filename, const Options& options); /** Build the parser, using the current settings. */ @@ -92,7 +92,7 @@ public: ParserBuilder& withChecks(bool flag = true); /** Set the ExprManager to use with the parser. */ - ParserBuilder& withExprManager(ExprManager& exprManager); + ParserBuilder& withExprManager(ExprManager* exprManager); /** Set the parser to read a file for its input. (Default) */ ParserBuilder& withFileInput(); -- 2.30.2