KSeExpr
4.0.4.0
|
Node that calls a function. More...
#include <ExprNode.h>
Classes | |
struct | Data |
base class for custom instance data More... | |
Public Member Functions | |
ExprFuncNode (const Expression *expr, const char *name) | |
ExprFuncNode (const ExprFuncNode &)=default | |
ExprFuncNode & | operator= (const ExprFuncNode &)=default |
ExprFuncNode (ExprFuncNode &&)=default | |
ExprFuncNode & | operator= (ExprFuncNode &&)=default |
~ExprFuncNode () override | |
ExprType | prep (bool wantScalar, ExprVarEnvBuilder &envBuilder) override |
int | buildInterpreter (Interpreter *interpreter) const override |
builds an interpreter. Returns the location index for the evaluated data More... | |
LLVM_VALUE | codegen (LLVM_BUILDER) LLVM_BODY |
const char * | name () const |
bool | checkArg (int argIndex, const ExprType &type, ExprVarEnvBuilder &envBuilder) |
bool | isStrArg (int n) const |
std::string | getStrArg (int n) const |
void | setData (Data *data) const |
associate blind data with this node (subsequently owned by this object) More... | |
Data * | getData () const |
get associated blind data (returns 0 if none) More... | |
int | promote (int i) const |
const ExprFunc * | func () const |
![]() | |
ExprNode (const Expression *expr) | |
ExprNode (const Expression *expr, const ExprType &type) | |
virtual | ~ExprNode () |
bool | isVec () const |
True if node has a vector result. More... | |
const Expression * | expr () const |
Access expression. More... | |
std::string | toString () const |
Access to original string representation of current expression. More... | |
const ExprType & | type () const |
The type of the node. More... | |
void | addError (const ErrorCode error, const std::vector< std::string > &ids={}) const |
Register error. This will allow users and sophisticated editors to highlight where in code problem was. More... | |
ExprNode (const Expression *expr, ExprNode *a) | |
ExprNode (const Expression *expr, ExprNode *a, const ExprType &type) | |
ExprNode (const Expression *expr, ExprNode *a, ExprNode *b) | |
ExprNode (const Expression *expr, ExprNode *a, ExprNode *b, const ExprType &type) | |
ExprNode (const Expression *expr, ExprNode *a, ExprNode *b, ExprNode *c) | |
ExprNode (const Expression *expr, ExprNode *a, ExprNode *b, ExprNode *c, const ExprType &type) | |
const ExprNode * | parent () const |
Access parent node - root node has no parent. More... | |
int | numChildren () const |
Number of children. More... | |
const ExprNode * | child (size_t i) const |
Get 0 indexed child. More... | |
ExprNode * | child (size_t i) |
Get 0 indexed child. More... | |
void | swapChildren (size_t i, size_t j) |
Swap children, do not use unless you know what you are doing. More... | |
void | removeLastChild () |
Remove last child and delete the entry. More... | |
void | addChild (ExprNode *child) |
Add a child to the child list (for parser use only) More... | |
void | addChildren (ExprNode *surrogate) |
Transfer children from surrogate parent (for parser use only) More... | |
void | setPosition (const short int startPos, const short int endPos) |
Remember the line and column position in the input string. More... | |
unsigned short int | startPos () const |
Access start position in input string. More... | |
unsigned short int | endPos () const |
Access end position in input string. More... | |
unsigned short int | length () const |
Access length of input string. More... | |
bool | checkCondition (bool check, const ErrorCode message, const std::vector< std::string > &ids, bool &error) const |
Checks the boolean value and records an error string with node if it is false. More... | |
bool | checkIsValue (const ExprType &type, bool &error) const |
Checks if the type is a value (i.e. string or float[d]) More... | |
bool | checkIsFP (const ExprType &type, bool &error) const |
Checks if the type is a float[d] for any d. More... | |
bool | checkIsFP (int d, const ExprType &type, bool &error) const |
Checks if the type is a float[d] for a specific d. More... | |
bool | checkTypesCompatible (const ExprType &first, const ExprType &second, bool &error) const |
types match (true if they do) More... | |
Private Attributes | |
std::string | _name |
const ExprFunc * | _func {nullptr} |
const ExprLocalFunctionNode * | _localFunc {nullptr} |
std::vector< int > | _promote |
Data * | _data {nullptr} |
Additional Inherited Members | |
![]() | |
void | setType (const ExprType &t) |
Set type of parameter. More... | |
void | setTypeWithChildLife (const ExprType &t) |
Set's the type to the argument but uses the children to determine lifetime. More... | |
![]() | |
const Expression * | _expr {nullptr} |
Owning expression (node can't modify) More... | |
ExprNode * | _parent {nullptr} |
Parent node (null if this the the root) More... | |
std::vector< ExprNode * > | _children |
List of children. More... | |
bool | _isVec |
True if node has a vector result. More... | |
ExprType | _type |
int | _maxChildDim {} |
unsigned short int | _startPos {} |
Position line and collumn. More... | |
unsigned short int | _endPos {} |
Node that calls a function.
Definition at line 653 of file ExprNode.h.
|
inline |
Definition at line 656 of file ExprNode.h.
References KSeExpr::Expression::addFunc(), KSeExpr::ExprNode::expr(), and name().
|
default |
|
default |
|
inlineoverride |
Definition at line 667 of file ExprNode.h.
References KSeExpr::ExprFuncNode::Data::_cleanup, and _data.
|
overridevirtual |
builds an interpreter. Returns the location index for the evaluated data
Reimplemented from KSeExpr::ExprNode.
Definition at line 620 of file ExprNode.cpp.
References _func, _localFunc, KSeExpr::ExprFuncX::buildInterpreter(), KSeExpr::ExprLocalFunctionNode::buildInterpreterForCall(), and KSeExpr::ExprFunc::funcx().
bool KSeExpr::ExprFuncNode::checkArg | ( | int | argIndex, |
const ExprType & | type, | ||
ExprVarEnvBuilder & | envBuilder | ||
) |
Definition at line 631 of file ExprNode.cpp.
References _promote, KSeExpr::ExprNode::addError(), KSeExpr::ArgumentTypeMismatch, KSeExpr::ExprNode::child(), KSeExpr::ExprType::dim(), KSeExpr::ExprType::isFP(), KSeExpr::ExprType::isLifeCompatible(), KSeExpr::ExprNode::prep(), KSeExpr::ExprType::toString(), KSeExpr::ExprNode::type(), and KSeExpr::ExprType::valuesCompatible().
Referenced by KSeExpr::ExprLocalFunctionNode::prep(), KSeExpr::GetVar::prep(), KSeExpr::MapFuncX::prep(), KSeExpr::TriplanarFuncX::prep(), KSeExpr::RandFuncX::prep(), KSeExpr::CachedVoronoiFunc::prep(), KSeExpr::CurveFuncX::prep(), KSeExpr::CCurveFuncX::prep(), KSeExpr::PrintFuncX::prep(), KSeExpr::SPrintFuncX::prep(), and BasicExpression::DummyFuncX::prep().
|
virtual |
Reimplemented from KSeExpr::ExprNode.
|
inline |
Definition at line 762 of file ExprNode.h.
References _func.
Referenced by KSeExprLLVMEvalCustomFunction().
|
inline |
get associated blind data (returns 0 if none)
Definition at line 754 of file ExprNode.h.
References _data.
|
inline |
Definition at line 715 of file ExprNode.h.
References KSeExpr::ExprNode::child(), and KSeExpr::ExprNode::numChildren().
Referenced by KSeExpr::GetVar::prep(), and KSeExpr::PrintFuncX::prep().
|
inline |
Definition at line 711 of file ExprNode.h.
References KSeExpr::ExprNode::child().
|
inline |
|
default |
|
default |
|
overridevirtual |
Prepare the node (for parser use only). See the discussion at the start of SeExprNode.cpp for more info.
Default is to call prep on children (giving AnyType as desired type). If all children return valid types, returns NoneType. Otherwise, returns ErrorType. Note: Ignores wanted type.
Reimplemented from KSeExpr::ExprNode.
Definition at line 585 of file ExprNode.cpp.
References KSeExpr::ExprNode::_expr, _func, _localFunc, _name, _promote, KSeExpr::ExprNode::_type, KSeExpr::ExprNode::checkCondition(), KSeExpr::ExprVarEnvBuilder::current(), KSeExpr::ExprVarEnv::findFunction(), KSeExpr::FunctionTooFewArguments, KSeExpr::FunctionTooManyArguments, KSeExpr::ExprFunc::funcx(), KSeExpr::ExprFunc::lookup(), KSeExpr::ExprFunc::maxArgs(), KSeExpr::ExprFunc::minArgs(), KSeExpr::ExprNode::numChildren(), KSeExpr::ExprNode::prep(), KSeExpr::ExprFuncX::prep(), KSeExpr::Expression::resolveFunc(), KSeExpr::ExprNode::setTypeWithChildLife(), KSeExpr::ExprNode::type(), and KSeExpr::UndeclaredFunction.
|
inline |
Definition at line 758 of file ExprNode.h.
References _promote.
Referenced by KSeExpr::ExprFuncSimple::buildInterpreter(), and KSeExpr::ExprLocalFunctionNode::buildInterpreterForCall().
|
inline |
associate blind data with this node (subsequently owned by this object)
Definition at line 744 of file ExprNode.h.
References _data.
Referenced by KSeExpr::ExprFuncSimple::buildInterpreter(), and KSeExprLLVMEvalCustomFunction().
|
mutableprivate |
Definition at line 775 of file ExprNode.h.
Referenced by getData(), setData(), and ~ExprFuncNode().
|
private |
Definition at line 769 of file ExprNode.h.
Referenced by buildInterpreter(), func(), and prep().
|
private |
Definition at line 770 of file ExprNode.h.
Referenced by buildInterpreter(), and prep().
|
private |
Definition at line 768 of file ExprNode.h.
|
mutableprivate |
Definition at line 774 of file ExprNode.h.
Referenced by checkArg(), prep(), and promote().