#include <ucn_token.hh>
Inheritance diagram for lestes::lang::cplus::lex::ucn_token:

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::message > | error_type |
| The type of stored error message. | |
Public Member Functions | |
| error_type | error_get (void) const |
| Returns error for token. | |
| ptr< ucn_token > | clone_type (const type_type &a_type) const |
| Returns copy of token with changed type. | |
| ptr< ucn_token > | clone_value (const value_type &a_value) const |
| Returns copy of token with changed value. | |
| ptr< ucn_token > | clone_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_token > | create (const type_type &a_type) |
| Returns new token, initializes with token type. | |
| static ptr< ucn_token > | create (const type_type &a_type, const value_type &a_value) |
| Returns new token, initializes with token type and token value. | |
| static ptr< ucn_token > | create (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_token > | create_error (const error_type &a_error, const location_type &a_location) |
| Returns new error token, initializes with error and location. | |
| static ptr< ucn_token > | create_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_token & | operator= (const ucn_token &) |
| Hides assignment operator. | |
Private Attributes | |
| srp< ::lestes::msg::message > | error |
| Message to report for token. | |
Represents single source character token. For character translation and other processing before lex phase.
Definition at line 56 of file ucn_token.hh.
| typedef ptr< ::lestes::msg::message > lestes::lang::cplus::lex::ucn_token::error_type |
Token type constants.
Definition at line 82 of file ucn_token.hh.
00082 { 00083 //! End of file. 00084 TOK_EOF = 0, 00085 //! Anything which is not basic source character. 00086 TOK_TRANSLATED = 1, 00087 //! Any character in early stages of processing. 00088 TOK_NOT_EOF = 2, 00089 //! Basic source character. 00090 TOK_BASIC = 3, 00091 //! Token for propagation of messages. 00092 TOK_ERROR = 4 00093 };
| 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.
| a_location | The initial location of the token. | |
| a_type | The initial type of the token. | |
| a_value | The initial value of the token. |
Definition at line 50 of file ucn_token.cc.
Referenced by clone_location(), clone_type(), clone_value(), create(), and create_error().
00051 : 00052 basic_ucn_token(a_location,(lassert(a_type != TOK_ERROR),a_type),a_value), 00053 error() 00054 { 00055 }
| 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.
| a_location | The location of the token. | |
| a_error | The error message. |
Definition at line 63 of file ucn_token.cc.
00063 : 00064 basic_ucn_token(a_location,TOK_ERROR,0), 00065 error(checked(a_error)) 00066 { 00067 }
| lestes::lang::cplus::lex::ucn_token::ucn_token | ( | const ucn_token & | ) | [private] |
Hides copy constructor.
| ucn_token::error_type lestes::lang::cplus::lex::ucn_token::error_get | ( | void | ) | const |
Returns error for token.
Returns error for an error token.
Definition at line 83 of file ucn_token.cc.
References error, lassert, TOK_ERROR, and lestes::lang::cplus::lex::basic_token< lc_host_uint_least9, ptr< simple_location >, ucn >::type_get().
Referenced by clone_location().
Returns copy of token with changed type.
Returns copy of this token with new type.
Definition at line 117 of file ucn_token.cc.
References lassert, lestes::lang::cplus::lex::basic_token< lc_host_uint_least9, ptr< simple_location >, ucn >::location_get(), TOK_ERROR, lestes::lang::cplus::lex::basic_token< lc_host_uint_least9, ptr< simple_location >, ucn >::type_get(), ucn_token(), and lestes::lang::cplus::lex::basic_token< lc_host_uint_least9, ptr< simple_location >, ucn >::value_get().
00118 { 00119 lassert(type_get() != TOK_ERROR); 00120 return new ucn_token(location_get(),a_type,value_get()); 00121 }
| 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.
Definition at line 128 of file ucn_token.cc.
References lassert, lestes::lang::cplus::lex::basic_token< lc_host_uint_least9, ptr< simple_location >, ucn >::location_get(), TOK_ERROR, lestes::lang::cplus::lex::basic_token< lc_host_uint_least9, ptr< simple_location >, ucn >::type_get(), and ucn_token().
00129 { 00130 lassert(type_get() != TOK_ERROR); 00131 return new ucn_token(location_get(),type_get(),a_value); 00132 }
| 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.
Definition at line 138 of file ucn_token.cc.
References error_get(), TOK_ERROR, lestes::lang::cplus::lex::basic_token< lc_host_uint_least9, ptr< simple_location >, ucn >::type_get(), ucn_token(), and lestes::lang::cplus::lex::basic_token< lc_host_uint_least9, ptr< simple_location >, ucn >::value_get().
00139 { 00140 if (type_get() == TOK_ERROR) 00141 return new ucn_token(a_location,error_get()); 00142 return new ucn_token(a_location,type_get(),value_get()); 00143 }
Returns new token, initializes with token type.
Returns new token, initializes with token type.
| a_type | The initial token type. |
Definition at line 151 of file ucn_token.cc.
References ucn_token().
Referenced by lestes::lang::cplus::lex::string_source::read(), lestes::lang::cplus::lex::stream_source::read(), lestes::lang::cplus::lex::special_tokens::read(), and lestes::lang::cplus::lex::pre_lex::read().
00152 { 00153 return new ucn_token(location_type(),a_type,value_type()); 00154 }
| 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.
is_equal(value_get(),a_value)
| a_type | The initial token type. | |
| a_value | The initial value. |
Definition at line 164 of file ucn_token.cc.
References ucn_token().
00165 { 00166 return new ucn_token(location_type(),a_type,a_value); 00167 }
| 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.
is_equal(value_get(),a_value)
is_equal(location_get(),a_location)
| a_type | The initial token type. | |
| a_value | The initial token value. | |
| a_location | The initial location. |
Definition at line 179 of file ucn_token.cc.
References ucn_token().
00181 { 00182 return new ucn_token(a_location,a_type,a_value); 00183 }
| 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.
is_equal(location_get(),a_location)
| a_error | The error message. | |
| a_location | The location. |
Definition at line 193 of file ucn_token.cc.
References ucn_token().
Referenced by lestes::lang::cplus::lex::special_tokens::read(), lestes::lang::cplus::lex::pre_lex::read(), lestes::lang::cplus::lex::encoder_utf8::read(), lestes::lang::cplus::lex::encoder_host::read(), and lestes::lang::cplus::lex::encoder_ascii7::read().
00194 { 00195 return new ucn_token(a_location,a_error); 00196 }
| 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.
| a_error | The error message. | |
| a_location | The location. |
Definition at line 205 of file ucn_token.cc.
References ucn_token().
00206 { 00207 return new ucn_token(NULL,a_error); 00208 }
| bool lestes::lang::cplus::lex::ucn_token::equals | ( | const ptr< ucn_token > & | rhs | ) | const |
Tests equality.
Tests equality of the token.
| rhs | The token to compare with. |
Definition at line 215 of file ucn_token.cc.
References lestes::lang::cplus::lex::basic_token< lc_host_uint_least9, ptr< simple_location >, ucn >::equals().
00216 { 00217 return basic_ucn_token::equals(rhs.dncast<basic_ucn_token>()); 00218 }
| 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 >.
Definition at line 72 of file ucn_token.cc.
References error, and lestes::lang::cplus::lex::basic_token< lc_host_uint_least9, ptr< simple_location >, ucn >::gc_mark().
00073 { 00074 error.gc_mark(); 00075 basic_ucn_token::gc_mark(); 00076 }
Hides assignment operator.
srp< ::lestes::msg::message > lestes::lang::cplus::lex::ucn_token::error [private] |
Message to report for token.
Definition at line 103 of file ucn_token.hh.
Referenced by error_get(), and gc_mark().
1.5.1-20070107