OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 
Expression expression
 If expression the expression, Otherwise not used.
 
UValue value
 If literal, the literal. Otherwise not used.
 
bool isSigned
 Sign of the value.
 

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) {}
UValue value
If literal, the literal. Otherwise not used.

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 }
std::string toString() const
bool isExpression
Does object contain expression or literal.
Expression expression
If expression the expression, Otherwise not used.

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

◆ isExpression

bool LiteralOrExpression::isExpression

◆ isSigned

bool LiteralOrExpression::isSigned

◆ value

UValue LiteralOrExpression::value

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