Schnek
parsersettings.hpp
1 /*
2  * parsersettings.hpp
3  *
4  * Created on: 1 May 2012
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_PARSERSETTINGS_HPP_
28 #define SCHNEK_PARSERSETTINGS_HPP_
29 
30 #include "../variables/variables.hpp"
31 #include "../variables/function_expression.hpp"
32 #include "../variables/blockclasses.hpp"
33 
34 namespace schnek {
35 
37 {
38  VariableStorage variables;
39  FunctionRegistry funcReg;
40  BlockClasses blockClasses;
41 
42  ParserSettings(std::string name, std::string classname)
43  :variables(name, classname)
44  {}
45 
46  template<typename func>
47  void registerFunction(std::string fname, func f)
48  {
49  funcReg.registerFunction(fname, f);
50  }
51 
52  BlockClassDescriptor &addBlockClass(std::string blockClass)
53  {
54  return blockClasses.registerBlock(blockClass);
55  }
56 
57  BlockClassDescriptor &getBlock(std::string blockClass)
58  {
59  return blockClasses(blockClass);
60  }
61 };
62 
63 } // namespace
64 
65 #endif // SCHNEK_PARSERSETTINGS_HPP_
Definition: parsersettings.hpp:36
Definition: algo.hpp:30
Definition: function_expression.hpp:194
Definition: blockclasses.hpp:103
Definition: blockclasses.hpp:66
Definition: variables.hpp:217