This repository has been archived by the owner on May 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
67 lines (55 loc) · 1.44 KB
/
main.cpp
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
#include <QCoreApplication>
#include <QDebug>
#include <QTextStream>
#include "source/interpreter.h"
#include "source/lexer.h"
#include "source/ast/ast.h"
#include "source/errorhandler.h"
#include <QFile>
#include <QTextStream>
/*void TestSingleLine() {
QTextStream s(stdin);
QString text = "";
while (text!="q") {
text = s.readLine();
QStringList lst;
Lexer lexer = Lexer(text, lst);
Parser parser = Parser(lexer);
Interpreter interpreter = Interpreter(parser);
interpreter.Interpret();
//qDebug() << result;
}
}
*/
QString ReadFile(QString fileName, QStringList& lst) {
if (!QFile::exists(fileName)) {
qDebug() << "Cannot open file: " << fileName;
exit(1);
}
QFile file(fileName);
file.open(QIODevice::ReadOnly);
QTextStream in(&file);
QString text = "";
while(!in.atEnd()) {
QString t = in.readLine();
text += t;
lst<<t;
}
file.close();
return text;
}
/*void ParseFile(QString fileName) {
QStringList lst;
QString text = ReadFile(fileName, lst);
Lexer lexer = Lexer(text, lst);
Parser parser = Parser(&lexer);
Interpreter interpreter = Interpreter(&parser);
interpreter.Interpret();
}
*/
int main(int argc, char *argv[])
{
ErrorHandler::e.m_level = ErrorHandler::e.DEBUG_LOW;
ErrorHandler::e.m_level = ErrorHandler::e.ERROR_ONLY;
//ParseFile("..\\pmm\\pmm\\test.ras");
}