Schnek
parser.hpp
1 /*
2  * parser.hpp
3  *
4  * Created on: 21 Jun 2011
5  * Author: Holger Schmitz
6  * Email: holger@notjustphysics.com
7  *
8  * Copyright 2012 Holger Schmitz
9  *
10  * This file is part of Schnek.
11  *
12  * Schnek is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * Schnek is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with Schnek. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef SCHNEK_PARSER_HPP_
28 #define SCHNEK_PARSER_HPP_
29 
30 #include <iostream>
31 #include "parsersettings.hpp"
32 #include "../variables/blockclasses.hpp"
33 #include "../variables/variables.hpp"
34 #include "../variables/function_expression.hpp"
35 
36 namespace schnek {
37 
38 class Parser {
39  private:
40  VariableStorage variables;
41  FunctionRegistry funcReg;
42  BlockClasses blockClasses;
43  public:
44  Parser(std::string name, std::string classname, const BlockClasses &blockClasses_)
45  : variables(name, classname), funcReg(), blockClasses(blockClasses_)
46  {}
47 
48  Parser(const VariableStorage &variables_, const FunctionRegistry &funcReg_)
49  : variables(variables_), funcReg(funcReg_), blockClasses(false)
50  {}
51 
52  Parser(const VariableStorage &variables_, const FunctionRegistry &funcReg_, const BlockClasses &blockClasses_)
53  : variables(variables_), funcReg(funcReg_), blockClasses(blockClasses_)
54  {}
55 
56  Parser(const ParserSettings &settings)
57  : variables(settings.variables), funcReg(settings.funcReg), blockClasses(settings.blockClasses)
58  {}
59 
60  FunctionRegistry &getFunctionRegistry() { return funcReg; }
61  VariableStorage &getVariableStorage() { return variables; }
62  BlockClasses &getBlockClasses() { return blockClasses; }
63 
64  pBlock parse(std::istream &input, std::string filename = "Setup File");
65 };
66 
67 } // namespace
68 
69 #endif // SCHNEK_PARSER_HPP_
Definition: parsersettings.hpp:36
Definition: algo.hpp:30
Definition: function_expression.hpp:193
Definition: parser.hpp:38
Definition: blockclasses.hpp:103
Definition: variables.hpp:222