27#ifndef OPENVDB_AX_AST_HAS_BEEN_INCLUDED
28#define OPENVDB_AX_AST_HAS_BEEN_INCLUDED
32#include <openvdb/version.h>
104 using Ptr = std::shared_ptr<Node>;
184 template <
typename NodeT>
186 return dynamic_cast<const NodeT*
>(
this);
206 virtual const Node*
child(
const size_t index)
const = 0;
218 for (; i < count; ++i) {
219 if (p->
child(i) ==
this)
break;
221 if (i == count)
return -1;
222 return static_cast<int64_t
>(i);
250 const int64_t idx = this->
childidx();
251 if (idx == -1)
return false;
252 return this->
parent()->replacechild(idx, node);
279 [[maybe_unused]]
bool hasChild =
false;
280 for (
size_t i = 0; i <
parent->children(); ++i)
281 hasChild |=
parent->child(i) ==
this;
293 inline Node* parent() {
return mParent; }
297 Node* mParent =
nullptr;
351 const Node*
child(
const size_t)
const override {
return nullptr; }
353 inline const std::string&
name()
const {
return mName; }
356 const std::string mName;
369 const Node*
child(
const size_t)
const override {
return nullptr; }
408 for (
Statement* statement : statements) {
418 this->addStatement(stmnt->copy());
428 const char*
nodename()
const override {
return "statement list"; }
430 const char*
subname()
const override {
return "stml"; }
438 if (i >= mList.size())
return nullptr;
439 return mList[i].get();
443 if (mList.size() <= i)
return false;
445 if (!expr)
return false;
446 mList[i].reset(expr);
452 inline size_t size()
const {
return mList.size(); }
458 mList.emplace_back(stmnt);
463 std::vector<Statement::UniquePtr> mList;
496 Block(
const std::vector<Statement*>& statements)
498 for (
Statement* statement : statements) {
507 this->addStatement(stmnt->copy());
517 const char*
nodename()
const override {
return "scoped block"; }
519 const char*
subname()
const override {
return "blk"; }
527 if (i >= mList.size())
return nullptr;
528 return mList[i].get();
532 if (mList.size() <= i)
return false;
534 if (!expr)
return false;
535 mList[i].reset(expr);
541 inline size_t size()
const {
return mList.size(); }
547 mList.emplace_back(stmnt);
552 std::vector<Statement::UniquePtr> mList;
564 using Ptr = std::shared_ptr<Tree>;
574 mBlock->setParent(
this);
580 : mBlock(new
Block(*other.mBlock)) {
581 mBlock->setParent(
this);
590 const char*
nodename()
const override {
return "tree"; }
592 const char*
subname()
const override {
return "tree"; }
597 size_t children() const override final {
return 1; }
600 if (i == 0)
return mBlock.get();
629 mExpressions.reserve(expressions.size());
640 mExpressions.reserve(other.mExpressions.size());
642 this->append(expr->copy());
654 const char*
nodename()
const override {
return "comma"; }
656 const char*
subname()
const override {
return "comma"; }
664 if (i >= mExpressions.size())
return nullptr;
665 return mExpressions[i].get();
669 if (mExpressions.size() <= i)
return false;
671 mExpressions[i].reset(expr);
677 inline size_t size()
const {
return mExpressions.size(); }
680 inline bool empty()
const {
return mExpressions.empty(); }
686 mExpressions.emplace_back(expr);
691 std::vector<Expression::UniquePtr> mExpressions;
735 mConditional->setParent(
this);
736 mBody->setParent(
this);
739 mInitial->setParent(
this);
743 mIteration->setParent(
this);
751 : mLoopType(other.mLoopType)
752 , mConditional(other.mConditional->
copy())
753 , mBody(other.mBody->
copy())
754 , mInitial(other.
hasInit() ? other.mInitial->
copy() : nullptr)
755 , mIteration(other.
hasIter() ? other.mIteration->
copy() : nullptr) {
756 mConditional->setParent(
this);
757 mBody->setParent(
this);
760 mInitial->setParent(
this);
764 mIteration->setParent(
this);
774 const char*
nodename()
const override {
return "loop"; }
776 const char*
subname()
const override {
return "loop"; }
781 size_t children() const override final {
return 4; }
784 if (i == 0)
return mConditional.get();
785 if (i == 1)
return mBody.get();
786 if (i == 2)
return mInitial.get();
787 if (i == 3)
return mIteration.get();
793 if (i == 0 || i == 2) {
795 if (!stmt)
return false;
797 mConditional.reset(stmt);
798 mConditional->setParent(
this);
801 mInitial.reset(stmt);
802 mInitial->setParent(
this);
808 if (!blk)
return false;
815 if (!expr)
return false;
816 mIteration.reset(expr);
866 using UniquePtr = std::unique_ptr<ConditionalStatement>;
880 Block* falseBlock =
nullptr)
881 : mConditional(conditional)
882 , mTrueBranch(trueBlock)
883 , mFalseBranch(falseBlock) {
886 mConditional->setParent(
this);
887 mTrueBranch->setParent(
this);
888 if (mFalseBranch) mFalseBranch->setParent(
this);
896 : mConditional(other.mConditional->
copy())
897 , mTrueBranch(other.mTrueBranch->
copy())
898 , mFalseBranch(other.
hasFalse() ? other.mFalseBranch->
copy() : nullptr) {
899 mConditional->setParent(
this);
900 mTrueBranch->setParent(
this);
901 if (mFalseBranch) mFalseBranch->setParent(
this);
912 const char*
nodename()
const override {
return "conditional statement"; }
914 const char*
subname()
const override {
return "cond"; }
919 size_t children() const override final {
return 3; }
932 if (!expr)
return false;
933 mConditional.reset(expr);
937 else if (i == 1 || i == 2) {
939 if (!blk)
return false;
941 mTrueBranch.reset(blk);
942 mTrueBranch->setParent(
this);
945 mFalseBranch.reset(blk);
946 mFalseBranch->setParent(
this);
1008 mLeft->setParent(
this);
1009 mRight->setParent(
this);
1018 const std::string& op)
1025 : mLeft(other.mLeft->
copy())
1026 , mRight(other.mRight->
copy())
1027 , mOperation(other.mOperation) {
1028 mLeft->setParent(
this);
1029 mRight->setParent(
this);
1040 const char*
nodename()
const override {
return "binary"; }
1042 const char*
subname()
const override {
return "bin"; }
1049 if (i == 0)
return mLeft.get();
1050 if (i == 1)
return mRight.get();
1055 if (i > 1)
return false;
1057 if (!expr)
return false;
1060 mLeft->setParent(
this);
1064 mRight->setParent(
this);
1108 : mConditional(conditional)
1109 , mTrueBranch(trueExpression)
1110 , mFalseBranch(falseExpression) {
1113 mConditional->setParent(
this);
1114 if (mTrueBranch) mTrueBranch->setParent(
this);
1115 mFalseBranch->setParent(
this);
1122 : mConditional(other.mConditional->
copy())
1123 , mTrueBranch(other.
hasTrue() ? other.mTrueBranch->
copy() : nullptr)
1124 , mFalseBranch(other.mFalseBranch->
copy()) {
1125 mConditional->setParent(
this);
1126 if (mTrueBranch) mTrueBranch->setParent(
this);
1127 mFalseBranch->setParent(
this);
1138 const char*
nodename()
const override {
return "ternary"; }
1140 const char*
subname()
const override {
return "tern"; }
1147 if (i == 0)
return mConditional.get();
1148 if (i == 1)
return mTrueBranch.get();
1149 if (i == 2)
return mFalseBranch.get();
1154 if (i > 2)
return false;
1156 if (!expr)
return false;
1158 mConditional.reset(expr);
1159 mConditional->setParent(
this);
1162 mTrueBranch.reset(expr);
1163 mTrueBranch->setParent(
this);
1166 mFalseBranch.reset(expr);
1167 mFalseBranch->setParent(
this);
1215 mLHS->setParent(
this);
1216 mRHS->setParent(
this);
1224 : mLHS(other.mLHS->
copy())
1225 , mRHS(other.mRHS->
copy())
1226 , mOperation(other.mOperation) {
1227 mLHS->setParent(
this);
1228 mRHS->setParent(
this);
1239 const char*
nodename()
const override {
return "assignment expression"; }
1241 const char*
subname()
const override {
return "asgn"; }
1248 if (i == 0)
return this->
lhs();
1249 if (i == 1)
return this->
rhs();
1254 if (i > 1)
return false;
1256 if (!expr)
return false;
1259 mLHS->setParent(
this);
1263 mRHS->setParent(
this);
1315 mExpression->setParent(
this);
1322 : mExpression(other.mExpression->
copy())
1323 , mOperation(other.mOperation)
1324 , mPost(other.mPost) {
1325 mExpression->setParent(
this);
1334 const char*
nodename()
const override {
return "crement"; }
1336 const char*
subname()
const override {
return "crmt"; }
1349 if (i != 0)
return false;
1351 if (!expr)
return false;
1352 mExpression.reset(expr);
1370 inline bool pre()
const {
return !mPost; }
1373 inline bool post()
const {
return mPost; }
1380 const Operation mOperation;
1402 mExpression->setParent(
this);
1415 : mExpression(other.mExpression->
copy())
1416 , mOperation(other.mOperation) {
1417 mExpression->setParent(
this);
1426 const char*
nodename()
const override {
return "unary"; }
1428 const char*
subname()
const override {
return "unry"; }
1440 if (i != 0)
return false;
1442 if (!expr)
return false;
1443 mExpression.reset(expr);
1476 , mExpression(expr) {
1478 mExpression->setParent(
this);
1486 , mType(other.mType)
1487 , mExpression(other.mExpression->
copy()) {
1497 const char*
nodename()
const override {
return "cast"; }
1499 const char*
subname()
const override {
return "cast"; }
1511 if (i != 0)
return false;
1513 if (!expr)
return false;
1514 mExpression.reset(expr);
1553 : mFunctionName(function)
1564 const std::vector<Expression*>& arguments)
1565 : mFunctionName(function)
1567 mArguments.reserve(arguments.size());
1577 : mFunctionName(other.mFunctionName)
1579 mArguments.reserve(other.mArguments.size());
1581 this->append(expr->copy());
1591 const char*
nodename()
const override {
return "function call"; }
1593 const char*
subname()
const override {
return "call"; }
1600 if (i >= mArguments.size())
return nullptr;
1601 return mArguments[i].get();
1605 if (mArguments.size() <= i)
return false;
1607 mArguments[i].reset(expr);
1614 inline const std::string&
name()
const {
return mFunctionName; }
1617 inline size_t numArgs()
const {
return mArguments.size(); }
1620 inline size_t size()
const {
return mArguments.size(); }
1623 inline bool empty()
const {
return mArguments.empty(); }
1629 mArguments.emplace_back(expr);
1634 const std::string mFunctionName;
1635 std::vector<Expression::UniquePtr> mArguments;
1652 : mKeyword(other.mKeyword) {}
1660 const char*
nodename()
const override {
return "keyword"; }
1662 const char*
subname()
const override {
return "keyw"; }
1704 , mExpression(expr) {
1707 mIdx0->setParent(
this);
1708 if(mIdx1) mIdx1->setParent(
this);
1709 mExpression->setParent(
this);
1717 other.mIdx0->
copy(),
1718 other.mIdx1 ? other.mIdx1->
copy() : nullptr) {}
1727 const char*
nodename()
const override {
return "array unpack"; }
1729 const char*
subname()
const override {
return "unpk"; }
1743 if (i > 2)
return false;
1745 if (!expr)
return false;
1746 if (i == 0) mIdx0.reset(expr);
1747 if (i == 1) mIdx1.reset(expr);
1748 if (i == 2) mExpression.reset(expr);
1776 return static_cast<bool>(this->
component1());
1796 this->
append(expression);
1804 mExpressions.reserve(arguments.size());
1814 mExpressions.reserve(other.mExpressions.size());
1816 this->append(expr->copy());
1826 const char*
nodename()
const override {
return "array pack"; }
1828 const char*
subname()
const override {
return "pack"; }
1835 if (i >= mExpressions.size())
return nullptr;
1836 return mExpressions[i].get();
1840 if (mExpressions.size() <= i)
return false;
1842 mExpressions[i].reset(expr);
1848 inline size_t size()
const {
return mExpressions.size(); }
1851 inline bool empty()
const {
return mExpressions.empty(); }
1857 mExpressions.emplace_back(expr);
1862 std::vector<Expression::UniquePtr> mExpressions;
1906 , mType(other.mType)
1907 , mTypeInferred(other.mTypeInferred) {}
1915 const char*
nodename()
const override {
return "attribute"; }
1917 const char*
subname()
const override {
return "atr"; }
1958 static inline std::string
1977 if (at == std::string::npos)
return false;
1979 *
type = token.substr(0, at);
1980 if (
type->empty()) {
1984 if (
name) *
name = token.substr(at + 1, token.size());
1989 const bool mTypeInferred;
2026 , mType(other.mType) {}
2036 const char*
nodename()
const override {
return "external"; }
2038 const char*
subname()
const override {
return "ext"; }
2075 static inline std::string
2094 if (at == std::string::npos)
return false;
2096 *
type = token.substr(0, at);
2097 if (
type->empty()) {
2101 if (
name) *
name = token.substr(at + 1, token.size());
2127 const char*
nodename()
const override {
return "local"; }
2129 const char*
subname()
const override {
return "lcl"; }
2152 mLocal->setParent(
this);
2153 if (mInit) mInit->setParent(
this);
2160 : mType(other.mType)
2161 , mLocal(other.mLocal->
copy())
2162 , mInit(other.
hasInit() ? other.mInit->
copy() : nullptr) {
2163 mLocal->setParent(
this);
2164 if (mInit) mInit->setParent(
this);
2173 const char*
nodename()
const override {
return "declaration"; }
2175 const char*
subname()
const override {
return "dcl"; }
2182 if (i == 0)
return this->
local();
2183 if (i == 1)
return this->
init();
2188 if (i > 1)
return false;
2191 if (!
local)
return false;
2192 mLocal.reset(
local);
2197 if (!
init)
return false;
2217 inline bool hasInit()
const {
return static_cast<bool>(this->
init()); }
2252template <
typename T>
2262 std::is_integral<T>::value, uint64_t, T>::type;
2267 std::is_same<T, bool>::value ||
2268 std::is_same<T, int16_t>::value ||
2269 std::is_same<T, int32_t>::value ||
2270 std::is_same<T, int64_t>::value ||
2271 std::is_same<T, float>::value ||
2272 std::is_same<T, double>::value;
2273 static_assert(
IsSupported,
"Incompatible ast::Value node instantiated.");
2285 : mValue(other.mValue) {}
2301 if (std::is_same<T, bool>::value)
return "boolean literal";
2302 if (std::is_same<T, int16_t>::value)
return "int16 literal";
2303 if (std::is_same<T, int32_t>::value)
return "int32 literal";
2304 if (std::is_same<T, int64_t>::value)
return "int64 literal";
2305 if (std::is_same<T, float>::value)
return "float (32bit) literal";
2306 if (std::is_same<T, double>::value)
return "double (64bit) literal";
2310 if (std::is_same<T, bool>::value)
return "bool";
2311 if (std::is_same<T, int16_t>::value)
return "i16";
2312 if (std::is_same<T, int32_t>::value)
return "i32";
2313 if (std::is_same<T, int64_t>::value)
return "i64";
2314 if (std::is_same<T, float>::value)
return "flt";
2315 if (std::is_same<T, double>::value)
return "dbl";
2325 inline T
value()
const {
return static_cast<T
>(mValue); }
2330 const ContainerType mValue;
2352 const char*
nodename()
const override {
return "string value"; }
2353 const char*
subname()
const override {
return "str"; }
2358 inline const std::string&
value()
const {
return mValue; }
#define OPENVDB_ASSERT(X)
Definition Assert.h:41
Various function and operator tokens used throughout the AST and code generation.
OperatorToken
Definition Tokens.h:151
@ EQUALS
ASSIGNMENT.
Definition Tokens.h:187
std::string typeStringFromToken(const CoreType type)
Definition Tokens.h:118
KeywordToken
Definition Tokens.h:315
LoopToken
Definition Tokens.h:297
@ FOR
Definition Tokens.h:298
CoreType
Definition Tokens.h:32
@ FLOAT
Definition Tokens.h:38
Definition Exceptions.h:13
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:1824
~ArrayPack() override=default
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:1826
const Expression * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:1834
std::unique_ptr< ArrayPack > UniquePtr
Definition AST.h:1787
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:1832
size_t size() const
Alias for ArrayPack::children.
Definition AST.h:1848
ArrayPack(const std::vector< Expression * > &arguments)
Construct a new ArrayPack transferring ownership of any provided arguments to the ArrayPack and updat...
Definition AST.h:1802
ArrayPack * copy() const override final
The deep copy method for a Node.
Definition AST.h:1822
void append(Expression *expr)
Appends an argument to this ArrayPack, transferring ownership to the ArrayPack and updating parent da...
Definition AST.h:1855
bool empty() const
Query whether this Expression list holds any valid expressions.
Definition AST.h:1851
ArrayPack(const ArrayPack &other)
Deep copy constructor for a ArrayPack, performing a deep copy on all held arguments,...
Definition AST.h:1812
const Expression * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:1830
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:1839
ArrayPack(Expression *expression)
Construct a new ArrayPack with a single expression, transferring ownership of the expression to the A...
Definition AST.h:1794
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:1828
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:1725
ArrayUnpack(const ArrayUnpack &other)
Deep copy constructor for a ArrayUnpack, performing a deep copy on the expression being indexed and a...
Definition AST.h:1715
ArrayUnpack * copy() const override final
The deep copy method for a Node.
Definition AST.h:1723
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:1727
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:1733
const Statement * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:1735
std::unique_ptr< ArrayUnpack > UniquePtr
Definition AST.h:1688
const Expression * expression() const
Access a const pointer to the expression being indexed as an abstract Expression.
Definition AST.h:1765
bool isMatrixIndex() const
Query whether this ArrayUnpack operation must be a matrix indexing operation by checking the presence...
Definition AST.h:1774
~ArrayUnpack() override=default
const Expression * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:1731
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:1742
const Expression * component1() const
Access a const pointer to the second component being used as an abstract Expression.
Definition AST.h:1761
const Expression * component0() const
Access a const pointer to the first component being used as an abstract Expression.
Definition AST.h:1756
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:1729
ArrayUnpack(Expression *expr, Expression *component0, Expression *component1=nullptr)
Construct a new ArrayUnpack with a valid expression, an initial component (as an expression) to the f...
Definition AST.h:1699
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:1237
AssignExpression * copy() const override final
The deep copy method for a Node.
Definition AST.h:1233
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:1239
const Expression * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:1247
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:1245
~AssignExpression() override=default
const Expression * lhs() const
Access a const pointer to the AssignExpression LHS as an abstract expression.
Definition AST.h:1280
tokens::OperatorToken operation() const
Query the actual operational type of this AssignExpression. For simple (non-compound) AssignExpressio...
Definition AST.h:1276
const Expression * rhs() const
Access a const pointer to the AssignExpression RHS as an.
Definition AST.h:1284
std::unique_ptr< AssignExpression > UniquePtr
Definition AST.h:1200
const Expression * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:1243
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:1253
bool isCompound() const
Query whether or not this is a compound AssignExpression. Compound AssignExpressions are assignments ...
Definition AST.h:1272
AssignExpression(const AssignExpression &other)
Deep copy constructor for an AssignExpression, performing a deep copy on both held expressions,...
Definition AST.h:1223
AssignExpression(Expression *lhs, Expression *rhs, const tokens::OperatorToken op=tokens::EQUALS)
Construct a new AssignExpression with valid LHS and RHS expressions, transferring ownership of the ex...
Definition AST.h:1208
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:1241
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:1913
bool inferred() const
Query whether this attribute was accessed via inferred syntax i.e. @P or @myattribute.
Definition AST.h:1924
static char symbolseparator()
Static method returning the symbol associated with an Attribute access as defined by AX Grammar.
Definition AST.h:1945
Attribute(const std::string &name, const std::string &token, const bool inferred=false)
Construct a new Attribute with a given name and type/token string, delegating construction to the abo...
Definition AST.h:1897
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:1915
std::unique_ptr< Attribute > UniquePtr
Definition AST.h:1876
Attribute(const std::string &name, const tokens::CoreType type, const bool inferred=false)
Construct a new Attribute with a given name and type. Optionally also mark it as inferred type creati...
Definition AST.h:1885
const Variable * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:1919
static std::string tokenFromNameType(const std::string &name, const tokens::CoreType type)
Static method returning the full unique attribute token identifier by consolidating its name and type...
Definition AST.h:1959
static bool nametypeFromToken(const std::string &token, std::string *name, std::string *type)
Static method which splits a valid attribute token into its name and type counterparts....
Definition AST.h:1975
Attribute * copy() const override final
The deep copy method for a Node.
Definition AST.h:1911
std::string tokenname() const
Construct and return the full attribute token identifier. See Attribute::tokenFromNameType.
Definition AST.h:1938
tokens::CoreType type() const
Access the type that was used to access this attribute.
Definition AST.h:1927
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:1917
~Attribute() override=default
Attribute(const Attribute &other)
Deep copy constructor for a Attribute.
Definition AST.h:1904
std::string typestr() const
Get the access type as a front end AX type/token string.
Definition AST.h:1932
BinaryOperator(Expression *left, Expression *right, const tokens::OperatorToken op)
Construct a new BinaryOperator with a given tokens::OperatorToken and a valid LHS and RHS expression,...
Definition AST.h:1000
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:1038
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:1040
const Expression * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:1048
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:1046
const Expression * lhs() const
Access a const pointer to the BinaryOperator LHS as an abstract expression.
Definition AST.h:1075
tokens::OperatorToken operation() const
Query the type of binary operation held on this node.
Definition AST.h:1071
const Expression * rhs() const
Access a const pointer to the BinaryOperator RHS as an abstract expression.
Definition AST.h:1079
BinaryOperator * copy() const override final
The deep copy method for a Node.
Definition AST.h:1034
std::unique_ptr< BinaryOperator > UniquePtr
Definition AST.h:990
const Expression * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:1044
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:1054
BinaryOperator(const BinaryOperator &other)
Deep copy constructor for a BinaryOperator, performing a deep copy on both held expressions,...
Definition AST.h:1024
~BinaryOperator() override=default
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:1042
BinaryOperator(Expression *left, Expression *right, const std::string &op)
Construct a new BinaryOperator with a string, delegating construction to the above BinaryOperator con...
Definition AST.h:1016
A Block node represents a scoped list of statements. It may comprise of 0 or more statements,...
Definition AST.h:477
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:515
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:517
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:524
size_t size() const
Alias for Block::children.
Definition AST.h:541
Block()
Construct a new Block with an empty list.
Definition AST.h:481
const Statement * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:521
const Statement * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:526
Block(const Block &other)
Deep copy constructor for a Block, performing a deep copy on every held statement,...
Definition AST.h:505
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:531
Block(Statement *statement)
Construct a new Block with a single statement, transferring ownership of the statement to the block a...
Definition AST.h:487
void addStatement(Statement *stmnt)
Adds a statement to this block, transferring ownership to the block and updating parent data on the s...
Definition AST.h:545
Block * copy() const override final
The deep copy method for a Node.
Definition AST.h:513
std::unique_ptr< Block > UniquePtr
Definition AST.h:478
Block(const std::vector< Statement * > &statements)
Construct a new Block from a vector of statements, transferring ownership of all valid statements to ...
Definition AST.h:496
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:519
~Block() override=default
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:1495
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:1497
const Expression * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:1505
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:1503
Cast(const Cast &other)
Deep copy constructor for a Cast node, performing a deep copy on the underlying expressions,...
Definition AST.h:1484
const Expression * expression() const
Access a const pointer to the Cast node's expression as an abstract expression.
Definition AST.h:1532
Cast(Expression *expr, const tokens::CoreType type)
Construct a new Cast with a valid expression and a target tokens::CoreType, transferring ownership of...
Definition AST.h:1473
const Expression * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:1501
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:1510
Cast * copy() const override final
The deep copy method for a Node.
Definition AST.h:1493
std::unique_ptr< Cast > UniquePtr
Definition AST.h:1466
tokens::CoreType type() const
Access to the target type.
Definition AST.h:1521
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:1499
std::string typestr() const
Get the target type as a front end AX type/token string.
Definition AST.h:1526
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:652
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:654
const Expression * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:663
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:661
size_t size() const
Alias for CommaOperator::children.
Definition AST.h:677
std::unique_ptr< CommaOperator > UniquePtr
Definition AST.h:609
void append(Expression *expr)
Append an expression to this CommaOperator, transferring ownership to the CommaOperator and updating ...
Definition AST.h:684
CommaOperator(const CommaOperator &other)
Deep copy constructor for an CommaOperator, performing a deep copy on every held expression,...
Definition AST.h:638
bool empty() const
Query whether this Expression list holds any valid expressions.
Definition AST.h:680
CommaOperator(Expression *expression)
Construct a new CommaOperator with a single expression, transferring ownership of the expression to t...
Definition AST.h:618
const Expression * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:658
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:668
~CommaOperator() override=default
CommaOperator()
Construct a new CommaOperator with an expr set.
Definition AST.h:612
CommaOperator(const std::vector< Expression * > &expressions)
Construct a new CommaOperator from a vector of expression, transferring ownership of all valid expres...
Definition AST.h:627
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:656
CommaOperator * copy() const override final
The deep copy method for a Node.
Definition AST.h:648
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:910
~ConditionalStatement() override=default
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:912
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:919
bool hasFalse() const
Query if this ConditionalStatement has a valid 'false' branch.
Definition AST.h:955
const Statement * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:916
const Statement * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:921
ConditionalStatement * copy() const override final
The deep copy method for a Node.
Definition AST.h:906
const Block * trueBranch() const
Access a const pointer to the ConditionalStatements 'true' branch as a Block.
Definition AST.h:971
ConditionalStatement(Expression *conditional, Block *trueBlock, Block *falseBlock=nullptr)
Construct a new ConditionalStatement with an Expression representing the primary condition,...
Definition AST.h:878
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:928
const Block * falseBranch() const
Access a const pointer to the ConditionalStatements 'false' branch as a Block.
Definition AST.h:975
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:914
std::unique_ptr< ConditionalStatement > UniquePtr
Definition AST.h:866
ConditionalStatement(const ConditionalStatement &other)
Deep copy constructor for an ConditionalStatement, performing a deep copy on the condition and both h...
Definition AST.h:895
size_t branchCount() const
Query the number of branches held by this ConditionalStatement. This is only ever 1 or 2.
Definition AST.h:961
const Expression * condition() const
Access a const pointer to the ConditionalStatements condition as an abstract expression.
Definition AST.h:967
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:1332
Crement(const Crement &other)
Deep copy constructor for a Crement, performing a deep copy on the underlying expressions,...
Definition AST.h:1321
bool decrement() const
Query if this Crement node represents an decrement –.
Definition AST.h:1367
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:1334
const Expression * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:1343
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:1341
const Expression * expression() const
Access a const pointer to the expression being crements as an abstract Expression.
Definition AST.h:1377
Crement * copy() const override final
The deep copy method for a Node.
Definition AST.h:1330
bool post() const
Query if this Crement node represents a post crement a++.
Definition AST.h:1373
Crement(Expression *expr, const Operation op, bool post)
Construct a new Crement with a valid expression, transferring ownership of the expression to the Crem...
Definition AST.h:1311
const Expression * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:1338
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:1348
bool increment() const
Query if this Crement node represents an incrementation ++.
Definition AST.h:1364
~Crement() override=default
Operation
A simple enum representing the crement type.
Definition AST.h:1299
@ Increment
Definition AST.h:1300
@ Decrement
Definition AST.h:1301
bool pre() const
Query if this Crement node represents a pre crement ++a.
Definition AST.h:1370
Operation operation() const
Query the type of the Crement operation. This does not hold post or pre-crement information.
Definition AST.h:1361
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:1336
std::unique_ptr< Crement > UniquePtr
Definition AST.h:1296
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:2171
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:2173
const Expression * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:2181
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:2179
const Statement * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:2177
DeclareLocal * copy() const override final
The deep copy method for a Node.
Definition AST.h:2169
DeclareLocal(const DeclareLocal &other)
Deep copy constructor for a DeclareLocal.
Definition AST.h:2159
const Local * local() const
Access a const pointer to the Local.
Definition AST.h:2221
DeclareLocal(const tokens::CoreType type, Local *local, Expression *init=nullptr)
Construct a new DeclareLocal with a given name and type.
Definition AST.h:2147
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:2187
const Expression * init() const
Access a const pointer to the initialiser.
Definition AST.h:2224
std::unique_ptr< DeclareLocal > UniquePtr
Definition AST.h:2141
tokens::CoreType type() const
Access the type that was specified at which to create the given local.
Definition AST.h:2207
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:2175
~DeclareLocal() override=default
bool hasInit() const
Query if this declaration has an initialiser.
Definition AST.h:2217
std::string typestr() const
Get the declaration type as a front end AX type/token string.
Definition AST.h:2212
Expressions are comprised of full or potentially partial parts of a full statement that may not neces...
Definition AST.h:327
virtual Expression * copy() const override=0
The deep copy method for a Node.
const Statement * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:331
~Expression() override=default
std::unique_ptr< Expression > UniquePtr
Definition AST.h:328
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:2034
ExternalVariable(const std::string &name, const tokens::CoreType type)
Construct a new ExternalVariable with a given name and type.
Definition AST.h:2009
static char symbolseparator()
Static method returning the symbol associated with an ExternalVariable access as defined by AX Gramma...
Definition AST.h:2062
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:2036
const std::string tokenname() const
Construct and return the full external token identifier. See ExternalVariable::tokenFromNameType.
Definition AST.h:2055
ExternalVariable(const std::string &name, const std::string &token)
Construct a new ExternalVariable with a given name and type/token string, delegating construction to ...
Definition AST.h:2017
ExternalVariable(const ExternalVariable &other)
Deep copy constructor for a ExternalVariable.
Definition AST.h:2024
const Variable * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:2040
static std::string tokenFromNameType(const std::string &name, const tokens::CoreType type)
Static method returning the full unique external token identifier by consolidating its name and type ...
Definition AST.h:2076
std::unique_ptr< ExternalVariable > UniquePtr
Definition AST.h:2004
static bool nametypeFromToken(const std::string &token, std::string *name, std::string *type)
Static method which splits a valid external token into its name and type counterparts....
Definition AST.h:2092
tokens::CoreType type() const
Access the type that was used to access this external variable.
Definition AST.h:2044
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:2038
ExternalVariable * copy() const override final
The deep copy method for a Node.
Definition AST.h:2030
~ExternalVariable() override=default
std::string typestr() const
Get the access type as a front end AX type/token string.
Definition AST.h:2049
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:1589
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:1591
const Expression * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:1599
const std::string & name() const
Access the function name/identifier.
Definition AST.h:1614
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:1597
size_t size() const
Alias for FunctionCall::children.
Definition AST.h:1620
size_t numArgs() const
Query the total number of arguments stored on this function.
Definition AST.h:1617
std::unique_ptr< FunctionCall > UniquePtr
Definition AST.h:1543
FunctionCall(const std::string &function, const std::vector< Expression * > &arguments)
Construct a new FunctionCall with a given function identifier and optional argument list,...
Definition AST.h:1563
void append(Expression *expr)
Appends an argument to this function call, transferring ownership to the FunctionCall and updating pa...
Definition AST.h:1627
bool empty() const
Query whether this Expression list holds any valid expressions.
Definition AST.h:1623
~FunctionCall() override=default
const Expression * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:1595
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:1604
FunctionCall * copy() const override final
The deep copy method for a Node.
Definition AST.h:1587
FunctionCall(const FunctionCall &other)
Deep copy constructor for a FunctionCall, performing a deep copy on all held function arguments,...
Definition AST.h:1576
FunctionCall(const std::string &function, Expression *argument=nullptr)
Construct a new FunctionCall with a given function identifier and an optional argument,...
Definition AST.h:1551
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:1593
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:1658
~Keyword() override=default
tokens::KeywordToken keyword() const
Query the keyword held on this node.
Definition AST.h:1673
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:1660
Keyword(const tokens::KeywordToken keyw)
Construct a new Keyword with a given tokens::KeywordToken.
Definition AST.h:1647
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:1666
std::unique_ptr< Keyword > UniquePtr
Definition AST.h:1643
const Statement * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:1664
Keyword * copy() const override final
The deep copy method for a Node.
Definition AST.h:1656
const Node * child(const size_t) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:1668
Keyword(const Keyword &other)
Deep copy constructor for a Keyword.
Definition AST.h:1651
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:1662
Local AST nodes represent a single accesses to a local variable. The only store the name of the varia...
Definition AST.h:2113
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:2125
Local(const std::string &name)
Construct a Local with a given name.
Definition AST.h:2118
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:2127
std::unique_ptr< Local > UniquePtr
Definition AST.h:2114
const Variable * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:2131
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:2129
Local * copy() const override final
The deep copy method for a Node.
Definition AST.h:2123
~Local() override=default
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:772
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:774
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:781
const Statement * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:778
const Statement * condition() const
Access a const pointer to the Loop condition as an abstract statement.
Definition AST.h:835
const Statement * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:783
Loop(const Loop &other)
Deep copy constructor for an Loop, performing a deep copy on the condition, body and initial Statemen...
Definition AST.h:750
Loop * copy() const override final
The deep copy method for a Node.
Definition AST.h:770
Loop(const tokens::LoopToken loopType, Statement *condition, Block *body, Statement *init=nullptr, Expression *iter=nullptr)
Construct a new Loop with the type defined by a tokens::LoopToken, a condition Statement,...
Definition AST.h:723
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:791
bool hasIter() const
Query if this Loop has a valid iteration expression list.
Definition AST.h:831
tokens::LoopToken loopType() const
Query the type of loop held on this node.
Definition AST.h:825
const Statement * initial() const
Access a const pointer to the Loop initial statement as an abstract statement.
Definition AST.h:842
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:776
const Expression * iteration() const
Access a const pointer to the Loop iteration Expression.
Definition AST.h:845
std::unique_ptr< Loop > UniquePtr
Definition AST.h:710
bool hasInit() const
Query if this Loop has a valid initial statement.
Definition AST.h:828
const Block * body() const
Access a const pointer to the Loop body as a Block.
Definition AST.h:838
The base abstract node which determines the interface and required methods for all derived concrete n...
Definition AST.h:103
bool replace(Node *node)
In place replacement. Attempts to replace this node at its specific location within its Abstract Synt...
Definition AST.h:248
std::unique_ptr< Node > UniquePtr
Definition AST.h:105
virtual bool replacechild(const size_t index, Node *node)
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:300
virtual size_t children() const =0
Virtual method for accessing child information. Returns the number of children a given AST node owns.
bool isType() const
Query whether or not this node is of a specific (derived) type. This method should be used to check i...
Definition AST.h:185
virtual const Node * child(const size_t index) const =0
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
int64_t childidx() const
Returns the child index of this node in relation to its parent, or -1 if no valid index is found (usu...
Definition AST.h:212
virtual Node * copy() const =0
The deep copy method for a Node.
virtual const char * subname() const =0
Virtual method for accessing node name information.
virtual const char * nodename() const =0
Virtual method for accessing node name information.
std::shared_ptr< Node > Ptr
Definition AST.h:104
NodeType
An enumerated list of node types for all concrete node types. These can be used for faster evaluation...
Definition AST.h:118
@ TernaryOperatorNode
Definition AST.h:130
@ BinaryOperatorNode
Definition AST.h:129
@ LoopNode
Definition AST.h:124
@ BlockNode
Definition AST.h:121
@ StatementListNode
Definition AST.h:120
@ ConditionalStatementNode
Definition AST.h:122
@ LocalNode
Definition AST.h:138
@ FunctionCallNode
Definition AST.h:133
@ UnaryOperatorNode
Definition AST.h:128
@ ArrayPackNode
Definition AST.h:136
@ TreeNode
Definition AST.h:119
@ ValueInt32Node
Definition AST.h:141
@ AttributeNode
Definition AST.h:132
@ ValueInt16Node
Definition AST.h:140
@ ExternalVariableNode
Definition AST.h:134
@ CommaOperatorNode
Definition AST.h:123
@ ArrayUnpackNode
Definition AST.h:137
@ ValueStrNode
Definition AST.h:145
@ KeywordNode
Definition AST.h:125
@ DeclareLocalNode
Definition AST.h:135
@ ValueBoolNode
Definition AST.h:139
@ ValueDoubleNode
Definition AST.h:144
@ ValueFloatNode
Definition AST.h:143
@ CrementNode
Definition AST.h:127
@ AssignExpressionNode
Definition AST.h:126
@ ValueInt64Node
Definition AST.h:142
@ CastNode
Definition AST.h:131
void setParent(Node *parent)
Set this node's parent. This is used during construction of an AST and should not be used.
Definition AST.h:277
virtual const Node * basetype() const
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:176
const Node * parent() const
Access a const pointer to this nodes parent.
Definition AST.h:272
virtual NodeType nodetype() const =0
Virtual method for accessing node type information.
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:426
std::unique_ptr< StatementList > UniquePtr
Definition AST.h:388
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:428
StatementList(const std::vector< Statement * > &statements)
Construct a new StatementList from a vector of statements, transferring ownership of all valid statem...
Definition AST.h:406
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:435
size_t size() const
Alias for StatementList::children.
Definition AST.h:452
const Statement * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:432
StatementList(const StatementList &other)
Deep copy constructor for a StatementList, performing a deep copy on every held statement,...
Definition AST.h:416
const Statement * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:437
~StatementList() override=default
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:442
void addStatement(Statement *stmnt)
Adds a statement to this statement list, transferring ownership to the statement list and updating pa...
Definition AST.h:456
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:430
StatementList * copy() const override
The deep copy method for a Node.
Definition AST.h:424
StatementList(Statement *statement)
Construct a new StatementList with a single statement, transferring ownership of the statement to the...
Definition AST.h:397
StatementList()
Construct a new StatementList with an empty list.
Definition AST.h:391
Abstract (pure-virtual) AST nodes.
Definition AST.h:313
const Node * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:317
~Statement() override=default
std::unique_ptr< Statement > UniquePtr
Definition AST.h:314
virtual Statement * copy() const override=0
The deep copy method for a Node.
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:1136
~TernaryOperator() override=default
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:1138
const Expression * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:1146
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:1144
TernaryOperator * copy() const override final
The deep copy method for a Node.
Definition AST.h:1132
TernaryOperator(const TernaryOperator &other)
Deep copy constructor for a TernaryOperator, performing a deep copy on held expressions,...
Definition AST.h:1121
const Expression * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:1142
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:1153
const Expression * trueBranch() const
Access a const pointer to the TernaryOperator true expression as an abstract expression.
Definition AST.h:1181
const Expression * falseBranch() const
Access a const pointer to the TernaryOperator false expression as an abstract expression.
Definition AST.h:1185
bool hasTrue() const
Query whether or not this has an optional if-true branch.
Definition AST.h:1173
TernaryOperator(Expression *conditional, Expression *trueExpression, Expression *falseExpression)
Construct a new TernaryOperator with a conditional expression and true (optional) and false expressio...
Definition AST.h:1105
std::unique_ptr< TernaryOperator > UniquePtr
Definition AST.h:1094
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:1140
const Expression * condition() const
Access a const pointer to the TernaryOperator conditional as an abstract expression.
Definition AST.h:1177
A Tree is the highest concrete (non-abstract) node in the entire AX AST hierarchy....
Definition AST.h:563
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:588
Tree(const Tree &other)
Deep copy constructor for a Tree, performing a deep copy on the held Block, ensuring parent informati...
Definition AST.h:579
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:590
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:597
Tree(Block *block=new Block())
Construct a new Tree from a given Block, transferring ownership of the Block to the tree and updating...
Definition AST.h:572
const Node * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:594
Tree * copy() const override final
The deep copy method for a Node.
Definition AST.h:586
std::unique_ptr< Tree > UniquePtr
Definition AST.h:566
std::shared_ptr< Tree > Ptr
Definition AST.h:564
std::shared_ptr< const Tree > ConstPtr
Definition AST.h:565
const Block * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:599
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:592
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:1424
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:1426
const Expression * child(const size_t i) const override final
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:1434
std::unique_ptr< UnaryOperator > UniquePtr
Definition AST.h:1391
UnaryOperator(Expression *expr, const tokens::OperatorToken op)
Construct a new UnaryOperator with a given tokens::OperatorToken and a valid expression,...
Definition AST.h:1398
size_t children() const override final
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:1432
tokens::OperatorToken operation() const
Query the type of unary operation held on this node.
Definition AST.h:1450
const Expression * expression() const
Access a const pointer to the UnaryOperator expression as an abstract expression.
Definition AST.h:1454
const Expression * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:1430
bool replacechild(const size_t i, Node *node) override final
Virtual method that attempted to replace a child at a given index with a provided node type.
Definition AST.h:1439
UnaryOperator(Expression *expr, const std::string &op)
Construct a new UnaryOperator with a string, delegating construction to the above UnaryOperator const...
Definition AST.h:1408
UnaryOperator(const UnaryOperator &other)
Deep copy constructor for a UnaryOperator, performing a deep copy on the underlying expressions,...
Definition AST.h:1414
~UnaryOperator() override=default
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:1428
UnaryOperator * copy() const override final
The deep copy method for a Node.
Definition AST.h:1422
ValueBases are a base class for anything that holds a value (literal). Derived classes store the actu...
Definition AST.h:362
virtual Expression * copy() const override=0
The deep copy method for a Node.
size_t children() const override
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:368
const Expression * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:366
~ValueBase() override=default
std::unique_ptr< ValueBase > UniquePtr
Definition AST.h:363
const Node * child(const size_t) const override
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:369
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:2351
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:2352
Value< Type > * copy() const override final
The deep copy method for a Node.
Definition AST.h:2350
Value(const Type &value)
Construct a new Value string from a string.
Definition AST.h:2342
const ValueBase * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:2354
const std::string & value() const
Access the string.
Definition AST.h:2358
~Value() override=default
std::unique_ptr< Value< std::string > > UniquePtr
Definition AST.h:2337
Value(const Value< Type > &other)
Deep copy constructor for a Value string.
Definition AST.h:2347
std::string Type
Definition AST.h:2339
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:2353
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition AST.h:2291
Value(const Value< T > &other)
Deep copy constructor for a Value.
Definition AST.h:2284
T Type
Definition AST.h:2257
const char * nodename() const override
Virtual method for accessing node name information.
Definition AST.h:2300
static constexpr bool IsSupported
The list of supported numerical constants.
Definition AST.h:2266
Value< Type > * copy() const override final
The deep copy method for a Node.
Definition AST.h:2289
typename std::conditional< std::is_integral< T >::value, uint64_t, T >::type ContainerType
Integers and Floats store their value as ContainerType, which is guaranteed to be at least large enou...
Definition AST.h:2261
const ValueBase * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:2318
std::unique_ptr< Value< T > > UniquePtr
Definition AST.h:2255
~Value() override=default
Value(const ContainerType value)
Directly construct a Value from a source integer, float or boolean, guaranteeing valid construction....
Definition AST.h:2278
ContainerType asContainerType() const
Access the value as its stored type.
Definition AST.h:2322
T value() const
Access the value as its requested (templated) type.
Definition AST.h:2325
const char * subname() const override
Virtual method for accessing node name information.
Definition AST.h:2309
size_t children() const override
Virtual method for accessing child information. Returns the number of children a given AST node owns.
Definition AST.h:350
const std::string & name() const
Definition AST.h:353
Variable(const std::string &name)
Definition AST.h:341
~Variable() override=default
virtual Variable * copy() const override=0
The deep copy method for a Node.
const Expression * basetype() const override
Virtual method for accessing a node's base class. Note that if this is called explicitly on an instan...
Definition AST.h:348
std::unique_ptr< Variable > UniquePtr
Definition AST.h:339
const Node * child(const size_t) const override
Virtual method for accessing child information. Returns a const pointer to a child node at the given ...
Definition AST.h:351
Variable(const Variable &other)
Definition AST.h:343
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218