9class Axiom :
public Def,
public Setters<Axiom> {
42 static std::tuple<const Axiom*, u8, u8>
get(
const Def* def);
59 template<
class T>
struct Match {
76template<
class Id,
class D>
class Match {
77 static_assert(
Annex::Num<Id> != size_t(-1),
"invalid number of sub tags");
90 operator const D*()
const {
return def_; }
91 explicit operator bool() {
return axiom_ !=
nullptr; }
101 auto id()
const {
return Id(
axiom()->flags()); }
105 const Axiom* axiom_ =
nullptr;
106 const D* def_ =
nullptr;
112template<
class Id,
bool DynCast = true>
auto match(
const Def* def) {
118 assert(cond &&
"assumed to be correct axiom");
122template<
class Id,
bool DynCast = true>
auto match(Id
id,
const Def* def) {
125 bool cond = axiom && curry == 0 && axiom->flags() == (
flags_t)
id;
128 assert(cond &&
"assumed to be correct axiom");
NormalizeFn normalizer() const
const Def * rebuild_(World &, const Def *, Defs) const override
static std::pair< u8, u8 > infer_curry_and_trip(const Def *type)
static std::tuple< const Axiom *, u8, u8 > get(const Def *def)
Yields currying counter of def.
static constexpr auto Node
static constexpr u8 Trip_End
Def * set(size_t i, const Def *)
Successively set from left to right.
constexpr flags_t flags() const noexcept
const Def * type() const noexcept
Yields the "raw" type of this Def (maybe nullptr).
const Axiom * axiom() const
auto id() const
Axiom::flags cast to Id.
const D * operator->() const
Match(const Axiom *axiom, const D *def)
CRTP-based Mixin to declare setters for Def::loc & Def::name using a covariant return type.
constexpr bool is_commutative(Id)
auto match(const Def *def)
const Def *(*)(const Def *, const Def *, const Def *) NormalizeFn
constexpr bool is_associative(Id id)
auto force(const Def *def)
static sub_t flags2sub(flags_t f)
Yields the sub part of the name as integer.
static plugin_t flags2plugin(flags_t f)
static flags_t flags2base(flags_t f)
Includes Axiom::plugin() and Axiom::tag() but not Axiom::sub.
static constexpr size_t Num
static constexpr flags_t Base
static tag_t flags2tag(flags_t f)
Yields the tag part of the name as integer.