330 states +=
State(pre?
"PP_NOTOKEN":
"NOTOKEN");
333 for (c =
'a'; c <=
'z'; ++c)
334 newState(states, pre?
"PP_CHARACTER":
"CHARACTER", c);
335 for (c =
'A'; c <=
'Z'; ++c)
336 newState(states, pre?
"PP_CHARACTER":
"CHARACTER", c);
338 newState(states, pre?
"PP_CHARACTER":
"CHARACTER",
'_');
339 newState(states, pre?
"PP_CHARACTER":
"CHARACTER",
'$');
342 for (c =
'0'; c <=
'9'; ++c)
343 newState(states, pre?
"PP_DIGIT":
"DIGIT", c);
346 for (i = 0; keywords[i].lexem; ++i)
347 newState(states, keywords[i].token, keywords[i].lexem, pre);
350 for (c =
'0'; c <=
'9'; ++c)
351 newState(states, pre?
"PP_FLOATING_LITERAL":
"FLOATING_LITERAL",
352 QByteArray(
".") +
char(c), pre);
356 for (i = 0; i < states.size(); ++i) {
359 for (c = 0; c < 128; ++c)
360 if (states[i].next[c]) {
367 states[i].defnext = states[i].next[defchar];
368 states[i].defchar = defchar;
371 states[i].nextindex = ++transindex;
377 for (i = 0; i < states.size(); ++i) {
378 for (j = i + 1; j < states.size(); ++j) {
379 if ( states[i] == states[j] ) {
380 for (k = 0; k < states.size(); ++k) {
381 if (states[k].defnext == j)
382 states[k].defnext = i;
383 if (states[k].defnext > j)
385 for (c = 0; c < 128; ++c) {
386 if (states[k].next[c] == j)
387 states[k].next[c] = i;
388 if (states[k].next[c] > j)
398 printf(
"static const short %skeyword_trans[][128] = {\n",
400 for (i = 0; i < states.size(); ++i) {
401 if (i && !states[i].nextindex)
403 printf(
"%s {", i?
",\n":
"");
404 for (c = 0; c < 128; ++c)
407 (!c || c%16)?
"":
"\n ",
414 printf(
"static const struct\n{\n"
420 "} %skeywords[] = {\n",
424 for (i = 0; i < states.size(); ++i) {
425 printf(
"%s {%s, %d, %d, %d, %s}",
427 states[i].token.data(),
431 states[i].ident?states[i].ident:(pre?
"PP_NOTOKEN":
"NOTOKEN"));