lestes::lang::cplus::lex::ucn_token Class Reference

Single source character token. More...

#include <ucn_token.hh>

Inheritance diagram for lestes::lang::cplus::lex::ucn_token:

Inheritance graph
[legend]
List of all members.

Public Types

enum  token_types {
  TOK_EOF = 0, TOK_TRANSLATED = 1, TOK_NOT_EOF = 2, TOK_BASIC = 3,
  TOK_ERROR = 4
}
 Token type constants. More...
typedef ptr< ::lestes::msg::messageerror_type
 The type of stored error message.

Public Member Functions

error_type error_get (void) const
 Returns error for token.
ptr< ucn_tokenclone_type (const type_type &a_type) const
 Returns copy of token with changed type.
ptr< ucn_tokenclone_value (const value_type &a_value) const
 Returns copy of token with changed value.
ptr< ucn_tokenclone_location (const location_type &a_location) const
 Returns copy of token with changed location.
bool equals (const ptr< ucn_token > &rhs) const
 Tests equality.

Static Public Member Functions

static ptr< ucn_tokencreate (const type_type &a_type)
 Returns new token, initializes with token type.
static ptr< ucn_tokencreate (const type_type &a_type, const value_type &a_value)
 Returns new token, initializes with token type and token value.
static ptr< ucn_tokencreate (const type_type &a_type, const value_type &a_value, const location_type &a_location)
 Returns new token, initializes with location, token type and value.
static ptr< ucn_tokencreate_error (const error_type &a_error, const location_type &a_location)
 Returns new error token, initializes with error and location.
static ptr< ucn_tokencreate_error (const error_type &a_error)
 Returns new error token, initializes with the error.

Protected Member Functions

 ucn_token (const location_type &a_location, const type_type &a_type, const value_type &a_value)
 Creates the object, initializes with location, type and value.
 ucn_token (const location_type &a_location, const error_type &a_error)
 Creates the object, initializes with location and error.
virtual void gc_mark (void)
 Marks the object.

Private Member Functions

 ucn_token (const ucn_token &)
 Hides copy constructor.
ucn_tokenoperator= (const ucn_token &)
 Hides assignment operator.

Private Attributes

srp< ::lestes::msg::messageerror
 Message to report for token.

Detailed Description

Single source character token.

Represents single source character token. For character translation and other processing before lex phase.


Member Typedef Documentation

typedef ptr< ::lestes::msg::message > lestes::lang::cplus::lex::ucn_token::error_type

The type of stored error message.


Member Enumeration Documentation

enum lestes::lang::cplus::lex::ucn_token::token_types

Token type constants.

Enumerator:
TOK_EOF  End of file.
TOK_TRANSLATED  Anything which is not basic source character.
TOK_NOT_EOF  Any character in early stages of processing.
TOK_BASIC  Basic source character.
TOK_ERROR  Token for propagation of messages.


Constructor & Destructor Documentation

lestes::lang::cplus::lex::ucn_token::ucn_token ( const location_type a_location,
const type_type a_type,
const value_type a_value 
) [protected]

Creates the object, initializes with location, type and value.

Creates the object, initializes with location, type and value.

Precondition:
a_type != TOK_ERROR
Postcondition:
a_error == NULL
Parameters:
a_location The initial location of the token.
a_type The initial type of the token.
a_value The initial value of the token.

lestes::lang::cplus::lex::ucn_token::ucn_token ( const location_type a_location,
const error_type a_error 
) [protected]

Creates the object, initializes with location and error.

Creates the object, initializes with location and error message.

Precondition:
a_error != NULL
Parameters:
a_location The location of the token.
a_error The error message.

lestes::lang::cplus::lex::ucn_token::ucn_token ( const ucn_token  )  [private]

Hides copy constructor.


Member Function Documentation

ucn_token::error_type lestes::lang::cplus::lex::ucn_token::error_get ( void   )  const

Returns error for token.

Returns error for an error token.

Precondition:
type_get() == TOK_ERROR
Returns:
The error assigned to the token.

ptr< ucn_token > lestes::lang::cplus::lex::ucn_token::clone_type ( const type_type a_type  )  const

Returns copy of token with changed type.

Returns copy of this token with new type.

Precondition:
type_get() != TOK_ERROR
Returns:
The token with new value.

ptr< ucn_token > lestes::lang::cplus::lex::ucn_token::clone_value ( const value_type a_value  )  const

Returns copy of token with changed value.

Returns copy of this token with new value.

Precondition:
type_get() != TOK_ERROR
Returns:
The token with new value.

ptr< ucn_token > lestes::lang::cplus::lex::ucn_token::clone_location ( const location_type a_location  )  const

Returns copy of token with changed location.

Returns copy of this token with new location.

Returns:
The token with new value.

ptr< ucn_token > lestes::lang::cplus::lex::ucn_token::create ( const type_type a_type  )  [static]

Returns new token, initializes with token type.

Returns new token, initializes with token type.

Postcondition:
is_equal(type_get(),a_type)
Parameters:
a_type The initial token type.
Returns:
New token initialized with token type.

ptr< ucn_token > lestes::lang::cplus::lex::ucn_token::create ( const type_type a_type,
const value_type a_value 
) [static]

Returns new token, initializes with token type and token value.

Returns new token, initializes with token type and token value.

Postcondition:
is_equal(type_get(),a_type)

is_equal(value_get(),a_value)

Parameters:
a_type The initial token type.
a_value The initial value.
Returns:
A new token initialized with token type and value.

ptr< ucn_token > lestes::lang::cplus::lex::ucn_token::create ( const type_type a_type,
const value_type a_value,
const location_type a_location 
) [static]

Returns new token, initializes with location, token type and value.

Returns new token, initializes with location, token type and token value.

Postcondition:
is_equal(type_get(),a_type)

is_equal(value_get(),a_value)

is_equal(location_get(),a_location)

Parameters:
a_type The initial token type.
a_value The initial token value.
a_location The initial location.
Returns:
A new token initialized with location, token type and token value.

ptr< ucn_token > lestes::lang::cplus::lex::ucn_token::create_error ( const error_type a_error,
const location_type a_location 
) [static]

Returns new error token, initializes with error and location.

Returns new token, initializes with error and location.

Postcondition:
is_equal(error_get(),a_error)

is_equal(location_get(),a_location)

Parameters:
a_error The error message.
a_location The location.
Returns:
A new token initialized with location and error message.

ptr< ucn_token > lestes::lang::cplus::lex::ucn_token::create_error ( const error_type a_error  )  [static]

Returns new error token, initializes with the error.

Returns new token, initializes with error.

Postcondition:
is_equal(error_get(),a_error)
Parameters:
a_error The error message.
a_location The location.
Returns:
A new token initialized with location and error message.

bool lestes::lang::cplus::lex::ucn_token::equals ( const ptr< ucn_token > &  rhs  )  const

Tests equality.

Tests equality of the token.

Parameters:
rhs The token to compare with.
Returns:
true If both tokens are equal.

void lestes::lang::cplus::lex::ucn_token::gc_mark ( void   )  [protected, virtual]

Marks the object.

Marks the object

Reimplemented from lestes::lang::cplus::lex::basic_token< lc_host_uint_least9, ptr< simple_location >, ucn >.

ucn_token& lestes::lang::cplus::lex::ucn_token::operator= ( const ucn_token  )  [private]

Hides assignment operator.


Member Data Documentation

srp< ::lestes::msg::message > lestes::lang::cplus::lex::ucn_token::error [private]

Message to report for token.


The documentation for this class was generated from the following files:
Generated on Mon Feb 12 18:43:55 2007 for lestes by doxygen 1.5.1-20070107