lestes::lang::cplus::lex::basic_token< Type, Location, Value > Class Template Reference

Token template. More...

#include <basic_token.hh>

Inheritance diagram for lestes::lang::cplus::lex::basic_token< Type, Location, Value >:

lestes::std::object lestes::std::mem::keystone List of all members.

Public Types

typedef convert< Type >::to_ptr type_type
 Type of token type.
typedef convert< Value
>::to_ptr 
value_type
 Type of token value.
typedef convert< Location
>::to_ptr 
location_type
 Type of token location.

Public Member Functions

Type type_get (void) const
 Returns type of token.
Value value_get (void) const
 Returns value of token.
Location location_get (void) const
 Returns location of token.
bool equals (const ptr< basic_token< Type, Location, Value > > &rhs) const
 Tests equality.

Protected Member Functions

 basic_token (const Location &a_location, const Type &a_type, const Value &a_value)
 Initializes with location, token type and value.
virtual void gc_mark (void)
 Marks the object.

Private Member Functions

 basic_token (const basic_token< Type, Location, Value > &copy)
 Hides copy constructor.
basic_token< Type, Location,
Value > & 
operator= (const basic_token< Type, Location, Value > &rhs)
 Hides assignment operator.

Private Attributes

convert< Type >::to_srp type
 Type of token.
convert< Value >::to_srp value
 Token value itself.
convert< Location >::to_srp location
 Where the token is located.

Detailed Description

template<typename Type, typename Location, typename Value>
class lestes::lang::cplus::lex::basic_token< Type, Location, Value >

Token template.

General token template representing an entity with specific occurence within file.

Parameters:
Type Type of the kind of the token.
Location Type of the location of the token.
Value Type of the value of the token.

Definition at line 55 of file basic_token.hh.


Member Typedef Documentation

template<typename Type, typename Location, typename Value>
typedef convert<Type>::to_ptr lestes::lang::cplus::lex::basic_token< Type, Location, Value >::type_type

Type of token type.

Definition at line 58 of file basic_token.hh.

template<typename Type, typename Location, typename Value>
typedef convert<Value>::to_ptr lestes::lang::cplus::lex::basic_token< Type, Location, Value >::value_type

Type of token value.

Definition at line 60 of file basic_token.hh.

template<typename Type, typename Location, typename Value>
typedef convert<Location>::to_ptr lestes::lang::cplus::lex::basic_token< Type, Location, Value >::location_type

Type of token location.

Definition at line 62 of file basic_token.hh.


Constructor & Destructor Documentation

template<typename Type, typename Location, typename Value>
lestes::lang::cplus::lex::basic_token< Type, Location, Value >::basic_token ( const Location &  a_location,
const Type &  a_type,
const Value &  a_value 
) [inline, protected]

Initializes with location, token type and value.

Creates initialized object.

Parameters:
a_location The location of the token.
a_type The type of the token.
a_value The value of the token.

Definition at line 97 of file basic_token.hh.

00098                                                          :
00099         type(a_type),
00100         value(a_value),
00101         location(a_location)
00102 {
00103 }

template<typename Type, typename Location, typename Value>
lestes::lang::cplus::lex::basic_token< Type, Location, Value >::basic_token ( const basic_token< Type, Location, Value > &  copy  )  [private]

Hides copy constructor.


Member Function Documentation

template<typename Type, typename Location, typename Value>
Type lestes::lang::cplus::lex::basic_token< Type, Location, Value >::type_get ( void   )  const [inline]

Returns type of token.

Returns token type.

Returns:
The token type.

Definition at line 110 of file basic_token.hh.

References lestes::lang::cplus::lex::basic_token< Type, Location, Value >::type.

00111 {
00112         return type;
00113 }

template<typename Type, typename Location, typename Value>
Value lestes::lang::cplus::lex::basic_token< Type, Location, Value >::value_get ( void   )  const [inline]

Returns value of token.

Returns token value.

Returns:
The token value.

Definition at line 120 of file basic_token.hh.

References lestes::lang::cplus::lex::basic_token< Type, Location, Value >::value.

