OpenASIP  2.0
Public Member Functions | Public Attributes | List of all members
LiteralOrExpression Class Reference

#include <ParserStructs.hh>

Collaboration diagram for LiteralOrExpression:
Collaboration graph

Public Member Functions

 LiteralOrExpression ()
 
std::string toString () const
 

Public Attributes

bool isExpression
 Does object contain expression or literal. More...
 
Expression expression
 If expression the expression, Otherwise not used. More...
 
UValue value
 If literal, the literal. Otherwise not used. More...
 
bool isSigned
 Sign of the value. More...
 

Detailed Description

Parsed literal or expression.

Definition at line 245 of file ParserStructs.hh.

Constructor & Destructor Documentation

◆ LiteralOrExpression()

LiteralOrExpression::LiteralOrExpression ( )
inline

Definition at line 248 of file ParserStructs.hh.

248 : value(0) {}

Member Function Documentation

◆ toString()

std::string LiteralOrExpression::toString ( ) const
inline

String representation of term for error message generation.

Definition at line 263 of file ParserStructs.hh.

263  {
264  std::stringstream retVal;
265  if (isExpression) {
266  retVal << expression.toString();
267  } else {
268  retVal << std::dec << static_cast<int>(value);
269  }
270  return retVal.str();
271  }

References expression, isExpression, Expression::toString(), and value.

Referenced by ParserSource::toString().

Here is the call graph for this function:

Member Data Documentation

◆ expression

Expression LiteralOrExpression::expression

If expression the expression, Otherwise not used.

Definition at line 253 of file ParserStructs.hh.

Referenced by CodeSectionCreator::finalize(), LabelManager::resolveExpressionValue(), toString(), InitDataField::toString(), and DataSectionCreator::writeDataLineToTPEF().

◆ isExpression

bool LiteralOrExpression::isExpression

◆ isSigned

bool LiteralOrExpression::isSigned

Sign of the value.

Definition at line 258 of file ParserStructs.hh.

Referenced by CodeSectionCreator::addAnnotationes(), and DataSectionCreator::writeDataLineToTPEF().

◆ value

UValue LiteralOrExpression::value

The documentation for this class was generated from the following file:
Expression::toString
std::string toString() const
Definition: ParserStructs.hh:218
LiteralOrExpression::isExpression
bool isExpression
Does object contain expression or literal.
Definition: ParserStructs.hh:251
LiteralOrExpression::value
UValue value
If literal, the literal. Otherwise not used.
Definition: ParserStructs.hh:256
LiteralOrExpression::expression
Expression expression
If expression the expression, Otherwise not used.
Definition: ParserStructs.hh:253