KSeExpr 6.0.0.0
|
Node that references a variable. More...
#include <ExprNode.h>
Public Member Functions | |
ExprVarNode (const Expression *expr, const char *name) | |
ExprVarNode (const Expression *expr, const char *name, const ExprType &type) | |
ExprType | prep (bool wantScalar, ExprVarEnvBuilder &envBuilder) override |
int | buildInterpreter (Interpreter *interpreter) const override |
builds an interpreter. Returns the location index for the evaluated data | |
LLVM_VALUE | codegen (LLVM_BUILDER) LLVM_BODY |
const char * | name () const |
const ExprLocalVar * | localVar () const |
const ExprVarRef * | var () const |
![]() | |
ExprNode (const Expression *expr) | |
ExprNode (const Expression *expr, const ExprType &type) | |
virtual | ~ExprNode () |
bool | isVec () const |
True if node has a vector result. | |
const Expression * | expr () const |
Access expression. | |
std::string | toString () const |
Access to original string representation of current expression. | |
const ExprType & | type () const |
The type of the node. | |
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. | |
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. | |
int | numChildren () const |
Number of children. | |
const ExprNode * | child (size_t i) const |
Get 0 indexed child. | |
ExprNode * | child (size_t i) |
Get 0 indexed child. | |
void | swapChildren (size_t i, size_t j) |
Swap children, do not use unless you know what you are doing. | |
void | removeLastChild () |
Remove last child and delete the entry. | |
void | addChild (ExprNode *child) |
Add a child to the child list (for parser use only) | |
void | addChildren (ExprNode *surrogate) |
Transfer children from surrogate parent (for parser use only) | |
void | setPosition (const short int startPos, const short int endPos) |
Remember the line and column position in the input string. | |
unsigned short int | startPos () const |
Access start position in input string. | |
unsigned short int | endPos () const |
Access end position in input string. | |
unsigned short int | length () const |
Access length of input string. | |
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. | |
bool | checkIsValue (const ExprType &type, bool &error) const |
Checks if the type is a value (i.e. string or float[d]) | |
bool | checkIsFP (const ExprType &type, bool &error) const |
Checks if the type is a float[d] for any d. | |
bool | checkIsFP (int d, const ExprType &type, bool &error) const |
Checks if the type is a float[d] for a specific d. | |
bool | checkTypesCompatible (const ExprType &first, const ExprType &second, bool &error) const |
types match (true if they do) | |
Private Attributes | |
std::string | _name |
ExprLocalVar * | _localVar {nullptr} |
ExprVarRef * | _var {nullptr} |
Additional Inherited Members | |
![]() | |
void | setType (const ExprType &t) |
Set type of parameter. | |
void | setTypeWithChildLife (const ExprType &t) |
Set's the type to the argument but uses the children to determine lifetime. | |
![]() | |
const Expression * | _expr {nullptr} |
Owning expression (node can't modify) | |
ExprNode * | _parent {nullptr} |
Parent node (null if this the the root) | |
std::vector< ExprNode * > | _children |
List of children. | |
bool | _isVec |
True if node has a vector result. | |
ExprType | _type |
int | _maxChildDim {} |
unsigned short int | _startPos {} |
Position line and collumn. | |
unsigned short int | _endPos {} |
Node that references a variable.
Definition at line 571 of file ExprNode.h.
|
inline |
Definition at line 574 of file ExprNode.h.
|
inline |
Definition at line 580 of file ExprNode.h.
|
overridevirtual |
builds an interpreter. Returns the location index for the evaluated data
Reimplemented from KSeExpr::ExprNode.
Definition at line 695 of file Interpreter.cpp.
References _localVar, _var, KSeExpr::ExprNode::type(), and var().
|
virtual |
Reimplemented from KSeExpr::ExprNode.
|
inline |
Definition at line 593 of file ExprNode.h.
References _localVar.
|
overridevirtual |
Prepare the node (for parser use only). See the discussion at the start of SeExprNode.cpp for more info.
Some friendlier error suggestions
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 531 of file ExprNode.cpp.
References KSeExpr::ExprNode::_expr, _localVar, KSeExpr::ExprNode::_type, _var, KSeExpr::ExprNode::addError(), KSeExpr::ExprNode::checkCondition(), KSeExpr::InconsistentDefinition, KSeExpr::ExprType::isError(), name(), KSeExpr::ExprNode::setType(), KSeExpr::ExprLocalVar::type(), KSeExpr::ExprVarRef::type(), and KSeExpr::UndeclaredVariable.
|
inline |
|
private |
Definition at line 604 of file ExprNode.h.
Referenced by buildInterpreter(), localVar(), and prep().
|
private |
Definition at line 603 of file ExprNode.h.
Referenced by name().
|
private |
Definition at line 605 of file ExprNode.h.
Referenced by buildInterpreter(), prep(), and var().