Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Token Class Reference

Atomic element in an ObjectFile. More...

#include <Token.h>

List of all members.

Public Methods

 Token ()
 Default constructor.

Token & operator= (const Token &t)
 Assingment. More...

bool operator== (TokenId t) const
 Checks type type equality.

bool operator!= (TokenId t) const
 Checks type type inequality.

TokenId getId ()
 Return the token type.

int asInt ()
 Returns the token value as an interger.

float asFloat ()
 Returns the token value as a float.

double asDouble ()
 Returns the token value as a double.

string & asString ()
 Returns the token value as a string.


Static Public Methods

const string lookup (TokenId type)
 Find and return the token string representation.


Protected Attributes

TokenId id
 The type or id of the token.

double value
 Numeric value of the token. More...

string data
 String value of the token. More...


Static Protected Attributes

const string stringTable []
 Mapping from TokenId to string. More...


Friends

ostream & operator<< (ostream &stream, const Token &token)
 Writes a token. More...


Detailed Description

Atomic element in an ObjectFile.


Member Function Documentation

Token & Token::operator= const Token &    t
 

Assingment.

Todo:
Use swap.
Parameters:
t  Token to assign (right value).
Returns:
*this.


Friends And Related Function Documentation

ostream& operator<< ostream &    stream,
const Token &    token
[friend]
 

Writes a token.

Parameters:
stream  ostream to write to.
token  Token to write.
Returns:
stream.


Member Data Documentation

string Token::data [protected]
 

String value of the token.

Note:
Only valid if id != numbersym and id >= directivesym

const string Token::stringTable [static, protected]
 

Initial value:

{
    "nosym",
    "eof",
    
    "{", "}",
    "[", "]",
    "(", ")",
    
    ",", ":", ";",
    
    "//", "/*", "*/",
    
    "*", "-", "+", "/",
    
    "#<directive>",
    "<number>",
    "<string>",
}
Mapping from TokenId to string.

double Token::value [protected]
 

Numeric value of the token.

Note:
Only valid if id == numbersym


The documentation for this class was generated from the following files:
This documentation was generated using doxygen. If you have any comments or additions please mail me.