Schnek
parsercontext.hpp
1 /*
2  * parsercontext.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_PARSERCONTEXT_HPP_
28 #define SCHNEK_PARSERCONTEXT_HPP_
29 
30 #include "../variables/blockclasses.hpp"
31 #include "../variables/variables.hpp"
32 #include "../variables/function_expression.hpp"
33 
34 namespace schnek {
35 
36 class BlockTree;
37 typedef std::shared_ptr<BlockTree> pBlockTree;
38 
40 {
41  VariableStorage *variables;
42  FunctionRegistry *funcReg;
43  BlockClasses *blockClasses;
44  pBlockTree blockTree;
45 
46  ParserContext() {}
48  VariableStorage &variables_,
49  FunctionRegistry &funcReg_,
50  BlockClasses &blockClasses_,
51  pBlockTree blockTree_)
52  : variables(&variables_),
53  funcReg(&funcReg_),
54  blockClasses(&blockClasses_) ,
55  blockTree(blockTree_)
56  {}
57  ParserContext(const ParserContext &con)
58  : variables(con.variables),
59  funcReg(con.funcReg),
60  blockClasses(con.blockClasses) ,
61  blockTree(con.blockTree)
62  {}
63 
64  ParserContext &operator=(const ParserContext &con)
65  {
66  variables = con.variables;
67  funcReg = con.funcReg;
68  blockClasses = con.blockClasses;
69  blockTree = con.blockTree;
70  return *this;
71  }
72 };
73 
74 } //namespace
75 
76 #endif // SCHNEK_PARSERCONTEXT_HPP_
Definition: algo.hpp:30
Definition: function_expression.hpp:193
Definition: blockclasses.hpp:103
Definition: parsercontext.hpp:39
Definition: variables.hpp:222