-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctionOperator.h
More file actions
72 lines (52 loc) · 1.7 KB
/
Copy pathFunctionOperator.h
File metadata and controls
72 lines (52 loc) · 1.7 KB
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
//----------------------------------------------------------------------
/// \autor Group: 20
/// \brief The operator for the function closure "}"
/// Last Changes: 22.06.2008
//----------------------------------------------------------------------
#ifndef FUNCTIONOPERATOR_H_
#define FUNCTIONOPERATOR_H_
#include "GMLOperator.h"
#include "GMLToken.h"
#include "TokenTypes.h"
#include <vector>
#include <string>
#include <memory>
#include <iostream>
class FunctionOperator : public GMLOperator
{
public:
//-------------------------------------------------------------------
/// \param stack execution stack of the interpreter
/// \param array_ function stack of the interpreter
FunctionOperator(std::vector<GMLToken> &stack,
std::vector<std::vector<GMLToken> > &array_) :
GMLOperator(stack), m_array(array_)
{
m_name = "}";
};
//------------------------------------------------------------------
~FunctionOperator()
{};
//------------------------------------------------------------------
/// \brief execution of the token
void execute() const
{
std::vector <GMLToken> array_;
while( m_stack.back().m_type != FMARKER )
{
GMLToken token = m_stack.back();
array_.push_back(token);
m_stack.pop_back();
}
m_stack.pop_back();
m_array.push_back(array_);
GMLToken token;
token.m_type = FUNCTION;
token.m_int[0]= m_array.size() - 1;
m_stack.push_back(token);
};
//------------------------------------------------------------------
private:
std::vector<std::vector<GMLToken> > &m_array;
};
#endif // FUNCTIONOPERATOR