-
Notifications
You must be signed in to change notification settings - Fork 0
/
statement.h
99 lines (90 loc) · 2.43 KB
/
statement.h
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef STATEMENT_H
#define STATEMENT_H
#include <QString>
#include "expression.h"
#include "parser.h"
#include "tokenizer.h"
class Statement
{
public:
friend class Program;
Statement(QString input,int n=0,Statement *p=nullptr);
virtual ~Statement();
virtual void run(QMap<QString,int> *¤tVariables,QString *&output);
virtual QString statementType();
protected:
int lineNumber;
QString text;
Statement *next;
};
class RemStatement: public Statement
{
public:
RemStatement(QString input,int n=0,Statement *p=nullptr);
~RemStatement() override;
QString statementType() override;
void run(QMap<QString,int> *¤tVariables,QString *&output) override;
private:
QString type;
};
class LetStatement: public Statement
{
public:
LetStatement(QString input,int n=0,Statement *p=nullptr);
~LetStatement() override;
QString statementType()override;
void run(QMap<QString,int> *¤tVariables,QString *&output) override;
private:
QString type;
};
class PrintStatement: public Statement
{
public:
PrintStatement(QString input,int n=0,Statement *p=nullptr);
~PrintStatement() override;
QString statementType()override;
void run(QMap<QString,int> *¤tVariables,QString *&output) override;
private:
QString type;
};
class GotoStatement: public Statement
{
public:
GotoStatement(QString input,int n=0,Statement *p=nullptr);
~GotoStatement() override;
QString statementType() override;
void run(QMap<QString,int> *¤tVariables,QString *&output) override;
private:
QString type;
};
class IfStatement: public Statement
{
public:
IfStatement(QString input,int n=0,Statement *p=nullptr);
~IfStatement() override;
QString statementType() override;
void run(QMap<QString,int> *¤tVariables,QString *&output) override;
private:
QString type;
};
class EndStatement: public Statement
{
public:
EndStatement(QString input,int n=0,Statement *p=nullptr);
~EndStatement() override;
QString statementType() override;
void run(QMap<QString,int> *¤tVariables,QString *&output) override;
private:
QString type;
};
class InputStatement: public Statement
{
public:
InputStatement(QString input,int n=0,Statement *p=nullptr);
~InputStatement() override;
QString statementType() override;
void run(QMap<QString,int> *¤tVariables,QString *&output) override;
private:
QString type;
};
#endif // STATEMENT_H