SeExpr
Public Member Functions | Private Attributes | List of all members
SeExpr2::ExprVarNode Class Reference

Node that references a variable. More...

#include <ExprNode.h>

Inheritance diagram for SeExpr2::ExprVarNode:
SeExpr2::ExprNode

Public Member Functions

 ExprVarNode (const Expression *expr, const char *name)
 
 ExprVarNode (const Expression *expr, const char *name, const ExprType &type)
 
virtual ExprType prep (bool wantScalar, ExprVarEnvBuilder &envBuilder)
 
virtual int buildInterpreter (Interpreter *interpreter) const
 builds an interpreter. Returns the location index for the evaluated data More...
 
virtual LLVM_VALUE codegen (LLVM_BUILDER) LLVM_BODY
 
const char * name () const
 
const ExprLocalVarlocalVar () const
 
const ExprVarRefvar () const
 
- Public Member Functions inherited from SeExpr2::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 std::string &error) 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...
 
short int startPos () const
 Access start position in input string. More...
 
short int endPos () const
 Access end position in input string. More...
 
short int length () const
 Access length of input string. More...
 
bool checkCondition (bool check, const std::string &message, bool &error)
 Checks the boolean value and records an error string with node if it is false. More...
 
bool checkIsValue (const ExprType &type, bool &error)
 Checks if the type is a value (i.e. string or float[d]) More...
 
bool checkIsFP (const ExprType &type, bool &error)
 Checks if the type is a float[d] for any d. More...
 
bool checkIsFP (int d, const ExprType &type, bool &error)
 Checks if the type is a float[d] for a specific d. More...
 
bool checkTypesCompatible (const ExprType &first, const ExprType &second, bool &error)
 types match (true if they do) More...
 

Private Attributes

std::string _name
 
ExprLocalVar_localVar
 
ExprVarRef_var
 

Additional Inherited Members

- Protected Member Functions inherited from SeExpr2::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 SeExpr2::ExprNode
const Expression_expr
 Owning expression (node can't modify) More...
 
ExprNode_parent
 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 references a variable.

Definition at line 462 of file ExprNode.h.

Constructor & Destructor Documentation

SeExpr2::ExprVarNode::ExprVarNode ( const Expression expr,
const char *  name 
)
inline

Definition at line 464 of file ExprNode.h.

SeExpr2::ExprVarNode::ExprVarNode ( const Expression expr,
const char *  name,
const ExprType type 
)
inline

Definition at line 466 of file ExprNode.h.

Member Function Documentation

int SeExpr2::ExprVarNode::buildInterpreter ( Interpreter interpreter) const
virtual
virtual LLVM_VALUE SeExpr2::ExprVarNode::codegen ( LLVM_BUILDER  )
virtual

Reimplemented from SeExpr2::ExprNode.

const ExprLocalVar* SeExpr2::ExprVarNode::localVar ( ) const
inline

Definition at line 473 of file ExprNode.h.

const char* SeExpr2::ExprVarNode::name ( ) const
inline

Definition at line 472 of file ExprNode.h.

Referenced by prep().

ExprType SeExpr2::ExprVarNode::prep ( bool  dontNeedScalar,
ExprVarEnvBuilder envBuilder 
)
virtual

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 SeExpr2::ExprNode.

Definition at line 482 of file ExprNode.cpp.

References SeExpr2::ExprNode::_expr, _localVar, SeExpr2::ExprNode::_type, _var, SeExpr2::ExprNode::addError(), SeExpr2::Expression::addVar(), SeExpr2::ExprNode::checkCondition(), SeExpr2::ExprVarEnvBuilder::current(), SeExpr2::ExprVarEnv::find(), SeExpr2::ExprType::isError(), name(), SeExpr2::Expression::resolveVar(), SeExpr2::ExprNode::setType(), SeExpr2::ExprLocalVar::type(), SeExpr2::ExprVarRef::type(), and SeExpr2::Expression::varBlockCreator().

Referenced by SeExpr2::GetVar::prep().

const ExprVarRef* SeExpr2::ExprVarNode::var ( ) const
inline

Definition at line 474 of file ExprNode.h.

Referenced by buildInterpreter().

Member Data Documentation

ExprLocalVar* SeExpr2::ExprVarNode::_localVar
private

Definition at line 478 of file ExprNode.h.

Referenced by buildInterpreter(), and prep().

std::string SeExpr2::ExprVarNode::_name
private

Definition at line 477 of file ExprNode.h.

ExprVarRef* SeExpr2::ExprVarNode::_var
private

Definition at line 479 of file ExprNode.h.

Referenced by buildInterpreter(), and prep().


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