add treyarch animtrees & fix nested switches

This commit is contained in:
xensik
2022-10-14 18:47:38 +02:00
committed by Xenxo Espasandín
parent b0ed15dc6c
commit 4e4480792a
12 changed files with 2205 additions and 1969 deletions

View File

@ -178,6 +178,9 @@ expr_path::expr_path(const location& loc, const std::string& value) : node(kind:
expr_identifier::expr_identifier(const std::string& value) : node(kind::expr_identifier), value(value) {}
expr_identifier::expr_identifier(const location& loc, const std::string& value) : node(kind::expr_identifier, loc), value(value) {}
expr_animtree::expr_animtree() : node(kind::expr_animtree) {}
expr_animtree::expr_animtree(const location& loc) : node(kind::expr_animtree, loc) {}
expr_animation::expr_animation(const std::string& value) : node(kind::expr_animation), value(value) {}
expr_animation::expr_animation(const location& loc, const std::string& value) : node(kind::expr_animation, loc), value(value) {}
@ -590,6 +593,11 @@ auto expr_identifier::print() const -> std::string
return value;
}
auto expr_animtree::print() const -> std::string
{
return "#animtree";
}
auto expr_animation::print() const -> std::string
{
return "%"s += value;
@ -1535,6 +1543,11 @@ bool operator==(const expr_identifier& lhs, const expr_identifier& rhs)
return lhs.value == rhs.value;
}
bool operator==(const expr_animtree&, const expr_animtree&)
{
return true;
}
bool operator==(const expr_animation& lhs, const expr_animation& rhs)
{
return lhs.value == rhs.value;
@ -1664,6 +1677,7 @@ expr::~expr()
case kind::expr_istring: as_istring.~unique_ptr(); return;
case kind::expr_path: as_path.~unique_ptr(); return;
case kind::expr_identifier: as_identifier.~unique_ptr(); return;
case kind::expr_animtree: as_animtree.~unique_ptr(); return;
case kind::expr_animation: as_animation.~unique_ptr(); return;
case kind::expr_level: as_level.~unique_ptr(); return;
case kind::expr_anim: as_anim.~unique_ptr(); return;
@ -1766,6 +1780,7 @@ bool operator==(const expr& lhs, const expr& rhs)
case kind::expr_istring: return *lhs.as_istring == *rhs.as_istring;
case kind::expr_path: return *lhs.as_path == *rhs.as_path;
case kind::expr_identifier: return *lhs.as_identifier == *rhs.as_identifier;
case kind::expr_animtree: return *lhs.as_animtree == *rhs.as_animtree;
case kind::expr_animation: return *lhs.as_animation == *rhs.as_animation;
case kind::expr_level: return *lhs.as_level == *rhs.as_level;
case kind::expr_anim: return *lhs.as_anim == *rhs.as_anim;

View File

@ -21,6 +21,7 @@ enum class kind
expr_istring,
expr_path,
expr_identifier,
expr_animtree,
expr_animation,
expr_level,
expr_anim,
@ -152,6 +153,7 @@ struct expr_string;
struct expr_istring;
struct expr_path;
struct expr_identifier;
struct expr_animtree;
struct expr_animation;
struct expr_level;
struct expr_anim;
@ -305,6 +307,7 @@ union expr
std::unique_ptr<expr_istring> as_istring;
std::unique_ptr<expr_path> as_path;
std::unique_ptr<expr_identifier> as_identifier;
std::unique_ptr<expr_animtree> as_animtree;
std::unique_ptr<expr_animation> as_animation;
std::unique_ptr<expr_level> as_level;
std::unique_ptr<expr_anim> as_anim;
@ -627,6 +630,16 @@ struct expr_identifier : public node
friend bool operator==(const expr_identifier& lhs, const expr_identifier& rhs);
};
struct expr_animtree : public node
{
using ptr = std::unique_ptr<expr_animtree>;
expr_animtree();
expr_animtree(const location& loc);
auto print() const -> std::string override;
friend bool operator==(const expr_animtree& lhs, const expr_animtree& rhs);
};
struct expr_animation : public node
{
using ptr = std::unique_ptr<expr_animation>;