2024-03-17 07:58:28 +00:00
|
|
|
|
#include "ast_novel.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using namespace example_novel;
|
2024-06-20 13:36:46 +00:00
|
|
|
|
using namespace lib_syntax;
|
2025-02-07 15:26:20 +00:00
|
|
|
|
using namespace ast_basic;
|
|
|
|
|
using namespace ast_gen;
|
|
|
|
|
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2024-07-12 04:53:43 +00:00
|
|
|
|
TextSection::TextSection(std::shared_ptr<const ExprRule> rule_bind)
|
2025-02-07 15:26:20 +00:00
|
|
|
|
: AbstractImpl(rule_bind) { }
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString TextSection::content() const {
|
2024-07-28 08:37:31 +00:00
|
|
|
|
QString text;
|
|
|
|
|
for (auto& t : selfTokens()) {
|
|
|
|
|
text += t->token()->content() + " ";
|
|
|
|
|
}
|
|
|
|
|
return text;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString TextSection::signature() const {
|
|
|
|
|
return u8"::section";
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-02 14:29:03 +00:00
|
|
|
|
PointRefers::PointRefers(std::shared_ptr<const ExprRule> rule_bind)
|
2025-02-07 15:26:20 +00:00
|
|
|
|
: AbstractImpl(rule_bind) { }
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString PointRefers::storyRefer() const {
|
|
|
|
|
return story_refs;
|
|
|
|
|
}
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
void PointRefers::setStoryRefer(const QString& refer) {
|
2024-07-28 08:37:31 +00:00
|
|
|
|
this->story_refs = refer;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString PointRefers::sliceRefer() const {
|
|
|
|
|
return story_refs;
|
|
|
|
|
}
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
void PointRefers::setSliceRefer(const QString& refer) {
|
|
|
|
|
story_refs = refer;
|
2024-06-18 04:44:18 +00:00
|
|
|
|
}
|
2024-07-28 08:37:31 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString PointRefers::pointRefer() const {
|
|
|
|
|
return point_ref;
|
2024-03-31 05:59:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
void PointRefers::setPointRefer(const QString& refer) {
|
|
|
|
|
this->point_ref = refer;
|
|
|
|
|
}
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString PointRefers::referSignature() const {
|
|
|
|
|
return storyRefer() + u8"&" + sliceRefer() + u8"&" + pointRefer();
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-02 14:29:03 +00:00
|
|
|
|
QString PointRefers::signature() const {
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString signature = u8"@" + referSignature();
|
|
|
|
|
return parent().lock()->signature() + u8"&" + signature;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-18 04:44:18 +00:00
|
|
|
|
|
2025-02-02 14:30:47 +00:00
|
|
|
|
PointDefines::PointDefines(std::shared_ptr<const ExprRule> rule_bind)
|
2025-02-07 15:26:20 +00:00
|
|
|
|
: AbstractImpl(rule_bind) { }
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString PointDefines::name() const {
|
|
|
|
|
return name_store;
|
|
|
|
|
}
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
void PointDefines::setName(const QString& nm) {
|
2024-07-28 08:37:31 +00:00
|
|
|
|
this->name_store = nm;
|
2024-06-18 04:44:18 +00:00
|
|
|
|
}
|
2024-07-28 08:37:31 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString PointDefines::signature() const {
|
|
|
|
|
return parent().lock()->signature() + u8"&" + name();
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-18 04:44:18 +00:00
|
|
|
|
|
2024-07-12 04:53:43 +00:00
|
|
|
|
StoryDefine::StoryDefine(std::shared_ptr<const ExprRule> rule_bind)
|
2025-02-07 15:26:20 +00:00
|
|
|
|
: AbstractImpl(rule_bind), sort_index(0) { }
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString StoryDefine::name() const {
|
|
|
|
|
return name_store;
|
|
|
|
|
}
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
void StoryDefine::setName(const QString& nm) {
|
2024-07-28 08:37:31 +00:00
|
|
|
|
this->name_store = nm;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
void StoryDefine::setSort(int value) {
|
2024-06-20 13:36:46 +00:00
|
|
|
|
sort_index = value;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
int StoryDefine::sort() const {
|
|
|
|
|
return sort_index;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString StoryDefine::signature() const {
|
|
|
|
|
return name();
|
|
|
|
|
}
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
|
|
|
|
#include "syntax_novel.h"
|
2024-07-12 04:53:43 +00:00
|
|
|
|
Document::Document(std::shared_ptr<const ExprRule> rule_bind)
|
2025-02-07 15:26:20 +00:00
|
|
|
|
: AbstractImpl(rule_bind) { }
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString Document::signature() const {
|
|
|
|
|
return QString(u8"::document<%1>").arg(path());
|
2024-07-28 08:37:31 +00:00
|
|
|
|
}
|
2024-06-18 03:54:36 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
VolumeDefine::VolumeDefine(std::shared_ptr<const ExprRule> rule_bind)
|
|
|
|
|
: AbstractImpl(rule_bind) { }
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString VolumeDefine::name() const {
|
|
|
|
|
return name_store;
|
2024-06-18 03:54:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
void VolumeDefine::setName(const QString& nm) {
|
|
|
|
|
this->name_store = nm;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString VolumeDefine::signature() const {
|
|
|
|
|
return name();
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
ArticleDefine::ArticleDefine(std::shared_ptr<const ExprRule> rule_bind)
|
|
|
|
|
: AbstractImpl(rule_bind) { }
|
2024-06-18 03:54:36 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString ArticleDefine::name() const {
|
|
|
|
|
return name_store;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
void ArticleDefine::setName(const QString& nm) {
|
2024-07-28 08:37:31 +00:00
|
|
|
|
this->name_store = nm;
|
2024-06-18 04:44:18 +00:00
|
|
|
|
}
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString ArticleDefine::signature() const {
|
|
|
|
|
return parent().lock()->signature() + u8"&" + name();
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
RankDeclare::RankDeclare(std::shared_ptr<const ExprRule> rule)
|
|
|
|
|
: AbstractImpl(rule) { }
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
int RankDeclare::rankNumber() const {
|
|
|
|
|
return page_rank;
|
|
|
|
|
}
|
2024-06-18 04:44:18 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
void RankDeclare::setRank(int nums) {
|
|
|
|
|
this->page_rank = nums;
|
2024-06-18 04:44:18 +00:00
|
|
|
|
}
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString RankDeclare::signature() const {
|
|
|
|
|
return u8"::rank";
|
|
|
|
|
}
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
FragmentSlice::FragmentSlice(std::shared_ptr<const ExprRule> rule)
|
|
|
|
|
:AbstractImpl(rule) {
|
|
|
|
|
_slice_name = QString(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>_%1").arg((uint64_t)this);
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString FragmentSlice::name() const {
|
|
|
|
|
return _slice_name;
|
|
|
|
|
}
|
2024-06-20 13:36:46 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
void FragmentSlice::setName(const QString& nm) {
|
|
|
|
|
this->_slice_name = nm;
|
2024-06-20 13:36:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString FragmentSlice::signature() const {
|
|
|
|
|
return parent().lock()->signature() + u8"&" + name();
|
2024-06-20 13:36:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
std::shared_ptr<const IExprInstance> NGlobalElement::bindExpression() const {
|
|
|
|
|
return shared_from_this();
|
2024-07-28 08:37:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
int NGlobalElement::typeMark() const {
|
|
|
|
|
return (int)NovelNode::GlobalElement;
|
2024-06-20 13:36:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
bool NGlobalElement::isAnonymous() const {
|
2024-06-20 13:36:46 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString NGlobalElement::path() const {
|
|
|
|
|
return ExprProgram::filePath();
|
2024-06-20 13:36:46 +00:00
|
|
|
|
}
|
2025-02-04 14:26:34 +00:00
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
QString NGlobalElement::signature() const {
|
|
|
|
|
return u8"::program";
|
2025-02-04 14:26:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
std::weak_ptr<const SyntaxElement> NGlobalElement::parent() const {
|
|
|
|
|
return std::weak_ptr<const SyntaxElement>();
|
2025-02-04 14:26:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-07 15:26:20 +00:00
|
|
|
|
void NGlobalElement::setParent(std::shared_ptr<const SyntaxElement> inst) { }
|
|
|
|
|
|
|
|
|
|
QList<std::shared_ptr<const TokenAccess>> NGlobalElement::selfTokens() const {
|
|
|
|
|
return QList<std::shared_ptr<const TokenAccess>>();
|
2025-02-04 14:26:34 +00:00
|
|
|
|
}
|
2025-02-07 15:26:20 +00:00
|
|
|
|
|
|
|
|
|
NGlobalElement::NGlobalElement(const QString& root): ExprProgram(root) { }
|