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>;
149 virtual ~
Node() =
default;
153 virtual Node* copy()
const = 0;
161 virtual NodeType nodetype()
const = 0;
165 virtual const char* nodename()
const = 0;
169 virtual const char* subname()
const = 0;
184 template <
typename NodeT>
186 return dynamic_cast<const NodeT*
>(
this);
197 virtual size_t children()
const = 0;
206 virtual const Node* child(
const size_t index)
const = 0;
214 const Node* p = this->parent();
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);
261 inline virtual bool replacechild(
const size_t index,
Node* 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;
300 inline bool Node::replacechild(
const size_t,
Node*) {
return false; }
316 virtual Statement* copy()
const override = 0;
330 virtual Expression* copy()
const override = 0;
347 virtual Variable* copy()
const override = 0;
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;
365 virtual Expression* copy()
const override = 0;
369 const Node*
child(
const size_t)
const override {
return nullptr; }
399 this->addStatement(statement);
408 for (
Statement* statement : statements) {
409 this->addStatement(statement);
418 this->addStatement(stmnt->copy());
428 const char*
nodename()
const override {
return "statement list"; }
430 const char*
subname()
const override {
return "stml"; }
435 size_t children() const override final {
return this->size(); }
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;
489 this->addStatement(statement);
496 Block(
const std::vector<Statement*>& statements)
498 for (
Statement* statement : statements) {
499 this->addStatement(statement);
507 this->addStatement(stmnt->copy());
510 ~
Block()
override =
default;
517 const char*
nodename()
const override {
return "scoped block"; }
519 const char*
subname()
const override {
return "blk"; }
524 size_t children() const override final {
return this->size(); }
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);
583 ~
Tree()
override =
default;
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();
620 this->append(expression);
629 mExpressions.reserve(expressions.size());
631 this->append(expression);
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"; }
661 size_t children() const override final {
return this->size(); }
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;
728 : mLoopType(loopType)
729 , mConditional(condition)
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);
767 ~
Loop()
override =
default;
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);
801 mInitial.reset(stmt);
802 mInitial->setParent(
this);
808 if (!blk)
return false;
815 if (!expr)
return false;
816 mIteration.reset(expr);
828 inline bool hasInit()
const {
return static_cast<bool>(this->initial()); }
831 inline bool hasIter()
const {
return static_cast<bool>(this->iteration()); }
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; }
922 if (i == 0)
return this->condition();
923 if (i == 1)
return this->trueBranch();
924 if (i == 2)
return this->falseBranch();
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);
945 mFalseBranch.reset(blk);
946 mFalseBranch->setParent(
this);
956 return static_cast<bool>(this->falseBranch());
962 return this->hasFalse() ? 2 : 1;
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;
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);
1162 mTrueBranch.reset(expr);
1163 mTrueBranch->setParent(
this);
1166 mFalseBranch.reset(expr);
1167 mFalseBranch->setParent(
this);
1173 bool hasTrue()
const {
return static_cast<bool>(this->trueBranch()); }
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;
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);
1327 ~
Crement()
override =
default;
1334 const char*
nodename()
const override {
return "crement"; }
1336 const char*
subname()
const override {
return "crmt"; }
1344 if (i == 0)
return this->expression();
1349 if (i != 0)
return false;
1351 if (!expr)
return false;
1352 mExpression.reset(expr);
1364 inline bool increment()
const {
return mOperation == Increment; }
1367 inline bool decrement()
const {
return mOperation == Decrement; }
1370 inline bool pre()
const {
return !mPost; }
1373 inline bool post()
const {
return mPost; }
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"; }
1435 if (i == 0)
return this->expression();
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()) {
1490 ~
Cast()
override =
default;
1497 const char*
nodename()
const override {
return "cast"; }
1499 const char*
subname()
const override {
return "cast"; }
1506 if (i == 0)
return this->expression();
1511 if (i != 0)
return false;
1513 if (!expr)
return false;
1514 mExpression.reset(expr);
1553 : mFunctionName(function)
1555 this->append(argument);
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"; }
1597 size_t children() const override final {
return this->size(); }
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) {}
1653 ~
Keyword()
override =
default;
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"; }
1736 if (i == 0)
return this->component0();
1737 if (i == 1)
return this->component1();
1738 if (i == 2)
return this->expression();
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"; }
1832 size_t children() const override final {
return this->size(); }
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;
1886 const bool inferred =
false)
1889 , mTypeInferred(inferred) {}
1897 Attribute(
const std::string& name,
const std::string& token,
1898 const bool inferred =
false)
1906 , mType(other.mType)
1907 , mTypeInferred(other.mTypeInferred) {}
1915 const char*
nodename()
const override {
return "attribute"; }
1917 const char*
subname()
const override {
return "atr"; }
1939 return Attribute::tokenFromNameType(this->name(), this->type());
1958 static inline std::string
1961 Attribute::symbolseparator() + name;
1976 const size_t at = token.find(symbolseparator());
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"; }
2056 return ExternalVariable::tokenFromNameType(this->name(), this->type());
2075 static inline std::string
2078 ExternalVariable::symbolseparator() + name;
2093 const size_t at = token.find(symbolseparator());
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());
2120 ~
Local()
override =
default;
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()); }
2252 template <
typename T>
2262 std::is_integral<T>::value, uint64_t, T>::type;
2266 static constexpr
bool IsSupported =
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) {}
2286 ~
Value()
override =
default;
2292 if (std::is_same<T, bool>::value)
return Node::ValueBoolNode;
2293 if (std::is_same<T, int16_t>::value)
return Node::ValueInt16Node;
2294 if (std::is_same<T, int32_t>::value)
return Node::ValueInt32Node;
2295 if (std::is_same<T, int64_t>::value)
return Node::ValueInt64Node;
2296 if (std::is_same<T, float>::value)
return Node::ValueFloatNode;
2297 if (std::is_same<T, double>::value)
return Node::ValueDoubleNode;
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); }
2348 ~
Value()
override =
default;
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; }
2369 #endif // OPENVDB_AX_AST_HAS_BEEN_INCLUDED 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
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
AssignExpressions represents a similar object construction to a BinaryOperator. AssignExpressions can...
Definition: AST.h:1198
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
Operation
A simple enum representing the crement type.
Definition: AST.h:1299
Local(const std::string &name)
Construct a Local with a given name.
Definition: AST.h:2118
virtual size_t children() const =0
Virtual method for accessing child information. Returns the number of children a given AST node owns...
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
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::string typestr() const
Get the access type as a front end AX type/token string.
Definition: AST.h:1932
Local AST nodes represent a single accesses to a local variable. The only store the name of the varia...
Definition: AST.h:2112
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
const Statement * condition() const
Access a const pointer to the Loop condition as an abstract statement.
Definition: AST.h:835
std::unique_ptr< Expression > UniquePtr
Definition: AST.h:328
Value(const ContainerType value)
Directly construct a Value from a source integer, float or boolean, guaranteeing valid construction...
Definition: AST.h:2278
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:430
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 size() const
Alias for Block::children.
Definition: AST.h:541
Attributes represent any access to a primitive value, typically associated with the '@' symbol syntax...
Definition: AST.h:1874
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1662
KeywordToken
Definition: Tokens.h:314
tokens::CoreType type() const
Access the type that was used to access this attribute.
Definition: AST.h:1927
Keyword(const Keyword &other)
Deep copy constructor for a Keyword.
Definition: AST.h:1651
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
A Tree is the highest concrete (non-abstract) node in the entire AX AST hierarchy. It represents an entire conversion of a valid AX string.
Definition: AST.h:562
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
const Expression * component1() const
Access a const pointer to the second component being used as an abstract Expression.
Definition: AST.h:1761
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
OperatorToken operatorTokenFromName(const std::string &name)
Definition: Tokens.h:221
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
Concrete AST nodes.
Definition: AST.h:386
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1042
Variables are a base type for Locals, Attributes and ExternalVariables. Unlike other abstract types...
Definition: AST.h:337
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
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:2309
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:590
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1725
ArrayPack * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1822
ConditionalStatement * copy() const override final
The deep copy method for a Node.
Definition: AST.h:906
const Block * falseBranch() const
Access a const pointer to the ConditionalStatements 'false' branch as a Block.
Definition: AST.h:975
const Expression * falseBranch() const
Access a const pointer to the TernaryOperator false expression as an abstract expression.
Definition: AST.h:1185
const Expression * rhs() const
Access a const pointer to the BinaryOperator RHS as an abstract expression.
Definition: AST.h:1079
ValueBases are a base class for anything that holds a value (literal). Derived classes store the actu...
Definition: AST.h:361
bool hasIter() const
Query if this Loop has a valid iteration expression list.
Definition: AST.h:831
T value() const
Access the value as its requested (templated) type.
Definition: AST.h:2325
tokens::KeywordToken keyword() const
Query the keyword held on this node.
Definition: AST.h:1673
const Expression * trueBranch() const
Access a const pointer to the TernaryOperator true expression as an abstract expression.
Definition: AST.h:1181
UnaryOperator(Expression *expr, const tokens::OperatorToken op)
Construct a new UnaryOperator with a given tokens::OperatorToken and a valid expression, transferring ownership of the expression to the UnaryOperator and updating parent data on the expression.
Definition: AST.h:1398
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
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
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
ExternalVariable represent any access to external (custom) data, typically associated with the '$' sy...
Definition: AST.h:2002
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1040
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. If the token cannot be split, neither name or type are updated and false is returned.
Definition: AST.h:2092
FunctionCall * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1587
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
ContainerType asContainerType() const
Access the value as its stored type.
Definition: AST.h:2322
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
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:1046
std::string typestr() const
Get the target type as a front end AX type/token string.
Definition: AST.h:1526
std::unique_ptr< Statement > UniquePtr
Definition: AST.h:314
void addStatement(Statement *stmnt)
Adds a statement to this statement list, transferring ownership to the statement list and updating pa...
Definition: AST.h:456
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
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1424
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
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. If the token cannot be split, neither name or type are updated and false is returned.
Definition: AST.h:1975
const Expression * lhs() const
Access a const pointer to the BinaryOperator LHS as an abstract expression.
Definition: AST.h:1075
Crement(const Crement &other)
Deep copy constructor for a Crement, performing a deep copy on the underlying expressions, ensuring parent information is updated.
Definition: AST.h:1321
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
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:2175
tokens::OperatorToken operation() const
Query the type of binary operation held on this node.
Definition: AST.h:1071
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:2036
Definition: axparser.h:124
void append(Expression *expr)
Appends an argument to this ArrayPack, transferring ownership to the ArrayPack and updating parent da...
Definition: AST.h:1855
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
ArrayPacks represent temporary container creations of arbitrary sizes, typically generated through th...
Definition: AST.h:1785
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:2351
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
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:2352
ConditionalStatement(Expression *conditional, Block *trueBlock, Block *falseBlock=nullptr)
Construct a new ConditionalStatement with an Expression representing the primary condition, a Block representing the 'true' branch and an optional Block representing the 'false' branch. Ownership of all arguments is transferred to the ConditionalStatement. All arguments have their parent data updated.
Definition: AST.h:878
const std::string & value() const
Access the string.
Definition: AST.h:2358
bool hasInit() const
Query if this Loop has a valid initial statement.
Definition: AST.h:828
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1826
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1915
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
std::string typestr() const
Get the declaration type as a front end AX type/token string.
Definition: AST.h:2212
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1495
std::unique_ptr< FunctionCall > UniquePtr
Definition: AST.h:1543
StatementList()
Construct a new StatementList with an empty list.
Definition: AST.h:391
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:428
std::unique_ptr< Block > UniquePtr
Definition: AST.h:478
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
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:652
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:2129
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1336
Cast(const Cast &other)
Deep copy constructor for a Cast node, performing a deep copy on the underlying expressions, ensuring parent information is updated.
Definition: AST.h:1484
Value(const Value< T > &other)
Deep copy constructor for a Value.
Definition: AST.h:2284
A UnaryOperator represents a single unary operation on an expression. The operation type is stored as...
Definition: AST.h:1389
ConditionalStatement(const ConditionalStatement &other)
Deep copy constructor for an ConditionalStatement, performing a deep copy on the condition and both h...
Definition: AST.h:895
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1499
A BinaryOperator represents a single binary operation between a left hand side (LHS) and right hand s...
Definition: AST.h:988
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
Definition: axparser.h:72
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
NodeType
An enumerated list of node types for all concrete node types. These can be used for faster evaluation...
Definition: AST.h:118
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:515
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
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
std::shared_ptr< const Tree > ConstPtr
Definition: AST.h:565
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 char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1334
ConditionalStatements represents all combinations of 'if', 'else' and 'else if' syntax and semantics...
Definition: AST.h:864
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
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:2034
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1138
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:776
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
Value(const Value< Type > &other)
Deep copy constructor for a Value string.
Definition: AST.h:2347
Expressions are comprised of full or potentially partial parts of a full statement that may not neces...
Definition: AST.h:326
TernaryOperator(const TernaryOperator &other)
Deep copy constructor for a TernaryOperator, performing a deep copy on held expressions, ensuring parent information is updated.
Definition: AST.h:1121
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 char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1428
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
const Expression * expression() const
Access a const pointer to the expression being crements as an abstract Expression.
Definition: AST.h:1377
const Expression * init() const
Access a const pointer to the initialiser.
Definition: AST.h:2224
Value< Type > * copy() const override final
The deep copy method for a Node.
Definition: AST.h:2289
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:1917
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
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1426
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:2125
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1591
Cast * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1493
A Value (literal) AST node holds either literal text or absolute value information on all numerical...
Definition: AST.h:2253
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1593
const std::string tokenname() const
Construct and return the full external token identifier. See ExternalVariable::tokenFromNameType.
Definition: AST.h:2055
bool hasFalse() const
Query if this ConditionalStatement has a valid 'false' branch.
Definition: AST.h:955
BinaryOperator(const BinaryOperator &other)
Deep copy constructor for a BinaryOperator, performing a deep copy on both held expressions, ensuring parent information is updated.
Definition: AST.h:1024
FunctionCall(const FunctionCall &other)
Deep copy constructor for a FunctionCall, performing a deep copy on all held function arguments...
Definition: AST.h:1576
const Block * body() const
Access a const pointer to the Loop body as a Block.
Definition: AST.h:838
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:656
CommaOperator()
Construct a new CommaOperator with an expr set.
Definition: AST.h:612
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
Attribute(const Attribute &other)
Deep copy constructor for a Attribute.
Definition: AST.h:1904
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
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:1253
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1239
bool inferred() const
Query whether this attribute was accessed via inferred syntax i.e. @P or @myattribute.
Definition: AST.h:1924
Loops represent for, while and do-while loop constructs. These all consist of a condition - evaluated...
Definition: AST.h:708
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:2300
CommaOperator * copy() const override final
The deep copy method for a Node.
Definition: AST.h:648
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 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
tokens::CoreType type() const
Access the type that was specified at which to create the given local.
Definition: AST.h:2207
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:2171
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
std::string Type
Definition: AST.h:2339
Variable(const Variable &other)
Definition: AST.h:343
bool empty() const
Query whether this Expression list holds any valid expressions.
Definition: AST.h:1623
bool isMatrixIndex() const
Query whether this ArrayUnpack operation must be a matrix indexing operation by checking the presence...
Definition: AST.h:1774
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
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
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1038
bool empty() const
Query whether this Expression list holds any valid expressions.
Definition: AST.h:1851
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:2173
Attribute * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1911
#define OPENVDB_ASSERT(X)
Definition: Assert.h:41
const std::string & name() const
Definition: AST.h:353
LoopToken
Definition: Tokens.h:296
Block(const Block &other)
Deep copy constructor for a Block, performing a deep copy on every held statement, ensuring parent information is updated.
Definition: AST.h:505
Abstract (pure-virtual) AST nodes.
Definition: AST.h:312
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 hasInit() const
Query if this declaration has an initialiser.
Definition: AST.h:2217
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:588
DeclareLocal(const DeclareLocal &other)
Deep copy constructor for a DeclareLocal.
Definition: AST.h:2159
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
ArrayPack(Expression *expression)
Construct a new ArrayPack with a single expression, transferring ownership of the expression to the A...
Definition: AST.h:1794
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 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
tokens::CoreType type() const
Access to the target type.
Definition: AST.h:1521
const Expression * expression() const
Access a const pointer to the Cast node's expression as an abstract expression.
Definition: AST.h:1532
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1729
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1660
BinaryOperator * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1034
CoreType
Definition: Tokens.h:31
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
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
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
size_t branchCount() const
Query the number of branches held by this ConditionalStatement. This is only ever 1 or 2...
Definition: AST.h:961
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 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 ...
Definition: Exceptions.h:13
A Block node represents a scoped list of statements. It may comprise of 0 or more statements...
Definition: AST.h:476
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
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
tokens::OperatorToken operation() const
Query the type of unary operation held on this node.
Definition: AST.h:1450
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:912
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
const Expression * condition() const
Access a const pointer to the TernaryOperator conditional as an abstract expression.
Definition: AST.h:1177
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1589
size_t size() const
Alias for StatementList::children.
Definition: AST.h:452
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:654
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:2291
std::unique_ptr< Local > UniquePtr
Definition: AST.h:2114
tokens::OperatorToken operation() const
Query the actual operational type of this AssignExpression. For simple (non-compound) AssignExpressio...
Definition: AST.h:1276
std::unique_ptr< Node > UniquePtr
Definition: AST.h:105
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:592
const Expression * expression() const
Access a const pointer to the UnaryOperator expression as an abstract expression. ...
Definition: AST.h:1454
bool increment() const
Query if this Crement node represents an incrementation ++.
Definition: AST.h:1364
bool replace(Node *node)
In place replacement. Attempts to replace this node at its specific location within its Abstract Synt...
Definition: AST.h:248
AssignExpression * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1233
Loop * copy() const override final
The deep copy method for a Node.
Definition: AST.h:770
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1332
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1658
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
Block(Statement *statement)
Construct a new Block with a single statement, transferring ownership of the statement to the block a...
Definition: AST.h:487
const std::string & name() const
Access the function name/identifier.
Definition: AST.h:1614
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1237
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
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
std::string typestr() const
Get the access type as a front end AX type/token string.
Definition: AST.h:2049
Local * copy() const override final
The deep copy method for a Node.
Definition: AST.h:2123
Cast nodes represent the conversion of an underlying expression to a target type. Cast nodes are typi...
Definition: AST.h:1464
ArrayUnpack * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1723
const Expression * condition() const
Access a const pointer to the ConditionalStatements condition as an abstract expression.
Definition: AST.h:967
TernaryOperator * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1132
StatementList * copy() const override
The deep copy method for a Node.
Definition: AST.h:424
A Crement node represents a single increment '++' and decrement '–' operation. As well as it's creme...
Definition: AST.h:1294
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
static char symbolseparator()
Static method returning the symbol associated with an ExternalVariable access as defined by AX Gramma...
Definition: AST.h:2062
std::unique_ptr< CommaOperator > UniquePtr
Definition: AST.h:609
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
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
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:774
static char symbolseparator()
Static method returning the symbol associated with an Attribute access as defined by AX Grammar...
Definition: AST.h:1945
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
bool post() const
Query if this Crement node represents a post crement a++.
Definition: AST.h:1373
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
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
size_t numArgs() const
Query the total number of arguments stored on this function.
Definition: AST.h:1617
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
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
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:914
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:426
Variable(const std::string &name)
Definition: AST.h:341
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
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
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
std::string typeStringFromToken(const CoreType type)
Definition: Tokens.h:118
T Type
Definition: AST.h:2257
std::shared_ptr< Node > Ptr
Definition: AST.h:104
Value< Type > * copy() const override final
The deep copy method for a Node.
Definition: AST.h:2350
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
std::unique_ptr< ArrayPack > UniquePtr
Definition: AST.h:1787
void append(Expression *expr)
Append an expression to this CommaOperator, transferring ownership to the CommaOperator and updating ...
Definition: AST.h:684
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
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
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
StatementList(Statement *statement)
Construct a new StatementList with a single statement, transferring ownership of the statement to the...
Definition: AST.h:397
DeclareLocal AST nodes symbolize a single type declaration of a local variable. These store the local...
Definition: AST.h:2139
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
const Expression * iteration() const
Access a const pointer to the Loop iteration Expression.
Definition: AST.h:845
bool hasTrue() const
Query whether or not this has an optional if-true branch.
Definition: AST.h:1173
FunctionCall(const std::string &function, Expression *argument=nullptr)
Construct a new FunctionCall with a given function identifier and an optional argument, transferring ownership of any provided argument to the FunctionCall and updating parent data on the arguments.
Definition: AST.h:1551
Keyword(const tokens::KeywordToken keyw)
Construct a new Keyword with a given tokens::KeywordToken.
Definition: AST.h:1647
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
Various function and operator tokens used throughout the AST and code generation. ...
bool isCompound() const
Query whether or not this is a compound AssignExpression. Compound AssignExpressions are assignments ...
Definition: AST.h:1272
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
size_t size() const
Alias for ArrayPack::children.
Definition: AST.h:1848
const Expression * rhs() const
Access a const pointer to the AssignExpression RHS as an.
Definition: AST.h:1284
std::unique_ptr< StatementList > UniquePtr
Definition: AST.h:388
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
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 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
tokens::LoopToken loopType() const
Query the type of loop held on this node.
Definition: AST.h:825
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:2353
Keywords represent keyword statements defining changes in execution. These include those that define ...
Definition: AST.h:1641
AssignExpression(const AssignExpression &other)
Deep copy constructor for an AssignExpression, performing a deep copy on both held expressions...
Definition: AST.h:1223
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
const Expression * component0() const
Access a const pointer to the first component being used as an abstract Expression.
Definition: AST.h:1756
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 FunctionCall::children.
Definition: AST.h:1620
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1727
DeclareLocal(const tokens::CoreType type, Local *local, Expression *init=nullptr)
Construct a new DeclareLocal with a given name and type.
Definition: AST.h:2147
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
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:2262
FunctionCalls represent a single call to a function and any provided arguments. The argument list can...
Definition: AST.h:1541
tokens::CoreType type() const
Access the type that was used to access this external variable.
Definition: AST.h:2044
std::string tokenname() const
Construct and return the full attribute token identifier. See Attribute::tokenFromNameType.
Definition: AST.h:1938
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:2127
CommaOperator(Expression *expression)
Construct a new CommaOperator with a single expression, transferring ownership of the expression to t...
Definition: AST.h:618
const Local * local() const
Access a const pointer to the Local.
Definition: AST.h:2221
Definition: axparser.h:84
DeclareLocal * copy() const override final
The deep copy method for a Node.
Definition: AST.h:2169
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:2038
const Statement * initial() const
Access a const pointer to the Loop initial statement as an abstract statement.
Definition: AST.h:842
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:435
bool pre() const
Query if this Crement node represents a pre crement ++a.
Definition: AST.h:1370
size_t size() const
Alias for CommaOperator::children.
Definition: AST.h:677
CoreType tokenFromTypeString(const std::string &type)
Definition: Tokens.h:66
Block()
Construct a new Block with an empty list.
Definition: AST.h:481
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
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
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
StatementList(const StatementList &other)
Deep copy constructor for a StatementList, performing a deep copy on every held statement, ensuring parent information is updated.
Definition: AST.h:416
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
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
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
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
UnaryOperator * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1422
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 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
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
Crement * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1330
The base abstract node which determines the interface and required methods for all derived concrete n...
Definition: AST.h:102
const Block * trueBranch() const
Access a const pointer to the ConditionalStatements 'true' branch as a Block.
Definition: AST.h:971
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
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
Keyword * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1656
Tree * copy() const override final
The deep copy method for a Node.
Definition: AST.h:586
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
const Expression * expression() const
Access a const pointer to the expression being indexed as an abstract Expression. ...
Definition: AST.h:1765
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:519
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1136
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
void append(Expression *expr)
Appends an argument to this function call, transferring ownership to the FunctionCall and updating pa...
Definition: AST.h:1627
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
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
const Node * parent() const
Access a const pointer to this nodes parent.
Definition: AST.h:272
ExternalVariable * copy() const override final
The deep copy method for a Node.
Definition: AST.h:2030
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
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
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:910
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
CommaOperator(const CommaOperator &other)
Deep copy constructor for an CommaOperator, performing a deep copy on every held expression, ensuring parent information is updated.
Definition: AST.h:638
OperatorToken
Definition: Tokens.h:150
ArrayPack(const ArrayPack &other)
Deep copy constructor for a ArrayPack, performing a deep copy on all held arguments, ensuring parent information is updated.
Definition: AST.h:1812
bool decrement() const
Query if this Crement node represents an decrement –.
Definition: AST.h:1367
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1913
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1824
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1140
ArrayUnpack represent indexing operations into AX container types, primarily vectors and matrices ind...
Definition: AST.h:1686
UnaryOperator(const UnaryOperator &other)
Deep copy constructor for a UnaryOperator, performing a deep copy on the underlying expressions...
Definition: AST.h:1414
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
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:772
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
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1241
A TernaryOperator represents a ternary (conditional) expression 'a ? b : c' which evaluates to 'b' if...
Definition: AST.h:1092
Value(const Type &value)
Construct a new Value string from a string.
Definition: AST.h:2342
ExternalVariable(const std::string &name, const tokens::CoreType type)
Construct a new ExternalVariable with a given name and type.
Definition: AST.h:2009
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:218
Block * copy() const override final
The deep copy method for a Node.
Definition: AST.h:513
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1828
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
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, a Block representing the body and for for-loops an optional initial Statement and iteration Expression. Ownership of all arguments is transferred to the Loop. All arguments have their parent data updated.
Definition: AST.h:723
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
bool empty() const
Query whether this Expression list holds any valid expressions.
Definition: AST.h:680
ExternalVariable(const ExternalVariable &other)
Deep copy constructor for a ExternalVariable.
Definition: AST.h:2024
const Expression * lhs() const
Access a const pointer to the AssignExpression LHS as an abstract expression.
Definition: AST.h:1280