diff options
author | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-05-12 20:29:24 +0000 |
---|---|---|
committer | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-05-12 20:29:24 +0000 |
commit | a358ed3b520919acbb72fb9bcd2974ee4165f495 (patch) | |
tree | 52a9dd03f5735114cf196bafbc6a5ee6f5a40b22 /src/parser/parser_builder.h | |
parent | 8d691eac8e478576ebceb6406a8e372db5e3f7f1 (diff) |
Adding ParserBuilder, reducing visibility of Parser and Input constructors
Adding Smt2 subclass of Parser
Checking for multiple calls to set-logic in SMT v2
Diffstat (limited to 'src/parser/parser_builder.h')
-rw-r--r-- | src/parser/parser_builder.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/src/parser/parser_builder.h b/src/parser/parser_builder.h new file mode 100644 index 000000000..d0b8b7bb2 --- /dev/null +++ b/src/parser/parser_builder.h @@ -0,0 +1,91 @@ +/********************* */ +/** parser_builder.h + ** Original author: cconway + ** Major contributors: none + ** Minor contributors (to current version): none + ** This file is part of the CVC4 prototype. + ** Copyright (c) 2009, 2010 The Analysis of Computer Systems Group (ACSys) + ** Courant Institute of Mathematical Sciences + ** New York University + ** See the file COPYING in the top-level source directory for licensing + ** information. + ** + ** A builder for parsers. + **/ + +#include "cvc4parser_public.h" + +#ifndef __CVC4__PARSER__PARSER_BUILDER_H_ +#define __CVC4__PARSER__PARSER_BUILDER_H_ + +#include <string> + +#include "parser/input.h" +#include "parser/parser_options.h" + +namespace CVC4 { + +class ExprManager; + +namespace parser { +/* + +class InputBuilder { +protected: + InputLanguage d_lang; + std::string d_name; +public: + InputBuilder(InputLanguage lang, const std::string& name) : + d_lang(lang), + d_name(name) { + } + virtual Input& build() = 0; +}; +*/ + +class Parser; + +class CVC4_PUBLIC ParserBuilder { + enum InputType { + FILE_INPUT, + STRING_INPUT + }; + + /** The input type. */ + InputType d_inputType; + + /** The input language */ + InputLanguage d_lang; + + /** The file name (may not exist) */ + std::string d_filename; + + /** The string input, if any. */ + std::string d_stringInput; + + /** The expression manager */ + ExprManager *d_exprManager; + + /** Should semantic checks be enabled during parsing? */ + bool d_checksEnabled; + + /** Should we parse in strict mode? */ + bool d_strictMode; + + /** Should we memory-map a file input? */ + bool d_mmap; + +public: + ParserBuilder(InputLanguage lang, const std::string& filename); + Parser *build() throw (InputStreamException); + ParserBuilder& withChecks(bool flag = true); + ParserBuilder& withMmap(bool flag = true); + ParserBuilder& withStrictMode(bool flag = true); + ParserBuilder& withExprManager(ExprManager& exprManager); + ParserBuilder& withStringInput(const std::string& input); +}; + +} /* namespace parser */ + +} /* namespace CVC4 */ +#endif /* __CVC4__PARSER__PARSER_BUILDER_H_ */ |