-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsto.h
More file actions
76 lines (63 loc) · 1.69 KB
/
sto.h
File metadata and controls
76 lines (63 loc) · 1.69 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
73
74
75
76
#include"sta.h"
#include<QObject>
#include<QString>
#include<QDebug>
#include<QMainWindow>
#include "ui_mainwindow.h"
#ifndef STO_H
#define STO_H
struct node: public QObject{
Q_OBJECT
public:
node(QString in, int line, node *n = nullptr):input(in), next(n),linenum(line){
error_flag = false;
type = in.section(' ',1,1);
QString l = in.section(' ',0,0);
int firstSpace = in.indexOf(' ');
QString s = in.mid(firstSpace + 1);
if(type == "REM"){statement = new Rem();}
else if(type == "LET"){statement = new Let();}
else if(type == "PRINT"){statement = new Print();}
else if(type == "INPUT"){statement = new Input();}
else if(type == "GOTO"){statement = new Goto();}
else if(type == "IF"){statement = new If();}
else if(type == "END"){statement = new End();}
connect(statement,&Sta::error_signal,[=](){
error_flag = true;
});
statement->gen_tree(s);
};
node(){};
node *next;
int linenum;
Sta *statement;
QString input;
QString type;
bool error_flag;
signals:
};
class Sto:public QObject
{
Q_OBJECT
public:
node *head ;
void codeChange(QString change);
void insert(int line ,QString i);
void remove(int line);
bool search(int line);
void exitChange(int line ,QString i,QString s);
void display_code(){};
void commandRun(QString com_type,QString command);
Sto(){
head = new node();
head->next = nullptr;
};
signals:
void direct_signal(Sta* sta);
void run_signal();
void help_signal();
void quit_signal();
void load_signal();
void clear_signal();
};
#endif // STO_H