mjplusplus  v0.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ast::ue::UnaryExpression Class Referenceabstract

#include <UnaryExpression.hpp>

Inheritance diagram for ast::ue::UnaryExpression:
ast::Expression ast::Node ast::PositionAwareNode ast::ue::Neg ast::ue::Not

Public Member Functions

virtual bool isLValue () const
 
virtual bool standalone () const
 
virtual std::pair< bool, bool > constBool () const
 
virtual shptr< ExpressiongetChild () const
 
virtual int getSize () const
 
- Public Member Functions inherited from ast::Expression
 Expression (source_position_t position)
 
virtual shptr< Typeget_type (semantic::SemanticAnalysis &sa, shptr< semantic::symbol::SymbolTable > symbolTable) const =0
 
virtual void accept (ASTVisitor &visitor) const
 
- Public Member Functions inherited from ast::PositionAwareNode
source_position_t getPosition () const
 
 PositionAwareNode (lexer::Token const &token)
 
 PositionAwareNode (source_position_t const &position)
 

Static Public Member Functions

static shptr< ExpressioncreateUnaryExpr (shptr< Expression > child, shptr< vec< lexer::Token::Token_type >> operator_types)
 

Protected Types

enum  Unary_Operator { UNARY_NOT, UNARY_MINUS }
 

Protected Member Functions

 UnaryExpression (shptr< Expression > child, int size)
 
void toString (std::ostream &out, unsigned int indent, std::string op, bool special=false) const
 
virtual void toString (std::ostream &out, unsigned int indent, bool special=false) const =0
 

Protected Attributes

shptr< Expressionchild
 
int size
 
- Protected Attributes inherited from ast::PositionAwareNode
source_position_t position
 

Member Enumeration Documentation

Enumerator
UNARY_NOT 
UNARY_MINUS 

Constructor & Destructor Documentation

ast::ue::UnaryExpression::UnaryExpression ( shptr< Expression child,
int  size 
)
protected

Member Function Documentation

std::pair< bool, bool > ast::ue::UnaryExpression::constBool ( ) const
virtual

Special while check for definite return analysis: Return a pair<bool,bool>. The first bool signifies whether it is a constant bool expression, and in this case, the second bool is the result.

Implements ast::Expression.

Reimplemented in ast::ue::Not.

shptr< Expression > ast::ue::UnaryExpression::createUnaryExpr ( shptr< Expression child,
shptr< vec< lexer::Token::Token_type >>  operator_types 
)
static

Creates an Expression using the given child expression and the operator vector. If the operator vector is empty, the child is returned. Else the corresponding UnaryExpression is returned.

Parameters
childchild expression
operator_typesoperator vector
Returns
expr, either the child or an UnaryExpression
shptr< Expression > ast::ue::UnaryExpression::getChild ( ) const
virtual
int ast::ue::UnaryExpression::getSize ( ) const
virtual
bool ast::ue::UnaryExpression::isLValue ( ) const
virtual

Implements ast::Expression.

bool ast::ue::UnaryExpression::standalone ( ) const
virtual

Implements ast::Expression.

void ast::ue::UnaryExpression::toString ( std::ostream &  out,
unsigned int  indent,
std::string  op,
bool  special = false 
) const
protected
virtual void ast::ue::UnaryExpression::toString ( std::ostream &  out,
unsigned int  indent,
bool  special = false 
) const
protectedpure virtual

writes a representation of the Node to out, including all children. special invokes "special" behavior for certain nodes MethodDeclaration: print static keyword Block & If: skip indentation Expression: don't print surrounding parens in addition Block doesn't print newline after trailing } if ~indent is passed instead of indent

Implements ast::Node.

Implemented in ast::ue::Neg, and ast::ue::Not.

Member Data Documentation

shptr<Expression> ast::ue::UnaryExpression::child
protected
int ast::ue::UnaryExpression::size
protected

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