update
This commit is contained in:
parent
d921431bc9
commit
ea2db22b37
|
@ -27,16 +27,12 @@ auto name_text = std::make_shared<NameSection>(); // ^([^\
|
|||
|
||||
|
||||
// rule-parts ===============================================================================
|
||||
template<typename ExprT>
|
||||
void apntk(std::shared_ptr<ExprT> expr, std::shared_ptr<const lib_token::IToken> t) {
|
||||
expr->addToken(t);
|
||||
}
|
||||
|
||||
#include "syntax_templets.h"
|
||||
// MakeRule
|
||||
#define MK(type) std::make_shared<const type>()
|
||||
// MatchRule
|
||||
#define MER(E, XProc, t) std::make_shared<const TokenMatch<E, XProc>>(t)
|
||||
#define MR(E, t) MER(E, apntk<E>, t)
|
||||
#define MR(E, t) MER(E, lib_composit::apntk<E>, t)
|
||||
// Buffer
|
||||
#define Rules QList<std::shared_ptr<const IBasicRule>>
|
||||
// Option
|
||||
|
@ -47,175 +43,162 @@ void apntk(std::shared_ptr<ExprT> expr, std::shared_ptr<const lib_token::IToken>
|
|||
// opt?
|
||||
#define OptR(rule) std::make_shared<const Rept>(rule, 0, 1)
|
||||
|
||||
|
||||
|
||||
class DeclExpr : public ElementRule<TextSection, (int) NovelNode::TextSection> {
|
||||
public:
|
||||
DeclExpr() : ElementRule<TextSection, (int) NovelNode::TextSection>(
|
||||
"decl_section",
|
||||
MultiR(std::make_shared<const Any>(Rules{
|
||||
MR(TextSection, numbers), MR(TextSection, vtext), MR(TextSection, refers), MR(TextSection, split_mark)
|
||||
}))) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
using namespace lib_composit;
|
||||
|
||||
void point_nmset(std::shared_ptr<PointDefines> inst, std::shared_ptr<const lib_token::IToken> token) {
|
||||
inst->addToken(token);
|
||||
inst->setName(token->content());
|
||||
}
|
||||
class PointSyntax : public ElementRule<PointDefines, (int) NovelNode::PointDefines> {
|
||||
public:
|
||||
PointSyntax() : ElementRule<PointDefines, (int) NovelNode::PointDefines>(
|
||||
"point_define", std::make_shared<const Seqs>(Rules{
|
||||
MR(PointDefines, leftb), MR(PointDefines, point_key), MER(PointDefines, point_nmset, name_text) } <<
|
||||
OptR(MK(DeclExpr)) <<
|
||||
MR(PointDefines, rightb)
|
||||
)) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
void point_ref_story_set(std::shared_ptr<PointRefers> inst, std::shared_ptr<const lib_token::IToken> token) {
|
||||
void ref_story_set(std::shared_ptr<PointRefers> inst, std::shared_ptr<const lib_token::IToken> token) {
|
||||
inst->addToken(token);
|
||||
inst->setStoryRefer(token->content());
|
||||
}
|
||||
void point_ref_slice_set(std::shared_ptr<PointRefers> inst, std::shared_ptr<const lib_token::IToken> token) {
|
||||
void ref_slice_set(std::shared_ptr<PointRefers> inst, std::shared_ptr<const lib_token::IToken> token) {
|
||||
inst->addToken(token);
|
||||
inst->setSliceRefer(token->content());
|
||||
}
|
||||
void point_ref_point_set(std::shared_ptr<PointRefers> inst, std::shared_ptr<const lib_token::IToken> token) {
|
||||
void ref_point_set(std::shared_ptr<PointRefers> inst, std::shared_ptr<const lib_token::IToken> token) {
|
||||
inst->addToken(token);
|
||||
inst->setPointRefer(token->content());
|
||||
}
|
||||
class ReferSyntax : public ElementRule<PointRefers, (int) NovelNode::PointRefers> {
|
||||
public:
|
||||
ReferSyntax() : ElementRule < PointRefers, (int) NovelNode::PointRefers>(
|
||||
"point_refer", std::make_shared<const Seqs>(Rules{
|
||||
MR(PointRefers, leftb), MR(PointRefers, refers), MR(PointRefers, point_key),
|
||||
MER(PointRefers, point_ref_story_set, name_text),
|
||||
MR(PointRefers, split_mark),
|
||||
MER(PointRefers, point_ref_slice_set, name_text),
|
||||
MR(PointRefers, split_mark),
|
||||
MER(PointRefers, point_ref_point_set, name_text) } <<
|
||||
OptR(MK(DeclExpr)) <<
|
||||
MR(PointRefers, rightb))) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
void slice_nm_set(std::shared_ptr<FragmentSlice> inst, std::shared_ptr<const lib_token::IToken> token) {
|
||||
inst->addToken(token);
|
||||
inst->setName(token->content());
|
||||
}
|
||||
class SliceSyntax : public ElementRule<FragmentSlice, (int) NovelNode::FragmentSlice> {
|
||||
public:
|
||||
SliceSyntax() : ElementRule<FragmentSlice, (int) NovelNode::FragmentSlice>(
|
||||
"slice_define", std::make_shared<const Seqs>(Rules{
|
||||
MR(FragmentSlice, leftb), MR(FragmentSlice, slice_key), MER(FragmentSlice, slice_nm_set, name_text) } <<
|
||||
OptMulR(std::make_shared<const Any>(Rules{ MK(PointSyntax), MK(ReferSyntax), MK(DeclExpr) })) <<
|
||||
MR(FragmentSlice, rightb))) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
void story_nmset(std::shared_ptr<StoryDefine> inst, std::shared_ptr<const lib_token::IToken> token) {
|
||||
inst->addToken(token);
|
||||
inst->setName(token->content());
|
||||
}
|
||||
class StorySyntax : public ElementRule<StoryDefine, (int) NovelNode::StoryDefine> {
|
||||
public:
|
||||
StorySyntax() : ElementRule<StoryDefine, (int) NovelNode::StoryDefine>(
|
||||
"story_define",
|
||||
std::make_shared<const Seqs>(Rules{
|
||||
MR(StoryDefine, leftb), MR(StoryDefine, story_key), MER(StoryDefine, story_nmset, name_text) } <<
|
||||
OptMulR(std::make_shared<const Any>(Rules{ MK(SliceSyntax), MK(DeclExpr) })) <<
|
||||
MR(StoryDefine, rightb)
|
||||
)) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
void article_nset(std::shared_ptr<ArticleDefine>inst, std::shared_ptr<const lib_token::IToken> token) {
|
||||
inst->addToken(token);
|
||||
inst->setName(token->content());
|
||||
}
|
||||
class ArticleSyntax : public ElementRule<ArticleDefine, (int) NovelNode::ArticleDefine> {
|
||||
public:
|
||||
ArticleSyntax() : ElementRule<ArticleDefine, (int) NovelNode::ArticleDefine>(
|
||||
"article_define", std::make_shared<const Seqs>(Rules{
|
||||
MR(ArticleDefine, leftb), MR(ArticleDefine, article_key), MER(ArticleDefine, article_nset, name_text) } <<
|
||||
OptMulR(std::make_shared<const Any>(Rules{ MK(ReferSyntax), MK(DeclExpr) })) <<
|
||||
MR(ArticleDefine, rightb)
|
||||
)) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
void volume_nset(std::shared_ptr<VolumeDefine> inst, std::shared_ptr<const lib_token::IToken> token) {
|
||||
inst->addToken(token);
|
||||
inst->setName(token->content());
|
||||
}
|
||||
class VolumeSyntax : public ElementRule<VolumeDefine, (int) NovelNode::VolumeDefine> {
|
||||
public:
|
||||
VolumeSyntax() : ElementRule<VolumeDefine, (int) NovelNode::VolumeDefine>(
|
||||
"volume_define", std::make_shared<const Seqs>(Rules{
|
||||
MR(VolumeDefine, leftb), MR(VolumeDefine, volume_key), MER(VolumeDefine, volume_nset, name_text) } <<
|
||||
OptMulR(std::make_shared<const Any>(Rules{ MK(DeclExpr), MK(ArticleSyntax) })) <<
|
||||
MR(VolumeDefine, rightb)
|
||||
)) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
void rank_set(std::shared_ptr<RankDeclare> inst, std::shared_ptr<const lib_token::IToken> token) {
|
||||
inst->addToken(token);
|
||||
inst->setRank(token->content().toInt());
|
||||
}
|
||||
|
||||
using TextDeclsSyntaxDef = lib_composit::Multi<AnyR<TokenRn<TextSection, Numbers>, TokenRn<TextSection, NormalText>, TokenRn<TextSection, ReferMk>, TokenRn<TextSection, SplitMk>>>;
|
||||
class DeclExpr : public ElementRule<TextSection, (int) NovelNode::TextSection> {
|
||||
public:
|
||||
DeclExpr() : ElementRule<TextSection, (int) NovelNode::TextSection>(
|
||||
"decl_section", std::make_shared<TextDeclsSyntaxDef>()) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
using PointSyntaxDef = lib_composit::SeqsR<
|
||||
TokenRn<PointDefines, LBracket>, TokenRn<PointDefines, PointWord>, TokenR<PointDefines, NameSection, point_nmset>,
|
||||
Opt<DeclExpr>,
|
||||
TokenRn<PointDefines, RBracket>>;
|
||||
class PointSyntax : public ElementRule<PointDefines, (int) NovelNode::PointDefines> {
|
||||
public:
|
||||
PointSyntax() : ElementRule<PointDefines, (int) NovelNode::PointDefines>(
|
||||
"point_define", std::make_shared<PointSyntaxDef>()) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
using ReferSyntaxDef = lib_composit::SeqsR<
|
||||
TokenRn<PointRefers, LBracket>, TokenRn<PointRefers, ReferMk>, TokenRn<PointRefers, PointWord>, TokenR<PointRefers, NameSection, ref_story_set>, TokenRn<PointRefers, ReferMk>, TokenR<PointRefers, NameSection, ref_slice_set>, TokenRn<PointRefers, ReferMk>, TokenR<PointRefers, NameSection, ref_point_set>,
|
||||
Opt<DeclExpr>,
|
||||
TokenRn<PointDefines, RBracket>>;
|
||||
class ReferSyntax : public ElementRule<PointRefers, (int) NovelNode::PointRefers> {
|
||||
public:
|
||||
ReferSyntax() : ElementRule < PointRefers, (int) NovelNode::PointRefers>(
|
||||
"point_refer", std::make_shared<ReferSyntaxDef>()) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
using SliceSyntaxDef = lib_composit::SeqsR<
|
||||
TokenRn<FragmentSlice, LBracket>, TokenRn<FragmentSlice, SliceWord>, TokenR<FragmentSlice, NameSection, slice_nm_set>,
|
||||
lib_composit::OptMulti<AnyR<PointSyntax, ReferSyntax, DeclExpr>>,
|
||||
TokenRn<FragmentSlice, RBracket>>;
|
||||
class SliceSyntax : public ElementRule<FragmentSlice, (int) NovelNode::FragmentSlice> {
|
||||
public:
|
||||
SliceSyntax() : ElementRule<FragmentSlice, (int) NovelNode::FragmentSlice>(
|
||||
"slice_define", std::make_shared<SliceSyntaxDef>()) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
using StorySyntaxDef = lib_composit::SeqsR<
|
||||
TokenRn<StoryDefine, LBracket>, TokenRn<StoryDefine, StoryWord>, TokenR<StoryDefine, NameSection, story_nmset>,
|
||||
lib_composit::OptMulti<AnyR<SliceSyntax, DeclExpr>>,
|
||||
TokenRn<StoryDefine, RBracket>>;
|
||||
class StorySyntax : public ElementRule<StoryDefine, (int) NovelNode::StoryDefine> {
|
||||
public:
|
||||
StorySyntax() : ElementRule<StoryDefine, (int) NovelNode::StoryDefine>(
|
||||
"story_define", std::make_shared<StorySyntaxDef>()) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
using ArticleSyntaxDef = lib_composit::SeqsR<
|
||||
TokenRn<ArticleDefine, LBracket>, TokenRn<ArticleDefine, ArticleWord>, TokenR<ArticleDefine, NameSection, article_nset>,
|
||||
lib_composit::OptMulti<AnyR<ReferSyntax, DeclExpr>>,
|
||||
TokenRn<ArticleDefine, RBracket>>;
|
||||
class ArticleSyntax : public ElementRule<ArticleDefine, (int) NovelNode::ArticleDefine> {
|
||||
public:
|
||||
ArticleSyntax() : ElementRule<ArticleDefine, (int) NovelNode::ArticleDefine>(
|
||||
"article_define", std::make_shared<ArticleSyntaxDef>()) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
using VolumeSyntaxDef = lib_composit::SeqsR<
|
||||
TokenRn<VolumeDefine, LBracket>, TokenRn<VolumeDefine, VolumeWord>, TokenR<VolumeDefine, NameSection, volume_nset>,
|
||||
lib_composit::OptMulti<AnyR<ArticleSyntax, DeclExpr>>,
|
||||
TokenRn<VolumeDefine, RBracket>>;
|
||||
class VolumeSyntax : public ElementRule<VolumeDefine, (int) NovelNode::VolumeDefine> {
|
||||
public:
|
||||
VolumeSyntax() : ElementRule<VolumeDefine, (int) NovelNode::VolumeDefine>(
|
||||
"volume_define", std::make_shared<VolumeSyntaxDef>()) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
using RankSyntaxDef = lib_composit::SeqsR<
|
||||
TokenRn<RankDeclare, DeclareSymbo>, TokenRn<RankDeclare, RankWord>, TokenR<RankDeclare, Numbers, rank_set>>;
|
||||
class RankSyntax : public ElementRule<RankDeclare, (int) NovelNode::RankDeclaration> {
|
||||
public:
|
||||
RankSyntax() : ElementRule<RankDeclare, (int) NovelNode::RankDeclaration>(
|
||||
"rank_define", std::make_shared<const Seqs>(Rules{
|
||||
MR(RankDeclare, declare), MR(RankDeclare, rank_key), MER(RankDeclare, rank_set, numbers) }
|
||||
)) { }
|
||||
"rank_define", std::make_shared<RankSyntaxDef>()) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
|
@ -225,12 +208,11 @@ public:
|
|||
|
||||
|
||||
|
||||
using DocSyntaxDef = lib_composit::SeqsR<Opt<RankSyntaxDef>, lib_composit::OptMulti<AnyR<StorySyntax, VolumeSyntax>>>;
|
||||
class DocumentSyntax : public ElementRule<Document, (int) NovelNode::Document> {
|
||||
public:
|
||||
DocumentSyntax() : ElementRule<Document, (int) NovelNode::Document>(
|
||||
"decls-doc", std::make_shared<const Seqs>(Rules{
|
||||
OptR(MK(RankSyntax)), MultiR(std::make_shared<const Any>(Rules{ MK(StorySyntax), MK(VolumeSyntax) }))
|
||||
})) { }
|
||||
"decls-doc", std::make_shared<DocSyntaxDef>()) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
|
@ -238,25 +220,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class MM : public lib_syntax::IBasicRule {
|
||||
// 通过 IBasicRule 继承
|
||||
QList<std::shared_ptr<const IBasicRule>> children() const override {
|
||||
return QList<std::shared_ptr<const IBasicRule>>();
|
||||
}
|
||||
QString present() const override {
|
||||
return QString();
|
||||
}
|
||||
QList<std::shared_ptr<const MatchCursor>> parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return QList<std::shared_ptr<const MatchCursor>>();
|
||||
}
|
||||
};
|
||||
|
||||
#include "syntax_templets.h"
|
||||
std::shared_ptr<const ExprRule> NovalSyntax::getSyntaxTree() {
|
||||
lib_composit::__types_list<MM, MM> vv;
|
||||
|
||||
return std::make_shared<DocumentSyntax>();
|
||||
}
|
||||
|
||||
//std::shared_ptr<const ast_gen::SyntaxElement> NovalSyntax::tidy(std::shared_ptr<ast_gen::SyntaxElement> root, QList<std::shared_ptr<ast_gen::SyntaxElement>> children)
|
||||
//{
|
||||
|
@ -302,34 +267,9 @@ std::shared_ptr<const ExprRule> NovalSyntax::getSyntaxTree() {
|
|||
|
||||
#include "syntax_templets.h"
|
||||
|
||||
/**
|
||||
* class DeclExpr : public ElementRule<TextSection, (int) NovelNode::TextSection> {
|
||||
public:
|
||||
DeclExpr() : ElementRule<TextSection, (int) NovelNode::TextSection>(
|
||||
"decl_section",
|
||||
MultiR(std::make_shared<const Any>(Rules{
|
||||
MR(TextSection, numbers), MR(TextSection, vtext), MR(TextSection, refers), MR(TextSection, split_mark)
|
||||
}))) { }
|
||||
|
||||
// 通过 ElementRule 继承
|
||||
QList<std::shared_ptr<const MatchCursor>> expr_rule_parse(std::shared_ptr<const MatchCursor> cursor) const override {
|
||||
return _children_store->parse(cursor);
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
using namespace lib_composit;
|
||||
|
||||
template<typename E, typename T> class TokenRn : public TokenR<E, T, apntk> { };
|
||||
template<typename R> class MultiRx : public ReptR<R, 1, INT_MAX> { };
|
||||
|
||||
void rules() {
|
||||
MultiRx<AnyR<
|
||||
TokenRn<TextSection, Numbers>,
|
||||
TokenRn<TextSection, NormalText>,
|
||||
TokenRn<TextSection, ReferMk>,
|
||||
TokenRn<TextSection, SplitMk>
|
||||
>> dcc;
|
||||
|
||||
|
||||
AnyR<TokenRn<TextSection, Numbers>, TokenRn<TextSection, NormalText>, TokenRn<TextSection, ReferMk>, TokenRn<TextSection, SplitMk>> mmm;
|
||||
ReptR<decltype(mmm), 1, INT_MAX> decl;
|
||||
|
|
|
@ -27,29 +27,37 @@ namespace lib_composit {
|
|||
template<typename... TYPES>
|
||||
class AnyR : public lib_syntax::Any, public __types_list<TYPES...> {
|
||||
public:
|
||||
AnyR() : Any(__types_list<TYPES...>::getRules()){ }
|
||||
AnyR() : Any(__types_list<TYPES...>::getRules()) { }
|
||||
};
|
||||
|
||||
template<typename... TYPES>
|
||||
class SeqsR : public lib_syntax::Seqs, public __types_list<TYPES...> {
|
||||
public:
|
||||
SeqsR() : Seqs(__types_list<TYPES...>::getRules()){ }
|
||||
SeqsR() : Seqs(__types_list<TYPES...>::getRules()) { }
|
||||
};
|
||||
|
||||
template<typename TYPE, int min, int max> requires std::derived_from<TYPE, lib_syntax::IBasicRule>
|
||||
class ReptR : public lib_syntax::Rept {
|
||||
public:
|
||||
ReptR() : Rept(std::make_shared<TYPE>(), min, max){ }
|
||||
ReptR() : Rept(std::make_shared<TYPE>(), min, max) { }
|
||||
};
|
||||
template<typename TYPE> class OptMulti : public ReptR<TYPE, 0, INT_MAX>{ };
|
||||
template<typename TYPE> class Multi : public ReptR<TYPE, 1, INT_MAX>{ };
|
||||
template<typename TYPE> class Opt : public ReptR<TYPE, 0, 1>{ };
|
||||
template<typename TYPE> class OptMulti : public ReptR<TYPE, 0, INT_MAX> { };
|
||||
template<typename TYPE> class Multi : public ReptR<TYPE, 1, INT_MAX> { };
|
||||
template<typename TYPE> class Opt : public ReptR<TYPE, 0, 1> { };
|
||||
|
||||
|
||||
template<typename E, typename T, lib_token::TokenProc<E> p = nullptr>
|
||||
requires std::derived_from<E, ast_basic::IExprInstance> && std::derived_from<T, lib_token::ITokenProcess>
|
||||
requires std::derived_from<E, ast_basic::IExprInstance>&& std::derived_from<T, lib_token::ITokenProcess>
|
||||
class TokenR : public lib_syntax::TokenMatch<E, p> {
|
||||
public:
|
||||
TokenR() : TokenMatch<E, p>(std::make_shared<T>()){ }
|
||||
TokenR() : TokenMatch<E, p>(std::make_shared<T>()) { }
|
||||
};
|
||||
|
||||
template<typename ExprT> requires std::derived_from<ExprT, ast_basic::IExprInstance>
|
||||
void apntk(std::shared_ptr<ExprT> expr, std::shared_ptr<const lib_token::IToken> t) {
|
||||
expr->addToken(t);
|
||||
}
|
||||
template<typename E, typename T>
|
||||
requires std::derived_from<E, ast_basic::IExprInstance>&& std::derived_from<T, lib_token::ITokenProcess>
|
||||
class TokenRn : public TokenR<E, T, apntk> { };
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue