Zen
A cross-platform functional programming language

Token Struct Reference

The token data returned by the scanner. More...

#include <Token.hpp>

Inheritance diagram for Token:
TokenData

List of all members.

Public Member Functions

void initString (char *str, const int &len)
 Initialize string.
void init ()
 Initialize common members.
void createValue (const z::string &v)
 Create a large string in the token data, if necessary.
 Token ()
 Default constructor.
 Token (const int &i, const z::string &v, const bool &h)
 Default constructor.
 Token (const z::string &v)
 Default constructor.
 Token (const int &i, const z::string &v, const bool &h, const int &l, const int &c)
 Default constructor.
void copyFrom (const zbl::Token &src)
 Copy data from othr instance.
 Token (const zbl::Token &src)
 Copy constructor.
Tokenoperator= (const zbl::Token &src)
 Assignment operator.

Static Public Member Functions

static void deleteValue (zbl::TokenData &td)
 Delete large string stored in the token data, if any.
static z::string getValue (const zbl::TokenData &td)
 Get the value in a token.

Private Attributes

z::string text
 The token text.

Detailed Description

The token data returned by the scanner.


Constructor & Destructor Documentation

Token ( const int &  i,
const z::string v,
const bool &  h 
) [inline]

Default constructor.

Special ctor for unit tests.

Parameters:
iToken ID
vToken text
hTrue if hidden
Token ( const z::string v) [inline]

Default constructor.

Special ctor for unit tests.

Parameters:
vToken text
Token ( const int &  i,
const z::string v,
const bool &  h,
const int &  l,
const int &  c 
) [inline]

Default constructor.

Parameters:
iToken ID
vToken text
hTrue if hidden
lLine number
cColumn number
Token ( const zbl::Token src) [inline]

Copy constructor.

Parameters:
srcSource instance

Member Function Documentation

void copyFrom ( const zbl::Token src) [inline]

Copy data from othr instance.

Parameters:
srcSource instance
void createValue ( const z::string v) [inline]

Create a large string in the token data, if necessary.

Parameters:
vThe string to assign to this token
static void deleteValue ( zbl::TokenData td) [inline, static]

Delete large string stored in the token data, if any.

Parameters:
tdThe TokenData to clean
static z::string getValue ( const zbl::TokenData td) [inline, static]

Get the value in a token.

Returns the large member if it is non-zero, or the value member.

Parameters:
tdThe TokenData
Returns:
The string value of the token
void initString ( char *  str,
const int &  len 
) [inline]

Initialize string.

Parameters:
strThe string to initialize
lenLength of string
Token& operator= ( const zbl::Token src) [inline]

Assignment operator.

Parameters:
srcSource instance
Returns:
Self reference

Member Data Documentation

z::string text [private]

The token text.

Todo:
Eliminate need for token text

The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines