2025-02-08 05:40:36 +00:00
|
|
|
#include <QtCore/QCoreApplication>
|
|
|
|
#include <libwords.h>
|
|
|
|
#include <qdebug.h>
|
|
|
|
#include <QFile>
|
|
|
|
#include <libsyntax.h>
|
|
|
|
#include <ast_gen.h>
|
|
|
|
#include <syntax_novel.h>
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QCoreApplication a(argc, argv);
|
|
|
|
|
2025-02-12 06:41:24 +00:00
|
|
|
QFile in("D:\\Projects\\Cpp\\WsNovelParser\\CoreTest\\syntax_example.txt");
|
2025-02-08 05:40:36 +00:00
|
|
|
in.open(QIODevice::ReadOnly|QIODevice::Text);
|
|
|
|
QTextStream tt(&in);
|
|
|
|
lib_words::WordReader reader;
|
2025-02-12 06:41:24 +00:00
|
|
|
auto vwords = reader.wordsFrom(tt, "D:\\Projects\\Cpp\\WsNovelParser\\CoreTest\\syntax_example.txt");
|
2025-02-08 05:40:36 +00:00
|
|
|
|
|
|
|
auto words = vwords;
|
|
|
|
while (words) {
|
|
|
|
qDebug() << words->content();
|
|
|
|
words = words->nextWord();
|
|
|
|
}
|
|
|
|
|
|
|
|
ast_gen::SyntaxParser parser(example_novel::NovalSyntax::getSyntaxTree());
|
|
|
|
auto rst = parser.parse(vwords);
|
2025-02-14 17:48:14 +00:00
|
|
|
|
|
|
|
auto prag_root = std::make_shared< ast_basic::ExprProgram>("HelloWorld!");
|
|
|
|
auto structx = parser.getAst(rst.first(), prag_root);
|
|
|
|
|
2025-02-12 13:50:45 +00:00
|
|
|
|
2025-02-08 05:40:36 +00:00
|
|
|
|
2025-02-14 17:48:14 +00:00
|
|
|
qDebug() << "finished";
|
2025-02-08 05:40:36 +00:00
|
|
|
return a.exec();
|
|
|
|
}
|