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

Public Member Functions | |
| ptr< ucn_token > | read (void) |
| Reads next token. | |
Static Public Member Functions | |
| static ptr< encoder_host > | create (void) |
| Returns new instance. | |
Protected Member Functions | |
| encoder_host (void) | |
| Creates the object. | |
| virtual void | gc_mark (void) |
| Marks the object. | |
Private Member Functions | |
| encoder_host (const encoder_host &) | |
| Hides copy constructor. | |
| encoder_host & | operator= (const encoder_host &) |
| Hides assignment operator. | |
Performs host character set encoding to internal representation. Useful for testing, when input comes from string created in the compiler sources.
Definition at line 52 of file encoder_host.hh.
| lestes::lang::cplus::lex::encoder_host::encoder_host | ( | void | ) | [protected] |
Creates the object.
Creates the encoder.
Definition at line 53 of file encoder_host.cc.
Referenced by create().
| lestes::lang::cplus::lex::encoder_host::encoder_host | ( | const encoder_host & | ) | [private] |
Hides copy constructor.
| ptr< ucn_token > lestes::lang::cplus::lex::encoder_host::read | ( | void | ) | [virtual] |
Reads next token.
Reads next token. Performs encoding from host character set. Checks whether the input contains valid characters, for which the encoding into ucn is known. If error is encountered, it returns token with type ucn_token::TOK_ERROR.
Token with type ucn_token::TOK_ERROR if the source character is invalid (out of range).
Token with type ucn_token::TOK_EOF in case of previous error.
Implements lestes::lang::cplus::lex::ucn_filter.
Definition at line 66 of file encoder_host.cc.
References lestes::msg::message::create(), lestes::lang::cplus::lex::ucn_token::create_error(), lestes::msg::message::FLG_ERROR, lestes::lang::cplus::lex::ucn_filter::input_read(), lestes::lang::cplus::lex::ucn_token::TOK_NOT_EOF, and u.
00067 { 00068 // TODO remove return the eof token in case of previous error if (bad) return bad; 00069 00070 ptr<ucn_token> t = input_read(); 00071 ucn u = t->value_get(); 00072 ucn_token_type utt = t->type_get(); 00073 00074 if (utt == ucn_token::TOK_NOT_EOF) { 00075 // check that the character is can be converted to internal 00076 if (character::is_encodable_host(u)) { 00077 ulint x = character::extract_value(u); 00078 // encode value in source charset 00079 // TODO t->value_set(character::create_from_host(static_cast<hchar>(x))); 00080 t = t->clone_value(character::create_from_host(static_cast<hchar>(x))); 00081 } else { 00082 // TODO report error: value out of range for ASCII 00083 //t->type_set(ucn_token::TOK_ERROR); 00084 // TODO pt remove set flag for next calls 00085 //bad = ucn_token::create(ucn_token::TOK_EOF); 00086 // TODO pt 00087 t = ucn_token::create_error(::lestes::msg::message::create(0xdada,"TODO encoder_host",::lestes::msg::message::FLG_ERROR)); 00088 } 00089 } 00090 00091 return t; 00092 }
| ptr< encoder_host > lestes::lang::cplus::lex::encoder_host::create | ( | void | ) | [static] |
Returns new instance.
Returns new instance of the encoder.
Definition at line 106 of file encoder_host.cc.
References encoder_host().
00107 { 00108 return new encoder_host(); 00109 }
| void lestes::lang::cplus::lex::encoder_host::gc_mark | ( | void | ) | [protected, virtual] |
Marks the object.
Marks the object.
Reimplemented from lestes::lang::cplus::lex::ucn_filter.
Definition at line 97 of file encoder_host.cc.
References lestes::lang::cplus::lex::ucn_filter::gc_mark().
00098 { 00099 encoder::gc_mark(); 00100 }
| encoder_host& lestes::lang::cplus::lex::encoder_host::operator= | ( | const encoder_host & | ) | [private] |
Hides assignment operator.
1.5.1-20070107