校正层级比较错误

This commit is contained in:
codeboss 2025-05-17 19:05:07 +08:00
parent 0290c8bf55
commit 71d7de9f18
2 changed files with 14 additions and 7 deletions

View File

@ -3,7 +3,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>$(SolutionDir)$(Platform)\$(Configuration)\</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>--path "D:/Projects/Cpp/WsNovelParser/x64/test_file/" --dest E:\</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>--path "E:\novel-set" --dest F:\novelout</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>--path "D:\Projects\Cpp\WsNovelParser\x64\test_file" --dest E:\</LocalDebuggerCommandArguments>

View File

@ -413,9 +413,11 @@ std::shared_ptr<FragmentNode> FragmentLayerCheck::_sets_fill(std::shared_ptr<con
void FragmentLayerCheck::_refers_rebuild(std::shared_ptr<const FragmentNode> node) {
auto fragm = std::static_pointer_cast<const FragmentSlice>(node->bind()->element());
for (auto node_t : fragm->children()) {
auto refn = std::static_pointer_cast<const FragmentRefers>(node_t);
auto target_node = _node_set[refn->referSignature()];
std::const_pointer_cast<FragmentNode>(node)->appendNext(target_node);
auto refn = std::dynamic_pointer_cast<const FragmentRefers>(node_t);
if(refn){
auto target_node = _node_set[refn->referSignature()];
std::const_pointer_cast<FragmentNode>(node)->appendNext(target_node);
}
}
}
@ -440,14 +442,19 @@ void FragmentLayerCheck::layer_check(std::shared_ptr<const ElementAccess> node)
story_layer_check(node);
break;
default:
layer_check(node);
for(auto ins : node->children())
layer_check(ins);
break;
}
}
void FragmentLayerCheck::story_layer_check(std::shared_ptr<const ast_gen::ElementAccess> story) {
auto fragms_list = story->children();
for (auto curr = ++fragms_list.begin(); curr != fragms_list.end(); ++curr) {
decltype(fragms_list) real_elms;
std::copy_if(fragms_list.begin(), fragms_list.end(), std::back_inserter(real_elms),
[](std::shared_ptr<const ast_gen::ElementAccess> ins) { return ins->element()->typeMark() == (int) NovelNode::FragmentSlice; });
for (auto curr = ++real_elms.begin(); curr != real_elms.end(); ++curr) {
auto prev = curr - 1;
auto curr_sign = (*curr)->element()->signature();
auto prev_sign = (*prev)->element()->signature();
@ -471,7 +478,7 @@ void FragmentLayerCheck::sibling_element_compair(std::shared_ptr<const FragmentN
auto min0 = *std::min_element(prev_layers.begin(), prev_layers.end());
auto max1 = *std::max_element(next_layers.begin(), next_layers.end());
if (min0 < max1) {
if (next_layers.size() && min0 > max1) {
decltype(prev_childs) tempx;
std::copy_if(curr_childs.begin(), curr_childs.end(), std::back_inserter(tempx),
[=](std::shared_ptr<const FragmentNode> ins) { return ins->layerNumber() >= min0; });