27 #ifndef OPENVDB_AX_AST_HAS_BEEN_INCLUDED 28 #define OPENVDB_AX_AST_HAS_BEEN_INCLUDED 32 #include <openvdb/version.h> 103 using Ptr = std::shared_ptr<Node>;
148 virtual ~
Node() =
default;
152 virtual Node* copy()
const = 0;
160 virtual NodeType nodetype()
const = 0;
164 virtual const char* nodename()
const = 0;
168 virtual const char* subname()
const = 0;
183 template <
typename NodeT>
185 return dynamic_cast<const NodeT*
>(
this);
196 virtual size_t children()
const = 0;
205 virtual const Node*
child(
const size_t index)
const = 0;
213 const Node* p = this->parent();
217 for (; i < count; ++i) {
218 if (p->
child(i) ==
this)
break;
220 if (i == count)
return -1;
221 return static_cast<int64_t
>(i);
249 const int64_t idx = this->childidx();
250 if (idx == -1)
return false;
251 return this->parent()->replacechild(idx, node);
260 inline virtual bool replacechild(
const size_t index,
Node* node);
278 bool hasChild =
false;
279 for (
size_t i = 0; i < parent->
children(); ++i)
280 hasChild |= parent->
child(i) ==
this;
292 inline Node* parent() {
return mParent; }
296 Node* mParent =
nullptr;
299 inline bool Node::replacechild(
const size_t,
Node*) {
return false; }
315 virtual Statement* copy()
const override = 0;
329 virtual Expression* copy()
const override = 0;
346 virtual Variable* copy()
const override = 0;
350 const Node*
child(
const size_t)
const override {
return nullptr; }
352 inline const std::string&
name()
const {
return mName; }
355 const std::string mName;
364 virtual Expression* copy()
const override = 0;
368 const Node*
child(
const size_t)
const override {
return nullptr; }
398 this->addStatement(statement);
407 for (
Statement* statement : statements) {
408 this->addStatement(statement);
417 this->addStatement(stmnt->copy());
427 const char*
nodename()
const override {
return "statement list"; }
429 const char*
subname()
const override {
return "stml"; }
434 size_t children() const override final {
return this->size(); }
437 if (i >= mList.size())
return nullptr;
438 return mList[i].get();
442 if (mList.size() <= i)
return false;
444 if (!expr)
return false;
445 mList[i].reset(expr);
451 inline size_t size()
const {
return mList.size(); }
457 mList.emplace_back(stmnt);
462 std::vector<Statement::UniquePtr> mList;
488 this->addStatement(statement);
495 Block(
const std::vector<Statement*>& statements)
497 for (
Statement* statement : statements) {
498 this->addStatement(statement);
506 this->addStatement(stmnt->copy());
509 ~
Block()
override =
default;
516 const char*
nodename()
const override {
return "scoped block"; }
518 const char*
subname()
const override {
return "blk"; }
523 size_t children() const override final {
return this->size(); }
526 if (i >= mList.size())
return nullptr;
527 return mList[i].get();
531 if (mList.size() <= i)
return false;
533 if (!expr)
return false;
534 mList[i].reset(expr);
540 inline size_t size()
const {
return mList.size(); }
546 mList.emplace_back(stmnt);
551 std::vector<Statement::UniquePtr> mList;
563 using Ptr = std::shared_ptr<Tree>;
573 mBlock->setParent(
this);
579 : mBlock(new
Block(*other.mBlock)) {
580 mBlock->setParent(
this);
582 ~
Tree()
override =
default;
589 const char*
nodename()
const override {
return "tree"; }
591 const char*
subname()
const override {
return "tree"; }
596 size_t children() const override final {
return 1; }
599 if (i == 0)
return mBlock.get();
619 this->append(expression);
628 mExpressions.reserve(expressions.size());
630 this->append(expression);
639 mExpressions.reserve(other.mExpressions.size());
641 this->append(expr->copy());
653 const char*
nodename()
const override {
return "comma"; }
655 const char*
subname()
const override {
return "comma"; }
660 size_t children() const override final {
return this->size(); }
663 if (i >= mExpressions.size())
return nullptr;
664 return mExpressions[i].get();
668 if (mExpressions.size() <= i)
return false;
670 mExpressions[i].reset(expr);
676 inline size_t size()
const {
return mExpressions.size(); }
679 inline bool empty()
const {
return mExpressions.empty(); }
685 mExpressions.emplace_back(expr);
690 std::vector<Expression::UniquePtr> mExpressions;
727 : mLoopType(loopType)
728 , mConditional(condition)
732 assert(mConditional);
734 mConditional->setParent(
this);
735 mBody->setParent(
this);
738 mInitial->setParent(
this);
742 mIteration->setParent(
this);
750 : mLoopType(other.mLoopType)
751 , mConditional(other.mConditional->copy())
752 , mBody(other.mBody->copy())
753 , mInitial(other.hasInit() ? other.mInitial->copy() : nullptr)
754 , mIteration(other.hasIter() ? other.mIteration->copy() : nullptr) {
755 mConditional->setParent(
this);
756 mBody->setParent(
this);
759 mInitial->setParent(
this);
763 mIteration->setParent(
this);
766 ~
Loop()
override =
default;
773 const char*
nodename()
const override {
return "loop"; }
775 const char*
subname()
const override {
return "loop"; }
780 size_t children() const override final {
return 4; }
783 if (i == 0)
return mConditional.get();
784 if (i == 1)
return mBody.get();
785 if (i == 2)
return mInitial.get();
786 if (i == 3)
return mIteration.get();
792 if (i == 0 || i == 2) {
794 if (!stmt)
return false;
796 mConditional.reset(stmt);
800 mInitial.reset(stmt);
801 mInitial->setParent(
this);
807 if (!blk)
return false;
814 if (!expr)
return false;
815 mIteration.reset(expr);
827 inline bool hasInit()
const {
return static_cast<bool>(this->initial()); }
830 inline bool hasIter()
const {
return static_cast<bool>(this->iteration()); }
865 using UniquePtr = std::unique_ptr<ConditionalStatement>;
879 Block* falseBlock =
nullptr)
880 : mConditional(conditional)
881 , mTrueBranch(trueBlock)
882 , mFalseBranch(falseBlock) {
883 assert(mConditional);
885 mConditional->setParent(
this);
886 mTrueBranch->setParent(
this);
887 if (mFalseBranch) mFalseBranch->setParent(
this);
895 : mConditional(other.mConditional->copy())
896 , mTrueBranch(other.mTrueBranch->copy())
897 , mFalseBranch(other.hasFalse() ? other.mFalseBranch->copy() : nullptr) {
898 mConditional->setParent(
this);
899 mTrueBranch->setParent(
this);
900 if (mFalseBranch) mFalseBranch->setParent(
this);
911 const char*
nodename()
const override {
return "conditional statement"; }
913 const char*
subname()
const override {
return "cond"; }
918 size_t children() const override final {
return 3; }
921 if (i == 0)
return this->condition();
922 if (i == 1)
return this->trueBranch();
923 if (i == 2)
return this->falseBranch();
931 if (!expr)
return false;
932 mConditional.reset(expr);
936 else if (i == 1 || i == 2) {
938 if (!blk)
return false;
940 mTrueBranch.reset(blk);
944 mFalseBranch.reset(blk);
945 mFalseBranch->setParent(
this);
955 return static_cast<bool>(this->falseBranch());
961 return this->hasFalse() ? 2 : 1;
1007 mLeft->setParent(
this);
1008 mRight->setParent(
this);
1017 const std::string& op)
1024 : mLeft(other.mLeft->copy())
1025 , mRight(other.mRight->copy())
1026 , mOperation(other.mOperation) {
1027 mLeft->setParent(
this);
1028 mRight->setParent(
this);
1039 const char*
nodename()
const override {
return "binary"; }
1041 const char*
subname()
const override {
return "bin"; }
1048 if (i == 0)
return mLeft.get();
1049 if (i == 1)
return mRight.get();
1054 if (i > 1)
return false;
1056 if (!expr)
return false;
1063 mRight->setParent(
this);
1107 : mConditional(conditional)
1108 , mTrueBranch(trueExpression)
1109 , mFalseBranch(falseExpression) {
1110 assert(mConditional);
1111 assert(mFalseBranch);
1112 mConditional->setParent(
this);
1113 if (mTrueBranch) mTrueBranch->setParent(
this);
1114 mFalseBranch->setParent(
this);
1121 : mConditional(other.mConditional->copy())
1122 , mTrueBranch(other.hasTrue() ? other.mTrueBranch->copy() : nullptr)
1123 , mFalseBranch(other.mFalseBranch->copy()) {
1124 mConditional->setParent(
this);
1125 if (mTrueBranch) mTrueBranch->setParent(
this);
1126 mFalseBranch->setParent(
this);
1137 const char*
nodename()
const override {
return "ternary"; }
1139 const char*
subname()
const override {
return "tern"; }
1146 if (i == 0)
return mConditional.get();
1147 if (i == 1)
return mTrueBranch.get();
1148 if (i == 2)
return mFalseBranch.get();
1153 if (i > 2)
return false;
1155 if (!expr)
return false;
1157 mConditional.reset(expr);
1161 mTrueBranch.reset(expr);
1162 mTrueBranch->setParent(
this);
1165 mFalseBranch.reset(expr);
1166 mFalseBranch->setParent(
this);
1172 bool hasTrue()
const {
return static_cast<bool>(this->trueBranch()); }
1214 mLHS->setParent(
this);
1215 mRHS->setParent(
this);
1223 : mLHS(other.mLHS->copy())
1224 , mRHS(other.mRHS->copy())
1225 , mOperation(other.mOperation) {
1226 mLHS->setParent(
this);
1227 mRHS->setParent(
this);
1238 const char*
nodename()
const override {
return "assignment expression"; }
1240 const char*
subname()
const override {
return "asgn"; }
1247 if (i == 0)
return this->lhs();
1248 if (i == 1)
return this->rhs();
1253 if (i > 1)
return false;
1255 if (!expr)
return false;
1262 mRHS->setParent(
this);
1314 mExpression->setParent(
this);
1321 : mExpression(other.mExpression->copy())
1322 , mOperation(other.mOperation)
1323 , mPost(other.mPost) {
1324 mExpression->setParent(
this);
1326 ~
Crement()
override =
default;
1333 const char*
nodename()
const override {
return "crement"; }
1335 const char*
subname()
const override {
return "crmt"; }
1343 if (i == 0)
return this->expression();
1348 if (i != 0)
return false;
1350 if (!expr)
return false;
1351 mExpression.reset(expr);
1363 inline bool increment()
const {
return mOperation == Increment; }
1366 inline bool decrement()
const {
return mOperation == Decrement; }
1369 inline bool pre()
const {
return !mPost; }
1372 inline bool post()
const {
return mPost; }
1400 assert(mExpression);
1401 mExpression->setParent(
this);
1414 : mExpression(other.mExpression->copy())
1415 , mOperation(other.mOperation) {
1416 mExpression->setParent(
this);
1425 const char*
nodename()
const override {
return "unary"; }
1427 const char*
subname()
const override {
return "unry"; }
1434 if (i == 0)
return this->expression();
1439 if (i != 0)
return false;
1441 if (!expr)
return false;
1442 mExpression.reset(expr);
1475 , mExpression(expr) {
1476 assert(mExpression);
1477 mExpression->setParent(
this);
1485 , mType(other.mType)
1486 , mExpression(other.mExpression->copy()) {
1489 ~
Cast()
override =
default;
1496 const char*
nodename()
const override {
return "cast"; }
1498 const char*
subname()
const override {
return "cast"; }
1505 if (i == 0)
return this->expression();
1510 if (i != 0)
return false;
1512 if (!expr)
return false;
1513 mExpression.reset(expr);
1552 : mFunctionName(function)
1554 this->append(argument);
1563 const std::vector<Expression*>& arguments)
1564 : mFunctionName(function)
1566 mArguments.reserve(arguments.size());
1576 : mFunctionName(other.mFunctionName)
1578 mArguments.reserve(other.mArguments.size());
1580 this->append(expr->copy());
1590 const char*
nodename()
const override {
return "function call"; }
1592 const char*
subname()
const override {
return "call"; }
1596 size_t children() const override final {
return this->size(); }
1599 if (i >= mArguments.size())
return nullptr;
1600 return mArguments[i].get();
1604 if (mArguments.size() <= i)
return false;
1606 mArguments[i].reset(expr);
1613 inline const std::string&
name()
const {
return mFunctionName; }
1616 inline size_t numArgs()
const {
return mArguments.size(); }
1619 inline size_t size()
const {
return mArguments.size(); }
1622 inline bool empty()
const {
return mArguments.empty(); }
1628 mArguments.emplace_back(expr);
1633 const std::string mFunctionName;
1634 std::vector<Expression::UniquePtr> mArguments;
1651 : mKeyword(other.mKeyword) {}
1652 ~
Keyword()
override =
default;
1659 const char*
nodename()
const override {
return "keyword"; }
1661 const char*
subname()
const override {
return "keyw"; }
1703 , mExpression(expr) {
1705 assert(mExpression);
1706 mIdx0->setParent(
this);
1707 if(mIdx1) mIdx1->setParent(
this);
1708 mExpression->setParent(
this);
1716 other.mIdx0->copy(),
1717 other.mIdx1 ? other.mIdx1->copy() : nullptr) {}
1726 const char*
nodename()
const override {
return "array unpack"; }
1728 const char*
subname()
const override {
return "unpk"; }
1735 if (i == 0)
return this->component0();
1736 if (i == 1)
return this->component1();
1737 if (i == 2)
return this->expression();
1742 if (i > 2)
return false;
1744 if (!expr)
return false;
1745 if (i == 0) mIdx0.reset(expr);
1746 if (i == 1) mIdx1.reset(expr);
1747 if (i == 2) mExpression.reset(expr);
1775 return static_cast<bool>(this->component1());
1795 this->append(expression);
1803 mExpressions.reserve(arguments.size());
1813 mExpressions.reserve(other.mExpressions.size());
1815 this->append(expr->copy());
1825 const char*
nodename()
const override {
return "array pack"; }
1827 const char*
subname()
const override {
return "pack"; }
1831 size_t children() const override final {
return this->size(); }
1834 if (i >= mExpressions.size())
return nullptr;
1835 return mExpressions[i].get();
1839 if (mExpressions.size() <= i)
return false;
1841 mExpressions[i].reset(expr);
1847 inline size_t size()
const {
return mExpressions.size(); }
1850 inline bool empty()
const {
return mExpressions.empty(); }
1856 mExpressions.emplace_back(expr);
1861 std::vector<Expression::UniquePtr> mExpressions;
1885 const bool inferred =
false)
1888 , mTypeInferred(inferred) {}
1896 Attribute(
const std::string& name,
const std::string& token,
1897 const bool inferred =
false)
1905 , mType(other.mType)
1906 , mTypeInferred(other.mTypeInferred) {}
1914 const char*
nodename()
const override {
return "attribute"; }
1916 const char*
subname()
const override {
return "atr"; }
1938 return Attribute::tokenFromNameType(this->name(), this->type());
1957 static inline std::string
1960 Attribute::symbolseparator() + name;
1975 const size_t at = token.find(symbolseparator());
1976 if (at == std::string::npos)
return false;
1978 *type = token.substr(0, at);
1979 if (type->empty()) {
1983 if (name) *name = token.substr(at + 1, token.size());
1988 const bool mTypeInferred;
2025 , mType(other.mType) {}
2035 const char*
nodename()
const override {
return "external"; }
2037 const char*
subname()
const override {
return "ext"; }
2055 return ExternalVariable::tokenFromNameType(this->name(), this->type());
2074 static inline std::string
2077 ExternalVariable::symbolseparator() + name;
2092 const size_t at = token.find(symbolseparator());
2093 if (at == std::string::npos)
return false;
2095 *type = token.substr(0, at);
2096 if (type->empty()) {
2100 if (name) *name = token.substr(at + 1, token.size());
2119 ~
Local()
override =
default;
2126 const char*
nodename()
const override {
return "local"; }
2128 const char*
subname()
const override {
return "lcl"; }
2151 mLocal->setParent(
this);
2152 if (mInit) mInit->setParent(
this);
2159 : mType(other.mType)
2160 , mLocal(other.mLocal->copy())
2161 , mInit(other.hasInit() ? other.mInit->copy() : nullptr) {
2162 mLocal->setParent(
this);
2163 if (mInit) mInit->setParent(
this);
2172 const char*
nodename()
const override {
return "declaration"; }
2174 const char*
subname()
const override {
return "dcl"; }
2181 if (i == 0)
return this->local();
2182 if (i == 1)
return this->init();
2187 if (i > 1)
return false;
2190 if (!local)
return false;
2191 mLocal.reset(local);
2196 if (!init)
return false;
2216 inline bool hasInit()
const {
return static_cast<bool>(this->init()); }
2251 template <
typename T>
2265 static constexpr
bool IsSupported =
2272 static_assert(IsSupported,
"Incompatible ast::Value node instantiated.");
2284 : mValue(other.mValue) {}
2285 ~
Value()
override =
default;
2324 inline T
value()
const {
return static_cast<T
>(mValue); }
2347 ~
Value()
override =
default;
2351 const char*
nodename()
const override {
return "string value"; }
2352 const char*
subname()
const override {
return "str"; }
2357 inline const std::string&
value()
const {
return mValue; }
2363 openvdb::ax::ast::Tree::Ptr
parse(
const char* code);
2371 #endif // OPENVDB_AX_AST_HAS_BEEN_INCLUDED const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:655
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:1429
Cast * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1492
ExternalVariable(const std::string &name, const tokens::CoreType type)
Construct a new ExternalVariable with a given name and type.
Definition: AST.h:2008
const Expression * rhs() const
Access a const pointer to the BinaryOperator RHS as an abstract expression.
Definition: AST.h:1078
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1659
size_t size() const
Alias for Block::children.
Definition: AST.h:540
bool hasInit() const
Query if this Loop has a valid initial statement.
Definition: AST.h:827
Cast nodes represent the conversion of an underlying expression to a target type. Cast nodes are typi...
Definition: AST.h:1463
tokens::CoreType type() const
Access the type that was specified at which to create the given local.
Definition: AST.h:2206
TernaryOperator * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1131
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:2128
size_t numArgs() const
Query the total number of arguments stored on this function.
Definition: AST.h:1616
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1139
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:999
ChildT * child
Definition: GridBuilder.h:1286
Variable(const Variable &other)
Definition: AST.h:342
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1724
tokens::CoreType type() const
Access the type that was used to access this attribute.
Definition: AST.h:1926
Loops represent for, while and do-while loop constructs. These all consist of a condition - evaluated...
Definition: AST.h:707
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:520
tokens::KeywordToken keyword() const
Query the keyword held on this node.
Definition: AST.h:1672
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:2176
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:1698
A TernaryOperator represents a ternary (conditional) expression 'a ? b : c' which evaluates to 'b' if...
Definition: AST.h:1091
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:1896
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:1734
ArrayPacks represent temporary container creations of arbitrary sizes, typically generated through th...
Definition: AST.h:1784
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1427
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:1143
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:2033
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1661
void append(Expression *expr)
Appends an argument to this function call, transferring ownership to the FunctionCall and updating pa...
Definition: AST.h:1626
A UnaryOperator represents a single unary operation on an expression. The operation type is stored as...
Definition: AST.h:1388
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:1603
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:429
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:637
Value(const Type &value)
Construct a new Value string from a string.
Definition: AST.h:2341
std::unique_ptr< CommaOperator > UniquePtr
Definition: AST.h:608
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1916
size_t children() const override
Virtual method for accessing child information. Returns the number of children a given AST node owns...
Definition: AST.h:349
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:211
bool inferred() const
Query whether this attribute was accessed via inferred syntax i.e. @P or @myattribute.
Definition: AST.h:1923
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:1741
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:2126
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1823
FunctionCall * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1586
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:1015
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:350
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:1918
bool hasIter() const
Query if this Loop has a valid iteration expression list.
Definition: AST.h:830
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:2016
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:1152
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:1340
const Expression * falseBranch() const
Access a const pointer to the TernaryOperator false expression as an abstract expression.
Definition: AST.h:1184
StatementList()
Construct a new StatementList with an empty list.
Definition: AST.h:390
const Block * trueBranch() const
Access a const pointer to the ConditionalStatements 'true' branch as a Block.
Definition: AST.h:970
openvdb::ax::ast::Tree::Ptr parse(const char *code)
Construct an abstract syntax tree from a code snippet. A runtime exception will be thrown with the fi...
tokens::CoreType type() const
Access to the target type.
Definition: AST.h:1520
const Expression * rhs() const
Access a const pointer to the AssignExpression RHS as an.
Definition: AST.h:1283
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1498
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:2317
ArrayPack(const std::vector< Expression * > &arguments)
Construct a new ArrayPack transferring ownership of any provided arguments to the ArrayPack and updat...
Definition: AST.h:1801
Block()
Construct a new Block with an empty list.
Definition: AST.h:480
bool replace(Node *node)
In place replacement. Attempts to replace this node at its specific location within its Abstract Synt...
Definition: AST.h:247
CommaOperator * copy() const override final
The deep copy method for a Node.
Definition: AST.h:647
void append(Expression *expr)
Append an expression to this CommaOperator, transferring ownership to the CommaOperator and updating ...
Definition: AST.h:683
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:514
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:434
bool post() const
Query if this Crement node represents a post crement a++.
Definition: AST.h:1372
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:1831
A Value (literal) AST node holds either literal text or absolute value information on all numerical...
Definition: AST.h:2252
StatementList(const std::vector< Statement * > &statements)
Construct a new StatementList from a vector of statements, transferring ownership of all valid statem...
Definition: AST.h:405
tokens::OperatorToken operation() const
Query the type of binary operation held on this node.
Definition: AST.h:1070
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:722
bool empty() const
Query whether this Expression list holds any valid expressions.
Definition: AST.h:1622
std::string typestr() const
Get the declaration type as a front end AX type/token string.
Definition: AST.h:2211
ConditionalStatement(const ConditionalStatement &other)
Deep copy constructor for an ConditionalStatement, performing a deep copy on the condition and both h...
Definition: AST.h:894
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:2174
Definition: axparser.h:115
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:777
CoreType tokenFromTypeString(const std::string &type)
Definition: Tokens.h:66
Tree(const Tree &other)
Deep copy constructor for a Tree, performing a deep copy on the held Block, ensuring parent informati...
Definition: AST.h:578
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:365
ArrayUnpack represent indexing operations into AX container types, primarily vectors and matrices ind...
Definition: AST.h:1685
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:1320
UnaryOperator * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1421
ConditionalStatements represents all combinations of 'if', 'else' and 'else if' syntax and semantics...
Definition: AST.h:863
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:2186
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:1342
bool pre() const
Query if this Crement node represents a pre crement ++a.
Definition: AST.h:1369
bool hasFalse() const
Query if this ConditionalStatement has a valid 'false' branch.
Definition: AST.h:954
Block * copy() const override final
The deep copy method for a Node.
Definition: AST.h:512
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:653
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:587
const std::string & value() const
Access the string.
Definition: AST.h:2357
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:2299
Value(const Value< Type > &other)
Deep copy constructor for a Value string.
Definition: AST.h:2346
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:1732
const Expression * condition() const
Access a const pointer to the ConditionalStatements condition as an abstract expression.
Definition: AST.h:966
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:571
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:1347
void append(Expression *expr)
Appends an argument to this ArrayPack, transferring ownership to the ArrayPack and updating parent da...
Definition: AST.h:1854
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:2290
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:771
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:651
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1425
Definition: axparser.h:63
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:1053
CommaOperator(const std::vector< Expression * > &expressions)
Construct a new CommaOperator from a vector of expression, transferring ownership of all valid expres...
Definition: AST.h:626
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:782
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:1829
Local(const std::string &name)
Construct a Local with a given name.
Definition: AST.h:2117
CommaOperator()
Construct a new CommaOperator with an expr set.
Definition: AST.h:611
bool isCompound() const
Query whether or not this is a compound AssignExpression. Compound AssignExpressions are assignments ...
Definition: AST.h:1271
const Statement * condition() const
Access a const pointer to the Loop condition as an abstract statement.
Definition: AST.h:834
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:2035
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1333
size_t size() const
Alias for CommaOperator::children.
Definition: AST.h:676
Concrete AST nodes.
Definition: AST.h:385
const Statement * initial() const
Access a const pointer to the Loop initial statement as an abstract statement.
Definition: AST.h:841
Local * copy() const override final
The deep copy method for a Node.
Definition: AST.h:2122
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:1438
const Expression * expression() const
Access a const pointer to the UnaryOperator expression as an abstract expression. ...
Definition: AST.h:1453
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:2352
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:1594
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:518
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:2039
bool increment() const
Query if this Crement node represents an incrementation ++.
Definition: AST.h:1363
OperatorToken
Definition: Tokens.h:150
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:598
std::string typeStringFromToken(const CoreType type)
Definition: Tokens.h:118
Attribute * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1910
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:915
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:530
Crement * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1329
const Expression * lhs() const
Access a const pointer to the BinaryOperator LHS as an abstract expression.
Definition: AST.h:1074
T Type
Definition: AST.h:2256
std::unique_ptr< Node > UniquePtr
Definition: AST.h:104
A BinaryOperator represents a single binary operation between a left hand side (LHS) and right hand s...
Definition: AST.h:987
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:175
FunctionCalls represent a single call to a function and any provided arguments. The argument list can...
Definition: AST.h:1540
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:1884
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:516
DeclareLocal(const DeclareLocal &other)
Deep copy constructor for a DeclareLocal.
Definition: AST.h:2158
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:425
CoreType
Definition: Tokens.h:31
bool empty() const
Query whether this Expression list holds any valid expressions.
Definition: AST.h:679
Operation operation() const
Query the type of the Crement operation. This does not hold post or pre-crement information.
Definition: AST.h:1360
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1135
const Expression * expression() const
Access a const pointer to the expression being indexed as an abstract Expression. ...
Definition: AST.h:1764
tokens::CoreType type() const
Access the type that was used to access this external variable.
Definition: AST.h:2043
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:775
const std::string tokenname() const
Construct and return the full external token identifier. See ExternalVariable::tokenFromNameType.
Definition: AST.h:2054
Expressions are comprised of full or potentially partial parts of a full statement that may not neces...
Definition: AST.h:325
Value< Type > * copy() const override final
The deep copy method for a Node.
Definition: AST.h:2349
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:1145
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1236
const Expression * expression() const
Access a const pointer to the Cast node's expression as an abstract expression.
Definition: AST.h:1531
ValueBases are a base class for anything that holds a value (literal). Derived classes store the actu...
Definition: AST.h:360
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1657
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:1974
Local AST nodes represent a single accesses to a local variable. The only store the name of the varia...
Definition: AST.h:2111
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:1242
CommaOperator(Expression *expression)
Construct a new CommaOperator with a single expression, transferring ownership of the expression to t...
Definition: AST.h:617
Loop(const Loop &other)
Deep copy constructor for an Loop, performing a deep copy on the condition, body and initial Statemen...
Definition: AST.h:749
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:660
const Expression * component0() const
Access a const pointer to the first component being used as an abstract Expression.
Definition: AST.h:1755
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:316
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1728
const Expression * trueBranch() const
Access a const pointer to the TernaryOperator true expression as an abstract expression.
Definition: AST.h:1180
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:593
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:2091
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:918
const Expression * iteration() const
Access a const pointer to the Loop iteration Expression.
Definition: AST.h:844
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:773
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:1509
std::string typestr() const
Get the access type as a front end AX type/token string.
Definition: AST.h:1931
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1037
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:1120
std::string Type
Definition: AST.h:2338
std::unique_ptr< StatementList > UniquePtr
Definition: AST.h:387
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
StatementList * copy() const override
The deep copy method for a Node.
Definition: AST.h:423
Value(const Value< T > &other)
Deep copy constructor for a Value.
Definition: AST.h:2283
AssignExpression * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1232
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:525
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:2308
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:276
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1331
Variable(const std::string &name)
Definition: AST.h:340
ArrayUnpack(const ArrayUnpack &other)
Deep copy constructor for a ArrayUnpack, performing a deep copy on the expression being indexed and a...
Definition: AST.h:1714
const Expression * expression() const
Access a const pointer to the expression being crements as an abstract Expression.
Definition: AST.h:1376
T value() const
Access the value as its requested (templated) type.
Definition: AST.h:2324
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:1730
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:1141
Keyword * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1655
Block(Statement *statement)
Construct a new Block with a single statement, transferring ownership of the statement to the block a...
Definition: AST.h:486
BinaryOperator * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1033
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1590
tokens::LoopToken loopType() const
Query the type of loop held on this node.
Definition: AST.h:824
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:1667
const std::string & name() const
Definition: AST.h:352
std::string typestr() const
Get the target type as a front end AX type/token string.
Definition: AST.h:1525
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:1562
Definition: Exceptions.h:13
const Block * body() const
Access a const pointer to the Loop body as a Block.
Definition: AST.h:837
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:1433
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:657
ValueT value
Definition: GridBuilder.h:1287
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:2350
The base abstract node which determines the interface and required methods for all derived concrete n...
Definition: AST.h:101
bool empty() const
Query whether this Expression list holds any valid expressions.
Definition: AST.h:1850
DeclareLocal * copy() const override final
The deep copy method for a Node.
Definition: AST.h:2168
std::unique_ptr< Block > UniquePtr
Definition: AST.h:477
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:495
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:589
size_t children() const override
Virtual method for accessing child information. Returns the number of children a given AST node owns...
Definition: AST.h:367
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:1500
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1137
ConditionalStatement * copy() const override final
The deep copy method for a Node.
Definition: AST.h:905
bool hasInit() const
Query if this declaration has an initialiser.
Definition: AST.h:2216
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:2180
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:1246
std::string typestr() const
Get the access type as a front end AX type/token string.
Definition: AST.h:2048
Keyword(const tokens::KeywordToken keyw)
Construct a new Keyword with a given tokens::KeywordToken.
Definition: AST.h:1646
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:2170
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:1958
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:2172
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1423
size_t size() const
Alias for ArrayPack::children.
Definition: AST.h:1847
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:1596
static char symbolseparator()
Static method returning the symbol associated with an Attribute access as defined by AX Grammar...
Definition: AST.h:1944
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:2353
std::string tokenname() const
Construct and return the full attribute token identifier. See Attribute::tokenFromNameType.
Definition: AST.h:1937
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:909
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:790
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:1337
A Block node represents a scoped list of statements. It may comprise of 0 or more statements...
Definition: AST.h:475
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:1431
const Expression * component1() const
Access a const pointer to the second component being used as an abstract Expression.
Definition: AST.h:1760
const Expression * init() const
Access a const pointer to the initialiser.
Definition: AST.h:2223
ArrayUnpack * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1722
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:877
ContainerType asContainerType() const
Access the value as its stored type.
Definition: AST.h:2321
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:2124
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:911
std::unique_ptr< ArrayPack > UniquePtr
Definition: AST.h:1786
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:780
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:927
StatementList(Statement *statement)
Construct a new StatementList with a single statement, transferring ownership of the statement to the...
Definition: AST.h:396
ArrayPack(Expression *expression)
Construct a new ArrayPack with a single expression, transferring ownership of the expression to the A...
Definition: AST.h:1793
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1238
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:1811
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:184
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:368
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:544
ExternalVariable * copy() const override final
The deep copy method for a Node.
Definition: AST.h:2029
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:667
UnaryOperator(Expression *expr, const std::string &op)
Construct a new UnaryOperator with a string, delegating construction to the above UnaryOperator const...
Definition: AST.h:1407
DeclareLocal(const tokens::CoreType type, Local *local, Expression *init=nullptr)
Construct a new DeclareLocal with a given name and type.
Definition: AST.h:2146
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:1310
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:2075
DeclareLocal AST nodes symbolize a single type declaration of a local variable. These store the local...
Definition: AST.h:2138
bool hasTrue() const
Query whether or not this has an optional if-true branch.
Definition: AST.h:1172
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1827
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:1550
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:2178
size_t branchCount() const
Query the number of branches held by this ConditionalStatement. This is only ever 1 or 2...
Definition: AST.h:960
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:2130
const Expression * lhs() const
Access a const pointer to the AssignExpression LHS as an abstract expression.
Definition: AST.h:1279
AssignExpressions represents a similar object construction to a BinaryOperator. AssignExpressions can...
Definition: AST.h:1197
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:1244
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:1665
Keyword(const Keyword &other)
Deep copy constructor for a Keyword.
Definition: AST.h:1650
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1494
LoopToken
Definition: Tokens.h:296
OperatorToken operatorTokenFromName(const std::string &name)
Definition: Tokens.h:221
std::unique_ptr< Statement > UniquePtr
Definition: AST.h:313
Various function and operator tokens used throughout the AST and code generation. ...
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:561
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1496
Keywords represent keyword statements defining changes in execution. These include those that define ...
Definition: AST.h:1640
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:431
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:1663
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:2037
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1914
tokens::OperatorToken operation() const
Query the actual operational type of this AssignExpression. For simple (non-compound) AssignExpressio...
Definition: AST.h:1275
AssignExpression(const AssignExpression &other)
Deep copy constructor for an AssignExpression, performing a deep copy on both held expressions...
Definition: AST.h:1222
size_t size() const
Alias for StatementList::children.
Definition: AST.h:451
const Local * local() const
Access a const pointer to the Local.
Definition: AST.h:2220
std::unique_ptr< FunctionCall > UniquePtr
Definition: AST.h:1542
NodeType
An enumerated list of node types for all concrete node types. These can be used for faster evaluation...
Definition: AST.h:117
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:920
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:441
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1588
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:1043
const Block * falseBranch() const
Access a const pointer to the ConditionalStatements 'false' branch as a Block.
Definition: AST.h:974
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:1833
KeywordToken
Definition: Tokens.h:314
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:1207
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:523
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:2351
NodeType nodetype() const override
Virtual method for accessing node type information.
Definition: AST.h:1912
Operation
A simple enum representing the crement type.
Definition: AST.h:1298
A Crement node represents a single increment '++' and decrement '–' operation. As well as it's creme...
Definition: AST.h:1293
Abstract (pure-virtual) AST nodes.
Definition: AST.h:311
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:347
Attributes represent any access to a primitive value, typically associated with the '@' symbol syntax...
Definition: AST.h:1873
Definition: axparser.h:75
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1240
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1726
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:591
Loop * copy() const override final
The deep copy method for a Node.
Definition: AST.h:769
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1335
size_t size() const
Alias for FunctionCall::children.
Definition: AST.h:1619
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1041
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:1397
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:1045
ArrayPack * copy() const override final
The deep copy method for a Node.
Definition: AST.h:1821
bool decrement() const
Query if this Crement node represents an decrement –.
Definition: AST.h:1366
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:1252
Tree * copy() const override final
The deep copy method for a Node.
Definition: AST.h:585
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:504
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1825
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:913
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:415
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
std::unique_ptr< Expression > UniquePtr
Definition: AST.h:327
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:1472
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:1598
TernaryOperator(Expression *conditional, Expression *trueExpression, Expression *falseExpression)
Construct a new TernaryOperator with a conditional expression and true (optional) and false expressio...
Definition: AST.h:1104
Attribute(const Attribute &other)
Deep copy constructor for a Attribute.
Definition: AST.h:1903
const Node * parent() const
Access a const pointer to this nodes parent.
Definition: AST.h:271
const std::string & name() const
Access the function name/identifier.
Definition: AST.h:1613
FunctionCall(const FunctionCall &other)
Deep copy constructor for a FunctionCall, performing a deep copy on all held function arguments...
Definition: AST.h:1575
std::shared_ptr< const Tree > ConstPtr
Definition: AST.h:564
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 ...
static char symbolseparator()
Static method returning the symbol associated with an ExternalVariable access as defined by AX Gramma...
Definition: AST.h:2061
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:1504
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:1502
ExternalVariable represent any access to external (custom) data, typically associated with the '$' sy...
Definition: AST.h:2001
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:330
bool isMatrixIndex() const
Query whether this ArrayUnpack operation must be a matrix indexing operation by checking the presence...
Definition: AST.h:1773
Value(const ContainerType value)
Directly construct a Value from a source integer, float or boolean, guaranteeing valid construction...
Definition: AST.h:2277
UnaryOperator(const UnaryOperator &other)
Deep copy constructor for a UnaryOperator, performing a deep copy on the underlying expressions...
Definition: AST.h:1413
std::shared_ptr< Node > Ptr
Definition: AST.h:103
ExternalVariable(const ExternalVariable &other)
Deep copy constructor for a ExternalVariable.
Definition: AST.h:2023
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:1039
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:1047
Variables are a base type for Locals, Attributes and ExternalVariables. Unlike other abstract types...
Definition: AST.h:336
std::unique_ptr< Local > UniquePtr
Definition: AST.h:2113
tokens::OperatorToken operation() const
Query the type of unary operation held on this node.
Definition: AST.h:1449
Value< Type > * copy() const override final
The deep copy method for a Node.
Definition: AST.h:2288
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:1483
const char * nodename() const override
Virtual method for accessing node name information.
Definition: AST.h:427
const char * subname() const override
Virtual method for accessing node name information.
Definition: AST.h:1592
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:202
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:662
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:436
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:1023
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:596
const Expression * condition() const
Access a const pointer to the TernaryOperator conditional as an abstract expression.
Definition: AST.h:1176
void addStatement(Statement *stmnt)
Adds a statement to this statement list, transferring ownership to the statement list and updating pa...
Definition: AST.h:455
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:1838