From e02a85b01cd31a241e9cb192ad982d9ace0d396a Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Mon, 15 Jan 1990 17:40:45 +0000 Subject: [PATCH] %t hacks. minor cosmetics. 2.2 Relase. --- dfa.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/dfa.c b/dfa.c index 5241e4d..f1be016 100644 --- a/dfa.c +++ b/dfa.c @@ -127,8 +127,8 @@ register int nacc; if ( accset[j] & YY_TRAILING_HEAD_MASK ) { fprintf( stderr, - "flex: Dangerous trailing context in rule at line %d\n", - rule_linenum[ar] ); + "%s: Dangerous trailing context in rule at line %d\n", + program_name, rule_linenum[ar] ); return; } } @@ -211,13 +211,9 @@ int state[]; register int i, ec; int out_char_set[CSIZE + 1]; - for ( i = 1; i <= CSIZE; ++i ) + for ( i = 1; i <= csize; ++i ) { - ec = ecgroup[i]; - - if ( ec < 0 ) - ec = -ec; - + ec = abs( ecgroup[i] ); out_char_set[i] = state[ec]; } @@ -226,7 +222,7 @@ int state[]; list_character_set( file, out_char_set ); /* now invert the members of the set to get the jam transitions */ - for ( i = 1; i <= CSIZE; ++i ) + for ( i = 1; i <= csize; ++i ) out_char_set[i] = ! out_char_set[i]; fprintf( file, "\n jam-transitions: EOF " ); @@ -435,7 +431,7 @@ ntod() */ todo_head = todo_next = 0; - for ( i = 0; i <= CSIZE; ++i ) + for ( i = 0; i <= csize; ++i ) { duplist[i] = NIL; symlist[i] = false; @@ -464,7 +460,7 @@ ntod() /* declare it "short" because it's a real long-shot that that * won't be large enough */ - printf( "static short int %s[][%d] =\n {\n", NEXTARRAY, + printf( "static short int yy_nxt[][%d] =\n {\n", numecs + 1 ); /* '}' so vi doesn't get too confused */ /* generate 0 entries for state #0 */ @@ -875,7 +871,7 @@ int ds[], dsize, transsym, nset[]; { /* do nothing */ } - else if ( ecgroup[sym] == transsym ) + else if ( abs( ecgroup[sym] ) == transsym ) nset[++numstates] = tsp; bottom: @@ -922,13 +918,16 @@ int symlist[]; if ( tch != SYM_EPSILON ) { - if ( tch < -lastccl || tch > CSIZE ) + if ( tch < -lastccl || tch > csize ) flexfatal( "bad transition character detected in sympartition()" ); if ( tch > 0 ) { /* character transition */ - mkechar( ecgroup[tch], dupfwd, duplist ); - symlist[ecgroup[tch]] = 1; + /* abs() needed for fake %t ec's */ + int ec = abs( ecgroup[tch] ); + + mkechar( ec, dupfwd, duplist ); + symlist[ec] = 1; } else -- 2.40.0