| 57 |
typedef std::basic_ios<char_type, traits_type> ios_type; |
typedef std::basic_ios<char_type, traits_type> ios_type; |
| 58 |
typedef std::basic_streambuf<char_type, traits_type> streambuf_type; |
typedef std::basic_streambuf<char_type, traits_type> streambuf_type; |
| 59 |
typedef std::ctype<char_type> ctype_type; |
typedef std::ctype<char_type> ctype_type; |
| 60 |
|
typedef std::basic_string<char_type, traits_type> string_type; |
| 61 |
|
|
| 62 |
static const ecstacy::size_type tab_size; |
static const ecstacy::size_type tab_size; |
| 63 |
|
|
| 64 |
class token |
struct token |
| 65 |
{ |
{ |
|
public: |
|
| 66 |
enum type_t { |
enum type_t { |
| 67 |
type_none, |
type_none, |
| 68 |
type_identifier, |
type_identifier, |
| 69 |
type_string, |
type_string, |
| 70 |
type_block_start, |
type_command_begin, |
| 71 |
|
type_block_begin, |
| 72 |
type_block_end, |
type_block_end, |
| 73 |
type_equals, |
type_equals, |
| 74 |
type_endl, |
type_endl, |
| 75 |
|
type_semicolon, |
| 76 |
type_eof |
type_eof |
| 77 |
}; |
}; |
| 78 |
|
|
| 79 |
type_t type; |
type_t type; |
| 80 |
std::basic_string<char_type, traits_type> value; |
string_type value; |
| 81 |
ecstacy::size_type line; |
ecstacy::size_type line; |
| 82 |
ecstacy::size_type column; |
ecstacy::size_type column; |
| 83 |
|
|
| 91 |
} |
} |
| 92 |
|
|
| 93 |
inline |
inline |
| 94 |
token (type_t type, const std::basic_string<char_type, traits_type> &value, ecstacy::size_type line, ecstacy::size_type column) |
token (type_t type, |
| 95 |
|
const string_type &value = string_type (), |
| 96 |
|
ecstacy::size_type line = 0, |
| 97 |
|
ecstacy::size_type column = 0) |
| 98 |
: type (type), |
: type (type), |
| 99 |
value (value), |
value (value), |
| 100 |
line (line), |
line (line), |
| 101 |
column (column) |
column (column) |
| 102 |
{ |
{ |
| 103 |
} |
} |
| 104 |
|
|
| 105 |
|
inline |
| 106 |
|
token (const token &token) |
| 107 |
|
: type (token.type), |
| 108 |
|
value (token.value), |
| 109 |
|
line (token.line), |
| 110 |
|
column (token.column) |
| 111 |
|
{ |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
const token &operator = (const token &token) |
| 115 |
|
{ |
| 116 |
|
this->type = token.type; |
| 117 |
|
this->value = token.value; |
| 118 |
|
this->line = token.line; |
| 119 |
|
this->column = token.column; |
| 120 |
|
return *this; |
| 121 |
|
} |
| 122 |
}; |
}; |
| 123 |
|
|
| 124 |
private: |
private: |
| 154 |
this->buf_->sputbackc (c); |
this->buf_->sputbackc (c); |
| 155 |
if (traits_type::eq (c, ct.widen ('\n'))) { |
if (traits_type::eq (c, ct.widen ('\n'))) { |
| 156 |
--this->line_; |
--this->line_; |
| 157 |
this->column = 0; |
this->column_ = static_cast<ecstacy::size_type> (-1); |
| 158 |
} else { |
} else { |
| 159 |
--this->column_; |
--this->column_; |
| 160 |
} |
} |
| 194 |
} |
} |
| 195 |
|
|
| 196 |
token next_token (void); |
token next_token (void); |
| 197 |
|
|
| 198 |
|
private: |
| 199 |
|
basic_lexer (void) |
| 200 |
|
{ |
| 201 |
|
} |
| 202 |
|
|
| 203 |
|
basic_lexer (const basic_lexer &lexer) |
| 204 |
|
{ |
| 205 |
|
} |
| 206 |
|
|
| 207 |
|
basic_lexer &operator = (const basic_lexer &lexer) |
| 208 |
|
{ |
| 209 |
|
return *this; |
| 210 |
|
} |
| 211 |
}; |
}; |
| 212 |
|
|
| 213 |
typedef basic_lexer<char> lexer; |
typedef basic_lexer<char> lexer; |
| 214 |
typedef basic_lexer<wchar_t> wlexer; |
typedef basic_lexer<wchar_t> wlexer; |
| 215 |
|
|