400 int *accset, ds, nacc, newds;
401 int sym, hashval, numstates, dsize;
402 int num_full_table_rows = 0;
404 int targptr, totaltrans,
i, comstate, comfreq, targ;
405 int *
epsclosure(
int *t,
int *ns_addr,
int *accset,
int *nacc_addr,
int *hv_addr);
406 int snstods(
int *sns,
int numstates,
int *accset,
int nacc,
int hashval,
int *newds_addr);
407 int symlist[
CSIZE + 1];
408 int num_start_states;
409 int todo_head, todo_next;
419 int targfreq[
CSIZE + 1], targstate[
CSIZE + 1];
436 todo_head = todo_next = 0;
438 for ( i = 0; i <=
csize; ++
i )
450 fputs(
"\n\nDFA Dump:\n\n",
stderr );
488 if (
fulltbl && ! use_NUL_table )
492 for ( power_of_two = 1; power_of_two <=
csize; power_of_two *= 2 )
493 if (
numecs == power_of_two )
495 use_NUL_table =
true;
510 for ( i = 0; i <=
numecs; ++
i )
521 num_full_table_rows =
numecs;
528 num_full_table_rows =
numecs + 1;
533 printf(
"static short int yy_nxt[][%d] =\n {\n",
535 num_full_table_rows );
538 for ( i = 0; i < num_full_table_rows; ++
i )
550 num_start_states =
lastsc * 2;
552 for ( i = 1; i <= num_start_states; ++
i )
561 nset[numstates] =
scset[(i / 2) + 1];
565 nset =
epsclosure( nset, &numstates, accset, &nacc, &hashval );
567 if (
snstods( nset, numstates, accset, nacc, hashval, &ds ) )
581 flexfatal(
"could not create unique end-of-buffer state" );
588 while ( todo_head < todo_next )
593 for ( i = 1; i <=
numecs; ++
i )
602 fprintf(
stderr,
"state # %d:\n", ds );
606 for ( sym = 1; sym <=
numecs; ++sym )
612 if ( duplist[sym] ==
NIL )
618 if (
snstods( nset, numstates, accset,
619 nacc, hashval, &newds ) )
633 fprintf(
stderr,
"\t%d\t%d\n", sym, newds );
635 targfreq[++targptr] = 1;
636 targstate[targptr] = newds;
645 targ = state[duplist[sym]];
649 fprintf(
stderr,
"\t%d\t%d\n", sym, targ );
654 while ( targstate[++i] != targ )
672 for ( i =
'A', j =
'a'; i <=
'Z'; ++
i, ++j )
676 if ( ds > num_start_states )
693 for ( i = 1; i < num_full_table_rows; ++
i )
695 mk2data( state[i] ? state[i] : -ds );
722 for ( i = 1; i <= targptr; ++
i )
723 if ( targfreq[i] > comfreq )
725 comfreq = targfreq[
i];
726 comstate = targstate[
i];
729 bldtbl( state, ds, totaltrans, comstate, comfreq );
void stack1(int, int, int, int)
int variable_trailing_context_rules
void mk1tbl(int, int, int, int)
int symfollowset(int[], int, int, int[])
void sympartition(int[], int, int[], int[])
void check_trailing_context(int *nfa_states, int num_states, int *accset, int nacc)
int onestate[ONE_STACK_SIZE]
#define allocate_integer_array(size)
void check_for_backtracking(int ds, int state[])
int onesym[ONE_STACK_SIZE]
int * epsclosure(int *t, int *ns_addr, int accset[], int *nacc_addr, int *hv_addr)
int onedef[ONE_STACK_SIZE]
int onenext[ONE_STACK_SIZE]
int snstods(int sns[], int numstates, int accset[], int nacc, int hashval, int *newds_addr)
void bldtbl(int[], int, int, int, int)
void place_state(int *, int, int)