Compare commits
2 Commits
6b240e313b
...
a3e255a991
Author | SHA1 | Date |
---|---|---|
|
a3e255a991 | |
|
46fc8b0cb2 |
|
@ -3,12 +3,12 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LocalDebuggerWorkingDirectory>$(SolutionDir)$(Platform)\$(Configuration)\</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>-path D:\Projects\Cpp\WsNovelParser\x64\test_file</LocalDebuggerCommandArguments>
|
||||
<LocalDebuggerCommandArguments>-path "D:\手作小说\科学+修仙+创造世界"</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<QtLastBackgroundBuild>2024-04-18T16:19:34.8201347Z</QtLastBackgroundBuild>
|
||||
<QtLastBackgroundBuild>2024-05-04T13:29:44.1342154Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<QtLastBackgroundBuild>2024-04-18T16:19:35.0443022Z</QtLastBackgroundBuild>
|
||||
<QtLastBackgroundBuild>2024-05-04T13:29:44.5012357Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -298,7 +298,8 @@ void tools_printer::build_fragments(std::shared_ptr<const ast_gen::ElementAccess
|
|||
{
|
||||
if (novel_root->element()->typeMark() == (int)NovelNode::FragmentDefine) {
|
||||
auto inst = std::make_shared<Fragment>(novel_root);
|
||||
this->fragment_defines[novel_root->element()->signature()] = inst;
|
||||
auto name = novel_root->element()->signature();
|
||||
this->fragment_defines[name] = inst;
|
||||
}
|
||||
|
||||
for (auto& inst_c : novel_root->children()) {
|
||||
|
@ -438,7 +439,8 @@ QString printer::tools_printer::storylines_paint(const QList<std::shared_ptr<Sto
|
|||
auto fragment_peers = frag->accessPeers()->element();
|
||||
if (fragment_peers->typeMark() == (int)example_novel::NovelNode::FragmentDefine) {
|
||||
auto fragment_elem = std::dynamic_pointer_cast<const example_novel::FragmentDefine>(fragment_peers);
|
||||
node_records[fragment_elem->signature()] = frag;
|
||||
auto node_name = fragment_elem->signature();
|
||||
node_records[node_name] = frag;
|
||||
nodes_description += get_node_name(frag) + QString(u8"[label=\"%1\",shape=\"rect\"]\n").arg(fragment_elem->name());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<QtLastBackgroundBuild>2024-04-18T16:19:35.3371722Z</QtLastBackgroundBuild>
|
||||
<QtLastBackgroundBuild>2024-05-04T13:29:47.7605591Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<QtLastBackgroundBuild>2024-04-18T16:19:35.6699349Z</QtLastBackgroundBuild>
|
||||
<QtLastBackgroundBuild>2024-05-04T13:29:47.9767101Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -122,39 +122,51 @@ void FragmentOrdersCheck::elements_link_build(const QList<std::shared_ptr<StoryS
|
|||
}
|
||||
}
|
||||
|
||||
void FragmentOrdersCheck::sort_cycle_check(const QList<std::shared_ptr<FragmentSortHelper>>& tracks, std::shared_ptr<FragmentSortHelper> current, int story_sort_source)
|
||||
template<class InputIt, class OutputIt, class Operate>
|
||||
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)
|
||||
if (!_current || !_current->next())
|
||||
return;
|
||||
|
||||
if (tracks.contains(current)) {
|
||||
auto target = _current->next();
|
||||
|
||||
if (tracks.contains(peaks_appoint_element(target))) {
|
||||
QString error_cycle;
|
||||
for (auto& it : tracks)
|
||||
error_cycle += u8"->" + it->nodeBind()->element()->signature() + u8"\n";
|
||||
error_cycle += u8"->" + current->nodeBind()->element()->signature() + u8"¡£";
|
||||
error_cycle += u8"->" + target->nodeBind()->element()->signature() + u8"¡£";
|
||||
|
||||
throw new lib_parse::CheckException(u8"Parse[0x0003]ÅÅÐòÒì³££º\n" + error_cycle);
|
||||
}
|
||||
|
||||
auto nlist = tracks;
|
||||
nlist.append(peaks_appoint_element(target));
|
||||
|
||||
if (current->nodeType() == example_novel::FragmentSortHelper::Type::REFER) {
|
||||
decltype (current->siblings()) fork_list;
|
||||
for (auto& vit : current->siblings()) {
|
||||
if (target->nodeType() == example_novel::FragmentSortHelper::Type::REFER) {
|
||||
decltype (target->siblings()) sibling_forks;
|
||||
|
||||
auto siblings = target->siblings();
|
||||
for (auto& vit : siblings) {
|
||||
if (vit->storySort() <= story_sort_source)
|
||||
fork_list << vit;
|
||||
sibling_forks << vit;
|
||||
}
|
||||
|
||||
for (auto& fork : fork_list) {
|
||||
for (auto& fork : sibling_forks) {
|
||||
sort_cycle_check(nlist, fork, story_sort_source);
|
||||
}
|
||||
}
|
||||
|
||||
nlist.append(peaks_appoint_element(current));
|
||||
sort_cycle_check(nlist, current->next(), story_sort_source);
|
||||
sort_cycle_check(nlist, target, story_sort_source);
|
||||
}
|
||||
|
||||
std::shared_ptr<FragmentSortHelper> example_novel::FragmentOrdersCheck::peaks_appoint_element(std::shared_ptr<FragmentSortHelper> refer_n)
|
||||
std::shared_ptr<FragmentSortHelper> example_novel::FragmentOrdersCheck::peaks_appoint_element(std::shared_ptr<FragmentSortHelper> refer_n) const
|
||||
{
|
||||
if (refer_n->nodeType() == example_novel::FragmentSortHelper::Type::ELEMENT)
|
||||
return refer_n;
|
||||
|
@ -230,8 +242,14 @@ void FragmentOrdersCheck::validCheck(std::shared_ptr<const ast_gen::ElementAcces
|
|||
|
||||
const_cast<FragmentOrdersCheck*>(this)->elements_link_build(this->stories_list);
|
||||
|
||||
for (auto& s : this->stories_list)
|
||||
const_cast<FragmentOrdersCheck*>(this)->sort_cycle_check(QList<std::shared_ptr<FragmentSortHelper>>(), s->fragmentSort(), s->sortValue());
|
||||
for (auto& s : this->stories_list) {
|
||||
if(!s->fragmentSort())
|
||||
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) {
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace example_novel {
|
|||
void sort_cycle_check(const QList<std::shared_ptr<FragmentSortHelper>>& tracks, std::shared_ptr<FragmentSortHelper> current,
|
||||
int story_sort_source);
|
||||
|
||||
std::shared_ptr<FragmentSortHelper> peaks_appoint_element(std::shared_ptr<FragmentSortHelper> refer_n);
|
||||
std::shared_ptr<FragmentSortHelper> peaks_appoint_element(std::shared_ptr<FragmentSortHelper> refer_n) const;
|
||||
|
||||
// CheckProvider interface
|
||||
public:
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<QtLastBackgroundBuild>2024-04-18T16:19:35.8253732Z</QtLastBackgroundBuild>
|
||||
<QtLastBackgroundBuild>2024-05-04T13:29:47.3997896Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<QtLastBackgroundBuild>2024-04-18T16:19:35.9840282Z</QtLastBackgroundBuild>
|
||||
<QtLastBackgroundBuild>2024-05-04T13:29:47.5416879Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -2,9 +2,9 @@
|
|||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<QtLastBackgroundBuild>2024-04-18T16:19:35.1200999Z</QtLastBackgroundBuild>
|
||||
<QtLastBackgroundBuild>2024-05-04T13:29:46.3016809Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<QtLastBackgroundBuild>2024-04-18T16:19:35.2650069Z</QtLastBackgroundBuild>
|
||||
<QtLastBackgroundBuild>2024-05-04T13:29:46.7433247Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue