diff --git a/WsNovelParser/WsNovelParser.vcxproj.user b/WsNovelParser/WsNovelParser.vcxproj.user
index b1eb8ad..14cfe35 100644
--- a/WsNovelParser/WsNovelParser.vcxproj.user
+++ b/WsNovelParser/WsNovelParser.vcxproj.user
@@ -3,11 +3,12 @@
$(SolutionDir)$(Platform)\$(Configuration)\
WindowsLocalDebugger
+ -path D:\Projects\Cpp\WsNovelParser\x64\test_file
- 2024-04-04T04:12:24.0605703Z
+ 2024-04-04T05:44:26.2812331Z
- 2024-04-04T04:12:24.5356632Z
+ 2024-04-04T05:44:26.7768638Z
\ No newline at end of file
diff --git a/WsNovelParser/main.cpp b/WsNovelParser/main.cpp
index d72234c..6da8095 100644
--- a/WsNovelParser/main.cpp
+++ b/WsNovelParser/main.cpp
@@ -16,73 +16,80 @@
using namespace example_novel;
int main(int argc, char* argv[]) {
- QCoreApplication a(argc, argv);
+ QCoreApplication a(argc, argv);
- try {
- QFileInfoList files;
- files.append(QFileInfo("D:\\Projects\\Cpp\\WsNovelParser\\x64\\test_file\\description.txt"));
+ auto sdir = QDir::current();
+ if (argc >= 3 && !strcmp(argv[1], "-path")) {
+ auto tdir = QDir(QString::fromLocal8Bit(argv[2]));
+ if (tdir.exists())
+ sdir = tdir;
+ }
- auto parser = std::make_shared();
- auto novel_accesstree = parser->parse(files);
+ auto files = sdir.entryInfoList(QStringList() << "*.story");
+ if (files.size()) {
+ try {
+ auto parser = std::make_shared();
+ auto novel_accesstree = parser->parse(files);
- printer::tools_printer tool;
- tool.build_fragments(novel_accesstree);
- tool.build_refers_network(novel_accesstree);
-
- tool.fragments_anchors_define(tool.fragment_defines.values(), QDir::current());
- tool.storylines_anchors_define(tool.storyline_defines.values(), QDir::current());
- tool.volumes_anchors_define(tool.volume_defines.values(), QDir::current());
+ printer::tools_printer tool;
+ tool.build_fragments(novel_accesstree);
+ tool.build_refers_network(novel_accesstree);
- std::function)> html_output =
- [](std::shared_ptr inst) {
- auto target_path = inst->pageRefers();
- QFile tfile(target_path);
- if (tfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
- QDomDocument doc_inst(QDomImplementation().createDocumentType(u8"html", QString(), QString()));
- auto html = doc_inst.createElement(u8"html");
- doc_inst.appendChild(html);
+ tool.fragments_anchors_define(tool.fragment_defines.values(), QDir::current());
+ tool.storylines_anchors_define(tool.storyline_defines.values(), QDir::current());
+ tool.volumes_anchors_define(tool.volume_defines.values(), QDir::current());
- auto body = doc_inst.createElement(u8"body");
- html.appendChild(body);
+ std::function)> html_output =
+ [](std::shared_ptr inst) {
+ auto target_path = inst->pageRefers();
+ QFile tfile(target_path);
+ if (tfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ QDomDocument doc_inst(QDomImplementation().createDocumentType(u8"html", QString(), QString()));
+ auto html = doc_inst.createElement(u8"html");
+ doc_inst.appendChild(html);
- inst->buildPageHTML(body);
+ auto body = doc_inst.createElement(u8"body");
+ html.appendChild(body);
- QTextStream tout(&tfile);
- doc_inst.save(tout, 2);
- tout.flush();
- }
- };
+ inst->buildPageHTML(body);
- for (auto& node : tool.fragment_defines)
- html_output(node);
- for (auto& node : tool.storyline_defines)
- html_output(node);
- for (auto& node : tool.volume_defines)
- html_output(node);
+ QTextStream tout(&tfile);
+ doc_inst.save(tout, 2);
+ tout.flush();
+ }
+ };
- std::function, int)> tnode_print =
- [&](std::shared_ptr node, int intend) {
- auto name = node->element()->signature();
- auto text = QString(intend * 2, ' ') + name;
- for (auto& t : node->tokens()) {
- text += " " + t->token()->content();
- }
- qDebug() << text;
+ for (auto& node : tool.fragment_defines)
+ html_output(node);
+ for (auto& node : tool.storyline_defines)
+ html_output(node);
+ for (auto& node : tool.volume_defines)
+ html_output(node);
- for (auto& c_n : node->children()) {
- tnode_print(c_n, intend + 1);
- }
- };
+ std::function, int)> tnode_print =
+ [&](std::shared_ptr node, int intend) {
+ auto name = node->element()->signature();
+ auto text = QString(intend * 2, ' ') + name;
+ /*for (auto& t : node->tokens()) {
+ text += " " + t->token()->content();
+ }*/
+ qDebug() << text;
- tnode_print(novel_accesstree, 0);
- }
- catch (lib_syntax::SyntaxException* e) {
- qDebug().noquote() << e->message();
- delete e;
- }
- catch (lib_parse::CheckException* e) {
- qDebug().noquote() << e->message();
- delete e;
- }
- return a.exec();
+ for (auto& c_n : node->children()) {
+ tnode_print(c_n, intend + 1);
+ }
+ };
+
+ tnode_print(novel_accesstree, 0);
+ }
+ catch (lib_syntax::SyntaxException* e) {
+ qDebug().noquote() << e->message();
+ delete e;
+ }
+ catch (lib_parse::CheckException* e) {
+ qDebug().noquote() << e->message();
+ delete e;
+ }
+ }
+ return a.exec();
}
diff --git a/libParse/libParse.vcxproj.user b/libParse/libParse.vcxproj.user
index ca45415..cad7316 100644
--- a/libParse/libParse.vcxproj.user
+++ b/libParse/libParse.vcxproj.user
@@ -5,9 +5,9 @@
WindowsLocalDebugger
- 2024-04-04T04:12:25.1970080Z
+ 2024-04-04T05:44:26.9010407Z
- 2024-04-04T04:12:25.4349434Z
+ 2024-04-04T05:44:26.9937157Z
\ No newline at end of file
diff --git a/libSyntax/libSyntax.vcxproj.user b/libSyntax/libSyntax.vcxproj.user
index 688b412..49d759b 100644
--- a/libSyntax/libSyntax.vcxproj.user
+++ b/libSyntax/libSyntax.vcxproj.user
@@ -5,9 +5,9 @@
WindowsLocalDebugger
- 2024-04-04T04:12:24.7411048Z
+ 2024-04-04T05:44:27.2679289Z
- 2024-04-04T04:12:25.0903609Z
+ 2024-04-04T05:44:27.3466654Z
\ No newline at end of file
diff --git a/libToken/libToken.vcxproj.user b/libToken/libToken.vcxproj.user
index 216f2b5..d5ff35e 100644
--- a/libToken/libToken.vcxproj.user
+++ b/libToken/libToken.vcxproj.user
@@ -2,9 +2,9 @@
- 2024-04-04T04:12:25.4971632Z
+ 2024-04-04T05:44:27.1222839Z
- 2024-04-04T04:12:25.6489839Z
+ 2024-04-04T05:44:27.2278924Z
\ No newline at end of file