添加注释

This commit is contained in:
codeboss 2025-02-08 14:12:01 +08:00
parent ffb558b545
commit ee94744b6a
1 changed files with 3 additions and 0 deletions

View File

@ -298,11 +298,14 @@ namespace lib_syntax {
auto nbranch = this->child_store->parse(ncursor); auto nbranch = this->child_store->parse(ncursor);
decltype(nbranch) list_ok; decltype(nbranch) list_ok;
// 选择完全匹配成功的
std::copy_if(nbranch.begin(), nbranch.end(), std::back_inserter(list_ok), std::copy_if(nbranch.begin(), nbranch.end(), std::back_inserter(list_ok),
[](std::shared_ptr<const MatchCursor> ins) { return !ins->exprsErrorCount(); }); [](std::shared_ptr<const MatchCursor> ins) { return !ins->exprsErrorCount(); });
if (!list_ok.size()) { if (!list_ok.size()) {
// 选择被修正的
std::copy_if(nbranch.begin(), nbranch.end(), std::back_inserter(list_ok), std::copy_if(nbranch.begin(), nbranch.end(), std::back_inserter(list_ok),
[](std::shared_ptr<const MatchCursor> ins) { return !ins->mustStop(); }); [](std::shared_ptr<const MatchCursor> ins) { return !ins->mustStop(); });
// 匹配失败的
if (!list_ok.size()) if (!list_ok.size())
list_ok = nbranch; list_ok = nbranch;
} }