332 states +=
State(pre?
"PP_NOTOKEN":
"NOTOKEN");
335 for (c =
'a'; c <=
'z'; ++c)
336 newState(states, pre?
"PP_CHARACTER":
"CHARACTER", c);
337 for (c =
'A'; c <=
'Z'; ++c)
338 newState(states, pre?
"PP_CHARACTER":
"CHARACTER", c);
340 newState(states, pre?
"PP_CHARACTER":
"CHARACTER",
'_');
341 newState(states, pre?
"PP_CHARACTER":
"CHARACTER",
'$');
344 for (c =
'0'; c <=
'9'; ++c)
345 newState(states, pre?
"PP_DIGIT":
"DIGIT", c);
348 for (i = 0; keywords[i].lexem; ++i)
349 newState(states, keywords[i].token, keywords[i].lexem, pre);
352 for (c =
'0'; c <=
'9'; ++c)
353 newState(states, pre?
"PP_FLOATING_LITERAL":
"FLOATING_LITERAL",
354 QByteArray(
".") +
char(c), pre);
358 for (i = 0; i < states.size(); ++i) {
361 for (c = 0; c < 128; ++c)
362 if (states[i].next[c]) {
369 states[i].defnext = states[i].next[defchar];
370 states[i].defchar = defchar;
373 states[i].nextindex = ++transindex;
379 for (i = 0; i < states.size(); ++i) {
380 for (j = i + 1; j < states.size(); ++j) {
381 if ( states[i] == states[j] ) {
382 for (k = 0; k < states.size(); ++k) {
383 if (states[k].defnext == j)
384 states[k].defnext = i;
385 if (states[k].defnext > j)
387 for (c = 0; c < 128; ++c) {
388 if (states[k].next[c] == j)
389 states[k].next[c] = i;
390 if (states[k].next[c] > j)
400 printf(
"static const short %skeyword_trans[][128] = {\n",
402 for (i = 0; i < states.size(); ++i) {
403 if (i && !states[i].nextindex)
405 printf(
"%s {", i?
",\n":
"");
406 for (c = 0; c < 128; ++c)
409 (!c || c%16)?
"":
"\n ",
416 printf(
"static const struct\n{\n"
422 "} %skeywords[] = {\n",
426 for (i = 0; i < states.size(); ++i) {
427 printf(
"%s {%s, %d, %d, %d, %s}",
429 states[i].token.data(),
433 states[i].ident?states[i].ident:(pre?
"PP_NOTOKEN":
"NOTOKEN"));