OpenASIP 2.2
Loading...
Searching...
No Matches
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 }
#define assert(condition)
static SLongWord toLong(const T &source)

References assert, isIntegerLiteral(), strValue_, and Conversion::toLong().

Referenced by OperationDAGBuilder::getIOOperand(), and TokenizerData::TokenTreeNode::intValue().

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_;}

References isAddrofOperator_.

◆ isAsteriskOperator()

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

Definition at line 327 of file OperationDAGLanguageParser.hh.

327{return isAsteriskOperator_;}

References isAsteriskOperator_.

◆ isBangOperator()

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

Definition at line 331 of file OperationDAGLanguageParser.hh.

331{return isBangOperator_;}

References isBangOperator_.

◆ isFloatLiteral()

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

Definition at line 324 of file OperationDAGLanguageParser.hh.

324{return isFloatLiteral_;}

References 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_;}

References isIntegerLiteral_.

Referenced by OperationDAGBuilder::getIOOperand(), and intValue().

◆ isMinusOperator()

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

Definition at line 329 of file OperationDAGLanguageParser.hh.

329{return isMinusOperator_;}

References isMinusOperator_.

◆ isPlusOperator()

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

Definition at line 328 of file OperationDAGLanguageParser.hh.

328{return isPlusOperator_;}

References 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_;}

References isStringLiteral_.

◆ isTildeOperator()

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

Definition at line 330 of file OperationDAGLanguageParser.hh.

330{return isTildeOperator_;}

References isTildeOperator_.

◆ isUnaryExpression()

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

Definition at line 325 of file OperationDAGLanguageParser.hh.

325{return isUnaryExpression_;}

References 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 }

References TokenizerData::FLOAT_LITERAL, TokenizerData::IDENTIFIER, TokenizerData::INTEGER_LITERAL, isAddrofOperator_, isAsteriskOperator_, isBangOperator_, isFloatLiteral_, isIdentifier_, isIntegerLiteral_, isMinusOperator_, isPlusOperator_, isStringLiteral_, isTildeOperator_, isUnaryExpression_, TokenizerData::STRING_LITERAL, type_, TokenizerData::UNARY_ADDROF, TokenizerData::UNARY_BANG, TokenizerData::UNARY_EXPRESSION, TokenizerData::UNARY_MINUS, TokenizerData::UNARY_PLUS, TokenizerData::UNARY_STAR, and TokenizerData::UNARY_TILDE.

◆ 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.

Referenced by isAddrofOperator(), and setProperty().

◆ isAsteriskOperator_

bool TokenizerData::Token::isAsteriskOperator_

Definition at line 377 of file OperationDAGLanguageParser.hh.

Referenced by isAsteriskOperator(), and setProperty().

◆ isBangOperator_

bool TokenizerData::Token::isBangOperator_

Definition at line 381 of file OperationDAGLanguageParser.hh.

Referenced by isBangOperator(), and setProperty().

◆ isFloatLiteral_

bool TokenizerData::Token::isFloatLiteral_

Definition at line 374 of file OperationDAGLanguageParser.hh.

Referenced by isFloatLiteral(), and setProperty().

◆ isIdentifier_

bool TokenizerData::Token::isIdentifier_

Definition at line 371 of file OperationDAGLanguageParser.hh.

Referenced by isIdentifier(), and setProperty().

◆ isIntegerLiteral_

bool TokenizerData::Token::isIntegerLiteral_

Definition at line 373 of file OperationDAGLanguageParser.hh.

Referenced by isIntegerLiteral(), and setProperty().

◆ isMinusOperator_

bool TokenizerData::Token::isMinusOperator_

Definition at line 379 of file OperationDAGLanguageParser.hh.

Referenced by isMinusOperator(), and setProperty().

◆ isPlusOperator_

bool TokenizerData::Token::isPlusOperator_

Definition at line 378 of file OperationDAGLanguageParser.hh.

Referenced by isPlusOperator(), and setProperty().

◆ isStringLiteral_

bool TokenizerData::Token::isStringLiteral_

Definition at line 372 of file OperationDAGLanguageParser.hh.

Referenced by isStringLiteral(), and setProperty().

◆ isTildeOperator_

bool TokenizerData::Token::isTildeOperator_

Definition at line 380 of file OperationDAGLanguageParser.hh.

Referenced by isTildeOperator(), and setProperty().

◆ isUnaryExpression_

bool TokenizerData::Token::isUnaryExpression_

Definition at line 375 of file OperationDAGLanguageParser.hh.

Referenced by isUnaryExpression(), and setProperty().

◆ start_

unsigned long TokenizerData::Token::start_

◆ strValue_

std::string TokenizerData::Token::strValue_

◆ type_

OperationID TokenizerData::Token::type_

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