eRPC Generator (erpcgen)  Rev. 1.12.0
NXP Semiconductors
erpcgen::Token Class Reference

Encapsulates all information about a token. More...

#include <Token.hpp>

Public Member Functions

 Token (int token)
 Constructor. More...
 
 Token (int token, Value *value)
 Constructor. More...
 
 Token (int token, Value *value, const token_loc_t &loc)
 Constructor. More...
 
 Token (const Token &other)
 This function is copy constructor. More...
 
Tokenoperator= (const Token &other)
 This function copy data from one token to other token with using assigned operator. More...
 
 ~Token ()
 Destructor.
 
Token
int getToken () const
 This function returns token number. More...
 
void setToken (int tok)
 This function set token number. More...
 
const char * getTokenName () const
 This function returns token name. More...
 
bool isNumberTok () const
 Returns true if token is an integer or float literal. More...
 
bool isIdentifierTok () const
 Returns true if token is an identifier. More...
 
Value
bool hasValue () const
 This function return true/false, when token has/hasn't value. More...
 
ValuegetValue ()
 This function returns token value. More...
 
const ValuegetValue () const
 This function returns const token value. More...
 
void setValue (Value *val)
 This function set token value. More...
 
const std::string & getStringValue () const
 This function returns string value. More...
 
uint64_t getIntValue () const
 This function returns integer value. More...
 
Location
const token_loc_tgetLocation () const
 This function returns token location (location from analyzed file). More...
 
void setLocation (const token_loc_t &loc)
 This function set token location (location from analyzed file). More...
 
void setLocation (const token_loc_t &first, const token_loc_t &last)
 This function set token location (location from analyzed file). More...
 
int getFirstLine () const
 This function returns first line of token from token location (location from analyzed file). More...
 
int getLastLine () const
 This function returns last line of token from token location (location from analyzed file). More...
 
bool isBinaryOp () const
 This function returns last line of token from token location (location from analyzed file). More...
 

Detailed Description

Encapsulates all information about a token.

Constructor & Destructor Documentation

erpcgen::Token::Token ( int  token)
inlineexplicit

Constructor.

This function set token number for this object to given token number.

Parameters
[in]tokenGiven token number.
See also
Token::Token(int token, Value * value)
Token::Token(int token, Value * value, const token_loc_t & loc)
Token::Token(const Token & other)
erpcgen::Token::Token ( int  token,
Value value 
)
inline

Constructor.

This function set token number to given token number and value to given value for this object.

Parameters
[in]tokenGiven token number.
[in]valuePointer to given value.
See also
Token::Token(int token)
Token::Token(int token, Value * value, const token_loc_t & loc)
Token::Token(const Token & other)
erpcgen::Token::Token ( int  token,
Value value,
const token_loc_t loc 
)
inline

Constructor.

This function set token number to given token number, value to given value and location in file to given location for this object.

Parameters
[in]tokenGiven token number.
[in]valuePointer to given value.
[in]locStruct with token location in file.
See also
Token::Token(int token)
Token::Token(int token, Value * value)
Token::Token(const Token & other)
Token::Token ( const Token other)
explicit

This function is copy constructor.

This function copy value from given token to new token, when his constructor is called (when token variable is declared).

Parameters
[in]otherToken, which values are copied to this object.
See also
Token::Token(int token)
Token::Token(int token, Value * value)
Token::Token(int token, Value * value, const token_loc_t & loc)

Member Function Documentation

int erpcgen::Token::getFirstLine ( ) const
inline

This function returns first line of token from token location (location from analyzed file).

Returns
Return first line of token location (location from analyzed file).
See also
void Token::getLastLine()
uint64_t Token::getIntValue ( ) const

This function returns integer value.

The function returns integer value converted from type value.

Returns
Return integer representation of value.
See also
const std::string & Token::getStringValue() const
Exceptions
internal_errorThrown if variable m_value is null.
int erpcgen::Token::getLastLine ( ) const
inline

This function returns last line of token from token location (location from analyzed file).

Returns
Return last line of token location (location from analyzed file).
See also
void Token::getFirstLine()
const token_loc_t& erpcgen::Token::getLocation ( ) const
inline

This function returns token location (location from analyzed file).

Returns
Return token location (location from analyzed file).
See also
void Token::setLocation()
const string & Token::getStringValue ( ) const

This function returns string value.

The function returns string value converted from type value.

Returns
Return string representation of value.
See also
uint32_t Token::getIntValue() const
Exceptions
internal_errorThrown if variable m_value is null.
int erpcgen::Token::getToken ( ) const
inline

This function returns token number.

Returns
Token number.
See also
void Token::setToken()
const char * Token::getTokenName ( ) const

This function returns token name.

The function returns token name for current token.

Returns
Return token name.
Value* erpcgen::Token::getValue ( )
inline

This function returns token value.

Returns
Return token value.
See also
void Token::hasValue()
const Value * Token::getValue()
void Token::setValue()
const Value* erpcgen::Token::getValue ( ) const
inline

This function returns const token value.

Returns
Return const token value.
See also
void Token::hasValue()
Value * Token::getValue()
void Token::setValue()
bool erpcgen::Token::hasValue ( ) const
inline

This function return true/false, when token has/hasn't value.

Return values
trueWhen token has value.
falseWhen token hasn't value.
See also
Value * Token::getValue()
const Value * Token::getValue()
void Token::setValue()
bool Token::isBinaryOp ( ) const

This function returns last line of token from token location (location from analyzed file).

Return values
trueReturn true when token means binary operation.
falseReturn false when token doesn't mean binary operation.
bool Token::isIdentifierTok ( ) const

Returns true if token is an identifier.

Return values
Truewhen token is identifier type, else false.
bool Token::isNumberTok ( ) const

Returns true if token is an integer or float literal.

Return values
Truewhen token is number type, else false.
Token & Token::operator= ( const Token other)

This function copy data from one token to other token with using assigned operator.

The function copy all necessary data from token at right side to token at left side, which are separated by operator "=".

Parameters
[in]otherToken, which values are copied to this object.
Returns
void erpcgen::Token::setLocation ( const token_loc_t loc)
inline

This function set token location (location from analyzed file).

Parameters
[in]locToken location (location from analyzed file).
See also
void Token::getLocation()
void Token::setLocation ( const token_loc_t first,
const token_loc_t last 
)

This function set token location (location from analyzed file).

Parameters
[in]firstToken locations, which values are copied to this object locations.
[in]lastToken locations, which values are copied to this object locations.
void erpcgen::Token::setToken ( int  tok)
inline

This function set token number.

Parameters
[in]tokGiven token number.
See also
int Token::getToken()
void erpcgen::Token::setValue ( Value val)
inline

This function set token value.

The function set token value for current token.

Parameters
[in]valPointer to given value.
See also
void Token::hasValue()
Value * Token::getValue()
const Value * Token::getValue()

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