OpenASIP  2.0
Public Member Functions | Public Attributes | List of all members
TokenizerData::Token Class Reference

#include <OperationDAGLanguageParser.hh>

Collaboration diagram for TokenizerData::Token:
Collaboration graph

Public Member Functions

 Token (unsigned long start, unsigned long end, std::string &strValue)
 
bool isIdentifier () const
 
bool isStringLiteral () const
 
bool isIntegerLiteral () const
 
bool isFloatLiteral () const
 
bool isUnaryExpression () const
 
bool isAddrofOperator () const
 
bool isAsteriskOperator () const
 
bool isPlusOperator () const
 
bool isMinusOperator () const
 
bool isTildeOperator () const
 
bool isBangOperator () const
 
long intValue () const
 
std::string stringValue () const
 
bool isPostfixExpression () const
 
void setProperty (OperationID id)
 

Public Attributes

unsigned long start_
 
unsigned long end_
 
std::string strValue_
 
OperationID type_
 
bool isIdentifier_
 
bool isStringLiteral_
 
bool isIntegerLiteral_
 
bool isFloatLiteral_
 
bool isUnaryExpression_
 
bool isAddrofOperator_
 
bool isAsteriskOperator_
 
bool isPlusOperator_
 
bool isMinusOperator_
 
bool isTildeOperator_
 
bool isBangOperator_
 

Detailed Description

Represents one token of source code.

Definition at line 304 of file OperationDAGLanguageParser.hh.

Constructor & Destructor Documentation

◆ Token()

TokenizerData::Token::Token ( unsigned long  start,
unsigned long  end,
std::string &  strValue 
)
inline

Definition at line 306 of file OperationDAGLanguageParser.hh.

306  :
307  start_(start), end_(end), strValue_(strValue),
309  isIdentifier_(false),
310  isStringLiteral_(false),
311  isIntegerLiteral_(false),
312  isFloatLiteral_(false),
313  isUnaryExpression_(false),
314  isAddrofOperator_(false),
315  isAsteriskOperator_(false),
316  isPlusOperator_(false),
317  isMinusOperator_(false),
318  isTildeOperator_(false),
319  isBangOperator_(false) {}

Member Function Documentation

◆ intValue()

long TokenizerData::Token::intValue ( ) const
inline

Definition at line 333 of file OperationDAGLanguageParser.hh.

333  {
334  if (!isIntegerLiteral()) {
335  // TODO: throw exception
336  assert(false && "Node is not integer literal.");
337  }
339  }

References assert, and Conversion::toLong().

Referenced by OperationDAGBuilder::getIOOperand().

Here is the call graph for this function:

◆ isAddrofOperator()

bool TokenizerData::Token::isAddrofOperator ( ) const
inline

Definition at line 326 of file OperationDAGLanguageParser.hh.

326 {return isAddrofOperator_;}

◆ isAsteriskOperator()

bool TokenizerData::Token::isAsteriskOperator ( ) const
inline

Definition at line 327 of file OperationDAGLanguageParser.hh.

327 {return isAsteriskOperator_;}

◆ isBangOperator()

bool TokenizerData::Token::isBangOperator ( ) const
inline

Definition at line 331 of file OperationDAGLanguageParser.hh.

331 {return isBangOperator_;}

◆ isFloatLiteral()

bool TokenizerData::Token::isFloatLiteral ( ) const
inline

Definition at line 324 of file OperationDAGLanguageParser.hh.

324 {return isFloatLiteral_;}

◆ isIdentifier()

bool TokenizerData::Token::isIdentifier ( ) const
inline

◆ isIntegerLiteral()

bool TokenizerData::Token::isIntegerLiteral ( ) const
inline

Definition at line 323 of file OperationDAGLanguageParser.hh.

323 {return isIntegerLiteral_;}

Referenced by OperationDAGBuilder::getIOOperand().

◆ isMinusOperator()

bool TokenizerData::Token::isMinusOperator ( ) const
inline

Definition at line 329 of file OperationDAGLanguageParser.hh.

329 {return isMinusOperator_;}

◆ isPlusOperator()

bool TokenizerData::Token::isPlusOperator ( ) const
inline

Definition at line 328 of file OperationDAGLanguageParser.hh.

328 {return isPlusOperator_;}

◆ isPostfixExpression()

bool TokenizerData::Token::isPostfixExpression ( ) const
inline

Definition at line 345 of file OperationDAGLanguageParser.hh.

345 {return false;}

◆ isStringLiteral()

bool TokenizerData::Token::isStringLiteral ( ) const
inline

Definition at line 322 of file OperationDAGLanguageParser.hh.

322 {return isStringLiteral_;}

◆ isTildeOperator()

bool TokenizerData::Token::isTildeOperator ( ) const
inline

Definition at line 330 of file OperationDAGLanguageParser.hh.

330 {return isTildeOperator_;}

◆ isUnaryExpression()

bool TokenizerData::Token::isUnaryExpression ( ) const
inline

Definition at line 325 of file OperationDAGLanguageParser.hh.

325 {return isUnaryExpression_;}

◆ setProperty()

void TokenizerData::Token::setProperty ( OperationID  id)
inline

Definition at line 347 of file OperationDAGLanguageParser.hh.

347  {
348  switch (id) {
349  case IDENTIFIER: isIdentifier_ = true; break;
350  case STRING_LITERAL: isStringLiteral_ = true; break;
351  case INTEGER_LITERAL: isIntegerLiteral_ = true; break;
352  case FLOAT_LITERAL: isFloatLiteral_ = true; break;
353  case UNARY_EXPRESSION: isUnaryExpression_ = true; break;
354  case UNARY_ADDROF: isAddrofOperator_ = true; break;
355  case UNARY_STAR: isAsteriskOperator_ = true; break;
356  case UNARY_PLUS: isPlusOperator_ = true; break;
357  case UNARY_MINUS: isMinusOperator_ = true; break;
358  case UNARY_TILDE: isTildeOperator_ = true; break;
359  case UNARY_BANG: isBangOperator_ = true; break;
360  default: ;
361  }
362 
363  type_ = id;
364  }

◆ stringValue()

std::string TokenizerData::Token::stringValue ( ) const
inline

Member Data Documentation

◆ end_

unsigned long TokenizerData::Token::end_

◆ isAddrofOperator_

bool TokenizerData::Token::isAddrofOperator_

Definition at line 376 of file OperationDAGLanguageParser.hh.

◆ isAsteriskOperator_

bool TokenizerData::Token::isAsteriskOperator_

Definition at line 377 of file OperationDAGLanguageParser.hh.

◆ isBangOperator_

bool TokenizerData::Token::isBangOperator_

Definition at line 381 of file OperationDAGLanguageParser.hh.

◆ isFloatLiteral_

bool TokenizerData::Token::isFloatLiteral_

Definition at line 374 of file OperationDAGLanguageParser.hh.

◆ isIdentifier_

bool TokenizerData::Token::isIdentifier_

Definition at line 371 of file OperationDAGLanguageParser.hh.

◆ isIntegerLiteral_

bool TokenizerData::Token::isIntegerLiteral_

Definition at line 373 of file OperationDAGLanguageParser.hh.

◆ isMinusOperator_

bool TokenizerData::Token::isMinusOperator_

Definition at line 379 of file OperationDAGLanguageParser.hh.

◆ isPlusOperator_

bool TokenizerData::Token::isPlusOperator_

Definition at line 378 of file OperationDAGLanguageParser.hh.

◆ isStringLiteral_

bool TokenizerData::Token::isStringLiteral_

Definition at line 372 of file OperationDAGLanguageParser.hh.

◆ isTildeOperator_

bool TokenizerData::Token::isTildeOperator_

Definition at line 380 of file OperationDAGLanguageParser.hh.

◆ isUnaryExpression_

bool TokenizerData::Token::isUnaryExpression_

Definition at line 375 of file OperationDAGLanguageParser.hh.

◆ start_

unsigned long TokenizerData::Token::start_

◆ strValue_

std::string TokenizerData::Token::strValue_

Definition at line 368 of file OperationDAGLanguageParser.hh.

◆ type_

OperationID TokenizerData::Token::type_

Definition at line 369 of file OperationDAGLanguageParser.hh.

Referenced by OperationDAGBuilder::parseNode().


The documentation for this class was generated from the following file:
TokenizerData::UNARY_MINUS
@ UNARY_MINUS
Definition: OperationDAGLanguageParser.hh:164
TokenizerData::Token::isPlusOperator_
bool isPlusOperator_
Definition: OperationDAGLanguageParser.hh:378
TokenizerData::Token::isFloatLiteral_
bool isFloatLiteral_
Definition: OperationDAGLanguageParser.hh:374
TokenizerData::Token::isIntegerLiteral_
bool isIntegerLiteral_
Definition: OperationDAGLanguageParser.hh:373
TokenizerData::Token::isIntegerLiteral
bool isIntegerLiteral() const
Definition: OperationDAGLanguageParser.hh:323
TokenizerData::UNARY_BANG
@ UNARY_BANG
Definition: OperationDAGLanguageParser.hh:166
TokenizerData::Token::isAddrofOperator_
bool isAddrofOperator_
Definition: OperationDAGLanguageParser.hh:376
TokenizerData::Token::end_
unsigned long end_
Definition: OperationDAGLanguageParser.hh:367
TokenizerData::UNARY_PLUS
@ UNARY_PLUS
Definition: OperationDAGLanguageParser.hh:163
TokenizerData::Token::strValue_
std::string strValue_
Definition: OperationDAGLanguageParser.hh:368
TokenizerData::Token::isStringLiteral_
bool isStringLiteral_
Definition: OperationDAGLanguageParser.hh:372
TokenizerData::FLOAT_LITERAL
@ FLOAT_LITERAL
Definition: OperationDAGLanguageParser.hh:158
assert
#define assert(condition)
Definition: Application.hh:86
TokenizerData::UNARY_EXPRESSION
@ UNARY_EXPRESSION
Definition: OperationDAGLanguageParser.hh:160
TokenizerData::Token::isUnaryExpression_
bool isUnaryExpression_
Definition: OperationDAGLanguageParser.hh:375
TokenizerData::UNARY_TILDE
@ UNARY_TILDE
Definition: OperationDAGLanguageParser.hh:165
TokenizerData::Token::isTildeOperator_
bool isTildeOperator_
Definition: OperationDAGLanguageParser.hh:380
TokenizerData::UNARY_ADDROF
@ UNARY_ADDROF
Definition: OperationDAGLanguageParser.hh:161
TokenizerData::INVALID_TOKEN
@ INVALID_TOKEN
Definition: OperationDAGLanguageParser.hh:220
TokenizerData::Token::start_
unsigned long start_
Definition: OperationDAGLanguageParser.hh:366
TokenizerData::Token::isAsteriskOperator_
bool isAsteriskOperator_
Definition: OperationDAGLanguageParser.hh:377
TokenizerData::Token::isBangOperator_
bool isBangOperator_
Definition: OperationDAGLanguageParser.hh:381
TokenizerData::Token::isIdentifier_
bool isIdentifier_
Definition: OperationDAGLanguageParser.hh:371
TokenizerData::STRING_LITERAL
@ STRING_LITERAL
Definition: OperationDAGLanguageParser.hh:156
Conversion::toLong
static SLongWord toLong(const T &source)
TokenizerData::Token::type_
OperationID type_
Definition: OperationDAGLanguageParser.hh:369
TokenizerData::INTEGER_LITERAL
@ INTEGER_LITERAL
Definition: OperationDAGLanguageParser.hh:157
TokenizerData::Token::isMinusOperator_
bool isMinusOperator_
Definition: OperationDAGLanguageParser.hh:379
TokenizerData::IDENTIFIER
@ IDENTIFIER
Definition: OperationDAGLanguageParser.hh:155
TokenizerData::UNARY_STAR
@ UNARY_STAR
Definition: OperationDAGLanguageParser.hh:162