summaryrefslogtreecommitdiff
path: root/src/parser/parser_builder.h
blob: d0b8b7bb2cb9f4225447d8a7a3d997a64604a6e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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_ */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback