KSeExpr  4.0.4.0
Public Member Functions | List of all members
KSeExpr::ExprModuleNode Class Reference

Node that contains entire program. More...

#include <ExprNode.h>

Inheritance diagram for KSeExpr::ExprModuleNode:
KSeExpr::ExprNode

Public Member Functions

 ExprModuleNode (const Expression *expr)
 
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
 
- Public Member Functions inherited from KSeExpr::ExprNode
 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 Expressionexpr () const
 Access expression. More...
 
std::string toString () const
 Access to original string representation of current expression. More...
 
const ExprTypetype () 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 ExprNodeparent () const
 Access parent node - root node has no parent. More...
 
int numChildren () const
 Number of children. More...
 
const ExprNodechild (size_t i) const
 Get 0 indexed child. More...
 
ExprNodechild (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...
 

Additional Inherited Members

- Protected Member Functions inherited from KSeExpr::ExprNode
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...
 
- Protected Attributes inherited from KSeExpr::ExprNode
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 {}
 

Detailed Description

Node that contains entire program.

Definition at line 261 of file ExprNode.h.

Constructor & Destructor Documentation

◆ ExprModuleNode()

KSeExpr::ExprModuleNode::ExprModuleNode ( const Expression expr)
inline

Definition at line 264 of file ExprNode.h.

Member Function Documentation

◆ buildInterpreter()

int KSeExpr::ExprModuleNode::buildInterpreter ( Interpreter interpreter) const
overridevirtual

builds an interpreter. Returns the location index for the evaluated data

Reimplemented from KSeExpr::ExprNode.

Definition at line 1049 of file Interpreter.cpp.

◆ codegen()

LLVM_VALUE KSeExpr::ExprModuleNode::codegen ( LLVM_BUILDER  )
virtual

Reimplemented from KSeExpr::ExprNode.

◆ prep()

ExprType KSeExpr::ExprModuleNode::prep ( bool  dontNeedScalar,
ExprVarEnvBuilder envBuilder 
)
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 146 of file ExprNode.cpp.

References KSeExpr::ExprNode::_type, KSeExpr::ExprNode::child(), KSeExpr::ExprType::isValid(), KSeExpr::ExprNode::numChildren(), KSeExpr::ExprNode::prep(), KSeExpr::ExprNode::setType(), and KSeExpr::ExprNode::type().


The documentation for this class was generated from the following files: