整理编译输出
This commit is contained in:
parent
e9950e20a2
commit
6a655ff47f
|
@ -37,19 +37,13 @@ int main(int argc, char* argv[]) {
|
|||
args_mode.clear();
|
||||
args_mode << std::make_shared<args_parse::IndexParam>(u8"程序名称");
|
||||
args_mode << std::make_shared<args_parse::FloatArgvPack>(u8"--path", u8"源代码目录");
|
||||
args_mode << std::make_shared<args_parse::FloatArgvPack>(u8"--dest", u8"生成目录", true);
|
||||
args_mode << std::make_shared<args_parse::FloatArgvPack>(u8"--dest", u8"生成目录");
|
||||
args_mode << std::make_shared<args_parse::FloatOption>(u8"--html", u8"生成html文件格式取代AST", true);
|
||||
args_parser.loadMode(0x000Bu, args_mode);
|
||||
|
||||
|
||||
auto parse_result = args_parser.parse(argc, argv);
|
||||
switch (std::get<0>(parse_result))
|
||||
{
|
||||
case 0xAu: {
|
||||
std::cout << "nsc(WsNovelStoryCompiler:故事线编译器)" << std::endl;
|
||||
std::cout << "版本:V1.0.0" << std::endl;
|
||||
std::cout << "nsc --path path-to-dir [--dest path-to-output] [--html]" << std::endl;
|
||||
}break;
|
||||
switch (std::get<0>(parse_result)) {
|
||||
case 0xBu: {
|
||||
auto args = std::get<1>(parse_result);
|
||||
auto src_dir = std::dynamic_pointer_cast<args_parse::FloatArgvPack>(args_mode[1]);
|
||||
|
@ -58,7 +52,7 @@ int main(int argc, char* argv[]) {
|
|||
|
||||
auto source_dir = QDir(src_dir->value());
|
||||
if (!source_dir.exists()) {
|
||||
std::cout << "编译指定的源代码目录不存在!" << std::endl;
|
||||
std::cout << "%编译指定的源代码目录不存在!" << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
auto destination_dir = QDir::current();
|
||||
|
@ -67,7 +61,7 @@ int main(int argc, char* argv[]) {
|
|||
destination_dir = QDir(target_output);
|
||||
}
|
||||
else {
|
||||
std::cout << "编译指定的生成目录不存在,重置为:" << destination_dir.absolutePath().toLocal8Bit().data() << std::endl;
|
||||
std::cout << "%编译指定的生成目录不存在,重置为:" << destination_dir.absolutePath().toLocal8Bit().data() << std::endl;
|
||||
}
|
||||
|
||||
auto files = source_dir.entryInfoList(QStringList() << "*.story");
|
||||
|
@ -76,7 +70,6 @@ int main(int argc, char* argv[]) {
|
|||
try {
|
||||
auto parser = std::make_shared<NovelParser>();
|
||||
access_ptr = parser->parse(files);
|
||||
qDebug() << u8"%编译成功:" << destination_dir.absoluteFilePath(u8"index.html");
|
||||
}
|
||||
catch (lib_syntax::SyntaxException* e) {
|
||||
qDebug().noquote() << e->message();
|
||||
|
@ -245,9 +238,11 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
auto current_stamp = QTime::currentTime();
|
||||
qDebug() << QString(u8"html构建消耗时间:%1 ms。").arg(time_stamp.msecsTo(current_stamp));
|
||||
qDebug().noquote() << QString(u8"%html构建消耗时间:%1 ms。").arg(time_stamp.msecsTo(current_stamp));
|
||||
qDebug().noquote() << u8"%编译成功:" << destination_dir.absoluteFilePath(u8"index.html");
|
||||
}
|
||||
else if (access_ptr) {
|
||||
QTime time_stamp = QTime::currentTime();
|
||||
lib_parse::VisitorControl control;
|
||||
auto visitor = std::make_shared<printer::AstGenerate>();
|
||||
control.visitWith(access_ptr, visitor);;
|
||||
|
@ -259,13 +254,18 @@ int main(int argc, char* argv[]) {
|
|||
tout << dom_result;
|
||||
tout.flush();
|
||||
}
|
||||
auto current_stamp = QTime::currentTime();
|
||||
qDebug().noquote() << QString(u8"%AST构建消耗时间:%1 ms。").arg(time_stamp.msecsTo(current_stamp));
|
||||
qDebug().noquote() << QString(u8"%编译成功:%1。").arg(QFileInfo(file).absoluteFilePath());
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
case 0xAu:
|
||||
default: {
|
||||
std::cout << "nsc(WsNovelStoryCompiler:故事线编译器)" << std::endl;
|
||||
std::cout << "版本:V1.0.0" << std::endl;
|
||||
std::cout << "nsc --path path-to-dir [--dest path-to-output] [--html]" << std::endl;
|
||||
}break;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
//return a.exec();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue