34 : mType(Undefined), mKey(0), mLine(0), mColumn(0)
41 : mType(rhs.mType), mKey(rhs.mKey), mLine(rhs.mLine), mColumn(rhs.mColumn)
54 : mType(t), mKey(0), mLine(0), mColumn(0)
61 : mType(t), mKey(k), mLine(l), mColumn(c)
74 : mType(t), mKey(k), mLine(l), mColumn(c)
227 case Keyword: t =
"Keyword";
break;
230 case Comment: t =
"Comment";
break;
235 case Dot: t =
"Dot";
break;
236 case Comma: t =
"Comma";
break;
237 case Colon: t =
"Colon";
break;
239 case LParen: t =
"LParen";
break;
240 case RParen: t =
"RParen";
break;
241 case LBracket: t =
"LBracket";
break;
242 case RBracket: t =
"RBracket";
break;
243 case LBrace: t =
"LBrace";
break;
244 case RBrace: t =
"RBrace";
break;
245 case EOT: t =
"EOT";
break;
260 case '.' : d =
"Token::Dot";
break;
261 case ',' : d =
"Token::Comma";
break;
262 case ';' : d =
"Token::Semicolon";
break;
263 case '(' : d =
"Token::LParen";
break;
264 case ')' : d =
"Token::RParen";
break;
265 case '[' : d =
"Token::LBracket";
break;
266 case ']' : d =
"Token::RBracket";
break;
267 case '{' : d =
"Token::LBrace";
break;
268 case '}' : d =
"Token::RBrace";
break;
274 d =
"\"" + tok +
"\", Token::AlphaIdent";
275 else if (isdigit(tok(0))) {
277 d =
"\"" + tok +
"\", Token::FloatLiteral";
279 d =
"\"" + tok +
"\", Token::IntLiteral";
282 d =
"\"" + tok +
"\", Token::SymbolicIdent";
291 : reader(r), str(0), index(0), old_index(0),
292 length(0), line(0), old_line(0), lineStart(0)
296 : index(rhs.index), old_index(rhs.old_index), length(rhs.length),
298 line(rhs.line), old_line(0), lineStart(rhs.lineStart)
300 str =
new(__FILE__, __LINE__)
char [strlen(rhs.
str) + 1];
305 : reader(0), index(0), old_index(0), length(s.length()), line(0),
306 old_line(0), lineStart(0)
308 str =
new(__FILE__, __LINE__)
char [s.
length() + 1];
323 str =
new(__FILE__, __LINE__)
char [strlen(rhs.
str) + 1];
342 str =
new(__FILE__, __LINE__)
char [s.
length() + 1];
375 while (isspace(*
p) &&
p <
eos) {
393 size_t start =
p -
str;
395 if (*
p ==
'"' || *
p ==
'\'') {
403 if (*(
p-1) !=
'\\') {
448 else if (isdigit(*
p))
461 size_t extent = (
p -
str) - start;
463 if (extent < 1) extent = 1;
465 index = start + extent;
467 if (
line == 0) col++;
469 char* buf =
new(__FILE__, __LINE__)
char [extent + 1];
470 strncpy(buf, str + start, extent);
490 result =
Token(buf, type, 0,
line+1, col);
507 if (*
p ==
'0' && *(
p+1) ==
'x') {
509 while (isxdigit(*
p))
p++;
513 while (isdigit(*
p) || *
p ==
'_')
p++;
515 if (*
p ==
'.') {
p++;
518 while (isdigit(*
p) || *
p ==
'_')
p++;
521 if (*
p ==
'E' || *
p ==
'e') {
p++;
522 if (*
p ==
'+' || *
p ==
'-')
p++;
523 while (isdigit(*
p))
p++;
536 return (isalpha(*
p) || isdigit(*
p) || (*
p ==
'_'))?
true:
false;
544 const char* s =
"+-*/\\<=>~!@#$%^&|:";
545 return strchr(s, c)?
true:
false;