cvc4-1.4
parser_builder.h
Go to the documentation of this file.
1 /********************* */
17 #include "cvc4parser_public.h"
18 
19 #ifndef __CVC4__PARSER__PARSER_BUILDER_H
20 #define __CVC4__PARSER__PARSER_BUILDER_H
21 
22 #include <string>
23 
24 #include "parser/input.h"
25 
26 #include "util/language.h"
27 
28 namespace CVC4 {
29 
30 class ExprManager;
31 class Options;
32 
33 namespace parser {
34 
35 class Parser;
36 
43  enum InputType {
44  FILE_INPUT,
45  LINE_BUFFERED_STREAM_INPUT,
46  STREAM_INPUT,
47  STRING_INPUT
48  };
49 
51  InputType d_inputType;
52 
54  InputLanguage d_lang;
55 
57  std::string d_filename;
58 
60  std::string d_stringInput;
61 
63  std::istream* d_streamInput;
64 
66  ExprManager* d_exprManager;
67 
69  bool d_checksEnabled;
70 
72  bool d_strictMode;
73 
75  bool d_canIncludeFile;
76 
78  bool d_mmap;
79 
81  bool d_parseOnly;
82 
84  bool d_logicIsForced;
85 
87  std::string d_forcedLogic;
88 
90  void init(ExprManager* exprManager, const std::string& filename);
91 
92 public:
93 
95  ParserBuilder(ExprManager* exprManager, const std::string& filename);
96 
97  ParserBuilder(ExprManager* exprManager, const std::string& filename,
98  const Options& options);
99 
101  Parser *build() throw (InputStreamException);
102 
104  ParserBuilder& withChecks(bool flag = true);
105 
107  ParserBuilder& withExprManager(ExprManager* exprManager);
108 
110  ParserBuilder& withFileInput();
111 
118  ParserBuilder& withFilename(const std::string& filename);
119 
125  ParserBuilder& withInputLanguage(InputLanguage lang);
126 
133  ParserBuilder& withMmap(bool flag = true);
134 
146  ParserBuilder& withParseOnly(bool flag = true);
147 
149  ParserBuilder& withOptions(const Options& options);
150 
156  ParserBuilder& withStrictMode(bool flag = true);
157 
163  ParserBuilder& withIncludeFile(bool flag = true);
164 
166  ParserBuilder& withStreamInput(std::istream& input);
167 
169  ParserBuilder& withLineBufferedStreamInput(std::istream& input);
170 
172  ParserBuilder& withStringInput(const std::string& input);
173 
175  ParserBuilder& withForcedLogic(const std::string& logic);
176 };/* class ParserBuilder */
177 
178 }/* CVC4::parser namespace */
179 }/* CVC4 namespace */
180 
181 #endif /* __CVC4__PARSER__PARSER_BUILDER_H */
Base for parser inputs.
void * ExprManager
#define CVC4_PUBLIC
Definition: cvc4_public.h:30
Definition of input and output languages.
A builder for input language parsers.
Macros that should be defined everywhere during the building of the libraries and driver binary...
This class encapsulates all of the state of a parser, including the name of the file, line number and column information, and in-scope declarations.
Definition: parser.h:106