-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlStructureMod.hpp
More file actions
executable file
·45 lines (32 loc) · 1011 Bytes
/
ControlStructureMod.hpp
File metadata and controls
executable file
·45 lines (32 loc) · 1011 Bytes
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
#ifndef _CONTROLSTRUCTUREMOD_HPP
#define _CONTROLSTRUCTUREMOD_HPP
#include "Line.hpp"
#include <iostream>
#include "RuntimeException.hpp"
class ControlStructureMod : public Line {
public:
enum ModType {
LOOP, CONDITIONAL, ELSE
};
private:
ModType modType;
public:
ControlStructureMod(std::string line, VariableHashMap& vars, int scope) : Line(line, vars, scope) {
//std::cout << "ControlStructureMod line" << std::endl;
//std::cout << "ControlStructureMod constructor: " << line << std::endl;
type = Statement::CONTROLSTRUCTUREMOD;
if(line.compare("loop")==0) {
modType = LOOP;
} else if(line.compare("if")==0) {
modType = CONDITIONAL;
} else if(line.compare("else")==0) {
modType = ELSE;
} else {
throw RuntimeException("Unexpected token \"" + line + "\" in control structure");
}
}
ModType getModType() {
return modType;
}
};
#endif //_CONTROLSTRUCTUREMOD_HPP