OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Expression Class Reference

#include <ParserStructs.hh>

Collaboration diagram for Expression:
Collaboration graph

Public Member Functions

std::string toString () const
 

Public Attributes

std::string label
 Name of the label.
 
bool hasValue
 Is resolved value defined in struct.
 
UValue value
 Resolved value.
 
bool hasOffset
 Is offset defined.
 
bool isMinus
 Is offset minus.
 
UValue offset
 Value of offset.
 

Detailed Description

Parsed expression.

Expression is label with possibly some additional information.

Form: name[(+|-)offset][=literal] e.g. myDataStructLabel+8=16, myCodeLabel=3, myDataStructLabel+8 or myDataStructLabel

Part after '=' sign is just value of label, if value is always resolved by compiler and it is also given by user values will be compared to match.

Offset can be used for example with structures, if one want's to refer different datafields.

Definition at line 198 of file ParserStructs.hh.

Member Function Documentation

◆ toString()

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

String representation of term for error message generation.

Definition at line 218 of file ParserStructs.hh.

218 {
219
220 std::stringstream retVal;
221
222 retVal << label;
223
224 if (hasOffset) {
225 if (isMinus) {
226 retVal << '-';
227 } else {
228 retVal << '+';
229 }
230
231 retVal << std::dec << offset;
232 }
233
234 if (hasValue) {
235 retVal << "=" << std::hex << value;
236 }
237
238 return retVal.str();
239 }
bool hasOffset
Is offset defined.
bool isMinus
Is offset minus.
UValue value
Resolved value.
bool hasValue
Is resolved value defined in struct.
std::string label
Name of the label.
UValue offset
Value of offset.

References hasOffset, hasValue, isMinus, label, offset, and value.

Referenced by LiteralOrExpression::toString().

Member Data Documentation

◆ hasOffset

bool Expression::hasOffset

◆ hasValue

bool Expression::hasValue

Is resolved value defined in struct.

Definition at line 204 of file ParserStructs.hh.

Referenced by AssemblerParser::definition< ScannerT >::definition(), LabelManager::resolveExpressionValue(), and toString().

◆ isMinus

bool Expression::isMinus

◆ label

std::string Expression::label

◆ offset

UValue Expression::offset

◆ value

UValue Expression::value

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