This commit is contained in:
codeboss 2025-02-15 14:42:24 +08:00
parent 1744a705bd
commit 405ef03a28
1 changed files with 30 additions and 8 deletions

View File

@ -68,24 +68,45 @@ public:
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
//// 如果提前结束,记录错误并返回
//if (!cursor->words()) {
// // 只有在表达式的起始点遇到nullptr才是正常结束。
// if (cursor->token()->tokenType() != lib_token::IActionToken::Type::ElementBegin) {
// auto ncurs = std::make_shared<MatchCursor>(cursor);
// ncurs->logExprsError(QString("Syntax[0x00001]输入错误,程序提前结束:%1。").arg(cursor->filePath()));
// ncurs->setFailure();
// return QList<std::shared_ptr<const MatchCursor>>() << ncurs;
// }
// while (cursor->token()->tokenType() == lib_token::IActionToken::Type::ElementBegin)
// cursor = cursor->previous();
// out << cursor;
// return QList<std::shared_ptr<const MatchCursor>>();
// auto ncurs = std::make_shared<MatchCursor>(cursor);
// ncurs->setComplete();
// return QList<std::shared_ptr<const MatchCursor>>() << ncurs;
//}
//auto content = content_extract(cursor->token());
//// 绑定文字行
//auto bind_row = cursor->words()->row();
//QList<std::shared_ptr<const MatchCursor>> bridge_list{ cursor };
//decltype(bridge_list) final_result;
//for (;bridge_list.size();) {
//for (; bridge_list.size();) {
// // 一次匹配
// decltype(bridge_list) current_result;
// for (auto branch : bridge_list) {
// if(branch->words()->row() == bind_row){
// auto mrst = _children_store->parse(branch, out);
// if (branch->words()->row() == bind_row) {
// auto mrst = _children_store->parse(branch);
// // 本次解析无法通过,全错
// if (!std::count_if(mrst.begin(), mrst.end(),
// [&](std::shared_ptr<const MatchCursor> v) {
// return !v->exprsErrorCount();// 没错
// })) {
// final_result.append(branch);
// continue;
// }
// //
// for (auto m : mrst) {
// if (m->exprsErrorCount()) {
// std::const_pointer_cast<MatchCursor>(m)->setFailure(true);
@ -99,8 +120,9 @@ public:
// }
// bridge_list = current_result;
//}
//for(auto x : bridge_list)
// if(!final_result.contains(x))
//for (auto x : bridge_list)
// if (!final_result.contains(x))
// final_result.append(x);
//return final_result;