00121 {
00122         return value;
00123 }

template<typename Type, typename Location, typename Value>
Location lestes::lang::cplus::lex::basic_token< Type, Location, Value >::location_get ( void   )  const [inline]

Returns location of token.

Returns token location.

Returns:
The token location.

Definition at line 130 of file basic_token.hh.

References lestes::lang::cplus::lex::basic_token< Type, Location, Value >::location.

00131 {
00132         return location;
00133 }

template<typename Type, typename Location, typename Value>
bool lestes::lang::cplus::lex::basic_token< Type, Location, Value >::equals ( const ptr< basic_token< Type, Location, Value > > &  rhs  )  const [inline]

Tests equality.

Tests equality of tokens. Checks equality of type, value and location.

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

Definition at line 154 of file basic_token.hh.

References lestes::is_equal(), lestes::lang::cplus::lex::basic_token< Type, Location, Value >::location, lestes::lang::cplus::lex::basic_token< Type, Location, Value >::type, and lestes::lang::cplus::lex::basic_token< Type, Location, Value >::value.

00156 {
00157         return
00158                 is_equal(type,rhs->type_get()) &&
00159                 is_equal(value,rhs->value_get()) &&
00160                 is_equal(location,rhs->location_get());
00161 }

template<typename Type, typename Location, typename Value>
void lestes::lang::cplus::lex::basic_token< Type, Location, Value >::gc_mark ( void   )  [inline, protected, virtual]

Marks the object.

Marks the object.

Reimplemented from lestes::std::mem::keystone.

Reimplemented in lestes::lang::cplus::lex::cpp_token, lestes::lang::cplus::lex::pp_token, and lestes::lang::cplus::lex::ucn_token.

Definition at line 139 of file basic_token.hh.

References lestes::std::mem::keystone::gc_mark(), lestes::gc_mark_srp(), lestes::lang::cplus::lex::basic_token< Type, Location, Value >::location, lestes::lang::cplus::lex::basic_token< Type, Location, Value >::type, and lestes::lang::cplus::lex::basic_token< Type, Location, Value >::value.

00140 {
00141         gc_mark_srp(type);
00142         gc_mark_srp(location);
00143         gc_mark_srp(value);
00144 	
00145 	::lestes::std::object::gc_mark();
00146 }

template<typename Type, typename Location, typename Value>
basic_token<Type,Location,Value>& lestes::lang::cplus::lex::basic_token< Type, Location, Value >::operator= ( const basic_token< Type, Location, Value > &  rhs  )  [private]

Hides assignment operator.


Member Data Documentation

template<typename Type, typename Location, typename Value>
convert<Type>::to_srp lestes::lang::cplus::lex::basic_token< Type, Location, Value >::type [private]

Type of token.

Definition at line 78 of file basic_token.hh.

Referenced by lestes::lang::cplus::lex::basic_token< Type, Location, Value >::equals(), lestes::lang::cplus::lex::basic_token< Type, Location, Value >::gc_mark(), and lestes::lang::cplus::lex::basic_token< Type, Location, Value >::type_get().

template<typename Type, typename Location, typename Value>
convert<Value>::to_srp lestes::lang::cplus::lex::basic_token< Type, Location, Value >::value [private]

Token value itself.

Definition at line 80 of file basic_token.hh.

Referenced by lestes::lang::cplus::lex::basic_token< Type, Location, Value >::equals(), lestes::lang::cplus::lex::basic_token< Type, Location, Value >::gc_mark(), and lestes::lang::cplus::lex::basic_token< Type, Location, Value >::value_get().

template<typename Type, typename Location, typename Value>
convert<Location>::to_srp lestes::lang::cplus::lex::basic_token< Type, Location, Value >::location [private]

Where the token is located.

Definition at line 82 of file basic_token.hh.

Referenced by lestes::lang::cplus::lex::basic_token< Type, Location, Value >::equals(), lestes::lang::cplus::lex::basic_token< Type, Location, Value >::gc_mark(), and lestes::lang::cplus::lex::basic_token< Type, Location, Value >::location_get().


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