Compare commits

..

No commits in common. "a3e255a991420abd99ff99d274bdc4841b6a54cb" and "6b240e313b16e5b432f3894c908b78a230aa1563" have entirely different histories.

7 changed files with 26 additions and 46 deletions

View File

@ -3,12 +3,12 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>$(SolutionDir)$(Platform)\$(Configuration)\</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(SolutionDir)$(Platform)\$(Configuration)\</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>-path "D:\手作小说\科学+修仙+创造世界"</LocalDebuggerCommandArguments> <LocalDebuggerCommandArguments>-path D:\Projects\Cpp\WsNovelParser\x64\test_file</LocalDebuggerCommandArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtLastBackgroundBuild>2024-05-04T13:29:44.1342154Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2024-04-18T16:19:34.8201347Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtLastBackgroundBuild>2024-05-04T13:29:44.5012357Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2024-04-18T16:19:35.0443022Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -298,8 +298,7 @@ void tools_printer::build_fragments(std::shared_ptr<const ast_gen::ElementAccess
{ {
if (novel_root->element()->typeMark() == (int)NovelNode::FragmentDefine) { if (novel_root->element()->typeMark() == (int)NovelNode::FragmentDefine) {
auto inst = std::make_shared<Fragment>(novel_root); auto inst = std::make_shared<Fragment>(novel_root);
auto name = novel_root->element()->signature(); this->fragment_defines[novel_root->element()->signature()] = inst;
this->fragment_defines[name] = inst;
} }
for (auto& inst_c : novel_root->children()) { for (auto& inst_c : novel_root->children()) {
@ -439,8 +438,7 @@ QString printer::tools_printer::storylines_paint(const QList<std::shared_ptr<Sto
auto fragment_peers = frag->accessPeers()->element(); auto fragment_peers = frag->accessPeers()->element();
if (fragment_peers->typeMark() == (int)example_novel::NovelNode::FragmentDefine) { if (fragment_peers->typeMark() == (int)example_novel::NovelNode::FragmentDefine) {
auto fragment_elem = std::dynamic_pointer_cast<const example_novel::FragmentDefine>(fragment_peers); auto fragment_elem = std::dynamic_pointer_cast<const example_novel::FragmentDefine>(fragment_peers);
auto node_name = fragment_elem->signature(); node_records[fragment_elem->signature()] = frag;
node_records[node_name] = frag;
nodes_description += get_node_name(frag) + QString(u8"[label=\"%1\",shape=\"rect\"]\n").arg(fragment_elem->name()); nodes_description += get_node_name(frag) + QString(u8"[label=\"%1\",shape=\"rect\"]\n").arg(fragment_elem->name());
} }
} }

View File

@ -5,9 +5,9 @@
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtLastBackgroundBuild>2024-05-04T13:29:47.7605591Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2024-04-18T16:19:35.3371722Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtLastBackgroundBuild>2024-05-04T13:29:47.9767101Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2024-04-18T16:19:35.6699349Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -122,51 +122,39 @@ void FragmentOrdersCheck::elements_link_build(const QList<std::shared_ptr<StoryS
} }
} }
template<class InputIt, class OutputIt, class Operate> void FragmentOrdersCheck::sort_cycle_check(const QList<std::shared_ptr<FragmentSortHelper>>& tracks, std::shared_ptr<FragmentSortHelper> current, int story_sort_source)
void cast(InputIt Begin, InputIt End, OutputIt Dst, Operate fn) {
while (Begin != End) {
*Dst++ = fn(*Begin++);
}
}
void FragmentOrdersCheck::sort_cycle_check(const QList<std::shared_ptr<FragmentSortHelper>>& tracks, std::shared_ptr<FragmentSortHelper> _current, int story_sort_source)
{ {
if (!_current || !_current->next()) if (!current)
return; return;
auto target = _current->next(); if (tracks.contains(current)) {
if (tracks.contains(peaks_appoint_element(target))) {
QString error_cycle; QString error_cycle;
for (auto& it : tracks) for (auto& it : tracks)
error_cycle += u8"->" + it->nodeBind()->element()->signature() + u8"\n"; error_cycle += u8"->" + it->nodeBind()->element()->signature() + u8"\n";
error_cycle += u8"->" + target->nodeBind()->element()->signature() + u8"¡£"; error_cycle += u8"->" + current->nodeBind()->element()->signature() + u8"¡£";
throw new lib_parse::CheckException(u8"Parse[0x0003]ÅÅÐòÒì³££º\n" + error_cycle); throw new lib_parse::CheckException(u8"Parse[0x0003]ÅÅÐòÒì³££º\n" + error_cycle);
} }
auto nlist = tracks; auto nlist = tracks;
nlist.append(peaks_appoint_element(target));
if (target->nodeType() == example_novel::FragmentSortHelper::Type::REFER) { if (current->nodeType() == example_novel::FragmentSortHelper::Type::REFER) {
decltype (target->siblings()) sibling_forks; decltype (current->siblings()) fork_list;
for (auto& vit : current->siblings()) {
auto siblings = target->siblings();
for (auto& vit : siblings) {
if (vit->storySort() <= story_sort_source) if (vit->storySort() <= story_sort_source)
sibling_forks << vit; fork_list << vit;
} }
for (auto& fork : sibling_forks) { for (auto& fork : fork_list) {
sort_cycle_check(nlist, fork, story_sort_source); sort_cycle_check(nlist, fork, story_sort_source);
} }
} }
sort_cycle_check(nlist, target, story_sort_source); nlist.append(peaks_appoint_element(current));
sort_cycle_check(nlist, current->next(), story_sort_source);
} }
std::shared_ptr<FragmentSortHelper> example_novel::FragmentOrdersCheck::peaks_appoint_element(std::shared_ptr<FragmentSortHelper> refer_n) const std::shared_ptr<FragmentSortHelper> example_novel::FragmentOrdersCheck::peaks_appoint_element(std::shared_ptr<FragmentSortHelper> refer_n)
{ {
if (refer_n->nodeType() == example_novel::FragmentSortHelper::Type::ELEMENT) if (refer_n->nodeType() == example_novel::FragmentSortHelper::Type::ELEMENT)
return refer_n; return refer_n;
@ -242,14 +230,8 @@ void FragmentOrdersCheck::validCheck(std::shared_ptr<const ast_gen::ElementAcces
const_cast<FragmentOrdersCheck*>(this)->elements_link_build(this->stories_list); const_cast<FragmentOrdersCheck*>(this)->elements_link_build(this->stories_list);
for (auto& s : this->stories_list) { for (auto& s : this->stories_list)
if(!s->fragmentSort()) const_cast<FragmentOrdersCheck*>(this)->sort_cycle_check(QList<std::shared_ptr<FragmentSortHelper>>(), s->fragmentSort(), s->sortValue());
continue;
QList<std::shared_ptr<FragmentSortHelper>> tracks;
tracks << peaks_appoint_element(s->fragmentSort());
const_cast<FragmentOrdersCheck*>(this)->sort_cycle_check(tracks, s->fragmentSort(), s->sortValue());
}
} }
StorySortHelper::StorySortHelper(std::shared_ptr<const ast_gen::ElementAccess> story_bind) { StorySortHelper::StorySortHelper(std::shared_ptr<const ast_gen::ElementAccess> story_bind) {

View File

@ -25,7 +25,7 @@ namespace example_novel {
void sort_cycle_check(const QList<std::shared_ptr<FragmentSortHelper>>& tracks, std::shared_ptr<FragmentSortHelper> current, void sort_cycle_check(const QList<std::shared_ptr<FragmentSortHelper>>& tracks, std::shared_ptr<FragmentSortHelper> current,
int story_sort_source); int story_sort_source);
std::shared_ptr<FragmentSortHelper> peaks_appoint_element(std::shared_ptr<FragmentSortHelper> refer_n) const; std::shared_ptr<FragmentSortHelper> peaks_appoint_element(std::shared_ptr<FragmentSortHelper> refer_n);
// CheckProvider interface // CheckProvider interface
public: public:

View File

@ -5,9 +5,9 @@
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtLastBackgroundBuild>2024-05-04T13:29:47.3997896Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2024-04-18T16:19:35.8253732Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtLastBackgroundBuild>2024-05-04T13:29:47.5416879Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2024-04-18T16:19:35.9840282Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -2,9 +2,9 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup /> <PropertyGroup />
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtLastBackgroundBuild>2024-05-04T13:29:46.3016809Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2024-04-18T16:19:35.1200999Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtLastBackgroundBuild>2024-05-04T13:29:46.7433247Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2024-04-18T16:19:35.2650069Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
</Project> </Project>