]> granicus.if.org Git - flex/commitdiff
Reformatting.
authorVern Paxson <vern@ee.lbl.gov>
Wed, 14 Apr 1993 22:41:35 +0000 (22:41 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Wed, 14 Apr 1993 22:41:35 +0000 (22:41 +0000)
15 files changed:
ccl.c
dfa.c
ecs.c
flex.skl
flexdef.h
gen.c
libmain.c
main.c
misc.c
nfa.c
parse.y
scan.l
sym.c
tblcmp.c
yylex.c

diff --git a/ccl.c b/ccl.c
index f17fa1bbbaee5dcb2216b6cd93486c85470045f7..77adfaee3dd168a4d6b3aa159c6b01fb00654315 100644 (file)
--- a/ccl.c
+++ b/ccl.c
@@ -33,143 +33,119 @@ static char rcsid[] =
 
 #include "flexdef.h"
 
-/* ccladd - add a single character to a ccl
- *
- * synopsis
- *    int cclp;
- *    int ch;
- *    ccladd( cclp, ch );
- */
+/* ccladd - add a single character to a ccl */
 
 void ccladd( cclp, ch )
 int cclp;
 int ch;
+       {
+       int ind, len, newpos, i;
 
-    {
-    int ind, len, newpos, i;
+       len = ccllen[cclp];
+       ind = cclmap[cclp];
 
-    len = ccllen[cclp];
-    ind = cclmap[cclp];
+       /* check to see if the character is already in the ccl */
 
-    /* check to see if the character is already in the ccl */
+       for ( i = 0; i < len; ++i )
+               if ( ccltbl[ind + i] == ch )
+                       return;
 
-    for ( i = 0; i < len; ++i )
-       if ( ccltbl[ind + i] == ch )
-           return;
+       newpos = ind + len;
 
-    newpos = ind + len;
+       if ( newpos >= current_max_ccl_tbl_size )
+               {
+               current_max_ccl_tbl_size += MAX_CCL_TBL_SIZE_INCREMENT;
 
-    if ( newpos >= current_max_ccl_tbl_size )
-       {
-       current_max_ccl_tbl_size += MAX_CCL_TBL_SIZE_INCREMENT;
+               ++num_reallocs;
 
-       ++num_reallocs;
+               ccltbl = reallocate_Character_array( ccltbl,
+                                               current_max_ccl_tbl_size );
+               }
 
-       ccltbl = reallocate_Character_array( ccltbl, current_max_ccl_tbl_size );
+       ccllen[cclp] = len + 1;
+       ccltbl[newpos] = ch;
        }
 
-    ccllen[cclp] = len + 1;
-    ccltbl[newpos] = ch;
-    }
-
 
-/* cclinit - make an empty ccl
- *
- * synopsis
- *    int cclinit();
- *    new_ccl = cclinit();
- */
+/* cclinit - return an empty ccl */
 
 int cclinit()
-
-    {
-    if ( ++lastccl >= current_maxccls )
        {
-       current_maxccls += MAX_CCLS_INCREMENT;
+       if ( ++lastccl >= current_maxccls )
+               {
+               current_maxccls += MAX_CCLS_INCREMENT;
 
-       ++num_reallocs;
+               ++num_reallocs;
 
-       cclmap = reallocate_integer_array( cclmap, current_maxccls );
-       ccllen = reallocate_integer_array( ccllen, current_maxccls );
-       cclng = reallocate_integer_array( cclng, current_maxccls );
-       }
+               cclmap = reallocate_integer_array( cclmap, current_maxccls );
+               ccllen = reallocate_integer_array( ccllen, current_maxccls );
+               cclng = reallocate_integer_array( cclng, current_maxccls );
+               }
 
-    if ( lastccl == 1 )
-       /* we're making the first ccl */
-       cclmap[lastccl] = 0;
+       if ( lastccl == 1 )
+               /* we're making the first ccl */
+               cclmap[lastccl] = 0;
 
-    else
-       /* the new pointer is just past the end of the last ccl.  Since
-        * the cclmap points to the \first/ character of a ccl, adding the
-        * length of the ccl to the cclmap pointer will produce a cursor
-        * to the first free space
-        */
-       cclmap[lastccl] = cclmap[lastccl - 1] + ccllen[lastccl - 1];
+       else
+               /* The new pointer is just past the end of the last ccl.
+                * Since the cclmap points to the \first/ character of a
+                * ccl, adding the length of the ccl to the cclmap pointer
+                * will produce a cursor to the first free space.
+                */
+               cclmap[lastccl] = cclmap[lastccl - 1] + ccllen[lastccl - 1];
 
-    ccllen[lastccl] = 0;
-    cclng[lastccl] = 0;        /* ccl's start out life un-negated */
+       ccllen[lastccl] = 0;
+       cclng[lastccl] = 0;     /* ccl's start out life un-negated */
 
-    return ( lastccl );
-    }
+       return lastccl;
+       }
 
 
-/* cclnegate - negate a ccl
- *
- * synopsis
- *    int cclp;
- *    cclnegate( ccl );
- */
+/* cclnegate - negate the given ccl */
 
 void cclnegate( cclp )
 int cclp;
-
-    {
-    cclng[cclp] = 1;
-    }
+       {
+       cclng[cclp] = 1;
+       }
 
 
 /* list_character_set - list the members of a set of characters in CCL form
  *
- * synopsis
- *     int cset[CSIZE];
- *     FILE *file;
- *     list_character_set( cset );
- *
- * writes to the given file a character-class representation of those
- * characters present in the given set.  A character is present if it
- * has a non-zero value in the set array.
+ * Writes to the given file a character-class representation of those
+ * characters present in the given CCL.  A character is present if it
+ * has a non-zero value in the cset array.
  */
 
 void list_character_set( file, cset )
 FILE *file;
 int cset[];
+       {
+       char *readable_form();
+       register int i;
 
-    {
-    register int i;
-    char *readable_form();
+       putc( '[', file );
 
-    putc( '[', file );
+       for ( i = 0; i < csize; ++i )
+               {
+               if ( cset[i] )
+                       {
+                       register int start_char = i;
 
-    for ( i = 0; i < csize; ++i )
-       {
-       if ( cset[i] )
-           {
-           register int start_char = i;
+                       putc( ' ', file );
 
-           putc( ' ', file );
+                       fputs( readable_form( i ), file );
 
-           fputs( readable_form( i ), file );
+                       while ( ++i < csize && cset[i] )
+                               ;
 
-           while ( ++i < csize && cset[i] )
-               ;
+                       if ( i - 1 > start_char )
+                               /* this was a run */
+                               fprintf( file, "-%s", readable_form( i - 1 ) );
 
-           if ( i - 1 > start_char )
-               /* this was a run */
-               fprintf( file, "-%s", readable_form( i - 1 ) );
+                       putc( ' ', file );
+                       }
+               }
 
-           putc( ' ', file );
-           }
+       putc( ']', file );
        }
-
-    putc( ']', file );
-    }
diff --git a/dfa.c b/dfa.c
index 884f7e3a93faa6758dbdbfbeb33ca7bf6b84e7cd..f91c19309d3a14261c9fbfe075fa06ef3d2bd7b6 100644 (file)
--- a/dfa.c
+++ b/dfa.c
@@ -45,55 +45,55 @@ int symfollowset PROTO((int[], int, int, int[]));
 /* check_for_backtracking - check a DFA state for backtracking
  *
  * synopsis
- *     int ds, state[numecs];
- *     check_for_backtracking( ds, state );
+ *     void check_for_backtracking( int ds, int state[numecs] );
  *
  * ds is the number of the state to check and state[] is its out-transitions,
- * indexed by equivalence class, and state_rules[] is the set of rules
- * associated with this state
+ * indexed by equivalence class.
  */
 
 void check_for_backtracking( ds, state )
 int ds;
 int state[];
+       {
+       if ( (reject && ! dfaacc[ds].dfaacc_set) || ! dfaacc[ds].dfaacc_state )
+               { /* state is non-accepting */
+               ++num_backtracking;
 
-    {
-    if ( (reject && ! dfaacc[ds].dfaacc_set) || ! dfaacc[ds].dfaacc_state )
-       { /* state is non-accepting */
-       ++num_backtracking;
-
-       if ( backtrack_report )
-           {
-           fprintf( backtrack_file, "State #%d is non-accepting -\n", ds );
+               if ( backtrack_report )
+                       {
+                       fprintf( backtrack_file,
+                               "State #%d is non-accepting -\n", ds );
 
-           /* identify the state */
-           dump_associated_rules( backtrack_file, ds );
+                       /* identify the state */
+                       dump_associated_rules( backtrack_file, ds );
 
-           /* now identify it further using the out- and jam-transitions */
-           dump_transitions( backtrack_file, state );
+                       /* Now identify it further using the out- and
+                        * jam-transitions.
+                        */
+                       dump_transitions( backtrack_file, state );
 
-           putc( '\n', backtrack_file );
-           }
+                       putc( '\n', backtrack_file );
+                       }
+               }
        }
-    }
 
 
 /* check_trailing_context - check to see if NFA state set constitutes
  *                          "dangerous" trailing context
  *
  * synopsis
- *    int nfa_states[num_states+1], num_states;
- *    int accset[nacc+1], nacc;
- *    check_trailing_context( nfa_states, num_states, accset, nacc );
+ *    void check_trailing_context( int nfa_states[num_states+1], int num_states,
+ *                             int accset[nacc+1], int nacc );
  *
  * NOTES
- *    Trailing context is "dangerous" if both the head and the trailing
+ *  Trailing context is "dangerous" if both the head and the trailing
  *  part are of variable size \and/ there's a DFA state which contains
  *  both an accepting state for the head part of the rule and NFA states
  *  which occur after the beginning of the trailing context.
+ *
  *  When such a rule is matched, it's impossible to tell if having been
- *  in the DFA state indicates the beginning of the trailing context
- *  or further-along scanning of the pattern.  In these cases, a warning
+ *  in the DFA state indicates the beginning of the trailing context or
+ *  further-along scanning of the pattern.  In these cases, a warning
  *  message is issued.
  *
  *    nfa_states[1 .. num_states] is the list of NFA states in the DFA.
@@ -104,101 +104,94 @@ void check_trailing_context( nfa_states, num_states, accset, nacc )
 int *nfa_states, num_states;
 int *accset;
 register int nacc;
+       {
+       register int i, j;
 
-    {
-    register int i, j;
+       for ( i = 1; i <= num_states; ++i )
+               {
+               int ns = nfa_states[i];
+               register int type = state_type[ns];
+               register int ar = assoc_rule[ns];
 
-    for ( i = 1; i <= num_states; ++i )
-       {
-       int ns = nfa_states[i];
-       register int type = state_type[ns];
-       register int ar = assoc_rule[ns];
-
-       if ( type == STATE_NORMAL || rule_type[ar] != RULE_VARIABLE )
-           { /* do nothing */
-           }
-
-       else if ( type == STATE_TRAILING_CONTEXT )
-           {
-           /* potential trouble.  Scan set of accepting numbers for
-            * the one marking the end of the "head".  We assume that
-            * this looping will be fairly cheap since it's rare that
-            * an accepting number set is large.
-            */
-           for ( j = 1; j <= nacc; ++j )
-               if ( accset[j] & YY_TRAILING_HEAD_MASK )
-                   {
-                   line_warning( "dangerous trailing context",
-                       rule_linenum[ar] );
-                   return;
-                   }
-           }
+               if ( type == STATE_NORMAL || rule_type[ar] != RULE_VARIABLE )
+                       { /* do nothing */
+                       }
+
+               else if ( type == STATE_TRAILING_CONTEXT )
+                       {
+                       /* Potential trouble.  Scan set of accepting numbers
+                        * for the one marking the end of the "head".  We
+                        * assume that this looping will be fairly cheap
+                        * since it's rare that an accepting number set
+                        * is large.
+                        */
+                       for ( j = 1; j <= nacc; ++j )
+                               if ( accset[j] & YY_TRAILING_HEAD_MASK )
+                                       {
+                                       line_warning(
+                                               "dangerous trailing context",
+                                               rule_linenum[ar] );
+                                       return;
+                                       }
+                       }
+               }
        }
-    }
 
 
 /* dump_associated_rules - list the rules associated with a DFA state
  *
- * synopsis
- *     int ds;
- *     FILE *file;
- *     dump_associated_rules( file, ds );
- *
- * goes through the set of NFA states associated with the DFA and
+ * Goes through the set of NFA states associated with the DFA and
  * extracts the first MAX_ASSOC_RULES unique rules, sorts them,
- * and writes a report to the given file
+ * and writes a report to the given file.
  */
 
 void dump_associated_rules( file, ds )
 FILE *file;
 int ds;
-
-    {
-    register int i, j;
-    register int num_associated_rules = 0;
-    int rule_set[MAX_ASSOC_RULES + 1];
-    int *dset = dss[ds];
-    int size = dfasiz[ds];
-    
-    for ( i = 1; i <= size; ++i )
        {
-       register int rule_num = rule_linenum[assoc_rule[dset[i]]];
+       register int i, j;
+       register int num_associated_rules = 0;
+       int rule_set[MAX_ASSOC_RULES + 1];
+       int *dset = dss[ds];
+       int size = dfasiz[ds];
 
-       for ( j = 1; j <= num_associated_rules; ++j )
-           if ( rule_num == rule_set[j] )
-               break;
+       for ( i = 1; i <= size; ++i )
+               {
+               register int rule_num = rule_linenum[assoc_rule[dset[i]]];
 
-       if ( j > num_associated_rules )
-           { /* new rule */
-           if ( num_associated_rules < MAX_ASSOC_RULES )
-               rule_set[++num_associated_rules] = rule_num;
-           }
-       }
+               for ( j = 1; j <= num_associated_rules; ++j )
+                       if ( rule_num == rule_set[j] )
+                               break;
 
-    bubble( rule_set, num_associated_rules );
+               if ( j > num_associated_rules )
+                       { /* new rule */
+                       if ( num_associated_rules < MAX_ASSOC_RULES )
+                               rule_set[++num_associated_rules] = rule_num;
+                       }
+               }
 
-    fprintf( file, " associated rule line numbers:" );
+       bubble( rule_set, num_associated_rules );
 
-    for ( i = 1; i <= num_associated_rules; ++i )
-       {
-       if ( i % 8 == 1 )
-           putc( '\n', file );
-       
-       fprintf( file, "\t%d", rule_set[i] );
+       fprintf( file, " associated rule line numbers:" );
+
+       for ( i = 1; i <= num_associated_rules; ++i )
+               {
+               if ( i % 8 == 1 )
+                       putc( '\n', file );
+
+               fprintf( file, "\t%d", rule_set[i] );
+               }
+
+       putc( '\n', file );
        }
-    
-    putc( '\n', file );
-    }
 
 
 /* dump_transitions - list the transitions associated with a DFA state
  *
  * synopsis
- *     int state[numecs];
- *     FILE *file;
- *     dump_transitions( file, state );
+ *     dump_transitions( FILE *file, int state[numecs] );
  *
- * goes through the set of out-transitions and lists them in human-readable
+ * Goes through the set of out-transitions and lists them in human-readable
  * form (i.e., not as equivalence classes); also lists jam transitions
  * (i.e., all those which are not out-transitions, plus EOF).  The dump
  * is done to the given file.
@@ -207,870 +200,893 @@ int ds;
 void dump_transitions( file, state )
 FILE *file;
 int state[];
+       {
+       register int i, ec;
+       int out_char_set[CSIZE];
 
-    {
-    register int i, ec;
-    int out_char_set[CSIZE];
+       for ( i = 0; i < csize; ++i )
+               {
+               ec = abs( ecgroup[i] );
+               out_char_set[i] = state[ec];
+               }
 
-    for ( i = 0; i < csize; ++i )
-       {
-       ec = abs( ecgroup[i] );
-       out_char_set[i] = state[ec];
-       }
-    
-    fprintf( file, " out-transitions: " );
+       fprintf( file, " out-transitions: " );
 
-    list_character_set( file, out_char_set );
+       list_character_set( file, out_char_set );
 
-    /* now invert the members of the set to get the jam transitions */
-    for ( i = 0; i < csize; ++i )
-       out_char_set[i] = ! out_char_set[i];
+       /* now invert the members of the set to get the jam transitions */
+       for ( i = 0; i < csize; ++i )
+               out_char_set[i] = ! out_char_set[i];
 
-    fprintf( file, "\n jam-transitions: EOF " );
+       fprintf( file, "\n jam-transitions: EOF " );
 
-    list_character_set( file, out_char_set );
+       list_character_set( file, out_char_set );
 
-    putc( '\n', file );
-    }
+       putc( '\n', file );
+       }
 
 
 /* epsclosure - construct the epsilon closure of a set of ndfa states
  *
  * synopsis
- *    int t[current_max_dfa_size], numstates, accset[num_rules + 1], nacc;
- *    int hashval;
- *    int *epsclosure();
- *    t = epsclosure( t, &numstates, accset, &nacc, &hashval );
+ *    int *epsclosure( int t[num_states], int *numstates_addr,
+ *                     int accset[num_rules+1], int *nacc_addr,
+ *                     int *hashval_addr );
  *
  * NOTES
- *    the epsilon closure is the set of all states reachable by an arbitrary
- *  number of epsilon transitions which themselves do not have epsilon
+ *  The epsilon closure is the set of all states reachable by an arbitrary
+ *  number of epsilon transitions, which themselves do not have epsilon
  *  transitions going out, unioned with the set of states which have non-null
  *  accepting numbers.  t is an array of size numstates of nfa state numbers.
- *  Upon return, t holds the epsilon closure and numstates is updated.  accset
- *  holds a list of the accepting numbers, and the size of accset is given
- *  by nacc.  t may be subjected to reallocation if it is not large enough
- *  to hold the epsilon closure.
+ *  Upon return, t holds the epsilon closure and *numstates_addr is updated.
+ *  accset holds a list of the accepting numbers, and the size of accset is
+ *  given by *nacc_addr.  t may be subjected to reallocation if it is not
+ *  large enough to hold the epsilon closure.
  *
- *    hashval is the hash value for the dfa corresponding to the state set
+ *  hashval is the hash value for the dfa corresponding to the state set.
  */
 
 int *epsclosure( t, ns_addr, accset, nacc_addr, hv_addr )
 int *t, *ns_addr, accset[], *nacc_addr, *hv_addr;
-
-    {
-    register int stkpos, ns, tsp;
-    int numstates = *ns_addr, nacc, hashval, transsym, nfaccnum;
-    int stkend, nstate;
-    static int did_stk_init = false, *stk; 
+       {
+       register int stkpos, ns, tsp;
+       int numstates = *ns_addr, nacc, hashval, transsym, nfaccnum;
+       int stkend, nstate;
+       static int did_stk_init = false, *stk; 
 
 #define MARK_STATE(state) \
-       trans1[state] = trans1[state] - MARKER_DIFFERENCE;
+trans1[state] = trans1[state] - MARKER_DIFFERENCE;
 
 #define IS_MARKED(state) (trans1[state] < 0)
 
 #define UNMARK_STATE(state) \
-       trans1[state] = trans1[state] + MARKER_DIFFERENCE;
+trans1[state] = trans1[state] + MARKER_DIFFERENCE;
 
 #define CHECK_ACCEPT(state) \
-       { \
-       nfaccnum = accptnum[state]; \
-       if ( nfaccnum != NIL ) \
-           accset[++nacc] = nfaccnum; \
-       }
+{ \
+nfaccnum = accptnum[state]; \
+if ( nfaccnum != NIL ) \
+accset[++nacc] = nfaccnum; \
+}
 
 #define DO_REALLOCATION \
-       { \
-       current_max_dfa_size += MAX_DFA_SIZE_INCREMENT; \
-       ++num_reallocs; \
-       t = reallocate_integer_array( t, current_max_dfa_size ); \
-       stk = reallocate_integer_array( stk, current_max_dfa_size ); \
-       } \
+{ \
+current_max_dfa_size += MAX_DFA_SIZE_INCREMENT; \
+++num_reallocs; \
+t = reallocate_integer_array( t, current_max_dfa_size ); \
+stk = reallocate_integer_array( stk, current_max_dfa_size ); \
+} \
 
 #define PUT_ON_STACK(state) \
-       { \
-       if ( ++stkend >= current_max_dfa_size ) \
-           DO_REALLOCATION \
-       stk[stkend] = state; \
-       MARK_STATE(state) \
-       }
+{ \
+if ( ++stkend >= current_max_dfa_size ) \
+DO_REALLOCATION \
+stk[stkend] = state; \
+MARK_STATE(state) \
+}
 
 #define ADD_STATE(state) \
-       { \
-       if ( ++numstates >= current_max_dfa_size ) \
-           DO_REALLOCATION \
-       t[numstates] = state; \
-       hashval = hashval + state; \
-       }
+{ \
+if ( ++numstates >= current_max_dfa_size ) \
+DO_REALLOCATION \
+t[numstates] = state; \
+hashval = hashval + state; \
+}
 
 #define STACK_STATE(state) \
-       { \
-       PUT_ON_STACK(state) \
-       CHECK_ACCEPT(state) \
-       if ( nfaccnum != NIL || transchar[state] != SYM_EPSILON ) \
-           ADD_STATE(state) \
-       }
+{ \
+PUT_ON_STACK(state) \
+CHECK_ACCEPT(state) \
+if ( nfaccnum != NIL || transchar[state] != SYM_EPSILON ) \
+ADD_STATE(state) \
+}
 
-    if ( ! did_stk_init )
-       {
-       stk = allocate_integer_array( current_max_dfa_size );
-       did_stk_init = true;
-       }
 
-    nacc = stkend = hashval = 0;
-
-    for ( nstate = 1; nstate <= numstates; ++nstate )
-       {
-       ns = t[nstate];
+       if ( ! did_stk_init )
+               {
+               stk = allocate_integer_array( current_max_dfa_size );
+               did_stk_init = true;
+               }
 
-       /* the state could be marked if we've already pushed it onto
-        * the stack
-        */
-       if ( ! IS_MARKED(ns) )
-           PUT_ON_STACK(ns)
+       nacc = stkend = hashval = 0;
 
-       CHECK_ACCEPT(ns)
-       hashval = hashval + ns;
-       }
+       for ( nstate = 1; nstate <= numstates; ++nstate )
+               {
+               ns = t[nstate];
 
-    for ( stkpos = 1; stkpos <= stkend; ++stkpos )
-       {
-       ns = stk[stkpos];
-       transsym = transchar[ns];
+               /* The state could be marked if we've already pushed it onto
+                * the stack.
+                */
+               if ( ! IS_MARKED(ns) )
+                       PUT_ON_STACK(ns)
 
-       if ( transsym == SYM_EPSILON )
-           {
-           tsp = trans1[ns] + MARKER_DIFFERENCE;
+               CHECK_ACCEPT(ns)
+               hashval = hashval + ns;
+               }
 
-           if ( tsp != NO_TRANSITION )
+       for ( stkpos = 1; stkpos <= stkend; ++stkpos )
                {
-               if ( ! IS_MARKED(tsp) )
-                   STACK_STATE(tsp)
+               ns = stk[stkpos];
+               transsym = transchar[ns];
+
+               if ( transsym == SYM_EPSILON )
+                       {
+                       tsp = trans1[ns] + MARKER_DIFFERENCE;
 
-               tsp = trans2[ns];
+                       if ( tsp != NO_TRANSITION )
+                               {
+                               if ( ! IS_MARKED(tsp) )
+                                       STACK_STATE(tsp)
 
-               if ( tsp != NO_TRANSITION )
-                   if ( ! IS_MARKED(tsp) )
-                       STACK_STATE(tsp)
+                               tsp = trans2[ns];
+
+                               if ( tsp != NO_TRANSITION && ! IS_MARKED(tsp) )
+                                       STACK_STATE(tsp)
+                               }
+                       }
                }
-           }
-       }
 
-    /* clear out "visit" markers */
+       /* Clear out "visit" markers. */
 
-    for ( stkpos = 1; stkpos <= stkend; ++stkpos )
-       {
-       if ( IS_MARKED(stk[stkpos]) )
-           {
-           UNMARK_STATE(stk[stkpos])
-           }
-       else
-           flexfatal( "consistency check failed in epsclosure()" );
-       }
+       for ( stkpos = 1; stkpos <= stkend; ++stkpos )
+               {
+               if ( IS_MARKED(stk[stkpos]) )
+                       UNMARK_STATE(stk[stkpos])
+               else
+                       flexfatal( "consistency check failed in epsclosure()" );
+               }
 
-    *ns_addr = numstates;
-    *hv_addr = hashval;
-    *nacc_addr = nacc;
+       *ns_addr = numstates;
+       *hv_addr = hashval;
+       *nacc_addr = nacc;
 
-    return ( t );
-    }
+       return t;
+       }
 
 
 /* increase_max_dfas - increase the maximum number of DFAs */
 
 void increase_max_dfas()
+       {
+       current_max_dfas += MAX_DFAS_INCREMENT;
 
-    {
-    current_max_dfas += MAX_DFAS_INCREMENT;
-
-    ++num_reallocs;
+       ++num_reallocs;
 
-    base = reallocate_integer_array( base, current_max_dfas );
-    def = reallocate_integer_array( def, current_max_dfas );
-    dfasiz = reallocate_integer_array( dfasiz, current_max_dfas );
-    accsiz = reallocate_integer_array( accsiz, current_max_dfas );
-    dhash = reallocate_integer_array( dhash, current_max_dfas );
-    dss = reallocate_int_ptr_array( dss, current_max_dfas );
-    dfaacc = reallocate_dfaacc_union( dfaacc, current_max_dfas );
+       base = reallocate_integer_array( base, current_max_dfas );
+       def = reallocate_integer_array( def, current_max_dfas );
+       dfasiz = reallocate_integer_array( dfasiz, current_max_dfas );
+       accsiz = reallocate_integer_array( accsiz, current_max_dfas );
+       dhash = reallocate_integer_array( dhash, current_max_dfas );
+       dss = reallocate_int_ptr_array( dss, current_max_dfas );
+       dfaacc = reallocate_dfaacc_union( dfaacc, current_max_dfas );
 
-    if ( nultrans )
-       nultrans = reallocate_integer_array( nultrans, current_max_dfas );
-    }
+       if ( nultrans )
+               nultrans =
+                       reallocate_integer_array( nultrans, current_max_dfas );
+       }
 
 
 /* ntod - convert an ndfa to a dfa
  *
- * synopsis
- *    ntod();
- *
- *  creates the dfa corresponding to the ndfa we've constructed.  the
- *  dfa starts out in state #1.
+ * Creates the dfa corresponding to the ndfa we've constructed.  The
+ * dfa starts out in state #1.
  */
 
 void ntod()
-
-    {
-    int *accset, ds, nacc, newds;
-    int sym, hashval, numstates, dsize;
-    int num_full_table_rows;   /* used only for -f */
-    int *nset, *dset;
-    int targptr, totaltrans, i, comstate, comfreq, targ;
-    int *epsclosure(), snstods(), symlist[CSIZE + 1];
-    int num_start_states;
-    int todo_head, todo_next;
-
-    /* note that the following are indexed by *equivalence classes*
-     * and not by characters.  Since equivalence classes are indexed
-     * beginning with 1, even if the scanner accepts NUL's, this
-     * means that (since every character is potentially in its own
-     * equivalence class) these arrays must have room for indices
-     * from 1 to CSIZE, so their size must be CSIZE + 1.
-     */
-    int duplist[CSIZE + 1], state[CSIZE + 1];
-    int targfreq[CSIZE + 1], targstate[CSIZE + 1];
-
-    /* this is so find_table_space(...) will know where to start looking in
-     * chk/nxt for unused records for space to put in the state
-     */
-    if ( fullspd )
-       firstfree = 0;
-
-    accset = allocate_integer_array( num_rules + 1 );
-    nset = allocate_integer_array( current_max_dfa_size );
-
-    /* the "todo" queue is represented by the head, which is the DFA
-     * state currently being processed, and the "next", which is the
-     * next DFA state number available (not in use).  We depend on the
-     * fact that snstods() returns DFA's \in increasing order/, and thus
-     * need only know the bounds of the dfas to be processed.
-     */
-    todo_head = todo_next = 0;
-
-    for ( i = 0; i <= csize; ++i )
        {
-       duplist[i] = NIL;
-       symlist[i] = false;
-       }
+       int *accset, ds, nacc, newds;
+       int sym, hashval, numstates, dsize;
+       int num_full_table_rows;        /* used only for -f */
+       int *nset, *dset;
+       int targptr, totaltrans, i, comstate, comfreq, targ;
+       int *epsclosure(), snstods(), symlist[CSIZE + 1];
+       int num_start_states;
+       int todo_head, todo_next;
+
+       /* Note that the following are indexed by *equivalence classes*
+        * and not by characters.  Since equivalence classes are indexed
+        * beginning with 1, even if the scanner accepts NUL's, this
+        * means that (since every character is potentially in its own
+        * equivalence class) these arrays must have room for indices
+        * from 1 to CSIZE, so their size must be CSIZE + 1.
+        */
+       int duplist[CSIZE + 1], state[CSIZE + 1];
+       int targfreq[CSIZE + 1], targstate[CSIZE + 1];
 
-    for ( i = 0; i <= num_rules; ++i )
-       accset[i] = NIL;
+       /* This is so find_table_space(...) will know where to start looking
+        * in chk/nxt for unused records for space to put in the state
+        */
+       if ( fullspd )
+               firstfree = 0;
 
-    if ( trace )
-       {
-       dumpnfa( scset[1] );
-       fputs( "\n\nDFA Dump:\n\n", stderr );
-       }
+       accset = allocate_integer_array( num_rules + 1 );
+       nset = allocate_integer_array( current_max_dfa_size );
 
-    inittbl();
-
-    /* Check to see whether we should build a separate table for transitions
-     * on NUL characters.  We don't do this for full-speed (-F) scanners,
-     * since for them we don't have a simple state number lying around with
-     * which to index the table.  We also don't bother doing it for scanners
-     * unless (1) NUL is in its own equivalence class (indicated by a
-     * positive value of ecgroup[NUL]), (2) NUL's equivalence class is
-     * the last equivalence class, and (3) the number of equivalence classes
-     * is the same as the number of characters.  This latter case comes about
-     * when useecs is false or when its true but every character still
-     * manages to land in its own class (unlikely, but it's cheap to check
-     * for).  If all these things are true then the character code needed
-     * to represent NUL's equivalence class for indexing the tables is
-     * going to take one more bit than the number of characters, and therefore
-     * we won't be assured of being able to fit it into a YY_CHAR variable.
-     * This rules out storing the transitions in a compressed table, since
-     * the code for interpreting them uses a YY_CHAR variable (perhaps it
-     * should just use an integer, though; this is worth pondering ... ###).
-     *
-     * Finally, for full tables, we want the number of entries in the
-     * table to be a power of two so the array references go fast (it
-     * will just take a shift to compute the major index).  If encoding
-     * NUL's transitions in the table will spoil this, we give it its
-     * own table (note that this will be the case if we're not using
-     * equivalence classes).
-     */
-
-    /* note that the test for ecgroup[0] == numecs below accomplishes
-     * both (1) and (2) above
-     */
-    if ( ! fullspd && ecgroup[0] == numecs )
-       { /* NUL is alone in its equivalence class, which is the last one */
-       int use_NUL_table = (numecs == csize);
-
-       if ( fulltbl && ! use_NUL_table )
-           { /* we still may want to use the table if numecs is a power of 2 */
-           int power_of_two;
-
-           for ( power_of_two = 1; power_of_two <= csize; power_of_two *= 2 )
-               if ( numecs == power_of_two )
-                   {
-                   use_NUL_table = true;
-                   break;
-                   }
-           }
-
-       if ( use_NUL_table )
-           nultrans = allocate_integer_array( current_max_dfas );
-           /* from now on, nultrans != nil indicates that we're
-            * saving null transitions for later, separate encoding
-            */
-       }
+       /* The "todo" queue is represented by the head, which is the DFA
+        * state currently being processed, and the "next", which is the
+        * next DFA state number available (not in use).  We depend on the
+        * fact that snstods() returns DFA's \in increasing order/, and thus
+        * need only know the bounds of the dfas to be processed.
+        */
+       todo_head = todo_next = 0;
 
+       for ( i = 0; i <= csize; ++i )
+               {
+               duplist[i] = NIL;
+               symlist[i] = false;
+               }
 
-    if ( fullspd )
-       {
-       for ( i = 0; i <= numecs; ++i )
-           state[i] = 0;
-       place_state( state, 0, 0 );
-       }
+       for ( i = 0; i <= num_rules; ++i )
+               accset[i] = NIL;
 
-    else if ( fulltbl )
-       {
-       if ( nultrans )
-           /* we won't be including NUL's transitions in the table,
-            * so build it for entries from 0 .. numecs - 1
-            */
-           num_full_table_rows = numecs;
+       if ( trace )
+               {
+               dumpnfa( scset[1] );
+               fputs( "\n\nDFA Dump:\n\n", stderr );
+               }
 
-       else
-           /* take into account the fact that we'll be including
-            * the NUL entries in the transition table.  Build it
-            * from 0 .. numecs.
-            */
-           num_full_table_rows = numecs + 1;
-
-       /* declare it "short" because it's a real long-shot that that
-        * won't be large enough.
+       inittbl();
+
+       /* Check to see whether we should build a separate table for
+        * transitions on NUL characters.  We don't do this for full-speed
+        * (-F) scanners, since for them we don't have a simple state
+        * number lying around with which to index the table.  We also
+        * don't bother doing it for scanners unless (1) NUL is in its own
+        * equivalence class (indicated by a positive value of
+        * ecgroup[NUL]), (2) NUL's equivalence class is the last
+        * equivalence class, and (3) the number of equivalence classes is
+        * the same as the number of characters.  This latter case comes
+        * about when useecs is false or when its true but every character
+        * still manages to land in its own class (unlikely, but it's
+        * cheap to check for).  If all these things are true then the
+        * character code needed to represent NUL's equivalence class for
+        * indexing the tables is going to take one more bit than the
+        * number of characters, and therefore we won't be assured of
+        * being able to fit it into a YY_CHAR variable.  This rules out
+        * storing the transitions in a compressed table, since the code
+        * for interpreting them uses a YY_CHAR variable (perhaps it
+        * should just use an integer, though; this is worth pondering ...
+        * ###).
+        *
+        * Finally, for full tables, we want the number of entries in the
+        * table to be a power of two so the array references go fast (it
+        * will just take a shift to compute the major index).  If
+        * encoding NUL's transitions in the table will spoil this, we
+        * give it its own table (note that this will be the case if we're
+        * not using equivalence classes).
         */
-       printf( "static short int yy_nxt[][%d] =\n    {\n",
-               /* '}' so vi doesn't get too confused */
-               num_full_table_rows );
-
-       /* generate 0 entries for state #0 */
-       for ( i = 0; i < num_full_table_rows; ++i )
-           mk2data( 0 );
 
-       /* force ',' and dataflush() next call to mk2data */
-       datapos = NUMDATAITEMS;
+       /* Note that the test for ecgroup[0] == numecs below accomplishes
+        * both (1) and (2) above
+        */
+       if ( ! fullspd && ecgroup[0] == numecs )
+               {
+               /* NUL is alone in its equivalence class, which is the
+                * last one.
+                */
+               int use_NUL_table = (numecs == csize);
 
-       /* force extra blank line next dataflush() */
-       dataline = NUMDATALINES;
-       }
+               if ( fulltbl && ! use_NUL_table )
+                       {
+                       /* We still may want to use the table if numecs
+                        * is a power of 2.
+                        */
+                       int power_of_two;
+
+                       for ( power_of_two = 1; power_of_two <= csize;
+                             power_of_two *= 2 )
+                               if ( numecs == power_of_two )
+                                       {
+                                       use_NUL_table = true;
+                                       break;
+                                       }
+                       }
 
-    /* create the first states */
+               if ( use_NUL_table )
+                       nultrans = allocate_integer_array( current_max_dfas );
 
-    num_start_states = lastsc * 2;
+               /* From now on, nultrans != nil indicates that we're
+                * saving null transitions for later, separate encoding.
+                */
+               }
 
-    for ( i = 1; i <= num_start_states; ++i )
-       {
-       numstates = 1;
 
-       /* for each start condition, make one state for the case when
-        * we're at the beginning of the line (the '^' operator) and
-        * one for the case when we're not
-        */
-       if ( i % 2 == 1 )
-           nset[numstates] = scset[(i / 2) + 1];
-       else
-           nset[numstates] = mkbranch( scbol[i / 2], scset[i / 2] );
+       if ( fullspd )
+               {
+               for ( i = 0; i <= numecs; ++i )
+                       state[i] = 0;
+               place_state( state, 0, 0 );
+               }
 
-       nset = epsclosure( nset, &numstates, accset, &nacc, &hashval );
+       else if ( fulltbl )
+               {
+               if ( nultrans )
+                       /* We won't be including NUL's transitions in the
+                        * table, so build it for entries from 0 .. numecs - 1.
+                        */
+                       num_full_table_rows = numecs;
 
-       if ( snstods( nset, numstates, accset, nacc, hashval, &ds ) )
-           {
-           numas += nacc;
-           totnst += numstates;
-           ++todo_next;
+               else
+                       /* Take into account the fact that we'll be including
+                        * the NUL entries in the transition table.  Build it
+                        * from 0 .. numecs.
+                        */
+                       num_full_table_rows = numecs + 1;
+
+               /* Declare it "short" because it's a real long-shot that that
+                * won't be large enough.
+                */
+               printf( "static short int yy_nxt[][%d] =\n    {\n",
+                       /* '}' so vi doesn't get too confused */
+                       num_full_table_rows );
+
+               /* Generate 0 entries for state #0. */
+               for ( i = 0; i < num_full_table_rows; ++i )
+                       mk2data( 0 );
+
+               /* Force ',' and dataflush() next call to mk2data().*/
+               datapos = NUMDATAITEMS;
+
+               /* Force extra blank line next dataflush(). */
+               dataline = NUMDATALINES;
+               }
 
-           if ( variable_trailing_context_rules && nacc > 0 )
-               check_trailing_context( nset, numstates, accset, nacc );
-           }
-       }
+       /* Create the first states. */
 
-    if ( ! fullspd )
-       {
-       if ( ! snstods( nset, 0, accset, 0, 0, &end_of_buffer_state ) )
-           flexfatal( "could not create unique end-of-buffer state" );
+       num_start_states = lastsc * 2;
 
-       ++numas;
-       ++num_start_states;
-       ++todo_next;
-       }
+       for ( i = 1; i <= num_start_states; ++i )
+               {
+               numstates = 1;
+
+               /* For each start condition, make one state for the case when
+                * we're at the beginning of the line (the '^' operator) and
+                * one for the case when we're not.
+                */
+               if ( i % 2 == 1 )
+                       nset[numstates] = scset[(i / 2) + 1];
+               else
+                       nset[numstates] =
+                               mkbranch( scbol[i / 2], scset[i / 2] );
 
-    while ( todo_head < todo_next )
-       {
-       targptr = 0;
-       totaltrans = 0;
+               nset = epsclosure( nset, &numstates, accset, &nacc, &hashval );
 
-       for ( i = 1; i <= numecs; ++i )
-           state[i] = 0;
-
-       ds = ++todo_head;
+               if ( snstods( nset, numstates, accset, nacc, hashval, &ds ) )
+                       {
+                       numas += nacc;
+                       totnst += numstates;
+                       ++todo_next;
 
-       dset = dss[ds];
-       dsize = dfasiz[ds];
+                       if ( variable_trailing_context_rules && nacc > 0 )
+                               check_trailing_context( nset, numstates,
+                                                       accset, nacc );
+                       }
+               }
 
-       if ( trace )
-           fprintf( stderr, "state # %d:\n", ds );
+       if ( ! fullspd )
+               {
+               if ( ! snstods( nset, 0, accset, 0, 0, &end_of_buffer_state ) )
+                       flexfatal(
+                               "could not create unique end-of-buffer state" );
 
-       sympartition( dset, dsize, symlist, duplist );
+               ++numas;
+               ++num_start_states;
+               ++todo_next;
+               }
 
-       for ( sym = 1; sym <= numecs; ++sym )
-           {
-           if ( symlist[sym] )
+       while ( todo_head < todo_next )
                {
-               symlist[sym] = 0;
+               targptr = 0;
+               totaltrans = 0;
 
-               if ( duplist[sym] == NIL )
-                   { /* symbol has unique out-transitions */
-                   numstates = symfollowset( dset, dsize, sym, nset );
-                   nset = epsclosure( nset, &numstates, accset,
-                                      &nacc, &hashval );
+               for ( i = 1; i <= numecs; ++i )
+                       state[i] = 0;
 
-                   if ( snstods( nset, numstates, accset,
-                                 nacc, hashval, &newds ) )
-                       {
-                       totnst = totnst + numstates;
-                       ++todo_next;
-                       numas += nacc;
+               ds = ++todo_head;
 
-                       if ( variable_trailing_context_rules && nacc > 0 )
-                           check_trailing_context( nset, numstates,
-                               accset, nacc );
-                       }
+               dset = dss[ds];
+               dsize = dfasiz[ds];
 
-                   state[sym] = newds;
+               if ( trace )
+                       fprintf( stderr, "state # %d:\n", ds );
 
-                   if ( trace )
-                       fprintf( stderr, "\t%d\t%d\n", sym, newds );
+               sympartition( dset, dsize, symlist, duplist );
 
-                   targfreq[++targptr] = 1;
-                   targstate[targptr] = newds;
-                   ++numuniq;
-                   }
+               for ( sym = 1; sym <= numecs; ++sym )
+                       {
+                       if ( symlist[sym] )
+                               {
+                               symlist[sym] = 0;
+
+                               if ( duplist[sym] == NIL )
+                                       {
+                                       /* Symbol has unique out-transitions. */
+                                       numstates = symfollowset( dset, dsize,
+                                                               sym, nset );
+                                       nset = epsclosure( nset, &numstates,
+                                               accset, &nacc, &hashval );
+
+                                       if ( snstods( nset, numstates, accset,
+                                               nacc, hashval, &newds ) )
+                                               {
+                                               totnst = totnst + numstates;
+                                               ++todo_next;
+                                               numas += nacc;
+
+                                               if (
+                                       variable_trailing_context_rules &&
+                                                       nacc > 0 )
+                                                       check_trailing_context(
+                                                               nset, numstates,
+                                                               accset, nacc );
+                                               }
+
+                                       state[sym] = newds;
+
+                                       if ( trace )
+                                               fprintf( stderr, "\t%d\t%d\n",
+                                                       sym, newds );
+
+                                       targfreq[++targptr] = 1;
+                                       targstate[targptr] = newds;
+                                       ++numuniq;
+                                       }
+
+                               else
+                                       {
+                                       /* sym's equivalence class has the same
+                                        * transitions as duplist(sym)'s
+                                        * equivalence class.
+                                        */
+                                       targ = state[duplist[sym]];
+                                       state[sym] = targ;
+
+                                       if ( trace )
+                                               fprintf( stderr, "\t%d\t%d\n",
+                                                       sym, targ );
+
+                                       /* Update frequency count for
+                                        * destination state.
+                                        */
+
+                                       i = 0;
+                                       while ( targstate[++i] != targ )
+                                               ;
+
+                                       ++targfreq[i];
+                                       ++numdup;
+                                       }
+
+                               ++totaltrans;
+                               duplist[sym] = NIL;
+                               }
+                       }
 
-               else
-                   {
-                   /* sym's equivalence class has the same transitions
-                    * as duplist(sym)'s equivalence class
-                    */
-                   targ = state[duplist[sym]];
-                   state[sym] = targ;
+               numsnpairs = numsnpairs + totaltrans;
+
+               if ( caseins && ! useecs )
+                       {
+                       register int j;
 
-                   if ( trace )
-                       fprintf( stderr, "\t%d\t%d\n", sym, targ );
+                       for ( i = 'A', j = 'a'; i <= 'Z'; ++i, ++j )
+                               state[i] = state[j];
+                       }
 
-                   /* update frequency count for destination state */
+               if ( ds > num_start_states )
+                       check_for_backtracking( ds, state );
 
-                   i = 0;
-                   while ( targstate[++i] != targ )
-                       ;
+               if ( nultrans )
+                       {
+                       nultrans[ds] = state[NUL_ec];
+                       state[NUL_ec] = 0;      /* remove transition */
+                       }
 
-                   ++targfreq[i];
-                   ++numdup;
-                   }
+               if ( fulltbl )
+                       {
+                       /* Supply array's 0-element. */
+                       if ( ds == end_of_buffer_state )
+                               mk2data( -end_of_buffer_state );
+                       else
+                               mk2data( end_of_buffer_state );
+
+                       for ( i = 1; i < num_full_table_rows; ++i )
+                               /* Jams are marked by negative of state
+                                * number.
+                                */
+                               mk2data( state[i] ? state[i] : -ds );
+
+                       /* Force ',' and dataflush() next call to mk2data().*/
+                       datapos = NUMDATAITEMS;
+
+                       /* Force extra blank line next dataflush(). */
+                       dataline = NUMDATALINES;
+                       }
 
-               ++totaltrans;
-               duplist[sym] = NIL;
-               }
-           }
+               else if ( fullspd )
+                       place_state( state, ds, totaltrans );
 
-       numsnpairs = numsnpairs + totaltrans;
+               else if ( ds == end_of_buffer_state )
+                       /* Special case this state to make sure it does what
+                        * it's supposed to, i.e., jam on end-of-buffer.
+                        */
+                       stack1( ds, 0, 0, JAMSTATE );
 
-       if ( caseins && ! useecs )
-           {
-           register int j;
+               else /* normal, compressed state */
+                       {
+                       /* Determine which destination state is the most
+                        * common, and how many transitions to it there are.
+                        */
 
-           for ( i = 'A', j = 'a'; i <= 'Z'; ++i, ++j )
-               state[i] = state[j];
-           }
+                       comfreq = 0;
+                       comstate = 0;
 
-       if ( ds > num_start_states )
-           check_for_backtracking( ds, state );
+                       for ( i = 1; i <= targptr; ++i )
+                               if ( targfreq[i] > comfreq )
+                                       {
+                                       comfreq = targfreq[i];
+                                       comstate = targstate[i];
+                                       }
 
-       if ( nultrans )
-           {
-           nultrans[ds] = state[NUL_ec];
-           state[NUL_ec] = 0;  /* remove transition */
-           }
+                       bldtbl( state, ds, totaltrans, comstate, comfreq );
+                       }
+               }
 
        if ( fulltbl )
-           {
-           /* supply array's 0-element */
-           if ( ds == end_of_buffer_state )
-               mk2data( -end_of_buffer_state );
-           else
-               mk2data( end_of_buffer_state );
-
-           for ( i = 1; i < num_full_table_rows; ++i )
-               /* jams are marked by negative of state number */
-               mk2data( state[i] ? state[i] : -ds );
-
-           /* force ',' and dataflush() next call to mk2data */
-           datapos = NUMDATAITEMS;
-
-           /* force extra blank line next dataflush() */
-           dataline = NUMDATALINES;
-           }
-
-        else if ( fullspd )
-           place_state( state, ds, totaltrans );
-
-       else if ( ds == end_of_buffer_state )
-           /* special case this state to make sure it does what it's
-            * supposed to, i.e., jam on end-of-buffer
-            */
-           stack1( ds, 0, 0, JAMSTATE );
-
-       else /* normal, compressed state */
-           {
-           /* determine which destination state is the most common, and
-            * how many transitions to it there are
-            */
-
-           comfreq = 0;
-           comstate = 0;
-
-           for ( i = 1; i <= targptr; ++i )
-               if ( targfreq[i] > comfreq )
-                   {
-                   comfreq = targfreq[i];
-                   comstate = targstate[i];
-                   }
-
-           bldtbl( state, ds, totaltrans, comstate, comfreq );
-           }
-       }
-
-    if ( fulltbl )
-       dataend();
+               dataend();
 
-    else if ( ! fullspd )
-       {
-       cmptmps();  /* create compressed template entries */
+       else if ( ! fullspd )
+               {
+               cmptmps();  /* create compressed template entries */
 
-       /* create tables for all the states with only one out-transition */
-       while ( onesp > 0 )
-           {
-           mk1tbl( onestate[onesp], onesym[onesp], onenext[onesp],
-                   onedef[onesp] );
-           --onesp;
-           }
+               /* Create tables for all the states with only one
+                * out-transition.
+                */
+               while ( onesp > 0 )
+                       {
+                       mk1tbl( onestate[onesp], onesym[onesp], onenext[onesp],
+                       onedef[onesp] );
+                       --onesp;
+                       }
 
-       mkdeftbl();
+               mkdeftbl();
+               }
        }
-    }
 
 
 /* snstods - converts a set of ndfa states into a dfa state
  *
  * synopsis
- *    int sns[numstates], numstates, newds, accset[num_rules + 1], nacc, hashval;
- *    int snstods();
- *    is_new_state = snstods( sns, numstates, accset, nacc, hashval, &newds );
+ *    is_new_state = snstods( int sns[numstates], int numstates,
+ *                             int accset[num_rules+1], int nacc,
+ *                             int hashval, int *newds_addr );
  *
- * on return, the dfa state number is in newds.
+ * On return, the dfa state number is in newds.
  */
 
 int snstods( sns, numstates, accset, nacc, hashval, newds_addr )
 int sns[], numstates, accset[], nacc, hashval, *newds_addr;
+       {
+       int didsort = 0;
+       register int i, j;
+       int newds, *oldsns;
 
-    {
-    int didsort = 0;
-    register int i, j;
-    int newds, *oldsns;
+       for ( i = 1; i <= lastdfa; ++i )
+               if ( hashval == dhash[i] )
+                       {
+                       if ( numstates == dfasiz[i] )
+                               {
+                               oldsns = dss[i];
+
+                               if ( ! didsort )
+                                       {
+                                       /* We sort the states in sns so we
+                                        * can compare it to oldsns quickly.
+                                        * We use bubble because there probably
+                                        * aren't very many states.
+                                        */
+                                       bubble( sns, numstates );
+                                       didsort = 1;
+                                       }
+
+                               for ( j = 1; j <= numstates; ++j )
+                                       if ( sns[j] != oldsns[j] )
+                                               break;
+
+                               if ( j > numstates )
+                                       {
+                                       ++dfaeql;
+                                       *newds_addr = i;
+                                       return 0;
+                                       }
+
+                               ++hshcol;
+                               }
+
+                       else
+                               ++hshsave;
+                       }
 
-    for ( i = 1; i <= lastdfa; ++i )
-       if ( hashval == dhash[i] )
-           {
-           if ( numstates == dfasiz[i] )
-               {
-               oldsns = dss[i];
-
-               if ( ! didsort )
-                   {
-                   /* we sort the states in sns so we can compare it to
-                    * oldsns quickly.  we use bubble because there probably
-                    * aren't very many states
-                    */
-                   bubble( sns, numstates );
-                   didsort = 1;
-                   }
-
-               for ( j = 1; j <= numstates; ++j )
-                   if ( sns[j] != oldsns[j] )
-                       break;
-
-               if ( j > numstates )
-                   {
-                   ++dfaeql;
-                   *newds_addr = i;
-                   return ( 0 );
-                   }
-
-               ++hshcol;
-               }
+       /* Make a new dfa. */
 
-           else
-               ++hshsave;
-           }
+       if ( ++lastdfa >= current_max_dfas )
+               increase_max_dfas();
 
-    /* make a new dfa */
+       newds = lastdfa;
 
-    if ( ++lastdfa >= current_max_dfas )
-       increase_max_dfas();
+       dss[newds] = allocate_integer_array( numstates + 1 );
 
-    newds = lastdfa;
+       /* If we haven't already sorted the states in sns, we do so now,
+        * so that future comparisons with it can be made quickly.
+        */
 
-    dss[newds] = allocate_integer_array( numstates + 1 );
+       if ( ! didsort )
+               bubble( sns, numstates );
 
-    /* if we haven't already sorted the states in sns, we do so now, so that
-     * future comparisons with it can be made quickly
-     */
+       for ( i = 1; i <= numstates; ++i )
+               dss[newds][i] = sns[i];
 
-    if ( ! didsort )
-       bubble( sns, numstates );
+       dfasiz[newds] = numstates;
+       dhash[newds] = hashval;
 
-    for ( i = 1; i <= numstates; ++i )
-       dss[newds][i] = sns[i];
+       if ( nacc == 0 )
+               {
+               if ( reject )
+                       dfaacc[newds].dfaacc_set = (int *) 0;
+               else
+                       dfaacc[newds].dfaacc_state = 0;
 
-    dfasiz[newds] = numstates;
-    dhash[newds] = hashval;
+               accsiz[newds] = 0;
+               }
 
-    if ( nacc == 0 )
-       {
-       if ( reject )
-           dfaacc[newds].dfaacc_set = (int *) 0;
-       else
-           dfaacc[newds].dfaacc_state = 0;
+       else if ( reject )
+               {
+               /* We sort the accepting set in increasing order so the
+                * disambiguating rule that the first rule listed is considered
+                * match in the event of ties will work.  We use a bubble
+                * sort since the list is probably quite small.
+                */
 
-       accsiz[newds] = 0;
-       }
+               bubble( accset, nacc );
 
-    else if ( reject )
-       {
-       /* we sort the accepting set in increasing order so the disambiguating
-        * rule that the first rule listed is considered match in the event of
-        * ties will work.  We use a bubble sort since the list is probably
-        * quite small.
-        */
+               dfaacc[newds].dfaacc_set = allocate_integer_array( nacc + 1 );
 
-       bubble( accset, nacc );
+               /* Save the accepting set for later */
+               for ( i = 1; i <= nacc; ++i )
+                       {
+                       dfaacc[newds].dfaacc_set[i] = accset[i];
 
-       dfaacc[newds].dfaacc_set = allocate_integer_array( nacc + 1 );
+                       if ( accset[i] <= num_rules )
+                               /* Who knows, perhaps a REJECT can yield
+                                * this rule.
+                                */
+                               rule_useful[accset[i]] = true;
+                       }
 
-       /* save the accepting set for later */
-       for ( i = 1; i <= nacc; ++i )
-           {
-           dfaacc[newds].dfaacc_set[i] = accset[i];
+               accsiz[newds] = nacc;
+               }
 
-           if ( accset[i] <= num_rules )
-               /* Who knows, perhaps a REJECT can yield this rule */
-               rule_useful[accset[i]] = true;
-           }
+       else
+               {
+               /* Find lowest numbered rule so the disambiguating rule
+                * will work.
+                */
+               j = num_rules + 1;
 
-       accsiz[newds] = nacc;
-       }
+               for ( i = 1; i <= nacc; ++i )
+                       if ( accset[i] < j )
+                               j = accset[i];
 
-    else
-       { /* find lowest numbered rule so the disambiguating rule will work */
-       j = num_rules + 1;
+               dfaacc[newds].dfaacc_state = j;
 
-       for ( i = 1; i <= nacc; ++i )
-           if ( accset[i] < j )
-               j = accset[i];
+               if ( j <= num_rules )
+                       rule_useful[j] = true;
+               }
 
-       dfaacc[newds].dfaacc_state = j;
+       *newds_addr = newds;
 
-       if ( j <= num_rules )
-           rule_useful[j] = true;
+       return 1;
        }
 
-    *newds_addr = newds;
-
-    return ( 1 );
-    }
-
 
 /* symfollowset - follow the symbol transitions one step
  *
  * synopsis
- *    int ds[current_max_dfa_size], dsize, transsym;
- *    int nset[current_max_dfa_size], numstates;
- *    numstates = symfollowset( ds, dsize, transsym, nset );
+ *    numstates = symfollowset( int ds[current_max_dfa_size], int dsize,
+ *                             int transsym, int nset[current_max_dfa_size] );
  */
 
 int symfollowset( ds, dsize, transsym, nset )
 int ds[], dsize, transsym, nset[];
+       {
+       int ns, tsp, sym, i, j, lenccl, ch, numstates, ccllist;
+
+       numstates = 0;
+
+       for ( i = 1; i <= dsize; ++i )
+               { /* for each nfa state ns in the state set of ds */
+               ns = ds[i];
+               sym = transchar[ns];
+               tsp = trans1[ns];
+
+               if ( sym < 0 )
+                       { /* it's a character class */
+                       sym = -sym;
+                       ccllist = cclmap[sym];
+                       lenccl = ccllen[sym];
+
+                       if ( cclng[sym] )
+                               {
+                               for ( j = 0; j < lenccl; ++j )
+                                       {
+                                       /* Loop through negated character
+                                        * class.
+                                        */
+                                       ch = ccltbl[ccllist + j];
+
+                                       if ( ch == 0 )
+                                               ch = NUL_ec;
+
+                                       if ( ch > transsym )
+                                               /* Transsym isn't in negated
+                                                * ccl.
+                                                */
+                                               break;
+
+                                       else if ( ch == transsym )
+                                               /* next 2 */ goto bottom;
+                                       }
+
+                               /* Didn't find transsym in ccl. */
+                               nset[++numstates] = tsp;
+                               }
+
+                       else
+                               for ( j = 0; j < lenccl; ++j )
+                                       {
+                                       ch = ccltbl[ccllist + j];
+
+                                       if ( ch == 0 )
+                                               ch = NUL_ec;
+
+                                       if ( ch > transsym )
+                                               break;
+                                       else if ( ch == transsym )
+                                               {
+                                               nset[++numstates] = tsp;
+                                               break;
+                                               }
+                                       }
+                       }
 
-    {
-    int ns, tsp, sym, i, j, lenccl, ch, numstates;
-    int ccllist;
-
-    numstates = 0;
-
-    for ( i = 1; i <= dsize; ++i )
-       { /* for each nfa state ns in the state set of ds */
-       ns = ds[i];
-       sym = transchar[ns];
-       tsp = trans1[ns];
-
-       if ( sym < 0 )
-           { /* it's a character class */
-           sym = -sym;
-           ccllist = cclmap[sym];
-           lenccl = ccllen[sym];
-
-           if ( cclng[sym] )
-               {
-               for ( j = 0; j < lenccl; ++j )
-                   { /* loop through negated character class */
-                   ch = ccltbl[ccllist + j];
-
-                   if ( ch == 0 )
-                       ch = NUL_ec;
-
-                   if ( ch > transsym )
-                       break;  /* transsym isn't in negated ccl */
-
-                   else if ( ch == transsym )
-                       /* next 2 */ goto bottom;
-                   }
-
-               /* didn't find transsym in ccl */
-               nset[++numstates] = tsp;
-               }
-
-           else
-               for ( j = 0; j < lenccl; ++j )
-                   {
-                   ch = ccltbl[ccllist + j];
-
-                   if ( ch == 0 )
-                       ch = NUL_ec;
-
-                   if ( ch > transsym )
-                       break;
+               else if ( sym >= 'A' && sym <= 'Z' && caseins )
+                       flexfatal( "consistency check failed in symfollowset" );
 
-                   else if ( ch == transsym )
-                       {
-                       nset[++numstates] = tsp;
-                       break;
+               else if ( sym == SYM_EPSILON )
+                       { /* do nothing */
                        }
-                   }
-           }
 
-       else if ( sym >= 'A' && sym <= 'Z' && caseins )
-           flexfatal( "consistency check failed in symfollowset" );
-
-       else if ( sym == SYM_EPSILON )
-           { /* do nothing */
-           }
+               else if ( abs( ecgroup[sym] ) == transsym )
+                       nset[++numstates] = tsp;
 
-       else if ( abs( ecgroup[sym] ) == transsym )
-           nset[++numstates] = tsp;
+               bottom: ;
+               }
 
-bottom:
-       ;
+       return numstates;
        }
 
-    return ( numstates );
-    }
-
 
 /* sympartition - partition characters with same out-transitions
  *
  * synopsis
- *    integer ds[current_max_dfa_size], numstates, duplist[numecs];
- *    symlist[numecs];
- *    sympartition( ds, numstates, symlist, duplist );
+ *    sympartition( int ds[current_max_dfa_size], int numstates,
+ *                     int symlist[numecs], int duplist[numecs] );
  */
 
 void sympartition( ds, numstates, symlist, duplist )
 int ds[], numstates;
 int symlist[], duplist[];
+       {
+       int tch, i, j, k, ns, dupfwd[CSIZE + 1], lenccl, cclp, ich;
 
-    {
-    int tch, i, j, k, ns, dupfwd[CSIZE + 1], lenccl, cclp, ich;
-
-    /* partitioning is done by creating equivalence classes for those
-     * characters which have out-transitions from the given state.  Thus
-     * we are really creating equivalence classes of equivalence classes.
-     */
-
-    for ( i = 1; i <= numecs; ++i )
-       { /* initialize equivalence class list */
-       duplist[i] = i - 1;
-       dupfwd[i] = i + 1;
-       }
+       /* Partitioning is done by creating equivalence classes for those
+        * characters which have out-transitions from the given state.  Thus
+        * we are really creating equivalence classes of equivalence classes.
+        */
 
-    duplist[1] = NIL;
-    dupfwd[numecs] = NIL;
+       for ( i = 1; i <= numecs; ++i )
+               { /* initialize equivalence class list */
+               duplist[i] = i - 1;
+               dupfwd[i] = i + 1;
+               }
 
-    for ( i = 1; i <= numstates; ++i )
-       {
-       ns = ds[i];
-       tch = transchar[ns];
+       duplist[1] = NIL;
+       dupfwd[numecs] = NIL;
 
-       if ( tch != SYM_EPSILON )
-           {
-           if ( tch < -lastccl || tch >= csize )
+       for ( i = 1; i <= numstates; ++i )
                {
-               if ( tch >= csize && tch <= CSIZE )
-                   flexerror( "scanner requires -8 flag" );
+               ns = ds[i];
+               tch = transchar[ns];
 
-               else
-                   flexfatal(
+               if ( tch != SYM_EPSILON )
+                       {
+                       if ( tch < -lastccl || tch >= csize )
+                               {
+                               if ( tch >= csize && tch <= CSIZE )
+                                       flexerror( "scanner requires -8 flag" );
+
+                               else
+                                       flexfatal(
                        "bad transition character detected in sympartition()" );
-               }
+                               }
 
-           if ( tch >= 0 )
-               { /* character transition */
-               /* abs() needed for fake %t ec's */
-               int ec = abs( ecgroup[tch] );
+                       if ( tch >= 0 )
+                               { /* character transition */
+                               /* abs() needed for fake %t ec's */
+                               int ec = abs( ecgroup[tch] );
 
-               mkechar( ec, dupfwd, duplist );
-               symlist[ec] = 1;
-               }
+                               mkechar( ec, dupfwd, duplist );
+                               symlist[ec] = 1;
+                               }
 
-           else
-               { /* character class */
-               tch = -tch;
+                       else
+                               { /* character class */
+                               tch = -tch;
 
-               lenccl = ccllen[tch];
-               cclp = cclmap[tch];
-               mkeccl( ccltbl + cclp, lenccl, dupfwd, duplist, numecs,
-                       NUL_ec );
+                               lenccl = ccllen[tch];
+                               cclp = cclmap[tch];
+                               mkeccl( ccltbl + cclp, lenccl, dupfwd,
+                                       duplist, numecs, NUL_ec );
 
-               if ( cclng[tch] )
-                   {
-                   j = 0;
+                               if ( cclng[tch] )
+                                       {
+                                       j = 0;
 
-                   for ( k = 0; k < lenccl; ++k )
-                       {
-                       ich = ccltbl[cclp + k];
+                                       for ( k = 0; k < lenccl; ++k )
+                                               {
+                                               ich = ccltbl[cclp + k];
 
-                       if ( ich == 0 )
-                           ich = NUL_ec;
+                                               if ( ich == 0 )
+                                                       ich = NUL_ec;
 
-                       for ( ++j; j < ich; ++j )
-                           symlist[j] = 1;
-                       }
+                                               for ( ++j; j < ich; ++j )
+                                                       symlist[j] = 1;
+                                               }
 
-                   for ( ++j; j <= numecs; ++j )
-                       symlist[j] = 1;
-                   }
+                                       for ( ++j; j <= numecs; ++j )
+                                               symlist[j] = 1;
+                                       }
 
-               else
-                   for ( k = 0; k < lenccl; ++k )
-                       {
-                       ich = ccltbl[cclp + k];
+                               else
+                                       for ( k = 0; k < lenccl; ++k )
+                                               {
+                                               ich = ccltbl[cclp + k];
 
-                       if ( ich == 0 )
-                           ich = NUL_ec;
+                                               if ( ich == 0 )
+                                                       ich = NUL_ec;
 
-                       symlist[ich] = 1;
+                                               symlist[ich] = 1;
+                                               }
+                               }
                        }
                }
-           }
        }
-    }
diff --git a/ecs.c b/ecs.c
index 2617c4649b89c51a9b9d691ce47a3ebdef32e8fb..ab6fadc6801e8d593274a733a08726ad48a9b9e5 100644 (file)
--- a/ecs.c
+++ b/ecs.c
@@ -33,81 +33,71 @@ static char rcsid[] =
 
 #include "flexdef.h"
 
-/* ccl2ecl - convert character classes to set of equivalence classes
- *
- * synopsis
- *    ccl2ecl();
- */
+/* ccl2ecl - convert character classes to set of equivalence classes */
 
 void ccl2ecl()
-
-    {
-    int i, ich, newlen, cclp, ccls, cclmec;
-
-    for ( i = 1; i <= lastccl; ++i )
        {
-       /* we loop through each character class, and for each character
-        * in the class, add the character's equivalence class to the
-        * new "character" class we are creating.  Thus when we are all
-        * done, character classes will really consist of collections
-        * of equivalence classes
-        */
-
-       newlen = 0;
-       cclp = cclmap[i];
+       int i, ich, newlen, cclp, ccls, cclmec;
 
-       for ( ccls = 0; ccls < ccllen[i]; ++ccls )
-           {
-           ich = ccltbl[cclp + ccls];
-           cclmec = ecgroup[ich];
-
-           if ( cclmec > 0 )
+       for ( i = 1; i <= lastccl; ++i )
                {
-               ccltbl[cclp + newlen] = cclmec;
-               ++newlen;
+               /* We loop through each character class, and for each character
+                * in the class, add the character's equivalence class to the
+                * new "character" class we are creating.  Thus when we are all
+                * done, character classes will really consist of collections
+                * of equivalence classes
+                */
+
+               newlen = 0;
+               cclp = cclmap[i];
+
+               for ( ccls = 0; ccls < ccllen[i]; ++ccls )
+                       {
+                       ich = ccltbl[cclp + ccls];
+                       cclmec = ecgroup[ich];
+
+                       if ( cclmec > 0 )
+                               {
+                               ccltbl[cclp + newlen] = cclmec;
+                               ++newlen;
+                               }
+                       }
+
+               ccllen[i] = newlen;
                }
-           }
-
-       ccllen[i] = newlen;
        }
-    }
 
 
 /* cre8ecs - associate equivalence class numbers with class members
  *
- * synopsis
- *    int cre8ecs();
- *    number of classes = cre8ecs( fwd, bck, num );
- *
- *  fwd is the forward linked-list of equivalence class members.  bck
- *  is the backward linked-list, and num is the number of class members.
+ * fwd is the forward linked-list of equivalence class members.  bck
+ * is the backward linked-list, and num is the number of class members.
  *
- *  Returned is the number of classes.
+ * Returned is the number of classes.
  */
 
 int cre8ecs( fwd, bck, num )
 int fwd[], bck[], num;
+       {
+       int i, j, numcl;
 
-    {
-    int i, j, numcl;
-
-    numcl = 0;
-
-    /* create equivalence class numbers.  From now on, abs( bck(x) )
-     * is the equivalence class number for object x.  If bck(x)
-     * is positive, then x is the representative of its equivalence
-     * class.
-     */
-    for ( i = 1; i <= num; ++i )
-       if ( bck[i] == NIL )
-           {
-           bck[i] = ++numcl;
-           for ( j = fwd[i]; j != NIL; j = fwd[j] )
-               bck[j] = -numcl;
-           }
+       numcl = 0;
 
-    return ( numcl );
-    }
+       /* Create equivalence class numbers.  From now on, abs( bck(x) )
+        * is the equivalence class number for object x.  If bck(x)
+        * is positive, then x is the representative of its equivalence
+        * class.
+        */
+       for ( i = 1; i <= num; ++i )
+               if ( bck[i] == NIL )
+                       {
+                       bck[i] = ++numcl;
+                       for ( j = fwd[i]; j != NIL; j = fwd[j] )
+                               bck[j] = -numcl;
+                       }
+
+       return numcl;
+       }
 
 
 /* mkeccl - update equivalence classes based on character class xtions
@@ -115,11 +105,12 @@ int fwd[], bck[], num;
  * synopsis
  *    Char ccls[];
  *    int lenccl, fwd[llsiz], bck[llsiz], llsiz, NUL_mapping;
- *    mkeccl( ccls, lenccl, fwd, bck, llsiz, NUL_mapping );
+ *    void mkeccl( Char ccls[], int lenccl, int fwd[llsiz], int bck[llsiz],
+ *                     int llsiz, int NUL_mapping );
  *
- * where ccls contains the elements of the character class, lenccl is the
+ * ccls contains the elements of the character class, lenccl is the
  * number of elements in the ccl, fwd is the forward link-list of equivalent
- * characters, bck is the backward link-list, and llsiz size of the link-list
+ * characters, bck is the backward link-list, and llsiz size of the link-list.
  *
  * NUL_mapping is the value which NUL (0) should be mapped to.
  */
@@ -127,116 +118,111 @@ int fwd[], bck[], num;
 void mkeccl( ccls, lenccl, fwd, bck, llsiz, NUL_mapping )
 Char ccls[];
 int lenccl, fwd[], bck[], llsiz, NUL_mapping;
+       {
+       int cclp, oldec, newec;
+       int cclm, i, j;
+       static unsigned char cclflags[CSIZE];   /* initialized to all '\0' */
 
-    {
-    int cclp, oldec, newec;
-    int cclm, i, j;
-    static unsigned char cclflags[CSIZE];      /* initialized to all '\0' */
+       /* Note that it doesn't matter whether or not the character class is
+        * negated.  The same results will be obtained in either case.
+        */
 
-    /* note that it doesn't matter whether or not the character class is
-     * negated.  The same results will be obtained in either case.
-     */
+       cclp = 0;
 
-    cclp = 0;
+       while ( cclp < lenccl )
+               {
+               cclm = ccls[cclp];
 
-    while ( cclp < lenccl )
-       {
-       cclm = ccls[cclp];
+               if ( NUL_mapping && cclm == 0 )
+                       cclm = NUL_mapping;
 
-       if ( NUL_mapping && cclm == 0 )
-           cclm = NUL_mapping;
+               oldec = bck[cclm];
+               newec = cclm;
 
-       oldec = bck[cclm];
-       newec = cclm;
+               j = cclp + 1;
 
-       j = cclp + 1;
+               for ( i = fwd[cclm]; i != NIL && i <= llsiz; i = fwd[i] )
+                       { /* look for the symbol in the character class */
+                       for ( ; j < lenccl; ++j )
+                               {
+                               register int ccl_char;
 
-       for ( i = fwd[cclm]; i != NIL && i <= llsiz; i = fwd[i] )
-           { /* look for the symbol in the character class */
-           for ( ; j < lenccl; ++j )
-               {
-               register int ccl_char;
-
-               if ( NUL_mapping && ccls[j] == 0 )
-                   ccl_char = NUL_mapping;
-               else
-                   ccl_char = ccls[j];
-
-               if ( ccl_char > i )
-                   break;
-
-               if ( ccl_char == i && ! cclflags[j] )
-                   {
-                   /* we found an old companion of cclm in the ccl.
-                    * link it into the new equivalence class and flag it as
-                    * having been processed
-                    */
-
-                   bck[i] = newec;
-                   fwd[newec] = i;
-                   newec = i;
-                   cclflags[j] = 1;    /* set flag so we don't reprocess */
-
-                   /* get next equivalence class member */
-                   /* continue 2 */
-                   goto next_pt;
-                   }
-               }
+                               if ( NUL_mapping && ccls[j] == 0 )
+                                       ccl_char = NUL_mapping;
+                               else
+                                       ccl_char = ccls[j];
+
+                               if ( ccl_char > i )
+                                       break;
+
+                               if ( ccl_char == i && ! cclflags[j] )
+                                       {
+                                       /* We found an old companion of cclm
+                                        * in the ccl.  Link it into the new
+                                        * equivalence class and flag it as
+                                        * having been processed.
+                                        */
+
+                                       bck[i] = newec;
+                                       fwd[newec] = i;
+                                       newec = i;
+                                       /* Set flag so we don't reprocess. */
+                                       cclflags[j] = 1;
+
+                                       /* Get next equivalence class member. */
+                                       /* continue 2 */
+                                       goto next_pt;
+                                       }
+                               }
+
+                       /* Symbol isn't in character class.  Put it in the old
+                        * equivalence class.
+                        */
 
-           /* symbol isn't in character class.  Put it in the old equivalence
-            * class
-            */
+                       bck[i] = oldec;
 
-           bck[i] = oldec;
+                       if ( oldec != NIL )
+                               fwd[oldec] = i;
 
-           if ( oldec != NIL )
-               fwd[oldec] = i;
+                       oldec = i;
 
-           oldec = i;
-next_pt:
-           ;
-           }
+                       next_pt: ;
+                       }
 
-       if ( bck[cclm] != NIL || oldec != bck[cclm] )
-           {
-           bck[cclm] = NIL;
-           fwd[oldec] = NIL;
-           }
+               if ( bck[cclm] != NIL || oldec != bck[cclm] )
+                       {
+                       bck[cclm] = NIL;
+                       fwd[oldec] = NIL;
+                       }
 
-       fwd[newec] = NIL;
+               fwd[newec] = NIL;
 
-       /* find next ccl member to process */
+               /* Find next ccl member to process. */
 
-       for ( ++cclp; cclflags[cclp] && cclp < lenccl; ++cclp )
-           {
-           /* reset "doesn't need processing" flag */
-           cclflags[cclp] = 0;
-           }
+               for ( ++cclp; cclflags[cclp] && cclp < lenccl; ++cclp )
+                       {
+                       /* Reset "doesn't need processing" flag. */
+                       cclflags[cclp] = 0;
+                       }
+               }
        }
-    }
 
 
-/* mkechar - create equivalence class for single character
- *
- * synopsis
- *    int tch, fwd[], bck[];
- *    mkechar( tch, fwd, bck );
- */
+/* mkechar - create equivalence class for single character */
 
 void mkechar( tch, fwd, bck )
 int tch, fwd[], bck[];
+       {
+       /* If until now the character has been a proper subset of
+        * an equivalence class, break it away to create a new ec
+        */
 
-    {
-    /* if until now the character has been a proper subset of
-     * an equivalence class, break it away to create a new ec
-     */
-
-    if ( fwd[tch] != NIL )
-       bck[fwd[tch]] = bck[tch];
+       if ( fwd[tch] != NIL )
+               bck[fwd[tch]] = bck[tch];
 
-    if ( bck[tch] != NIL )
-       fwd[bck[tch]] = fwd[tch];
+       if ( bck[tch] != NIL )
+               fwd[bck[tch]] = fwd[tch];
 
-    fwd[tch] = NIL;
-    bck[tch] = NIL;
-    }
+       fwd[tch] = NIL;
+       bck[tch] = NIL;
+       }
index a1282bfe50869fe719a3736c729c3dc574bb7838..0c5669ed6820aea497dfaf3ec98cd7aa591a94d1 100644 (file)
--- a/flex.skl
+++ b/flex.skl
@@ -1,6 +1,6 @@
 /* A lexical scanner generated by flex */
 
-/* scanner skeleton version:
+/* Scanner skeleton version:
  * $Header$
  */
 
 #include <stdlib.h>
 #include <osfcn.h>
 
-/* use prototypes in function declarations */
+/* Use prototypes in function declarations. */
 #define YY_USE_PROTOS
 
-/* the "const" storage-class-modifier is valid */
+/* The "const" storage-class-modifier is valid. */
 #define YY_USE_CONST
 
 #else  /* ! __cplusplus */
@@ -61,9 +61,9 @@ void free( void* );
 #define YY_PROTO(proto) proto
 #else
 #define YY_PROTO(proto) ()
-/* we can't get here if it's an ANSI C compiler, or a C++ compiler,
+/* We can't get here if it's an ANSI C compiler, or a C++ compiler,
  * so it's got to be a K&R compiler, and therefore there's no standard
- * place from which to include these definitions
+ * place from which to include these definitions.
  */
 char *malloc();
 int free();
@@ -71,37 +71,37 @@ int read();
 #endif
 
 
-/* amount of stuff to slurp up with each read */
+/* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
 #define YY_READ_BUF_SIZE 8192
 #endif
 
-/* returned upon end-of-file */
+/* Returned upon end-of-file. */
 #define YY_END_TOK 0
 
-/* copy whatever the last rule matched to the standard output */
+/* Copy whatever the last rule matched to the standard output. */
 
-/* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
+/* Cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
 /* this used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite()
+ * we now use fwrite().
  */
 #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
 
-/* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  * is returned in "result".
  */
 #define YY_INPUT(buf,result,max_size) \
        if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
-           YY_FATAL_ERROR( "read() in flex scanner failed" );
+               YY_FATAL_ERROR( "read() in flex scanner failed" );
 #define YY_NULL 0
 
-/* no semi-colon after return; correct usage is to write "yyterminate();" -
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
  * we don't want an extra ';' after the "return" because that will cause
  * some compilers to complain about unreachable statements.
  */
 #define yyterminate() return YY_NULL
 
-/* report a fatal error */
+/* Report a fatal error. */
 
 /* The funky do-while is used to turn this macro definition into
  * a single C statement (which needs a semi-colon terminator).
@@ -126,19 +126,19 @@ int read();
                } \
        while ( 0 )
 
-/* default yywrap function - always treat EOF as an EOF */
+/* Default yywrap function - always treat EOF as an EOF. */
 #define yywrap() 1
 
-/* enter a start condition.  This macro really ought to take a parameter,
+/* Enter a start condition.  This macro really ought to take a parameter,
  * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN
+ * definition of BEGIN.
  */
 #define BEGIN yy_start = 1 + 2 *
 
-/* action number for EOF rule of a given start state */
+/* Action number for EOF rule of a given start state. */
 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
 
-/* special action meaning "start processing a new file" */
+/* Special action meaning "start processing a new file". */
 #define YY_NEW_FILE \
        do \
                { \
@@ -147,12 +147,12 @@ int read();
                } \
        while ( 0 )
 
-/* default declaration of generated scanner - a define so the user can
- * easily add parameters
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
  */
 #define YY_DECL int yylex YY_PROTO(( void )) 
 
-/* code executed at the end of each rule */
+/* Code executed at the end of each rule. */
 #define YY_BREAK break;
 
 #define YY_END_OF_BUFFER_CHAR 0
@@ -165,8 +165,8 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
 
 %% section 1 definitions and declarations of yytext/yytext_ptr go here
 
-/* done after the current pattern has been matched and before the
- * corresponding action - sets up yytext
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
  */
 #define YY_DO_BEFORE_ACTION \
        yytext_ptr = yy_bp; \
@@ -180,11 +180,11 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
 #define EOB_ACT_END_OF_FILE 1
 #define EOB_ACT_LAST_MATCH 2
 
-/* return all but the first 'n' matched characters back to the input stream */
+/* Return all but the first 'n' matched characters back to the input stream. */
 #define yyless(n) \
        do \
                { \
-               /* undo effects of setting up yytext */ \
+               /* Undo effects of setting up yytext. */ \
                *yy_cp = yy_hold_char; \
                yy_c_buf_p = yy_cp = yy_bp + n; \
                YY_DO_BEFORE_ACTION; /* set up yytext again */ \
@@ -195,37 +195,42 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
 
 
 struct yy_buffer_state
-    {
-    FILE *yy_input_file;
+       {
+       FILE *yy_input_file;
 
-    YY_CHAR *yy_ch_buf;                /* input buffer */
-    YY_CHAR *yy_buf_pos;       /* current position in input buffer */
+       YY_CHAR *yy_ch_buf;             /* input buffer */
+       YY_CHAR *yy_buf_pos;            /* current position in input buffer */
 
-    /* size of input buffer in bytes, not including room for EOB characters */
-    int yy_buf_size;   
+       /* Size of input buffer in bytes, not including room for EOB
+        * characters.
+        */
+       int yy_buf_size;        
 
-    /* number of characters read into yy_ch_buf, not including EOB characters */
-    int yy_n_chars;
+       /* Number of characters read into yy_ch_buf, not including EOB
+        * characters.
+        */
+       int yy_n_chars;
 
-    int yy_eof_status;         /* whether we've seen an EOF on this buffer */
+       /* Whether we've seen an EOF on this buffer. */
+       int yy_eof_status;
 #define EOF_NOT_SEEN 0
-    /* "pending" happens when the EOF has been seen but there's still
-     * some text process
-     */
+       /* "Pending" happens when the EOF has been seen but there's still
+        * some text to process.
+        */
 #define EOF_PENDING 1
 #define EOF_DONE 2
-    };
+       };
 
 static YY_BUFFER_STATE yy_current_buffer = 0;
 
-/* we provide macros for accessing buffer states in case in the
+/* We provide macros for accessing buffer states in case in the
  * future we want to put the buffer states in a more general
- * "scanner state"
+ * "scanner state".
  */
 #define YY_CURRENT_BUFFER yy_current_buffer
 
 
-/* yy_hold_char holds the character lost when yytext is formed */
+/* yy_hold_char holds the character lost when yytext is formed. */
 static YY_CHAR yy_hold_char;
 
 static int yy_n_chars;         /* number of characters read into yy_ch_buf */
@@ -240,15 +245,15 @@ FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
 
 %% data tables for the DFA go here
 
-/* these variables are all declared out here so that section 3 code can
- * manipulate them
+/* These variables are all declared out here so that section 3 code can
+ * manipulate them.
  */
-/* points to current character in buffer */
+/* Points to current character in buffer. */
 static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
 static int yy_init = 1;                /* whether we need to initialize */
 static int yy_start = 0;       /* start state number */
 
-/* flag which is used to allow yywrap()'s to do buffer switches
+/* Flag which is used to allow yywrap()'s to do buffer switches
  * instead of setting up a fresh yyin.  A bit of a hack ...
  */
 static int yy_did_buffer_switch_on_eof;
@@ -273,300 +278,297 @@ static int input YY_PROTO(( void ));
 #endif
 
 YY_DECL
-    {
-    register yy_state_type yy_current_state;
-    register YY_CHAR *yy_cp, *yy_bp;
-    register int yy_act;
+       {
+       register yy_state_type yy_current_state;
+       register YY_CHAR *yy_cp, *yy_bp;
+       register int yy_act;
 
 %% user's declarations go here
 
-    if ( yy_init )
-       {
+       if ( yy_init )
+               {
 #ifdef YY_USER_INIT
-       YY_USER_INIT;
+               YY_USER_INIT;
 #endif
 
-       if ( ! yy_start )
-           yy_start = 1;       /* first start state */
+               if ( ! yy_start )
+                       yy_start = 1;   /* first start state */
 
-       if ( ! yyin )
-           yyin = stdin;
+               if ( ! yyin )
+                       yyin = stdin;
 
-       if ( ! yyout )
-           yyout = stdout;
+               if ( ! yyout )
+                       yyout = stdout;
 
-       if ( yy_current_buffer )
-           yy_init_buffer( yy_current_buffer, yyin );
-       else
-           yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+               if ( yy_current_buffer )
+                       yy_init_buffer( yy_current_buffer, yyin );
+               else
+                       yy_current_buffer =
+                               yy_create_buffer( yyin, YY_BUF_SIZE );
 
-       yy_load_buffer_state();
+               yy_load_buffer_state();
 
-       yy_init = 0;
-       }
+               yy_init = 0;
+               }
 
-    while ( 1 )                /* loops until end-of-file is reached */
-       {
+       while ( 1 )             /* loops until end-of-file is reached */
+               {
 %% yymore()-related code goes here
-       yy_cp = yy_c_buf_p;
+               yy_cp = yy_c_buf_p;
 
-       /* support of yytext */
-       *yy_cp = yy_hold_char;
+               /* Support of yytext. */
+               *yy_cp = yy_hold_char;
 
-       /* yy_bp points to the position in yy_ch_buf of the start of the
-        * current run.
-        */
-       yy_bp = yy_cp;
+               /* yy_bp points to the position in yy_ch_buf of the start of
+                * the current run.
+                */
+               yy_bp = yy_cp;
 
 %% code to set up and find next match goes here
 
 yy_find_action:
 %% code to find the action number goes here
 
-       YY_DO_BEFORE_ACTION;
+               YY_DO_BEFORE_ACTION;
 
 #ifdef YY_USER_ACTION
-       if ( yy_act != YY_END_OF_BUFFER )
-           {
-           YY_USER_ACTION;
-           }
+               if ( yy_act != YY_END_OF_BUFFER )
+                       {
+                       YY_USER_ACTION;
+                       }
 #endif
 
-do_action:     /* this label is used only to access EOF actions */
+do_action:     /* This label is used only to access EOF actions. */
 
 %% debug code goes here
 
-       switch ( yy_act )
-           {
+               switch ( yy_act )
+       { /* beginning of action switch */
 %% actions go here
 
-           case YY_END_OF_BUFFER:
+       case YY_END_OF_BUFFER:
                {
-               /* amount of text matched not including the EOB char */
+               /* Amount of text matched not including the EOB char. */
                int yy_amount_of_matched_text = yy_cp - yytext_ptr - 1;
 
-               /* undo the effects of YY_DO_BEFORE_ACTION */
+               /* Undo the effects of YY_DO_BEFORE_ACTION. */
                *yy_cp = yy_hold_char;
 
-               /* note that here we test for yy_c_buf_p "<=" to the position
+               /* Note that here we test for yy_c_buf_p "<=" to the position
                 * of the first EOB in the buffer, since yy_c_buf_p will
                 * already have been incremented past the NUL character
-                * (since all states make transitions on EOB to the end-
-                * of-buffer state).  Contrast this with the test in yyinput().
+                * (since all states make transitions on EOB to the
+                * end-of-buffer state).  Contrast this with the test
+                * in yyinput().
                 */
                if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
-                   /* this was really a NUL */
-                   {
-                   yy_state_type yy_next_state;
+                       { /* This was really a NUL. */
+                       yy_state_type yy_next_state;
 
-                   yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+                       yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
 
-                   yy_current_state = yy_get_previous_state();
+                       yy_current_state = yy_get_previous_state();
 
-                   /* okay, we're now positioned to make the
-                    * NUL transition.  We couldn't have
-                    * yy_get_previous_state() go ahead and do it
-                    * for us because it doesn't know how to deal
-                    * with the possibility of jamming (and we
-                    * don't want to build jamming into it because
-                    * then it will run more slowly)
-                    */
+                       /* Okay, we're now positioned to make the NUL
+                        * transition.  We couldn't have
+                        * yy_get_previous_state() go ahead and do it
+                        * for us because it doesn't know how to deal
+                        * with the possibility of jamming (and we don't
+                        * want to build jamming into it because then it
+                        * will run more slowly).
+                        */
 
-                   yy_next_state = yy_try_NUL_trans( yy_current_state );
+                       yy_next_state = yy_try_NUL_trans( yy_current_state );
 
-                   yy_bp = yytext_ptr + YY_MORE_ADJ;
+                       yy_bp = yytext_ptr + YY_MORE_ADJ;
 
-                   if ( yy_next_state )
-                       {
-                       /* consume the NUL */
-                       yy_cp = ++yy_c_buf_p;
-                       yy_current_state = yy_next_state;
-                       goto yy_match;
-                       }
+                       if ( yy_next_state )
+                               {
+                               /* Consume the NUL. */
+                               yy_cp = ++yy_c_buf_p;
+                               yy_current_state = yy_next_state;
+                               goto yy_match;
+                               }
 
-                   else
-                       {
+                       else
+                               {
 %% code to do backtracking for compressed tables and set up yy_cp goes here
-                       goto yy_find_action;
+                               goto yy_find_action;
+                               }
                        }
-                   }
 
                else switch ( yy_get_next_buffer() )
-                   {
-                   case EOB_ACT_END_OF_FILE:
                        {
-                       yy_did_buffer_switch_on_eof = 0;
-
-                       if ( yywrap() )
-                           {
-                           /* note: because we've taken care in
-                            * yy_get_next_buffer() to have set up yytext,
-                            * we can now set up yy_c_buf_p so that if some
-                            * total hoser (like flex itself) wants
-                            * to call the scanner after we return the
-                            * YY_NULL, it'll still work - another YY_NULL
-                            * will get returned.
-                            */
-                           yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
-
-                           yy_act = YY_STATE_EOF((yy_start - 1) / 2);
-                           goto do_action;
-                           }
-
-                       else
-                           {
-                           if ( ! yy_did_buffer_switch_on_eof )
-                               YY_NEW_FILE;
-                           }
+                       case EOB_ACT_END_OF_FILE:
+                               {
+                               yy_did_buffer_switch_on_eof = 0;
+
+                               if ( yywrap() )
+                                       {
+                                       /* Note: because we've taken care in
+                                        * yy_get_next_buffer() to have set up
+                                        * yytext, we can now set up
+                                        * yy_c_buf_p so that if some total
+                                        * hoser (like flex itself) wants to
+                                        * call the scanner after we return the
+                                        * YY_NULL, it'll still work - another
+                                        * YY_NULL will get returned.
+                                        */
+                                       yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+
+                                       yy_act = YY_STATE_EOF(
+                                                       (yy_start - 1) / 2);
+                                       goto do_action;
+                                       }
+
+                               else
+                                       {
+                                       if ( ! yy_did_buffer_switch_on_eof )
+                                               YY_NEW_FILE;
+                                       }
+                               break;
+                               }
+
+                       case EOB_ACT_CONTINUE_SCAN:
+                               yy_c_buf_p =
+                                       yytext_ptr + yy_amount_of_matched_text;
+
+                               yy_current_state = yy_get_previous_state();
+
+                               yy_cp = yy_c_buf_p;
+                               yy_bp = yytext_ptr + YY_MORE_ADJ;
+                               goto yy_match;
+
+                       case EOB_ACT_LAST_MATCH:
+                               yy_c_buf_p =
+                               &yy_current_buffer->yy_ch_buf[yy_n_chars];
+
+                               yy_current_state = yy_get_previous_state();
+
+                               yy_cp = yy_c_buf_p;
+                               yy_bp = yytext_ptr + YY_MORE_ADJ;
+                               goto yy_find_action;
                        }
-                       break;
-
-                   case EOB_ACT_CONTINUE_SCAN:
-                       yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
-
-                       yy_current_state = yy_get_previous_state();
-
-                       yy_cp = yy_c_buf_p;
-                       yy_bp = yytext_ptr + YY_MORE_ADJ;
-                       goto yy_match;
-
-                   case EOB_ACT_LAST_MATCH:
-                       yy_c_buf_p =
-                           &yy_current_buffer->yy_ch_buf[yy_n_chars];
-
-                       yy_current_state = yy_get_previous_state();
-
-                       yy_cp = yy_c_buf_p;
-                       yy_bp = yytext_ptr + YY_MORE_ADJ;
-                       goto yy_find_action;
-                   }
                break;
                }
 
-           default:
+       default:
 #ifdef FLEX_DEBUG
                printf( "action # %d\n", yy_act );
 #endif
                YY_FATAL_ERROR(
                        "fatal flex scanner internal error--no action found" );
-           }
-       }
-    }
+       } /* end of action switch */
+               } /* end of scanning one token */
+       } /* end of yylex */
 
 
 /* yy_get_next_buffer - try to read in a new buffer
  *
- * synopsis
- *     int yy_get_next_buffer();
- *     
- * returns a code representing an action
- *     EOB_ACT_LAST_MATCH - 
- *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- *     EOB_ACT_END_OF_FILE - end of file
+ * Returns a code representing an action:
+ *     EOB_ACT_LAST_MATCH - 
+ *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *     EOB_ACT_END_OF_FILE - end of file
  */
 
 static int yy_get_next_buffer()
+       {
+       register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
+       register YY_CHAR *source = yytext_ptr - 1; /* copy prev. char, too */
+       register int number_to_move, i;
+       int ret_val;
 
-    {
-    register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
-    register YY_CHAR *source = yytext_ptr - 1; /* copy prev. char, too */
-    register int number_to_move, i;
-    int ret_val;
-
-    if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
-       YY_FATAL_ERROR(
+       if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+               YY_FATAL_ERROR(
                "fatal flex scanner internal error--end of buffer missed" );
 
-    /* try to read more data */
+       /* Try to read more data. */
 
-    /* first move last chars to start of buffer */
-    number_to_move = yy_c_buf_p - yytext_ptr;
+       /* First move last chars to start of buffer. */
+       number_to_move = yy_c_buf_p - yytext_ptr;
 
-    for ( i = 0; i < number_to_move; ++i )
-       *(dest++) = *(source++);
+       for ( i = 0; i < number_to_move; ++i )
+               *(dest++) = *(source++);
 
-    if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
-       /* don't do the read, it's not guaranteed to return an EOF,
-        * just force an EOF
-        */
-       yy_n_chars = 0;
+       if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
+               /* don't do the read, it's not guaranteed to return an EOF,
+                * just force an EOF
+                */
+               yy_n_chars = 0;
 
-    else
-       {
-       int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
+       else
+               {
+               int num_to_read =
+                       yy_current_buffer->yy_buf_size - number_to_move - 1;
 
-       if ( num_to_read > YY_READ_BUF_SIZE )
-           num_to_read = YY_READ_BUF_SIZE;
+               if ( num_to_read > YY_READ_BUF_SIZE )
+                       num_to_read = YY_READ_BUF_SIZE;
 
-       else if ( num_to_read <= 0 )
-           YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
+               else if ( num_to_read <= 0 )
+                       YY_FATAL_ERROR(
+                               "fatal error - scanner input buffer overflow" );
 
-       /* read in more data */
-       YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
-                 yy_n_chars, num_to_read );
-       }
+               /* Read in more data. */
+               YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+                       yy_n_chars, num_to_read );
+               }
 
-    if ( yy_n_chars == 0 )
-       {
-       if ( number_to_move - YY_MORE_ADJ == 1 )
-           {
-           ret_val = EOB_ACT_END_OF_FILE;
-           yy_current_buffer->yy_eof_status = EOF_DONE;
-           }
+       if ( yy_n_chars == 0 )
+               {
+               if ( number_to_move - YY_MORE_ADJ == 1 )
+                       {
+                       ret_val = EOB_ACT_END_OF_FILE;
+                       yy_current_buffer->yy_eof_status = EOF_DONE;
+                       }
 
-       else
-           {
-           ret_val = EOB_ACT_LAST_MATCH;
-           yy_current_buffer->yy_eof_status = EOF_PENDING;
-           }
-       }
+               else
+                       {
+                       ret_val = EOB_ACT_LAST_MATCH;
+                       yy_current_buffer->yy_eof_status = EOF_PENDING;
+                       }
+               }
 
-    else
-       ret_val = EOB_ACT_CONTINUE_SCAN;
+       else
+               ret_val = EOB_ACT_CONTINUE_SCAN;
 
-    yy_n_chars += number_to_move;
-    yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
-    yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+       yy_n_chars += number_to_move;
+       yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+       yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
 
-    /* yytext begins at the second character in yy_ch_buf; the first
-     * character is the one which preceded it before reading in the latest
-     * buffer; it needs to be kept around in case it's a newline, so
-     * yy_get_previous_state() will have with '^' rules active
-     */
+       /* yytext begins at the second character in yy_ch_buf; the first
+        * character is the one which preceded it before reading in the latest
+        * buffer; it needs to be kept around in case it's a newline, so
+        * yy_get_previous_state() will have with '^' rules active.
+        */
 
-    yytext_ptr = &yy_current_buffer->yy_ch_buf[1];
+       yytext_ptr = &yy_current_buffer->yy_ch_buf[1];
 
-    return ret_val;
-    }
+       return ret_val;
+       }
 
 
-/* yy_get_previous_state - get the state just before the EOB char was reached
- *
- * synopsis
- *     yy_state_type yy_get_previous_state();
- */
+/* yy_get_previous_state - get the state just before the EOB char was reached */
 
 static yy_state_type yy_get_previous_state()
-
-    {
-    register yy_state_type yy_current_state;
-    register YY_CHAR *yy_cp;
+       {
+       register yy_state_type yy_current_state;
+       register YY_CHAR *yy_cp;
 
 %% code to get the start state into yy_current_state goes here
 
-    for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
-       {
+       for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+               {
 %% code to find the next state goes here
-       }
+               }
 
-    return yy_current_state;
-    }
+       return yy_current_state;
+       }
 
 
 /* yy_try_NUL_trans - try to make a transition on the NUL character
  *
  * synopsis
- *     next_state = yy_try_NUL_trans( current_state );
+ *     next_state = yy_try_NUL_trans( current_state );
  */
 
 #ifdef YY_USE_PROTOS
@@ -575,13 +577,12 @@ static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
 static yy_state_type yy_try_NUL_trans( yy_current_state )
 register yy_state_type yy_current_state;
 #endif
-
-    {
-    register int yy_is_jam;
+       {
+       register int yy_is_jam;
 %% code to find the next state, and perhaps do backtracking, goes here
 
-    return yy_is_jam ? 0 : yy_current_state;
-    }
+       return yy_is_jam ? 0 : yy_current_state;
+       }
 
 
 #ifdef YY_USE_PROTOS
@@ -591,42 +592,42 @@ static void yyunput( c, yy_bp )
 YY_CHAR c;
 register YY_CHAR *yy_bp;
 #endif
+       {
+       register YY_CHAR *yy_cp = yy_c_buf_p;
 
-    {
-    register YY_CHAR *yy_cp = yy_c_buf_p;
-
-    /* undo effects of setting up yytext */
-    *yy_cp = yy_hold_char;
-
-    if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
-       { /* need to shift things up to make room */
-       register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
-       register YY_CHAR *dest =
-           &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
-       register YY_CHAR *source =
-           &yy_current_buffer->yy_ch_buf[number_to_move];
-
-       while ( source > yy_current_buffer->yy_ch_buf )
-           *--dest = *--source;
-
-       yy_cp += dest - source;
-       yy_bp += dest - source;
-       yy_n_chars = yy_current_buffer->yy_buf_size;
+       /* undo effects of setting up yytext */
+       *yy_cp = yy_hold_char;
 
        if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
-           YY_FATAL_ERROR( "flex scanner push-back overflow" );
-       }
+               { /* need to shift things up to make room */
+               /* +2 for EOB chars. */
+               register int number_to_move = yy_n_chars + 2;
+               register YY_CHAR *dest = &yy_current_buffer->yy_ch_buf[
+                                       yy_current_buffer->yy_buf_size + 2];
+               register YY_CHAR *source =
+                               &yy_current_buffer->yy_ch_buf[number_to_move];
+
+               while ( source > yy_current_buffer->yy_ch_buf )
+                       *--dest = *--source;
+
+               yy_cp += dest - source;
+               yy_bp += dest - source;
+               yy_n_chars = yy_current_buffer->yy_buf_size;
+
+               if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+                       YY_FATAL_ERROR( "flex scanner push-back overflow" );
+               }
 
-    if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
-       yy_cp[-2] = '\n';
+       if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
+               yy_cp[-2] = '\n';
 
-    *--yy_cp = c;
+       *--yy_cp = c;
 
-    /* note: the formal parameter *must* be called "yy_bp" for this
-     *       macro to now work correctly
-     */
-    YY_DO_BEFORE_ACTION; /* set up yytext again */
-    }
+       /* Note: the formal parameter *must* be called "yy_bp" for this
+        * macro to now work correctly.
+        */
+       YY_DO_BEFORE_ACTION; /* set up yytext again */
+       }
 
 
 #ifdef __cplusplus
@@ -634,66 +635,67 @@ static int yyinput()
 #else
 static int input()
 #endif
-
-    {
-    int c;
-    YY_CHAR *yy_cp = yy_c_buf_p;
-
-    *yy_cp = yy_hold_char;
-
-    if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
        {
-       /* yy_c_buf_p now points to the character we want to return.
-        * If this occurs *before* the EOB characters, then it's a
-        * valid NUL; if not, then we've hit the end of the buffer.
-        */
-       if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
-           /* this was really a NUL */
-           *yy_c_buf_p = '\0';
+       int c;
+       YY_CHAR *yy_cp = yy_c_buf_p;
 
-       else
-           { /* need more input */
-           yytext_ptr = yy_c_buf_p;
-           ++yy_c_buf_p;
+       *yy_cp = yy_hold_char;
 
-           switch ( yy_get_next_buffer() )
+       if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
                {
-               case EOB_ACT_END_OF_FILE:
-                   {
-                   if ( yywrap() )
-                       {
-                       yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
-                       return EOF;
-                       }
-
-                   YY_NEW_FILE;
-
+               /* yy_c_buf_p now points to the character we want to return.
+                * If this occurs *before* the EOB characters, then it's a
+                * valid NUL; if not, then we've hit the end of the buffer.
+                */
+               if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+                       /* This was really a NUL. */
+                       *yy_c_buf_p = '\0';
+
+               else
+                       { /* need more input */
+                       yytext_ptr = yy_c_buf_p;
+                       ++yy_c_buf_p;
+
+                       switch ( yy_get_next_buffer() )
+                               {
+                               case EOB_ACT_END_OF_FILE:
+                                       {
+                                       if ( yywrap() )
+                                               {
+                                               yy_c_buf_p =
+                                               yytext_ptr + YY_MORE_ADJ;
+                                               return EOF;
+                                               }
+
+                                       YY_NEW_FILE;
 #ifdef __cplusplus
-                   return yyinput();
+                                       return yyinput();
 #else
-                   return input();
+                                       return input();
 #endif
-                   }
+                                       }
 
-               case EOB_ACT_CONTINUE_SCAN:
-                   yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
-                   break;
+                               case EOB_ACT_CONTINUE_SCAN:
+                                       yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+                                       break;
 
-               case EOB_ACT_LAST_MATCH:
+                               case EOB_ACT_LAST_MATCH:
 #ifdef __cplusplus
-                   YY_FATAL_ERROR( "unexpected last match in yyinput()" );
+                                       YY_FATAL_ERROR(
+                                       "unexpected last match in yyinput()" );
 #else
-                   YY_FATAL_ERROR( "unexpected last match in input()" );
+                                       YY_FATAL_ERROR(
+                                       "unexpected last match in input()" );
 #endif
+                               }
+                       }
                }
-           }
-       }
 
-    c = *yy_c_buf_p;
-    yy_hold_char = *++yy_c_buf_p;
+       c = *yy_c_buf_p;
+       yy_hold_char = *++yy_c_buf_p;
 
-    return c;
-    }
+       return c;
+       }
 
 
 #ifdef YY_USE_PROTOS
@@ -702,11 +704,10 @@ void yyrestart( FILE *input_file )
 void yyrestart( input_file )
 FILE *input_file;
 #endif
-
-    {
-    yy_init_buffer( yy_current_buffer, input_file );
-    yy_load_buffer_state();
-    }
+       {
+       yy_init_buffer( yy_current_buffer, input_file );
+       yy_load_buffer_state();
+       }
 
 
 #ifdef YY_USE_PROTOS
@@ -715,29 +716,28 @@ void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
 void yy_switch_to_buffer( new_buffer )
 YY_BUFFER_STATE new_buffer;
 #endif
-
-    {
-    if ( yy_current_buffer == new_buffer )
-       return;
-
-    if ( yy_current_buffer )
        {
-       /* flush out information for old buffer */
-       *yy_c_buf_p = yy_hold_char;
-       yy_current_buffer->yy_buf_pos = yy_c_buf_p;
-       yy_current_buffer->yy_n_chars = yy_n_chars;
-       }
+       if ( yy_current_buffer == new_buffer )
+               return;
+
+       if ( yy_current_buffer )
+               {
+               /* Flush out information for old buffer. */
+               *yy_c_buf_p = yy_hold_char;
+               yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+               yy_current_buffer->yy_n_chars = yy_n_chars;
+               }
 
-    yy_current_buffer = new_buffer;
-    yy_load_buffer_state();
+       yy_current_buffer = new_buffer;
+       yy_load_buffer_state();
 
-    /* we don't actually know whether we did this switch during
-     * EOF (yywrap()) processing, but the only time this flag
-     * is looked at is after yywrap() is called, so it's safe
-     * to go ahead and always set it.
-     */
-    yy_did_buffer_switch_on_eof = 1;
-    }
+       /* We don't actually know whether we did this switch during
+        * EOF (yywrap()) processing, but the only time this flag
+        * is looked at is after yywrap() is called, so it's safe
+        * to go ahead and always set it.
+        */
+       yy_did_buffer_switch_on_eof = 1;
+       }
 
 
 #ifdef YY_USE_PROTOS
@@ -745,13 +745,12 @@ void yy_load_buffer_state( void )
 #else
 void yy_load_buffer_state()
 #endif
-
-    {
-    yy_n_chars = yy_current_buffer->yy_n_chars;
-    yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
-    yyin = yy_current_buffer->yy_input_file;
-    yy_hold_char = *yy_c_buf_p;
-    }
+       {
+       yy_n_chars = yy_current_buffer->yy_n_chars;
+       yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+       yyin = yy_current_buffer->yy_input_file;
+       yy_hold_char = *yy_c_buf_p;
+       }
 
 
 #ifdef YY_USE_PROTOS
@@ -761,29 +760,28 @@ YY_BUFFER_STATE yy_create_buffer( file, size )
 FILE *file;
 int size;
 #endif
+       {
+       YY_BUFFER_STATE b;
 
-    {
-    YY_BUFFER_STATE b;
-
-    b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
+       b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
 
-    if ( ! b )
-       YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+       if ( ! b )
+               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
 
-    b->yy_buf_size = size;
+       b->yy_buf_size = size;
 
-    /* yy_ch_buf has to be 2 characters longer than the size given because
-     * we need to put in 2 end-of-buffer characters.
-     */
-    b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
+       /* yy_ch_buf has to be 2 characters longer than the size given because
+        * we need to put in 2 end-of-buffer characters.
+        */
+       b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
 
-    if ( ! b->yy_ch_buf )
-       YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+       if ( ! b->yy_ch_buf )
+               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
 
-    yy_init_buffer( b, file );
+       yy_init_buffer( b, file );
 
-    return b;
-    }
+       return b;
+       }
 
 
 #ifdef YY_USE_PROTOS
@@ -792,14 +790,13 @@ void yy_delete_buffer( YY_BUFFER_STATE b )
 void yy_delete_buffer( b )
 YY_BUFFER_STATE b;
 #endif
+       {
+       if ( b == yy_current_buffer )
+               yy_current_buffer = (YY_BUFFER_STATE) 0;
 
-    {
-    if ( b == yy_current_buffer )
-       yy_current_buffer = (YY_BUFFER_STATE) 0;
-
-    free( (char *) b->yy_ch_buf );
-    free( (char *) b );
-    }
+       free( (char *) b->yy_ch_buf );
+       free( (char *) b );
+       }
 
 
 #ifdef YY_USE_PROTOS
@@ -809,25 +806,24 @@ void yy_init_buffer( b, file )
 YY_BUFFER_STATE b;
 FILE *file;
 #endif
+       {
+       b->yy_input_file = file;
 
-    {
-    b->yy_input_file = file;
-
-    /* we put in the '\n' and start reading from [1] so that an
-     * initial match-at-newline will be true.
-     */
+       /* We put in the '\n' and start reading from [1] so that an
+        * initial match-at-newline will be true.
+        */
 
-    b->yy_ch_buf[0] = '\n';
-    b->yy_n_chars = 1;
+       b->yy_ch_buf[0] = '\n';
+       b->yy_n_chars = 1;
 
-    /* we always need two end-of-buffer characters.  The first causes
-     * a transition to the end-of-buffer state.  The second causes
-     * a jam in that state.
-     */
-    b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-    b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
+       /* We always need two end-of-buffer characters.  The first causes
+        * a transition to the end-of-buffer state.  The second causes
+        * a jam in that state.
+        */
+       b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+       b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
 
-    b->yy_buf_pos = &b->yy_ch_buf[1];
+       b->yy_buf_pos = &b->yy_ch_buf[1];
 
-    b->yy_eof_status = EOF_NOT_SEEN;
-    }
+       b->yy_eof_status = EOF_NOT_SEEN;
+       }
index daa69617cca82fdec31faf048d0f527b3dff947d..d2273635db23658b758d69281fed40342dcb4325 100644 (file)
--- a/flexdef.h
+++ b/flexdef.h
@@ -32,7 +32,7 @@
 #include <stdio.h>
 #endif
 
-/* always be prepared to generate an 8-bit scanner */
+/* Always be prepared to generate an 8-bit scanner. */
 #define FLEX_8_BIT_CHARS
 
 #ifdef FLEX_8_BIT_CHARS
@@ -43,7 +43,7 @@
 #define CSIZE 128
 #endif
 
-/* size of input alphabet - should be size of ASCII set */
+/* Size of input alphabet - should be size of ASCII set. */
 #ifndef DEFAULT_CSIZE
 #define DEFAULT_CSIZE 128
 #endif
@@ -97,10 +97,10 @@ char *malloc(), *realloc();
 #endif
 
 
-/* maximum line length we'll have to deal with */
+/* Maximum line length we'll have to deal with. */
 #define MAXLINE BUFSIZ
 
-/* maximum size of file name */
+/* Maximum size of file name. */
 #define FILENAMESIZE 1024
 
 #ifndef min
@@ -121,24 +121,24 @@ char *malloc(), *realloc();
 #define false 0
 
 
-/* special chk[] values marking the slots taking by end-of-buffer and action
- * numbers
+/* Special chk[] values marking the slots taking by end-of-buffer and action
+ * numbers.
  */
 #define EOB_POSITION -1
 #define ACTION_POSITION -2
 
-/* number of data items per line for -f output */
+/* Number of data items per line for -f output. */
 #define NUMDATAITEMS 10
 
-/* number of lines of data in -f output before inserting a blank line for
+/* Number of lines of data in -f output before inserting a blank line for
  * readability.
  */
 #define NUMDATALINES 10
 
-/* transition_struct_out() definitions */
+/* Transition_struct_out() definitions. */
 #define TRANS_STRUCT_PRINT_LENGTH 15
 
-/* returns true if an nfa state has an epsilon out-transition slot
+/* Returns true if an nfa state has an epsilon out-transition slot
  * that can be used.  This definition is currently not used.
  */
 #define FREE_EPSILON(state) \
@@ -146,14 +146,14 @@ char *malloc(), *realloc();
         trans2[state] == NO_TRANSITION && \
         finalst[state] != state)
 
-/* returns true if an nfa state has an epsilon out-transition character
+/* Returns true if an nfa state has an epsilon out-transition character
  * and both slots are free
  */
 #define SUPER_FREE_EPSILON(state) \
        (transchar[state] == SYM_EPSILON && \
         trans1[state] == NO_TRANSITION) \
 
-/* maximum number of NFA states that can comprise a DFA state.  It's real
+/* Maximum number of NFA states that can comprise a DFA state.  It's real
  * big because if there's a lot of rules, the initial state will have a
  * huge epsilon closure.
  */
@@ -161,7 +161,7 @@ char *malloc(), *realloc();
 #define MAX_DFA_SIZE_INCREMENT 750
 
 
-/* a note on the following masks.  They are used to mark accepting numbers
+/* A note on the following masks.  They are used to mark accepting numbers
  * as being special.  As such, they implicitly limit the number of accepting
  * numbers (i.e., rules) because if there are too many rules the rule numbers
  * will overload the mask bits.  Fortunately, this limit is \large/ (0x2000 ==
@@ -169,18 +169,20 @@ char *malloc(), *realloc();
  * new_rule() to ensure that this limit is not reached.
  */
 
-/* mask to mark a trailing context accepting number */
+/* Mask to mark a trailing context accepting number. */
 #define YY_TRAILING_MASK 0x2000
 
-/* mask to mark the accepting number of the "head" of a trailing context rule */
+/* Mask to mark the accepting number of the "head" of a trailing context
+ * rule.
+ */
 #define YY_TRAILING_HEAD_MASK 0x4000
 
-/* maximum number of rules, as outlined in the above note */
+/* Maximum number of rules, as outlined in the above note. */
 #define MAX_RULE (YY_TRAILING_MASK - 1)
 
 
 /* NIL must be 0.  If not, its special meaning when making equivalence classes
- * (it marks the representative of a given e.c.) will be unidentifiable
+ * (it marks the representative of a given e.c.) will be unidentifiable.
  */
 #define NIL 0
 
@@ -192,7 +194,7 @@ char *malloc(), *realloc();
 #define INITIAL_MAX_CCLS 100   /* max number of unique character classes */
 #define MAX_CCLS_INCREMENT 100
 
-/* size of table holding members of character classes */
+/* Size of table holding members of character classes. */
 #define INITIAL_MAX_CCL_TBL_SIZE 500
 #define MAX_CCL_TBL_SIZE_INCREMENT 250
 
@@ -207,17 +209,17 @@ char *malloc(), *realloc();
 
 #define JAMSTATE -32766        /* marks a reference to the state that always jams */
 
-/* enough so that if it's subtracted from an NFA state number, the result
- * is guaranteed to be negative
+/* Enough so that if it's subtracted from an NFA state number, the result
+ * is guaranteed to be negative.
  */
 #define MARKER_DIFFERENCE 32000
 #define MAXIMUM_MNS 31999
 
-/* maximum number of nxt/chk pairs for non-templates */
+/* Maximum number of nxt/chk pairs for non-templates. */
 #define INITIAL_MAX_XPAIRS 2000
 #define MAX_XPAIRS_INCREMENT 2000
 
-/* maximum number of nxt/chk pairs needed for templates */
+/* Maximum number of nxt/chk pairs needed for templates. */
 #define INITIAL_MAX_TEMPLATE_XPAIRS 2500
 #define MAX_TEMPLATE_XPAIRS_INCREMENT 2500
 
@@ -229,77 +231,77 @@ char *malloc(), *realloc();
 #define ONE_STACK_SIZE 500     /* stack of states with only one out-transition */
 #define SAME_TRANS -1  /* transition is the same as "default" entry for state */
 
-/* the following percentages are used to tune table compression:
+/* The following percentages are used to tune table compression:
 
- * the percentage the number of out-transitions a state must be of the
+ * The percentage the number of out-transitions a state must be of the
  * number of equivalence classes in order to be considered for table
- * compaction by using protos
+ * compaction by using protos.
  */
 #define PROTO_SIZE_PERCENTAGE 15
 
-/* the percentage the number of homogeneous out-transitions of a state
+/* The percentage the number of homogeneous out-transitions of a state
  * must be of the number of total out-transitions of the state in order
  * that the state's transition table is first compared with a potential 
  * template of the most common out-transition instead of with the first
- * proto in the proto queue
+ * proto in the proto queue.
  */
 #define CHECK_COM_PERCENTAGE 50
 
-/* the percentage the number of differences between a state's transition
+/* The percentage the number of differences between a state's transition
  * table and the proto it was first compared with must be of the total
  * number of out-transitions of the state in order to keep the first
- * proto as a good match and not search any further
+ * proto as a good match and not search any further.
  */
 #define FIRST_MATCH_DIFF_PERCENTAGE 10
 
-/* the percentage the number of differences between a state's transition
+/* The percentage the number of differences between a state's transition
  * table and the most similar proto must be of the state's total number
- * of out-transitions to use the proto as an acceptable close match
+ * of out-transitions to use the proto as an acceptable close match.
  */
 #define ACCEPTABLE_DIFF_PERCENTAGE 50
 
-/* the percentage the number of homogeneous out-transitions of a state
+/* The percentage the number of homogeneous out-transitions of a state
  * must be of the number of total out-transitions of the state in order
- * to consider making a template from the state
+ * to consider making a template from the state.
  */
 #define TEMPLATE_SAME_PERCENTAGE 60
 
-/* the percentage the number of differences between a state's transition
+/* The percentage the number of differences between a state's transition
  * table and the most similar proto must be of the state's total number
- * of out-transitions to create a new proto from the state
+ * of out-transitions to create a new proto from the state.
  */
 #define NEW_PROTO_DIFF_PERCENTAGE 20
 
-/* the percentage the total number of out-transitions of a state must be
+/* The percentage the total number of out-transitions of a state must be
  * of the number of equivalence classes in order to consider trying to
  * fit the transition table into "holes" inside the nxt/chk table.
  */
 #define INTERIOR_FIT_PERCENTAGE 15
 
-/* size of region set aside to cache the complete transition table of
- * protos on the proto queue to enable quick comparisons
+/* Size of region set aside to cache the complete transition table of
+ * protos on the proto queue to enable quick comparisons.
  */
 #define PROT_SAVE_SIZE 2000
 
 #define MSP 50 /* maximum number of saved protos (protos on the proto queue) */
 
-/* maximum number of out-transitions a state can have that we'll rummage
+/* Maximum number of out-transitions a state can have that we'll rummage
  * around through the interior of the internal fast table looking for a
- * spot for it
+ * spot for it.
  */
 #define MAX_XTIONS_FULL_INTERIOR_FIT 4
 
-/* maximum number of rules which will be reported as being associated
- * with a DFA state
+/* Maximum number of rules which will be reported as being associated
+ * with a DFA state.
  */
 #define MAX_ASSOC_RULES 100
 
-/* number that, if used to subscript an array, has a good chance of producing
- * an error; should be small enough to fit into a short
+/* Number that, if used to subscript an array, has a good chance of producing
+ * an error; should be small enough to fit into a short.
  */
 #define BAD_SUBSCRIPT -32767
 
-/* absolute value of largest number that can be stored in a short, with a
+/* Absolute value of largest number that can be stored in a short, with a
  * bit of slop thrown in for general paranoia.
  */
 #define MAX_SHORT 32766
@@ -307,19 +309,19 @@ char *malloc(), *realloc();
 
 /* Declarations for global variables. */
 
-/* variables for symbol tables:
+/* Variables for symbol tables:
  * sctbl - start-condition symbol table
  * ndtbl - name-definition symbol table
  * ccltab - character class text symbol table
  */
 
 struct hash_entry
-    {
-    struct hash_entry *prev, *next;
-    char *name;
-    char *str_val;
-    int int_val;
-    } ;
+       {
+       struct hash_entry *prev, *next;
+       char *name;
+       char *str_val;
+       int int_val;
+       } ;
 
 typedef struct hash_entry *hash_table[];
 
@@ -332,7 +334,7 @@ extern struct hash_entry *sctbl[START_COND_HASH_SIZE];
 extern struct hash_entry *ccltab[CCL_HASH_SIZE];
 
 
-/* variables for flags:
+/* Variables for flags:
  * printstats - if true (-v), dump statistics
  * syntaxerror - true if a syntax error has been found
  * eofseen - true if we've seen an eof in the input file
@@ -379,10 +381,10 @@ extern int yymore_used, reject, real_reject, continued_action;
 extern int yymore_really_used, reject_really_used;
 
 
-/* variables used in the flex input routines:
+/* Variables used in the flex input routines:
  * datapos - characters on current output line
  * dataline - number of contiguous lines of data in current data
- *    statement.  Used to generate readable -f output
+ *     statement.  Used to generate readable -f output
  * linenum - current input line number
  * skelfile - the skeleton file
  * skel - compiled-in skeleton array
@@ -399,9 +401,9 @@ extern int yymore_really_used, reject_really_used;
  * prolog - pointer to where the prolog starts in action_array
  * action_offset - index where the non-prolog starts in action_array
  * action_index - index where the next action should go, with respect
- *                to "action"
+ *     to "action"
  * action - pointer to where non-prolog starts; equal to
- *          &action_array[action_offset]
+ *     &action_array[action_offset]
  */
 
 extern int datapos, dataline, linenum;
@@ -417,7 +419,7 @@ extern char *action_array, *prolog, *action;
 extern int action_size, action_offset, action_index;
 
 
-/* variables for stack of states having only one out-transition:
+/* Variables for stack of states having only one out-transition:
  * onestate - state number
  * onesym - transition symbol
  * onenext - target state
@@ -429,10 +431,10 @@ extern int onestate[ONE_STACK_SIZE], onesym[ONE_STACK_SIZE];
 extern int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp;
 
 
-/* variables for nfa machine data:
+/* Variables for nfa machine data:
  * current_mns - current maximum on number of NFA states
  * num_rules - number of the last accepting state; also is number of
- *             rules created so far
+ *     rules created so far
  * num_eof_rules - number of <<EOF>> rules
  * default_rule - number of the default rule
  * current_max_rules - current maximum number of rules
@@ -446,14 +448,14 @@ extern int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp;
  * accptnum - accepting number
  * assoc_rule - rule associated with this NFA state (or 0 if none)
  * state_type - a STATE_xxx type identifying whether the state is part
- *              of a normal rule, the leading state in a trailing context
- *              rule (i.e., the state which marks the transition from
- *              recognizing the text-to-be-matched to the beginning of
- *              the trailing context), or a subsequent state in a trailing
- *              context rule
+ *     of a normal rule, the leading state in a trailing context
+ *     rule (i.e., the state which marks the transition from
+ *     recognizing the text-to-be-matched to the beginning of
+ *     the trailing context), or a subsequent state in a trailing
+ *     context rule
  * rule_type - a RULE_xxx type identifying whether this a ho-hum
- *             normal rule or one which has variable head & trailing
- *             context
+ *     normal rule or one which has variable head & trailing
+ *     context
  * rule_linenum - line number associated with rule
  * rule_useful - true if we've determined that the rule can be matched
  */
@@ -464,27 +466,27 @@ extern int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2;
 extern int *accptnum, *assoc_rule, *state_type;
 extern int *rule_type, *rule_linenum, *rule_useful;
 
-/* different types of states; values are useful as masks, as well, for
- * routines like check_trailing_context()
+/* Different types of states; values are useful as masks, as well, for
+ * routines like check_trailing_context().
  */
 #define STATE_NORMAL 0x1
 #define STATE_TRAILING_CONTEXT 0x2
 
-/* global holding current type of state we're making */
+/* Global holding current type of state we're making. */
 
 extern int current_state_type;
 
-/* different types of rules */
+/* Different types of rules. */
 #define RULE_NORMAL 0
 #define RULE_VARIABLE 1
 
-/* true if the input rules include a rule with both variable-length head
- * and trailing context, false otherwise
+/* True if the input rules include a rule with both variable-length head
+ * and trailing context, false otherwise.
  */
 extern int variable_trailing_context_rules;
 
 
-/* variables for protos:
+/* Variables for protos:
  * numtemps - number of templates created
  * numprots - number of protos created
  * protprev - backlink to a more-recently used proto
@@ -500,7 +502,7 @@ extern int numtemps, numprots, protprev[MSP], protnext[MSP], prottbl[MSP];
 extern int protcomst[MSP], firstprot, lastprot, protsave[PROT_SAVE_SIZE];
 
 
-/* variables for managing equivalence classes:
+/* Variables for managing equivalence classes:
  * numecs - number of equivalence classes
  * nextecm - forward link of Equivalence Class members
  * ecgroup - class number or backward link of EC members
@@ -510,14 +512,14 @@ extern int protcomst[MSP], firstprot, lastprot, protsave[PROT_SAVE_SIZE];
  * tecbck - backward link of MEC's
  */
 
-/* reserve enough room in the equivalence class arrays so that we
+/* Reserve enough room in the equivalence class arrays so that we
  * can use the CSIZE'th element to hold equivalence class information
  * for the NUL character.  Later we'll move this information into
  * the 0th element.
  */
 extern int numecs, nextecm[CSIZE + 1], ecgroup[CSIZE + 1], nummecs;
 
-/* meta-equivalence classes are indexed starting at 1, so it's possible
+/* Meta-equivalence classes are indexed starting at 1, so it's possible
  * that they will require positions from 1 .. CSIZE, i.e., CSIZE + 1
  * slots total (since the arrays are 0-based).  nextecm[] and ecgroup[]
  * don't require the extra position since they're indexed from 1 .. CSIZE - 1.
@@ -525,7 +527,7 @@ extern int numecs, nextecm[CSIZE + 1], ecgroup[CSIZE + 1], nummecs;
 extern int tecfwd[CSIZE + 1], tecbck[CSIZE + 1];
 
 
-/* variables for start conditions:
+/* Variables for start conditions:
  * lastsc - last start condition created
  * current_max_scs - current limit on number of start conditions
  * scset - set of rules active in start condition
@@ -534,19 +536,19 @@ extern int tecfwd[CSIZE + 1], tecbck[CSIZE + 1];
  * sceof - true if start condition has EOF rule
  * scname - start condition name
  * actvsc - stack of active start conditions for the current rule;
- *          a negative entry means that the start condition is *not*
- *          active for the current rule.  Start conditions may appear
- *          multiple times on the stack; the entry for it closest
- *          to the top of the stack (i.e., actvsc[actvp]) is the
- *          one to use.  Others are present from "<sc>{" scoping
- *          constructs.
+ *     a negative entry means that the start condition is *not*
+ *     active for the current rule.  Start conditions may appear
+ *     multiple times on the stack; the entry for it closest
+ *     to the top of the stack (i.e., actvsc[actvp]) is the
+ *     one to use.  Others are present from "<sc>{" scoping
+ *     constructs.
  */
 
 extern int lastsc, current_max_scs, *scset, *scbol, *scxclu, *sceof, *actvsc;
 extern char **scname;
 
 
-/* variables for dfa machine data:
+/* Variables for dfa machine data:
  * current_max_dfa_size - current maximum number of NFA states in DFA
  * current_max_xpairs - current maximum number of non-template xtion pairs
  * current_max_template_xpairs - current maximum number of template pairs
@@ -568,8 +570,8 @@ extern char **scname;
  * accsiz - size of accepting set for each dfa state
  * dhash - dfa state hash value
  * numas - number of DFA accepting states created; note that this
- *    is not necessarily the same value as num_rules, which is the analogous
- *    value for the NFA
+ *     is not necessarily the same value as num_rules, which is the analogous
+ *     value for the NFA
  * numsnpairs - number of state/nextstate transition pairs
  * jambase - position in base/def where the default jam table starts
  * jamstate - state number corresponding to "jam" state
@@ -581,15 +583,15 @@ extern int current_max_template_xpairs, current_max_dfas;
 extern int lastdfa, lasttemp, *nxt, *chk, *tnxt;
 extern int *base, *def, *nultrans, NUL_ec, tblend, firstfree, **dss, *dfasiz;
 extern union dfaacc_union
-    {
-    int *dfaacc_set;
-    int dfaacc_state;
-    } *dfaacc;
+       {
+       int *dfaacc_set;
+       int dfaacc_state;
+       } *dfaacc;
 extern int *accsiz, *dhash, numas;
 extern int numsnpairs, jambase, jamstate;
 extern int end_of_buffer_state;
 
-/* variables for ccl information:
+/* Variables for ccl information:
  * lastccl - ccl index of the last created ccl
  * current_maxccls - current limit on the maximum number of unique ccl's
  * cclmap - maps a ccl index to its set pointer
@@ -606,7 +608,7 @@ extern int current_max_ccl_tbl_size;
 extern Char *ccltbl;
 
 
-/* variables for miscellaneous information:
+/* Variables for miscellaneous information:
  * starttime - real-time when we started
  * endtime - real-time when we ended
  * nmstr - last NAME scanned by the scanner
@@ -617,7 +619,7 @@ extern Char *ccltbl;
  * numeps - number of epsilon NFA states created
  * eps2 - number of epsilon states which have 2 out-transitions
  * num_reallocs - number of times it was necessary to realloc() a group
- *               of arrays
+ *       of arrays
  * tmpuses - number of DFA states that chain to templates
  * totnst - total number of NFA states used to make DFA states
  * peakpairs - peak number of transition pairs we had to store internally
@@ -674,28 +676,28 @@ void *allocate_array(), *reallocate_array();
        (Char *) reallocate_array( (void *) array, size, sizeof( Char ) )
 
 
-/* used to communicate between scanner and parser.  The type should really
+/* Used to communicate between scanner and parser.  The type should really
  * be YYSTYPE, but we can't easily get our hands on it.
  */
 extern int yylval;
 
 
-/* external functions that are cross-referenced among the flex source files */
+/* External functions that are cross-referenced among the flex source files. */
 
 
 /* from file ccl.c */
 
-extern void ccladd PROTO((int, int));  /* Add a single character to a ccl */
+extern void ccladd PROTO((int, int));  /* add a single character to a ccl */
 extern int cclinit PROTO((void));      /* make an empty ccl */
 extern void cclnegate PROTO((int));    /* negate a ccl */
 
-/* list the members of a set of characters in CCL form */
+/* List the members of a set of characters in CCL form. */
 extern void list_character_set PROTO((FILE*, int[]));
 
 
 /* from file dfa.c */
 
-/* increase the maximum number of dfas */
+/* Increase the maximum number of dfas. */
 extern void increase_max_dfas PROTO((void));
 
 extern void ntod PROTO((void));        /* convert a ndfa to a dfa */
@@ -703,16 +705,16 @@ extern void ntod PROTO((void));   /* convert a ndfa to a dfa */
 
 /* from file ecs.c */
 
-/* convert character classes to set of equivalence classes */
+/* Convert character classes to set of equivalence classes. */
 extern void ccl2ecl PROTO((void));
 
-/* associate equivalence class numbers with class members */
+/* Associate equivalence class numbers with class members. */
 extern int cre8ecs PROTO((int[], int[], int));
 
-/* update equivalence classes based on character class transitions */
+/* Update equivalence classes based on character class transitions. */
 extern void mkeccl PROTO((Char[], int, int[], int[], int, int));
 
-/* create equivalence class for single character */
+/* Create equivalence class for single character. */
 extern void mkechar PROTO((int, int[], int[]));
 
 
@@ -732,94 +734,94 @@ extern void usage PROTO((void));
 /* Add the given text to the stored actions. */
 extern void add_action PROTO(( char *new_text ));
 
-/* true if a string is all lower case */
+/* True if a string is all lower case. */
 extern int all_lower PROTO((register Char *));
 
-/* true if a string is all upper case */
+/* True if a string is all upper case. */
 extern int all_upper PROTO((register Char *));
 
-/* bubble sort an integer array */
+/* Bubble sort an integer array. */
 extern void bubble PROTO((int [], int));
 
-/* shell sort a character array */
+/* Shell sort a character array. */
 extern void cshell PROTO((Char [], int, int));
 
-/* finish up a block of data declarations */
+/* Finish up a block of data declarations. */
 extern void dataend PROTO((void));
 
-/* report an error message and terminate */
+/* Report an error message and terminate. */
 extern void flexerror PROTO((char[]));
 
-/* report a fatal error message and terminate */
+/* Report a fatal error message and terminate. */
 extern void flexfatal PROTO((char[]));
 
-/* report an error message formatted with one integer argument */
+/* Report an error message formatted with one integer argument. */
 extern void lerrif PROTO((char[], int));
 
-/* report an error message formatted with one string argument */
+/* Report an error message formatted with one string argument. */
 extern void lerrsf PROTO((char[], char[]));
 
-/* spit out a "# line" statement */
+/* Spit out a "# line" statement. */
 extern void line_directive_out PROTO((FILE*));
 
-/* mark the current position in the action array as the end of the prolog */
+/* Mark the current position in the action array as the end of the prolog. */
 extern void mark_prolog PROTO(());
 
-/* generate a data statment for a two-dimensional array */
+/* Generate a data statment for a two-dimensional array. */
 extern void mk2data PROTO((int));
 
 extern void mkdata PROTO((int));       /* generate a data statement */
 
-/* return the integer represented by a string of digits */
+/* Return the integer represented by a string of digits. */
 extern int myctoi PROTO((Char []));
 
-/* write out one section of the skeleton file */
+/* Write out one section of the skeleton file. */
 extern void skelout PROTO((void));
 
-/* output a yy_trans_info structure */
+/* Output a yy_trans_info structure. */
 extern void transition_struct_out PROTO((int, int));
 
-/* set a region of memory to 0 */
+/* Set a region of memory to 0. */
 extern void zero_out PROTO((char *, int));
 
 
 /* from file nfa.c */
 
-/* add an accepting state to a machine */
+/* Add an accepting state to a machine. */
 extern void add_accept PROTO((int, int));
 
-/* make a given number of copies of a singleton machine */
+/* Make a given number of copies of a singleton machine. */
 extern int copysingl PROTO((int, int));
 
-/* debugging routine to write out an nfa */
+/* Debugging routine to write out an nfa. */
 extern void dumpnfa PROTO((int));
 
-/* finish up the processing for a rule */
+/* Finish up the processing for a rule. */
 extern void finish_rule PROTO((int, int, int, int));
 
-/* connect two machines together */
+/* Connect two machines together. */
 extern int link_machines PROTO((int, int));
 
-/* mark each "beginning" state in a machine as being a "normal" (i.e.,
- * not trailing context associated) state
+/* Mark each "beginning" state in a machine as being a "normal" (i.e.,
+ * not trailing context associated) state.
  */
 extern void mark_beginning_as_normal PROTO((register int));
 
-/* make a machine that branches to two machines */
+/* Make a machine that branches to two machines. */
 extern int mkbranch PROTO((int, int));
 
 extern int mkclos PROTO((int));        /* convert a machine into a closure */
 extern int mkopt PROTO((int)); /* make a machine optional */
 
-/* make a machine that matches either one of two machines */
+/* Make a machine that matches either one of two machines. */
 extern int mkor PROTO((int, int));
 
-/* convert a machine into a positive closure */
+/* Convert a machine into a positive closure. */
 extern int mkposcl PROTO((int));
 
 extern int mkrep PROTO((int, int, int));       /* make a replicated machine */
 
-/* create a state with a transition on a given symbol */
+/* Create a state with a transition on a given symbol. */
 extern int mkstate PROTO((int));
 
 extern void new_rule PROTO((void));    /* initialize for a new rule */
@@ -827,19 +829,19 @@ extern void new_rule PROTO((void));       /* initialize for a new rule */
 
 /* from file parse.y */
 
-/* write out a message formatted with one string, pinpointing its location */
+/* Write out a message formatted with one string, pinpointing its location. */
 extern void format_pinpoint_message PROTO((char[], char[]));
 
-/* write out a message, pinpointing its location */
+/* Write out a message, pinpointing its location. */
 extern void pinpoint_message PROTO((char[]));
 
-/* write out a warning, pinpointing it at the given line */
+/* Write out a warning, pinpointing it at the given line. */
 void line_warning PROTO(( char[], int ));
 
-/* write out a message, pinpointing it at the given line */
+/* Write out a message, pinpointing it at the given line. */
 void line_pinpoint PROTO(( char[], int ));
 
-/* report a formatted syntax error */
+/* Report a formatted syntax error. */
 extern void format_synerr PROTO((char [], char[]));
 extern void synerr PROTO((char []));   /* report a syntax error */
 extern void warn PROTO((char []));     /* report a warning */
@@ -848,51 +850,52 @@ extern int yyparse PROTO((void)); /* the YACC parser */
 
 /* from file scan.l */
 
-/* the Flex-generated scanner for flex */
+/* The Flex-generated scanner for flex. */
 extern int flexscan PROTO((void));
 
-/* open the given file (if NULL, stdin) for scanning */
+/* Open the given file (if NULL, stdin) for scanning. */
 extern void set_input_file PROTO((char*));
 
-/* wrapup a file in the lexical analyzer */
+/* Wrapup a file in the lexical analyzer. */
 extern int yywrap PROTO((void));
 
 
 /* from file sym.c */
 
-/* save the text of a character class */
+/* Save the text of a character class. */
 extern void cclinstal PROTO ((Char [], int));
 
-/* lookup the number associated with character class */
+/* Lookup the number associated with character class. */
 extern int ccllookup PROTO((Char []));
 
 extern void ndinstal PROTO((char[], Char[]));  /* install a name definition */
-/* increase maximum number of SC's */
+/* Increase maximum number of SC's. */
 extern void scextend PROTO((void));
 extern void scinstal PROTO((char[], int));     /* make a start condition */
 
-/* lookup the number associated with a start condition */
+/* Lookup the number associated with a start condition. */
 extern int sclookup PROTO((char[]));
 
 
 /* from file tblcmp.c */
 
-/* build table entries for dfa state */
+/* Build table entries for dfa state. */
 extern void bldtbl PROTO((int[], int, int, int, int));
 
 extern void cmptmps PROTO((void));     /* compress template table entries */
 extern void inittbl PROTO((void));     /* initialize transition tables */
-/* make the default, "jam" table entries */
+/* Make the default, "jam" table entries. */
 extern void mkdeftbl PROTO((void));
 
-/* create table entries for a state (or state fragment) which has
- * only one out-transition */
+/* Create table entries for a state (or state fragment) which has
+ * only one out-transition.
+ */
 extern void mk1tbl PROTO((int, int, int, int));
 
-/* place a state into full speed transition table */
+/* Place a state into full speed transition table. */
 extern void place_state PROTO((int*, int, int));
 
-/* save states with only one out-transition to be processed later */
+/* Save states with only one out-transition to be processed later. */
 extern void stack1 PROTO((int, int, int, int));
 
 
@@ -901,7 +904,7 @@ extern void stack1 PROTO((int, int, int, int));
 extern int yylex PROTO((void));
 
 
-/* The Unix kernel calls used here */
+/* The Unix system calls used here. */
 
 extern int read PROTO((int, char*, int));
 extern int unlink PROTO((char*));
diff --git a/gen.c b/gen.c
index b1f6e98260d282ae12aa2356072bc7a715cc4ff9..db3f4a1660ef4971943f36bf988264174755e5ee 100644 (file)
--- a/gen.c
+++ b/gen.c
@@ -42,14 +42,14 @@ void indent_put2s PROTO((char [], char []));
 void indent_puts PROTO((char []));
 
 
-static int indent_level = 0; /* each level is 4 spaces */
+static int indent_level = 0; /* each level is 8 spaces */
 
 #define indent_up() (++indent_level)
 #define indent_down() (--indent_level)
 #define set_indent(indent_val) indent_level = indent_val
 
-/* *everything* is done in terms of arrays starting at 1, so provide
- * a null entry for the zero element of all C arrays
+/* *Everything* is done in terms of arrays starting at 1, so provide
+ * a null entry for the zero element of all C arrays.
  */
 static char C_short_decl[] = "static const short int %s[%d] =\n    {   0,\n";
 static char C_long_decl[] = "static const long int %s[%d] =\n    {   0,\n";
@@ -57,1278 +57,1298 @@ static char C_state_decl[] =
        "static const yy_state_type %s[%d] =\n    {   0,\n";
 
 
-/* indent to the current level */
+/* Indent to the current level. */
 
 void do_indent()
+       {
+       register int i = indent_level * 8;
 
-    {
-    register int i = indent_level * 4;
+       while ( i >= 8 )
+               {
+               putchar( '\t' );
+               i -= 8;
+               }
 
-    while ( i >= 8 )
-       {
-       putchar( '\t' );
-       i -= 8;
-       }
-    
-    while ( i > 0 )
-       {
-       putchar( ' ' );
-       --i;
+       while ( i > 0 )
+               {
+               putchar( ' ' );
+               --i;
+               }
        }
-    }
 
 
-/* generate the code to keep backtracking information */
+/* Generate the code to keep backtracking information. */
 
 void gen_backtracking()
+       {
+       if ( reject || num_backtracking == 0 )
+               return;
 
-    {
-    if ( reject || num_backtracking == 0 )
-       return;
-
-    if ( fullspd )
-       indent_puts( "if ( yy_current_state[-1].yy_nxt )" );
-    else
-       indent_puts( "if ( yy_accept[yy_current_state] )" );
+       if ( fullspd )
+               indent_puts( "if ( yy_current_state[-1].yy_nxt )" );
+       else
+               indent_puts( "if ( yy_accept[yy_current_state] )" );
 
-    indent_up();
-    indent_puts( "{" );
-    indent_puts( "yy_last_accepting_state = yy_current_state;" );
-    indent_puts( "yy_last_accepting_cpos = yy_cp;" );
-    indent_puts( "}" );
-    indent_down();
-    }
+       indent_up();
+       indent_puts( "{" );
+       indent_puts( "yy_last_accepting_state = yy_current_state;" );
+       indent_puts( "yy_last_accepting_cpos = yy_cp;" );
+       indent_puts( "}" );
+       indent_down();
+       }
 
 
-/* generate the code to perform the backtrack */
+/* Generate the code to perform the backtrack. */
 
 void gen_bt_action()
+       {
+       if ( reject || num_backtracking == 0 )
+               return;
 
-    {
-    if ( reject || num_backtracking == 0 )
-       return;
-
-    set_indent( 3 );
+       set_indent( 3 );
 
-    indent_puts( "case 0: /* must backtrack */" );
-    indent_puts( "/* undo the effects of YY_DO_BEFORE_ACTION */" );
-    indent_puts( "*yy_cp = yy_hold_char;" );
+       indent_puts( "case 0: /* must backtrack */" );
+       indent_puts( "/* undo the effects of YY_DO_BEFORE_ACTION */" );
+       indent_puts( "*yy_cp = yy_hold_char;" );
 
-    if ( fullspd || fulltbl )
-       indent_puts( "yy_cp = yy_last_accepting_cpos + 1;" );
-    else
-       /* backtracking info for compressed tables is taken \after/
-        * yy_cp has been incremented for the next state
-        */
-       indent_puts( "yy_cp = yy_last_accepting_cpos;" );
+       if ( fullspd || fulltbl )
+               indent_puts( "yy_cp = yy_last_accepting_cpos + 1;" );
+       else
+               /* Backtracking info for compressed tables is taken \after/
+                * yy_cp has been incremented for the next state.
+                */
+               indent_puts( "yy_cp = yy_last_accepting_cpos;" );
 
-    indent_puts( "yy_current_state = yy_last_accepting_state;" );
-    indent_puts( "goto yy_find_action;" );
-    putchar( '\n' );
+       indent_puts( "yy_current_state = yy_last_accepting_state;" );
+       indent_puts( "goto yy_find_action;" );
+       putchar( '\n' );
 
-    set_indent( 0 );
-    }
+       set_indent( 0 );
+       }
 
 
-/* genctbl - generates full speed compressed transition table
- *
- * synopsis
- *     genctbl();
- */
+/* genctbl - generates full speed compressed transition table */
 
 void genctbl()
-
-    {
-    register int i;
-    int end_of_buffer_action = num_rules + 1;
-
-    /* table of verify for transition and offset to next state */
-    printf( "static const struct yy_trans_info yy_transition[%d] =\n",
-           tblend + numecs + 1 );
-    printf( "    {\n" );
-    
-    /* We want the transition to be represented as the offset to the
-     * next state, not the actual state number, which is what it currently is.
-     * The offset is base[nxt[i]] - base[chk[i]].  That's just the
-     * difference between the starting points of the two involved states
-     * (to - from).
-     *
-     * first, though, we need to find some way to put in our end-of-buffer
-     * flags and states.  We do this by making a state with absolutely no
-     * transitions.  We put it at the end of the table.
-     */
-    /* at this point, we're guaranteed that there's enough room in nxt[]
-     * and chk[] to hold tblend + numecs entries.  We need just two slots.
-     * One for the action and one for the end-of-buffer transition.  We
-     * now *assume* that we're guaranteed the only character we'll try to
-     * index this nxt/chk pair with is EOB, i.e., 0, so we don't have to
-     * make sure there's room for jam entries for other characters.
-     */
-
-    base[lastdfa + 1] = tblend + 2;
-    nxt[tblend + 1] = end_of_buffer_action;
-    chk[tblend + 1] = numecs + 1;
-    chk[tblend + 2] = 1; /* anything but EOB */
-    nxt[tblend + 2] = 0; /* so that "make test" won't show arb. differences */
-
-    /* make sure every state has a end-of-buffer transition and an action # */
-    for ( i = 0; i <= lastdfa; ++i )
        {
-       register int anum = dfaacc[i].dfaacc_state;
+       register int i;
+       int end_of_buffer_action = num_rules + 1;
+
+       /* Table of verify for transition and offset to next state. */
+       printf( "static const struct yy_trans_info yy_transition[%d] =\n",
+               tblend + numecs + 1 );
+       printf( "    {\n" );
+
+       /* We want the transition to be represented as the offset to the
+        * next state, not the actual state number, which is what it currently
+        * is.  The offset is base[nxt[i]] - base[chk[i]].  That's just the
+        * difference between the starting points of the two involved states
+        * (to - from).
+        *
+        * First, though, we need to find some way to put in our end-of-buffer
+        * flags and states.  We do this by making a state with absolutely no
+        * transitions.  We put it at the end of the table.
+        */
 
-       chk[base[i]] = EOB_POSITION;
-       chk[base[i] - 1] = ACTION_POSITION;
-       nxt[base[i] - 1] = anum;        /* action number */
-       }
+       /* At this point, we're guaranteed that there's enough room in nxt[]
+        * and chk[] to hold tblend + numecs entries.  We need just two slots.
+        * One for the action and one for the end-of-buffer transition.  We
+        * now *assume* that we're guaranteed the only character we'll try to
+        * index this nxt/chk pair with is EOB, i.e., 0, so we don't have to
+        * make sure there's room for jam entries for other characters.
+        */
 
-    for ( i = 0; i <= tblend; ++i )
-       {
-       if ( chk[i] == EOB_POSITION )
-           transition_struct_out( 0, base[lastdfa + 1] - i );
+       base[lastdfa + 1] = tblend + 2;
+       nxt[tblend + 1] = end_of_buffer_action;
+       chk[tblend + 1] = numecs + 1;
+       chk[tblend + 2] = 1; /* anything but EOB */
 
-       else if ( chk[i] == ACTION_POSITION )
-           transition_struct_out( 0, nxt[i] );
+       /* So that "make test" won't show arb. differences. */
+       nxt[tblend + 2] = 0;
 
-       else if ( chk[i] > numecs || chk[i] == 0 )
-           transition_struct_out( 0, 0 );              /* unused slot */
+       /* Make sure every state has a end-of-buffer transition and an
+        * action #.
+        */
+       for ( i = 0; i <= lastdfa; ++i )
+               {
+               register int anum = dfaacc[i].dfaacc_state;
 
-       else    /* verify, transition */
-           transition_struct_out( chk[i], base[nxt[i]] - (i - chk[i]) );
-       }
+               chk[base[i]] = EOB_POSITION;
+               chk[base[i] - 1] = ACTION_POSITION;
+               nxt[base[i] - 1] = anum;        /* action number */
+               }
 
+       for ( i = 0; i <= tblend; ++i )
+               {
+               if ( chk[i] == EOB_POSITION )
+                       transition_struct_out( 0, base[lastdfa + 1] - i );
 
-    /* here's the final, end-of-buffer state */
-    transition_struct_out( chk[tblend + 1], nxt[tblend + 1] );
-    transition_struct_out( chk[tblend + 2], nxt[tblend + 2] );
+               else if ( chk[i] == ACTION_POSITION )
+                       transition_struct_out( 0, nxt[i] );
 
-    printf( "    };\n" );
-    printf( "\n" );
+               else if ( chk[i] > numecs || chk[i] == 0 )
+                       transition_struct_out( 0, 0 );  /* unused slot */
 
-    /* table of pointers to start states */
-    printf( "static const struct yy_trans_info *yy_start_state_list[%d] =\n",
-           lastsc * 2 + 1 );
-    printf( "    {\n" );
+               else    /* verify, transition */
+                       transition_struct_out( chk[i],
+                                               base[nxt[i]] - (i - chk[i]) );
+               }
 
-    for ( i = 0; i <= lastsc * 2; ++i )
-       printf( "    &yy_transition[%d],\n", base[i] );
 
-    dataend();
+       /* Here's the final, end-of-buffer state. */
+       transition_struct_out( chk[tblend + 1], nxt[tblend + 1] );
+       transition_struct_out( chk[tblend + 2], nxt[tblend + 2] );
 
-    if ( useecs )
-       genecs();
-    }
+       printf( "    };\n" );
+       printf( "\n" );
 
+       /* Table of pointers to start states. */
+       printf(
+       "static const struct yy_trans_info *yy_start_state_list[%d] =\n",
+               lastsc * 2 + 1 );
+       printf( "    {\n" );    /* } so vi doesn't get confused */
 
-/* generate equivalence-class tables */
+       for ( i = 0; i <= lastsc * 2; ++i )
+               printf( "    &yy_transition[%d],\n", base[i] );
 
-void genecs()
+       dataend();
+
+       if ( useecs )
+               genecs();
+       }
 
-    {
-    register int i, j;
-    static char C_char_decl[] = "static const %s %s[%d] =\n    {   0,\n";
-    int numrows;
-    Char clower();
 
-    if ( numecs < csize )
-       printf( C_char_decl, "YY_CHAR", "yy_ec", csize );
-    else
-       printf( C_char_decl, "short", "yy_ec", csize );
+/* Generate equivalence-class tables. */
 
-    for ( i = 1; i < csize; ++i )
+void genecs()
        {
-       if ( caseins && (i >= 'A') && (i <= 'Z') )
-           ecgroup[i] = ecgroup[clower( i )];
+       Char clower();
+       static char C_char_decl[] = "static const %s %s[%d] =\n    {   0,\n";
+                                       /* } so vi doesn't get confused */
+       register int i, j;
+       int numrows;
+
+       if ( numecs < csize )
+               printf( C_char_decl, "YY_CHAR", "yy_ec", csize );
+       else
+               printf( C_char_decl, "short", "yy_ec", csize );
 
-       ecgroup[i] = abs( ecgroup[i] );
-       mkdata( ecgroup[i] );
-       }
+       for ( i = 1; i < csize; ++i )
+               {
+               if ( caseins && (i >= 'A') && (i <= 'Z') )
+                       ecgroup[i] = ecgroup[clower( i )];
 
-    dataend();
+               ecgroup[i] = abs( ecgroup[i] );
+               mkdata( ecgroup[i] );
+               }
 
-    if ( trace )
-       {
-       char *readable_form();
+       dataend();
 
-       fputs( "\n\nEquivalence Classes:\n\n", stderr );
+       if ( trace )
+               {
+               char *readable_form();
 
-       numrows = csize / 8;
+               fputs( "\n\nEquivalence Classes:\n\n", stderr );
 
-       for ( j = 0; j < numrows; ++j )
-           {
-           for ( i = j; i < csize; i = i + numrows )
-               {
-               fprintf( stderr, "%4s = %-2d", readable_form( i ), ecgroup[i] );
+               numrows = csize / 8;
 
-               putc( ' ', stderr );
-               }
+               for ( j = 0; j < numrows; ++j )
+                       {
+                       for ( i = j; i < csize; i = i + numrows )
+                               {
+                               fprintf( stderr, "%4s = %-2d",
+                                       readable_form( i ), ecgroup[i] );
+
+                               putc( ' ', stderr );
+                               }
 
-           putc( '\n', stderr );
-           }
+                       putc( '\n', stderr );
+                       }
+               }
        }
-    }
 
 
-/* generate the code to find the action number */
+/* Generate the code to find the action number. */
 
 void gen_find_action()
+       {
+       if ( fullspd )
+               indent_puts( "yy_act = yy_current_state[-1].yy_nxt;" );
 
-    {
-    if ( fullspd )
-       indent_puts( "yy_act = yy_current_state[-1].yy_nxt;" );
+       else if ( fulltbl )
+               indent_puts( "yy_act = yy_accept[yy_current_state];" );
 
-    else if ( fulltbl )
-       indent_puts( "yy_act = yy_accept[yy_current_state];" );
+       else if ( reject )
+               {
+               indent_puts( "yy_current_state = *--yy_state_ptr;" );
+               indent_puts( "yy_lp = yy_accept[yy_current_state];" );
 
-    else if ( reject )
-       {
-       indent_puts( "yy_current_state = *--yy_state_ptr;" );
-       indent_puts( "yy_lp = yy_accept[yy_current_state];" );
+               puts(
+               "find_rule: /* we branch to this label when backtracking */" );
 
-       puts( "find_rule: /* we branch to this label when backtracking */" );
+               indent_puts(
+               "for ( ; ; ) /* until we find what rule we matched */" );
 
-       indent_puts( "for ( ; ; ) /* until we find what rule we matched */" );
+               indent_up();
 
-       indent_up();
+               indent_puts( "{" );
 
-       indent_puts( "{" );
+               indent_puts(
+               "if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )" );
+               indent_up();
+               indent_puts( "{" );
+               indent_puts( "yy_act = yy_acclist[yy_lp];" );
 
-       indent_puts( "if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )" );
-       indent_up();
-       indent_puts( "{" );
-       indent_puts( "yy_act = yy_acclist[yy_lp];" );
-
-       if ( variable_trailing_context_rules )
-           {
-           indent_puts( "if ( yy_act & YY_TRAILING_HEAD_MASK ||" );
-           indent_puts( "     yy_looking_for_trail_begin )" );
-           indent_up();
-           indent_puts( "{" );
-
-           indent_puts( "if ( yy_act == yy_looking_for_trail_begin )" );
-           indent_up();
-           indent_puts( "{" );
-           indent_puts( "yy_looking_for_trail_begin = 0;" );
-           indent_puts( "yy_act &= ~YY_TRAILING_HEAD_MASK;" );
-           indent_puts( "break;" );
-           indent_puts( "}" );
-           indent_down();
-
-           indent_puts( "}" );
-           indent_down();
-
-           indent_puts( "else if ( yy_act & YY_TRAILING_MASK )" );
-           indent_up();
-           indent_puts( "{" );
-           indent_puts(
+               if ( variable_trailing_context_rules )
+                       {
+                       indent_puts( "if ( yy_act & YY_TRAILING_HEAD_MASK ||" );
+                       indent_puts( "     yy_looking_for_trail_begin )" );
+                       indent_up();
+                       indent_puts( "{" );
+
+                       indent_puts(
+                               "if ( yy_act == yy_looking_for_trail_begin )" );
+                       indent_up();
+                       indent_puts( "{" );
+                       indent_puts( "yy_looking_for_trail_begin = 0;" );
+                       indent_puts( "yy_act &= ~YY_TRAILING_HEAD_MASK;" );
+                       indent_puts( "break;" );
+                       indent_puts( "}" );
+                       indent_down();
+
+                       indent_puts( "}" );
+                       indent_down();
+
+                       indent_puts( "else if ( yy_act & YY_TRAILING_MASK )" );
+                       indent_up();
+                       indent_puts( "{" );
+                       indent_puts(
                "yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;" );
-           indent_puts(
+                       indent_puts(
                "yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;" );
 
-           if ( real_reject )
+                       if ( real_reject )
+                               {
+                               /* Remember matched text in case we back up
+                                * due to REJECT.
+                                */
+                               indent_puts( "yy_full_match = yy_cp;" );
+                               indent_puts( "yy_full_state = yy_state_ptr;" );
+                               indent_puts( "yy_full_lp = yy_lp;" );
+                               }
+
+                       indent_puts( "}" );
+                       indent_down();
+
+                       indent_puts( "else" );
+                       indent_up();
+                       indent_puts( "{" );
+                       indent_puts( "yy_full_match = yy_cp;" );
+                       indent_puts( "yy_full_state = yy_state_ptr;" );
+                       indent_puts( "yy_full_lp = yy_lp;" );
+                       indent_puts( "break;" );
+                       indent_puts( "}" );
+                       indent_down();
+
+                       indent_puts( "++yy_lp;" );
+                       indent_puts( "goto find_rule;" );
+                       }
+
+               else
                {
-               /* remember matched text in case we back up due to REJECT */
+               /* Remember matched text in case we back up due to trailing
+                * context plus REJECT.
+                */
+               indent_up();
+               indent_puts( "{" );
                indent_puts( "yy_full_match = yy_cp;" );
-               indent_puts( "yy_full_state = yy_state_ptr;" );
-               indent_puts( "yy_full_lp = yy_lp;" );
+               indent_puts( "break;" );
+               indent_puts( "}" );
+               indent_down();
                }
 
-           indent_puts( "}" );
-           indent_down();
+               indent_puts( "}" );
+               indent_down();
 
-           indent_puts( "else" );
-           indent_up();
-           indent_puts( "{" );
-           indent_puts( "yy_full_match = yy_cp;" );
-           indent_puts( "yy_full_state = yy_state_ptr;" );
-           indent_puts( "yy_full_lp = yy_lp;" );
-           indent_puts( "break;" );
-           indent_puts( "}" );
-           indent_down();
+               indent_puts( "--yy_cp;" );
 
-           indent_puts( "++yy_lp;" );
-           indent_puts( "goto find_rule;" );
-           }
+               /* We could consolidate the following two lines with those at
+                * the beginning, but at the cost of complaints that we're
+                * branching inside a loop.
+                */
+               indent_puts( "yy_current_state = *--yy_state_ptr;" );
+               indent_puts( "yy_lp = yy_accept[yy_current_state];" );
 
-       else
-           {
-           /* remember matched text in case we back up due to trailing context
-            * plus REJECT
-            */
-           indent_up();
-           indent_puts( "{" );
-           indent_puts( "yy_full_match = yy_cp;" );
-           indent_puts( "break;" );
-           indent_puts( "}" );
-           indent_down();
-           }
+               indent_puts( "}" );
 
-       indent_puts( "}" );
-       indent_down();
-
-       indent_puts( "--yy_cp;" );
-
-       /* we could consolidate the following two lines with those at
-        * the beginning, but at the cost of complaints that we're
-        * branching inside a loop
-        */
-       indent_puts( "yy_current_state = *--yy_state_ptr;" );
-       indent_puts( "yy_lp = yy_accept[yy_current_state];" );
-
-       indent_puts( "}" );
+               indent_down();
+               }
 
-       indent_down();
+       else
+               /* compressed */
+               indent_puts( "yy_act = yy_accept[yy_current_state];" );
        }
 
-    else
-       /* compressed */
-       indent_puts( "yy_act = yy_accept[yy_current_state];" );
-    }
 
-
-/* genftbl - generates full transition table
- *
- * synopsis
- *     genftbl();
- */
+/* genftbl - generates full transition table */
 
 void genftbl()
+       {
+       register int i;
+       int end_of_buffer_action = num_rules + 1;
 
-    {
-    register int i;
-    int end_of_buffer_action = num_rules + 1;
-
-    printf( C_short_decl, "yy_accept", lastdfa + 1 );
-
+       printf( C_short_decl, "yy_accept", lastdfa + 1 );
 
-    dfaacc[end_of_buffer_state].dfaacc_state = end_of_buffer_action;
+       dfaacc[end_of_buffer_state].dfaacc_state = end_of_buffer_action;
 
-    for ( i = 1; i <= lastdfa; ++i )
-       {
-       register int anum = dfaacc[i].dfaacc_state;
+       for ( i = 1; i <= lastdfa; ++i )
+               {
+               register int anum = dfaacc[i].dfaacc_state;
 
-       mkdata( anum );
+               mkdata( anum );
 
-       if ( trace && anum )
-           fprintf( stderr, "state # %d accepts: [%d]\n", i, anum );
-       }
+               if ( trace && anum )
+                       fprintf( stderr, "state # %d accepts: [%d]\n",
+                               i, anum );
+               }
 
-    dataend();
+       dataend();
 
-    if ( useecs )
-       genecs();
+       if ( useecs )
+               genecs();
 
-    /* don't have to dump the actual full table entries - they were created
-     * on-the-fly
-     */
-    }
+       /* Don't have to dump the actual full table entries - they were
+        * created on-the-fly.
+        */
+       }
 
 
-/* generate the code to find the next compressed-table state */
+/* Generate the code to find the next compressed-table state. */
 
 void gen_next_compressed_state( char_map )
 char *char_map;
-
-    {
-    indent_put2s( "register YY_CHAR yy_c = %s;", char_map );
-
-    /* save the backtracking info \before/ computing the next state
-     * because we always compute one more state than needed - we
-     * always proceed until we reach a jam state
-     */
-    gen_backtracking();
-
-    indent_puts(
-    "while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )" );
-    indent_up();
-    indent_puts( "{" );
-    indent_puts( "yy_current_state = yy_def[yy_current_state];" );
-
-    if ( usemecs )
        {
-       /* we've arrange it so that templates are never chained
-        * to one another.  This means we can afford make a
-        * very simple test to see if we need to convert to
-        * yy_c's meta-equivalence class without worrying
-        * about erroneously looking up the meta-equivalence
-        * class twice
+       indent_put2s( "register YY_CHAR yy_c = %s;", char_map );
+
+       /* Save the backtracking info \before/ computing the next state
+        * because we always compute one more state than needed - we
+        * always proceed until we reach a jam state
         */
-       do_indent();
-       /* lastdfa + 2 is the beginning of the templates */
-       printf( "if ( yy_current_state >= %d )\n", lastdfa + 2 );
+       gen_backtracking();
 
+       indent_puts(
+"while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )" );
        indent_up();
-       indent_puts( "yy_c = yy_meta[(unsigned int) yy_c];" );
-       indent_down();
-       }
+       indent_puts( "{" );
+       indent_puts( "yy_current_state = yy_def[yy_current_state];" );
 
-    indent_puts( "}" );
-    indent_down();
+       if ( usemecs )
+               {
+               /* We've arrange it so that templates are never chained
+                * to one another.  This means we can afford make a
+                * very simple test to see if we need to convert to
+                * yy_c's meta-equivalence class without worrying
+                * about erroneously looking up the meta-equivalence
+                * class twice
+                */
+               do_indent();
+
+               /* lastdfa + 2 is the beginning of the templates */
+               printf( "if ( yy_current_state >= %d )\n", lastdfa + 2 );
+
+               indent_up();
+               indent_puts( "yy_c = yy_meta[(unsigned int) yy_c];" );
+               indent_down();
+               }
 
-    indent_puts(
+       indent_puts( "}" );
+       indent_down();
+
+       indent_puts(
        "yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];" );
-    }
+       }
 
 
-/* generate the code to find the next match */
+/* Generate the code to find the next match. */
 
 void gen_next_match()
-
-    {
-    /* NOTE - changes in here should be reflected in gen_next_state() and
-     * gen_NUL_trans()
-     */
-    char *char_map = useecs ? "yy_ec[*yy_cp]" : "*yy_cp";
-    char *char_map_2 = useecs ? "yy_ec[*++yy_cp]" : "*++yy_cp";
-    
-    if ( fulltbl )
        {
-       indent_put2s(
-           "while ( (yy_current_state = yy_nxt[yy_current_state][%s]) > 0 )",
-               char_map );
+       /* NOTE - changes in here should be reflected in gen_next_state() and
+        * gen_NUL_trans().
+        */
+       char *char_map = useecs ? "yy_ec[*yy_cp]" : "*yy_cp";
+       char *char_map_2 = useecs ? "yy_ec[*++yy_cp]" : "*++yy_cp";
 
-       indent_up();
+       if ( fulltbl )
+               {
+               indent_put2s(
+       "while ( (yy_current_state = yy_nxt[yy_current_state][%s]) > 0 )",
+                               char_map );
 
-       if ( num_backtracking > 0 )
-           {
-           indent_puts( "{" );
-           gen_backtracking();
-           putchar( '\n' );
-           }
+               indent_up();
 
-       indent_puts( "++yy_cp;" );
+               if ( num_backtracking > 0 )
+                       {
+                       indent_puts( "{" );     /* } for vi */
+                       gen_backtracking();
+                       putchar( '\n' );
+                       }
 
-       if ( num_backtracking > 0 )
-           indent_puts( "}" );
+               indent_puts( "++yy_cp;" );
 
-       indent_down();
+               if ( num_backtracking > 0 )
+                       /* { for vi */
+                       indent_puts( "}" );
 
-       putchar( '\n' );
-       indent_puts( "yy_current_state = -yy_current_state;" );
-       }
+               indent_down();
 
-    else if ( fullspd )
-       {
-       indent_puts( "{" );
-       indent_puts( "register const struct yy_trans_info *yy_trans_info;\n" );
-       indent_puts( "register YY_CHAR yy_c;\n" );
-       indent_put2s( "for ( yy_c = %s;", char_map );
-       indent_puts(
+               putchar( '\n' );
+               indent_puts( "yy_current_state = -yy_current_state;" );
+               }
+
+       else if ( fullspd )
+               {
+               indent_puts( "{" );     /* } for vi */
+               indent_puts(
+               "register const struct yy_trans_info *yy_trans_info;\n" );
+               indent_puts( "register YY_CHAR yy_c;\n" );
+               indent_put2s( "for ( yy_c = %s;", char_map );
+               indent_puts(
        "      (yy_trans_info = &yy_current_state[yy_c])->yy_verify == yy_c;" );
-       indent_put2s( "      yy_c = %s )", char_map_2 );
+               indent_put2s( "      yy_c = %s )", char_map_2 );
 
-       indent_up();
+               indent_up();
 
-       if ( num_backtracking > 0 )
-           indent_puts( "{" );
+               if ( num_backtracking > 0 )
+                       indent_puts( "{" );     /* } for vi */
 
-       indent_puts( "yy_current_state += yy_trans_info->yy_nxt;" );
+               indent_puts( "yy_current_state += yy_trans_info->yy_nxt;" );
 
-       if ( num_backtracking > 0 )
-           {
-           putchar( '\n' );
-           gen_backtracking();
-           indent_puts( "}" );
-           }
+               if ( num_backtracking > 0 )
+                       {
+                       putchar( '\n' );
+                       gen_backtracking();     /* { for vi */
+                       indent_puts( "}" );
+                       }
 
-       indent_down();
-       indent_puts( "}" );
-       }
+               indent_down();  /* { for vi */
+               indent_puts( "}" );
+               }
 
-    else
-       { /* compressed */
-       indent_puts( "do" );
+       else
+               { /* compressed */
+               indent_puts( "do" );
 
-       indent_up();
-       indent_puts( "{" );
+               indent_up();
+               indent_puts( "{" );     /* } for vi */
 
-       gen_next_state( false );
+               gen_next_state( false );
 
-       indent_puts( "++yy_cp;" );
+               indent_puts( "++yy_cp;" );
 
-       indent_puts( "}" );
-       indent_down();
+               /* { for vi */
+               indent_puts( "}" );
+               indent_down();
 
-       do_indent();
+               do_indent();
 
-       if ( interactive )
-           printf( "while ( yy_base[yy_current_state] != %d );\n", jambase );
-       else
-           printf( "while ( yy_current_state != %d );\n", jamstate );
-
-       if ( ! reject && ! interactive )
-           {
-           /* do the guaranteed-needed backtrack to figure out the match */
-           indent_puts( "yy_cp = yy_last_accepting_cpos;" );
-           indent_puts( "yy_current_state = yy_last_accepting_state;" );
-           }
+               if ( interactive )
+                       printf( "while ( yy_base[yy_current_state] != %d );\n",
+                               jambase );
+               else
+                       printf( "while ( yy_current_state != %d );\n",
+                               jamstate );
+
+               if ( ! reject && ! interactive )
+                       {
+                       /* Do the guaranteed-needed backtrack to figure out
+                        * the match.
+                        */
+                       indent_puts( "yy_cp = yy_last_accepting_cpos;" );
+                       indent_puts(
+                               "yy_current_state = yy_last_accepting_state;" );
+                       }
+               }
        }
-    }
 
 
-/* generate the code to find the next state */
+/* Generate the code to find the next state. */
 
 void gen_next_state( worry_about_NULs )
 int worry_about_NULs;
+       { /* NOTE - changes in here should be reflected in get_next_match() */
+       char char_map[256];
 
-    { /* NOTE - changes in here should be reflected in get_next_match() */
-    char char_map[256];
+       if ( worry_about_NULs && ! nultrans )
+               {
+               if ( useecs )
+                       (void) sprintf( char_map,
+                               "(*yy_cp ? yy_ec[*yy_cp] : %d)", NUL_ec );
+               else
+                       (void) sprintf( char_map,
+                               "(*yy_cp ? *yy_cp : %d)", NUL_ec );
+               }
 
-    if ( worry_about_NULs && ! nultrans )
-       {
-       if ( useecs )
-           (void) sprintf( char_map, "(*yy_cp ? yy_ec[*yy_cp] : %d)", NUL_ec );
        else
-           (void) sprintf( char_map, "(*yy_cp ? *yy_cp : %d)", NUL_ec );
-       }
-
-    else
-       (void) strcpy( char_map, useecs ? "yy_ec[*yy_cp]" : "*yy_cp" );
-
-    if ( worry_about_NULs && nultrans )
-       {
-       if ( ! fulltbl && ! fullspd )
-           /* compressed tables backtrack *before* they match */
-           gen_backtracking();
-
-       indent_puts( "if ( *yy_cp )" );
-       indent_up();
-       indent_puts( "{" );
-       }
-   
-    if ( fulltbl )
-       indent_put2s( "yy_current_state = yy_nxt[yy_current_state][%s];", 
-               char_map );
-    
-    else if ( fullspd )
-       indent_put2s( "yy_current_state += yy_current_state[%s].yy_nxt;",
-                   char_map );
-
-    else
-       gen_next_compressed_state( char_map );
-
-    if ( worry_about_NULs && nultrans )
-       {
-       indent_puts( "}" );
-       indent_down();
-       indent_puts( "else" );
-       indent_up();
-       indent_puts( "yy_current_state = yy_NUL_trans[yy_current_state];" );
-       indent_down();
-       }
-    
-    if ( fullspd || fulltbl )
-       gen_backtracking();
-
-    if ( reject )
-       indent_puts( "*yy_state_ptr++ = yy_current_state;" );
-    }
+               (void) strcpy( char_map, useecs ? "yy_ec[*yy_cp]" : "*yy_cp" );
 
+       if ( worry_about_NULs && nultrans )
+               {
+               if ( ! fulltbl && ! fullspd )
+                       /* Compressed tables backtrack *before* they match. */
+                       gen_backtracking();
 
-/* generate the code to make a NUL transition */
+               indent_puts( "if ( *yy_cp )" );
+               indent_up();
+               indent_puts( "{" );     /* } for vi */
+               }
 
-void gen_NUL_trans()
+       if ( fulltbl )
+               indent_put2s(
+                       "yy_current_state = yy_nxt[yy_current_state][%s];", 
+                               char_map );
 
-    { /* NOTE - changes in here should be reflected in get_next_match() */
-    int need_backtracking = (num_backtracking > 0 && ! reject);
+       else if ( fullspd )
+               indent_put2s(
+                       "yy_current_state += yy_current_state[%s].yy_nxt;",
+                               char_map );
 
-    if ( need_backtracking )
-       /* we'll need yy_cp lying around for the gen_backtracking() */
-       indent_puts( "register YY_CHAR *yy_cp = yy_c_buf_p;" );
+       else
+               gen_next_compressed_state( char_map );
 
-    putchar( '\n' );
+       if ( worry_about_NULs && nultrans )
+               {
+               /* { for vi */
+               indent_puts( "}" );
+               indent_down();
+               indent_puts( "else" );
+               indent_up();
+               indent_puts(
+                       "yy_current_state = yy_NUL_trans[yy_current_state];" );
+               indent_down();
+               }
 
-    if ( nultrans )
-       {
-       indent_puts( "yy_current_state = yy_NUL_trans[yy_current_state];" );
-       indent_puts( "yy_is_jam = (yy_current_state == 0);" );
-       }
+       if ( fullspd || fulltbl )
+               gen_backtracking();
 
-    else if ( fulltbl )
-       {
-       do_indent();
-       printf( "yy_current_state = yy_nxt[yy_current_state][%d];\n",
-               NUL_ec );
-       indent_puts( "yy_is_jam = (yy_current_state <= 0);" );
+       if ( reject )
+               indent_puts( "*yy_state_ptr++ = yy_current_state;" );
        }
 
-    else if ( fullspd )
-       {
-       do_indent();
-       printf( "register int yy_c = %d;\n", NUL_ec );
 
-       indent_puts(
-           "register const struct yy_trans_info *yy_trans_info;\n" );
-       indent_puts( "yy_trans_info = &yy_current_state[yy_c];" );
-       indent_puts( "yy_current_state += yy_trans_info->yy_nxt;" );
+/* Generate the code to make a NUL transition. */
 
-       indent_puts( "yy_is_jam = (yy_trans_info->yy_verify != yy_c);" );
-       }
+void gen_NUL_trans()
+       { /* NOTE - changes in here should be reflected in get_next_match() */
+       int need_backtracking = (num_backtracking > 0 && ! reject);
 
-    else
-       {
-       char NUL_ec_str[20];
+       if ( need_backtracking )
+               /* We'll need yy_cp lying around for the gen_backtracking(). */
+               indent_puts( "register YY_CHAR *yy_cp = yy_c_buf_p;" );
 
-       (void) sprintf( NUL_ec_str, "%d", NUL_ec );
-       gen_next_compressed_state( NUL_ec_str );
+       putchar( '\n' );
 
-       if ( reject )
-           indent_puts( "*yy_state_ptr++ = yy_current_state;" );
+       if ( nultrans )
+               {
+               indent_puts(
+                       "yy_current_state = yy_NUL_trans[yy_current_state];" );
+               indent_puts( "yy_is_jam = (yy_current_state == 0);" );
+               }
 
-       do_indent();
+       else if ( fulltbl )
+               {
+               do_indent();
+               printf( "yy_current_state = yy_nxt[yy_current_state][%d];\n",
+                       NUL_ec );
+               indent_puts( "yy_is_jam = (yy_current_state <= 0);" );
+               }
 
-       printf( "yy_is_jam = (yy_current_state == %d);\n", jamstate );
-       }
+       else if ( fullspd )
+               {
+               do_indent();
+               printf( "register int yy_c = %d;\n", NUL_ec );
 
-    /* if we've entered an accepting state, backtrack; note that
-     * compressed tables have *already* done such backtracking, so
-     * we needn't bother with it again
-     */
-    if ( need_backtracking && (fullspd || fulltbl) )
-       {
-       putchar( '\n' );
-       indent_puts( "if ( ! yy_is_jam )" );
-       indent_up();
-       indent_puts( "{" );
-       gen_backtracking();
-       indent_puts( "}" );
-       indent_down();
-       }
-    }
+               indent_puts(
+               "register const struct yy_trans_info *yy_trans_info;\n" );
+               indent_puts( "yy_trans_info = &yy_current_state[yy_c];" );
+               indent_puts( "yy_current_state += yy_trans_info->yy_nxt;" );
 
+               indent_puts(
+                       "yy_is_jam = (yy_trans_info->yy_verify != yy_c);" );
+               }
 
-/* generate the code to find the start state */
+       else
+               {
+               char NUL_ec_str[20];
 
-void gen_start_state()
+               (void) sprintf( NUL_ec_str, "%d", NUL_ec );
+               gen_next_compressed_state( NUL_ec_str );
 
-    {
-    if ( fullspd )
-       indent_put2s( "yy_current_state = yy_start_state_list[yy_start%s];",
-               bol_needed ? " + (yy_bp[-1] == '\\n' ? 1 : 0)" : "" );
+               if ( reject )
+                       indent_puts( "*yy_state_ptr++ = yy_current_state;" );
 
-    else
-       {
-       indent_puts( "yy_current_state = yy_start;" );
+               do_indent();
 
-       if ( bol_needed )
-           {
-           indent_puts( "if ( yy_bp[-1] == '\\n' )" );
-           indent_up();
-           indent_puts( "++yy_current_state;" );
-           indent_down();
-           }
+               printf( "yy_is_jam = (yy_current_state == %d);\n", jamstate );
+               }
 
-       if ( reject )
-           {
-           /* set up for storing up states */
-           indent_puts( "yy_state_ptr = yy_state_buf;" );
-           indent_puts( "*yy_state_ptr++ = yy_current_state;" );
-           }
+       /* If we've entered an accepting state, backtrack; note that
+        * compressed tables have *already* done such backtracking, so
+        * we needn't bother with it again.
+        */
+       if ( need_backtracking && (fullspd || fulltbl) )
+               {
+               putchar( '\n' );
+               indent_puts( "if ( ! yy_is_jam )" );
+               indent_up();
+               indent_puts( "{" );
+               gen_backtracking();
+               indent_puts( "}" );
+               indent_down();
+               }
        }
-    }
 
 
-/* gentabs - generate data statements for the transition tables
- *
- * synopsis
- *    gentabs();
- */
+/* Generate the code to find the start state. */
 
-void gentabs()
+void gen_start_state()
+       {
+       if ( fullspd )
+               indent_put2s(
+                       "yy_current_state = yy_start_state_list[yy_start%s];",
+                       bol_needed ? " + (yy_bp[-1] == '\\n' ? 1 : 0)" : "" );
+
+       else
+               {
+               indent_puts( "yy_current_state = yy_start;" );
 
-    {
-    int i, j, k, *accset, nacc, *acc_array, total_states;
-    int end_of_buffer_action = num_rules + 1;
+               if ( bol_needed )
+                       {
+                       indent_puts( "if ( yy_bp[-1] == '\\n' )" );
+                       indent_up();
+                       indent_puts( "++yy_current_state;" );
+                       indent_down();
+                       }
 
-    /* *everything* is done in terms of arrays starting at 1, so provide
-     * a null entry for the zero element of all C arrays
-     */
-    static char C_char_decl[] =
-       "static const YY_CHAR %s[%d] =\n    {   0,\n";
+               if ( reject )
+                       {
+                       /* Set up for storing up states. */
+                       indent_puts( "yy_state_ptr = yy_state_buf;" );
+                       indent_puts( "*yy_state_ptr++ = yy_current_state;" );
+                       }
+               }
+       }
 
-    acc_array = allocate_integer_array( current_max_dfas );
-    nummt = 0;
 
-    /* the compressed table format jams by entering the "jam state",
-     * losing information about the previous state in the process.
-     * In order to recover the previous state, we effectively need
-     * to keep backtracking information.
-     */
-    ++num_backtracking;
+/* gentabs - generate data statements for the transition tables */
 
-    if ( reject )
+void gentabs()
        {
-       /* write out accepting list and pointer list
-        *
-        * first we generate the "yy_acclist" array.  In the process, we compute
-        * the indices that will go into the "yy_accept" array, and save the
-        * indices in the dfaacc array
-        */
-       int EOB_accepting_list[2];
+       int i, j, k, *accset, nacc, *acc_array, total_states;
+       int end_of_buffer_action = num_rules + 1;
 
-       /* set up accepting structures for the End Of Buffer state */
-       EOB_accepting_list[0] = 0;
-       EOB_accepting_list[1] = end_of_buffer_action;
-       accsiz[end_of_buffer_state] = 1;
-       dfaacc[end_of_buffer_state].dfaacc_set = EOB_accepting_list;
-
-       printf( C_short_decl, "yy_acclist", max( numas, 1 ) + 1 );
+       /* *Everything* is done in terms of arrays starting at 1, so provide
+        * a null entry for the zero element of all C arrays.
+        */
+       static char C_char_decl[] =
+               "static const YY_CHAR %s[%d] =\n    {   0,\n";  /* } for vi */
 
-       j = 1;  /* index into "yy_acclist" array */
+       acc_array = allocate_integer_array( current_max_dfas );
+       nummt = 0;
 
-       for ( i = 1; i <= lastdfa; ++i )
-           {
-           acc_array[i] = j;
+       /* The compressed table format jams by entering the "jam state",
+        * losing information about the previous state in the process.
+        * In order to recover the previous state, we effectively need
+        * to keep backtracking information.
+        */
+       ++num_backtracking;
 
-           if ( accsiz[i] != 0 )
+       if ( reject )
                {
-               accset = dfaacc[i].dfaacc_set;
-               nacc = accsiz[i];
+               /* Write out accepting list and pointer list.
+                *
+                * First we generate the "yy_acclist" array.  In the process,
+                * we compute the indices that will go into the "yy_accept"
+                * array, and save the indices in the dfaacc array.
+                */
+               int EOB_accepting_list[2];
 
-               if ( trace )
-                   fprintf( stderr, "state # %d accepts: ", i );
+               /* Set up accepting structures for the End Of Buffer state. */
+               EOB_accepting_list[0] = 0;
+               EOB_accepting_list[1] = end_of_buffer_action;
+               accsiz[end_of_buffer_state] = 1;
+               dfaacc[end_of_buffer_state].dfaacc_set = EOB_accepting_list;
 
-               for ( k = 1; k <= nacc; ++k )
-                   {
-                   int accnum = accset[k];
+               printf( C_short_decl, "yy_acclist", max( numas, 1 ) + 1 );
 
-                   ++j;
+               j = 1;  /* index into "yy_acclist" array */
 
-                   if ( variable_trailing_context_rules &&
-                        ! (accnum & YY_TRAILING_HEAD_MASK) &&
-                        accnum > 0 && accnum <= num_rules &&
-                        rule_type[accnum] == RULE_VARIABLE )
+               for ( i = 1; i <= lastdfa; ++i )
                        {
-                       /* special hack to flag accepting number as part
-                        * of trailing context rule
-                        */
-                       accnum |= YY_TRAILING_MASK;
+                       acc_array[i] = j;
+
+                       if ( accsiz[i] != 0 )
+                               {
+                               accset = dfaacc[i].dfaacc_set;
+                               nacc = accsiz[i];
+
+                               if ( trace )
+                                       fprintf( stderr,
+                                               "state # %d accepts: ", i );
+
+                               for ( k = 1; k <= nacc; ++k )
+                                       {
+                                       int accnum = accset[k];
+
+                                       ++j;
+
+                                       if ( variable_trailing_context_rules &&
+                                         ! (accnum & YY_TRAILING_HEAD_MASK) &&
+                                          accnum > 0 && accnum <= num_rules &&
+                                         rule_type[accnum] == RULE_VARIABLE )
+                                               {
+                                               /* Special hack to flag
+                                                * accepting number as part
+                                                * of trailing context rule.
+                                                */
+                                               accnum |= YY_TRAILING_MASK;
+                                               }
+
+                                       mkdata( accnum );
+
+                                       if ( trace )
+                                               {
+                                               fprintf( stderr, "[%d]",
+                                                       accset[k] );
+
+                                               if ( k < nacc )
+                                                       fputs( ", ", stderr );
+                                               else
+                                                       putc( '\n', stderr );
+                                               }
+                                       }
+                               }
                        }
 
-                   mkdata( accnum );
+               /* add accepting number for the "jam" state */
+               acc_array[i] = j;
 
-                   if ( trace )
-                       {
-                       fprintf( stderr, "[%d]", accset[k] );
-
-                       if ( k < nacc )
-                           fputs( ", ", stderr );
-                       else
-                           putc( '\n', stderr );
-                       }
-                   }
+               dataend();
                }
-           }
-
-       /* add accepting number for the "jam" state */
-       acc_array[i] = j;
 
-       dataend();
-       }
+       else
+               {
+               dfaacc[end_of_buffer_state].dfaacc_state = end_of_buffer_action;
 
-    else
-       {
-       dfaacc[end_of_buffer_state].dfaacc_state = end_of_buffer_action;
+               for ( i = 1; i <= lastdfa; ++i )
+                       acc_array[i] = dfaacc[i].dfaacc_state;
 
-       for ( i = 1; i <= lastdfa; ++i )
-           acc_array[i] = dfaacc[i].dfaacc_state;
+               /* add accepting number for jam state */
+               acc_array[i] = 0;
+               }
 
-       /* add accepting number for jam state */
-       acc_array[i] = 0;
-       }
+       /* Spit out "yy_accept" array.  If we're doing "reject", it'll be
+        * pointers into the "yy_acclist" array.  Otherwise it's actual
+        * accepting numbers.  In either case, we just dump the numbers.
+        */
 
-    /* spit out "yy_accept" array.  If we're doing "reject", it'll be pointers
-     * into the "yy_acclist" array.  Otherwise it's actual accepting numbers.
-     * In either case, we just dump the numbers.
-     */
-
-    /* "lastdfa + 2" is the size of "yy_accept"; includes room for C arrays
-     * beginning at 0 and for "jam" state
-     */
-    k = lastdfa + 2;
-
-    if ( reject )
-       /* we put a "cap" on the table associating lists of accepting
-        * numbers with state numbers.  This is needed because we tell
-        * where the end of an accepting list is by looking at where
-        * the list for the next state starts.
+       /* "lastdfa + 2" is the size of "yy_accept"; includes room for C arrays
+        * beginning at 0 and for "jam" state.
         */
-       ++k;
+       k = lastdfa + 2;
 
-    printf( C_short_decl, "yy_accept", k );
+       if ( reject )
+               /* We put a "cap" on the table associating lists of accepting
+                * numbers with state numbers.  This is needed because we tell
+                * where the end of an accepting list is by looking at where
+                * the list for the next state starts.
+                */
+               ++k;
 
-    for ( i = 1; i <= lastdfa; ++i )
-       {
-       mkdata( acc_array[i] );
+       printf( C_short_decl, "yy_accept", k );
 
-       if ( ! reject && trace && acc_array[i] )
-           fprintf( stderr, "state # %d accepts: [%d]\n", i, acc_array[i] );
-       }
+       for ( i = 1; i <= lastdfa; ++i )
+               {
+               mkdata( acc_array[i] );
 
-    /* add entry for "jam" state */
-    mkdata( acc_array[i] );
+               if ( ! reject && trace && acc_array[i] )
+                       fprintf( stderr, "state # %d accepts: [%d]\n",
+                               i, acc_array[i] );
+               }
 
-    if ( reject )
-       /* add "cap" for the list */
+       /* Add entry for "jam" state. */
        mkdata( acc_array[i] );
 
-    dataend();
+       if ( reject )
+               /* Add "cap" for the list. */
+               mkdata( acc_array[i] );
 
-    if ( useecs )
-       genecs();
+       dataend();
 
-    if ( usemecs )
-       {
-       /* write out meta-equivalence classes (used to index templates with) */
+       if ( useecs )
+               genecs();
 
-       if ( trace )
-           fputs( "\n\nMeta-Equivalence Classes:\n", stderr );
+       if ( usemecs )
+               {
+               /* Write out meta-equivalence classes (used to index
+                * templates with).
+                */
 
-       printf( C_char_decl, "yy_meta", numecs + 1 );
+               if ( trace )
+                       fputs( "\n\nMeta-Equivalence Classes:\n", stderr );
 
-       for ( i = 1; i <= numecs; ++i )
-           {
-           if ( trace )
-               fprintf( stderr, "%d = %d\n", i, abs( tecbck[i] ) );
+               printf( C_char_decl, "yy_meta", numecs + 1 );
 
-           mkdata( abs( tecbck[i] ) );
-           }
+               for ( i = 1; i <= numecs; ++i )
+                       {
+                       if ( trace )
+                               fprintf( stderr, "%d = %d\n",
+                                       i, abs( tecbck[i] ) );
 
-       dataend();
-       }
+                       mkdata( abs( tecbck[i] ) );
+                       }
 
-    total_states = lastdfa + numtemps;
+               dataend();
+               }
 
-    printf( total_states > MAX_SHORT ? C_long_decl : C_short_decl,
-           "yy_base", total_states + 1 );
+       total_states = lastdfa + numtemps;
 
-    for ( i = 1; i <= lastdfa; ++i )
-       {
-       register int d = def[i];
+       printf( total_states > MAX_SHORT ? C_long_decl : C_short_decl,
+               "yy_base", total_states + 1 );
 
-       if ( base[i] == JAMSTATE )
-           base[i] = jambase;
+       for ( i = 1; i <= lastdfa; ++i )
+               {
+               register int d = def[i];
 
-       if ( d == JAMSTATE )
-           def[i] = jamstate;
+               if ( base[i] == JAMSTATE )
+                       base[i] = jambase;
 
-       else if ( d < 0 )
-           {
-           /* template reference */
-           ++tmpuses;
-           def[i] = lastdfa - d + 1;
-           }
+               if ( d == JAMSTATE )
+                       def[i] = jamstate;
 
-       mkdata( base[i] );
-       }
+               else if ( d < 0 )
+                       {
+                       /* Template reference. */
+                       ++tmpuses;
+                       def[i] = lastdfa - d + 1;
+                       }
 
-    /* generate jam state's base index */
-    mkdata( base[i] );
+               mkdata( base[i] );
+               }
 
-    for ( ++i /* skip jam state */; i <= total_states; ++i )
-       {
+       /* Generate jam state's base index. */
        mkdata( base[i] );
-       def[i] = jamstate;
-       }
 
-    dataend();
+       for ( ++i /* skip jam state */; i <= total_states; ++i )
+               {
+               mkdata( base[i] );
+               def[i] = jamstate;
+               }
 
-    printf( tblend > MAX_SHORT ? C_long_decl : C_short_decl,
-           "yy_def", total_states + 1 );
+       dataend();
 
-    for ( i = 1; i <= total_states; ++i )
-       mkdata( def[i] );
+       printf( tblend > MAX_SHORT ? C_long_decl : C_short_decl,
+               "yy_def", total_states + 1 );
 
-    dataend();
+       for ( i = 1; i <= total_states; ++i )
+               mkdata( def[i] );
 
-    printf( lastdfa > MAX_SHORT ? C_long_decl : C_short_decl,
-           "yy_nxt", tblend + 1 );
+       dataend();
 
-    for ( i = 1; i <= tblend; ++i )
-       {
-       if ( nxt[i] == 0 || chk[i] == 0 )
-           nxt[i] = jamstate;  /* new state is the JAM state */
+       printf( lastdfa > MAX_SHORT ? C_long_decl : C_short_decl,
+               "yy_nxt", tblend + 1 );
 
-       mkdata( nxt[i] );
-       }
+       for ( i = 1; i <= tblend; ++i )
+               {
+               if ( nxt[i] == 0 || chk[i] == 0 )
+                       nxt[i] = jamstate;      /* new state is the JAM state */
 
-    dataend();
+               mkdata( nxt[i] );
+               }
 
-    printf( lastdfa > MAX_SHORT ? C_long_decl : C_short_decl,
-           "yy_chk", tblend + 1 );
+       dataend();
 
-    for ( i = 1; i <= tblend; ++i )
-       {
-       if ( chk[i] == 0 )
-           ++nummt;
+       printf( lastdfa > MAX_SHORT ? C_long_decl : C_short_decl,
+               "yy_chk", tblend + 1 );
 
-       mkdata( chk[i] );
-       }
+       for ( i = 1; i <= tblend; ++i )
+               {
+               if ( chk[i] == 0 )
+                       ++nummt;
+
+               mkdata( chk[i] );
+               }
 
-    dataend();
-    }
+       dataend();
+       }
 
 
-/* write out a formatted string (with a secondary string argument) at the
- * current indentation level, adding a final newline
+/* Write out a formatted string (with a secondary string argument) at the
+ * current indentation level, adding a final newline.
  */
 
 void indent_put2s( fmt, arg )
 char fmt[], arg[];
-
-    {
-    do_indent();
-    printf( fmt, arg );
-    putchar( '\n' );
-    }
+       {
+       do_indent();
+       printf( fmt, arg );
+       putchar( '\n' );
+       }
 
 
-/* write out a string at the current indentation level, adding a final
- * newline
+/* Write out a string at the current indentation level, adding a final
+ * newline.
  */
 
 void indent_puts( str )
 char str[];
-
-    {
-    do_indent();
-    puts( str );
-    }
+       {
+       do_indent();
+       puts( str );
+       }
 
 
-/* make_tables - generate transition tables
- *
- * synopsis
- *     make_tables();
- *
- * Generates transition tables and finishes generating output file
+/* make_tables - generate transition tables and finishes generating output file
  */
 
 void make_tables()
+       {
+       register int i;
+       int did_eof_rule = false;
 
-    {
-    register int i;
-    int did_eof_rule = false;
-
-    skelout();
+       skelout();
 
-    /* first, take care of YY_DO_BEFORE_ACTION depending on yymore being used */
-    set_indent( 2 );
+       /* First, take care of YY_DO_BEFORE_ACTION depending on yymore
+        * being used.
+        */
+       set_indent( 2 );
 
-    if ( yymore_used )
-       {
-       indent_puts( "yytext_ptr -= yy_more_len; \\" );
-       indent_puts( "yyleng = yy_cp - yytext_ptr; \\" );
-       }
+       if ( yymore_used )
+               {
+               indent_puts( "yytext_ptr -= yy_more_len; \\" );
+               indent_puts( "yyleng = yy_cp - yytext_ptr; \\" );
+               }
 
-    else
-       indent_puts( "yyleng = yy_cp - yy_bp; \\" );
+       else
+               indent_puts( "yyleng = yy_cp - yy_bp; \\" );
 
-    /* now also deal with copying yytext_ptr to yytext if needed */
-    skelout();
-    if ( yytext_is_array )
-       {
-       indent_puts( "if ( yyleng >= YYLMAX ) \\" );
-       indent_up();
-       indent_puts(
+       /* Now also deal with copying yytext_ptr to yytext if needed. */
+       skelout();
+       if ( yytext_is_array )
+               {
+               indent_puts( "if ( yyleng >= YYLMAX ) \\" );
+               indent_up();
+               indent_puts(
                "YY_FATAL_ERROR( \"token too large, exceeds YYLMAX\" ); \\" );
-       indent_down();
-       indent_puts( "strcpy( yytext, (char *) yytext_ptr ); \\" );
-       }
+               indent_down();
+               indent_puts( "strcpy( yytext, (char *) yytext_ptr ); \\" );
+               }
 
-    set_indent( 0 );
-    
-    skelout();
+       set_indent( 0 );
 
+       skelout();
 
-    printf( "#define YY_END_OF_BUFFER %d\n", num_rules + 1 );
 
-    if ( fullspd )
-       { /* need to define the transet type as a size large
-          * enough to hold the biggest offset
-          */
-       int total_table_size = tblend + numecs + 1;
-       char *trans_offset_type =
-           total_table_size > MAX_SHORT ? "long" : "short";
+       printf( "#define YY_END_OF_BUFFER %d\n", num_rules + 1 );
 
-       set_indent( 0 );
-       indent_puts( "struct yy_trans_info" );
-       indent_up();
-        indent_puts( "{" );
-        indent_puts( "short yy_verify;" );
-
-        /* in cases where its sister yy_verify *is* a "yes, there is a
-        * transition", yy_nxt is the offset (in records) to the next state.
-        * In most cases where there is no transition, the value of yy_nxt
-        * is irrelevant.  If yy_nxt is the -1th  record of a state, though,
-        * then yy_nxt is the action number for that state
-         */
-
-        indent_put2s( "%s yy_nxt;", trans_offset_type );
-        indent_puts( "};" );
-       indent_down();
+       if ( fullspd )
+               {
+               /* Need to define the transet type as a size large
+                * enough to hold the biggest offset.
+                */
+               int total_table_size = tblend + numecs + 1;
+               char *trans_offset_type =
+               total_table_size > MAX_SHORT ? "long" : "short";
+
+               set_indent( 0 );
+               indent_puts( "struct yy_trans_info" );
+               indent_up();
+               indent_puts( "{" );     /* } for vi */
+               indent_puts( "short yy_verify;" );
+
+               /* In cases where its sister yy_verify *is* a "yes, there is
+                * a transition", yy_nxt is the offset (in records) to the
+                * next state.  In most cases where there is no transition,
+                * the value of yy_nxt is irrelevant.  If yy_nxt is the -1th
+                * record of a state, though, then yy_nxt is the action number
+                * for that state.
+                */
+
+               indent_put2s( "%s yy_nxt;", trans_offset_type );
+               indent_puts( "};" );
+               indent_down();
+
+               indent_puts(
+                       "typedef const struct yy_trans_info *yy_state_type;" );
+               }
 
-       indent_puts( "typedef const struct yy_trans_info *yy_state_type;" );
-       }
-    
-    else
-       indent_puts( "typedef int yy_state_type;" );
+       else
+               indent_puts( "typedef int yy_state_type;" );
 
-    if ( fullspd )
-       genctbl();
+       if ( fullspd )
+               genctbl();
+       else if ( fulltbl )
+               genftbl();
+       else
+               gentabs();
 
-    else if ( fulltbl )
-       genftbl();
+       if ( num_backtracking > 0 )
+               {
+               indent_puts( "static yy_state_type yy_last_accepting_state;" );
+               indent_puts( "static YY_CHAR *yy_last_accepting_cpos;\n" );
+               }
 
-    else
-       gentabs();
+       if ( nultrans )
+               {
+               printf( C_state_decl, "yy_NUL_trans", lastdfa + 1 );
 
-    if ( num_backtracking > 0 )
-       {
-       indent_puts( "static yy_state_type yy_last_accepting_state;" );
-       indent_puts( "static YY_CHAR *yy_last_accepting_cpos;\n" );
-       }
+               for ( i = 1; i <= lastdfa; ++i )
+                       {
+                       if ( fullspd )
+                               {
+                               if ( nultrans )
+                                       printf( "    &yy_transition[%d],\n",
+                                               base[i] );
+                               else
+                                       printf( "    0,\n" );
+                               }
 
-    if ( nultrans )
-       {
-       printf( C_state_decl, "yy_NUL_trans", lastdfa + 1 );
+                       else
+                               mkdata( nultrans[i] );
+                       }
 
-       for ( i = 1; i <= lastdfa; ++i )
-           {
-           if ( fullspd )
-               {
-               if ( nultrans )
-                   printf( "    &yy_transition[%d],\n", base[i] );
-               else
-                   printf( "    0,\n" );
+               dataend();
                }
-           
-           else
-               mkdata( nultrans[i] );
-           }
-
-       dataend();
-       }
 
-    if ( ddebug )
-       { /* spit out table mapping rules to line numbers */
-       indent_puts( "extern int yy_flex_debug;" );
-       indent_puts( "int yy_flex_debug = 1;\n" );
+       if ( ddebug )
+               { /* Spit out table mapping rules to line numbers. */
+               indent_puts( "extern int yy_flex_debug;" );
+               indent_puts( "int yy_flex_debug = 1;\n" );
 
-       printf( C_short_decl, "yy_rule_linenum", num_rules );
-       for ( i = 1; i < num_rules; ++i )
-           mkdata( rule_linenum[i] );
-       dataend();
-       }
+               printf( C_short_decl, "yy_rule_linenum", num_rules );
+               for ( i = 1; i < num_rules; ++i )
+                       mkdata( rule_linenum[i] );
+               dataend();
+               }
 
-    if ( reject )
-       {
-       /* declare state buffer variables */
-       puts(
+       if ( reject )
+               {
+               /* Declare state buffer variables. */
+               puts(
        "static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;" );
-       puts( "static YY_CHAR *yy_full_match;" );
-       puts( "static int yy_lp;" );
-
-       if ( variable_trailing_context_rules )
-           {
-           puts( "static int yy_looking_for_trail_begin = 0;" );
-           puts( "static int yy_full_lp;" );
-           puts( "static int *yy_full_state;" );
-           printf( "#define YY_TRAILING_MASK 0x%x\n",
-                   (unsigned int) YY_TRAILING_MASK );
-           printf( "#define YY_TRAILING_HEAD_MASK 0x%x\n",
-                   (unsigned int) YY_TRAILING_HEAD_MASK );
-           }
-
-       puts( "#define REJECT \\" );
-        puts( "{ \\" );
-        puts(
+               puts( "static YY_CHAR *yy_full_match;" );
+               puts( "static int yy_lp;" );
+
+               if ( variable_trailing_context_rules )
+                       {
+                       puts( "static int yy_looking_for_trail_begin = 0;" );
+                       puts( "static int yy_full_lp;" );
+                       puts( "static int *yy_full_state;" );
+                       printf( "#define YY_TRAILING_MASK 0x%x\n",
+                               (unsigned int) YY_TRAILING_MASK );
+                       printf( "#define YY_TRAILING_HEAD_MASK 0x%x\n",
+                               (unsigned int) YY_TRAILING_HEAD_MASK );
+                       }
+
+               puts( "#define REJECT \\" );
+               puts( "{ \\" );         /* } for vi */
+               puts(
        "*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \\" );
-        puts(
-           "yy_cp = yy_full_match; /* restore poss. backed-over text */ \\" );
+               puts(
+       "yy_cp = yy_full_match; /* restore poss. backed-over text */ \\" );
 
-       if ( variable_trailing_context_rules )
-           {
-           puts( "yy_lp = yy_full_lp; /* restore orig. accepting pos. */ \\" );
-           puts(
+               if ( variable_trailing_context_rules )
+                       {
+                       puts(
+               "yy_lp = yy_full_lp; /* restore orig. accepting pos. */ \\" );
+                       puts(
                "yy_state_ptr = yy_full_state; /* restore orig. state */ \\" );
-           puts(
-           "yy_current_state = *yy_state_ptr; /* restore curr. state */ \\" );
-           }
-
-        puts( "++yy_lp; \\" );
-        puts( "goto find_rule; \\" );
-        puts( "}" );
-       }
-    
-    else
-       {
-       puts( "/* the intent behind this definition is that it'll catch" );
-       puts( " * any uses of REJECT which flex missed" );
-       puts( " */" );
-       puts( "#define REJECT reject_used_but_not_detected" );
-       }
-    
-    if ( yymore_used )
-       {
-       indent_puts( "static int yy_more_flag = 0;" );
-       indent_puts( "static int yy_doing_yy_more = 0;" );
-       indent_puts( "static int yy_more_len = 0;" );
-       indent_puts(
-           "#define yymore() do { yy_more_flag = 1; } while ( 0 )" );
-       indent_puts(
-           "#define YY_MORE_ADJ (yy_doing_yy_more ? yy_more_len : 0)" );
-       }
+                       puts(
+       "yy_current_state = *yy_state_ptr; /* restore curr. state */ \\" );
+                       }
 
-    else
-       {
-       indent_puts( "#define yymore() yymore_used_but_not_detected" );
-       indent_puts( "#define YY_MORE_ADJ 0" );
-       }
+               puts( "++yy_lp; \\" );
+               puts( "goto find_rule; \\" );
+               /* { for vi */
+               puts( "}" );
+               }
 
-    skelout();
+       else
+               {
+               puts(
+               "/* The intent behind this definition is that it'll catch" );
+               puts( " * any uses of REJECT which flex missed." );
+               puts( " */" );
+               puts( "#define REJECT reject_used_but_not_detected" );
+               }
 
-    /* copy prolog to output file */
-    fputs( prolog, stdout );
+       if ( yymore_used )
+               {
+               indent_puts( "static int yy_more_flag = 0;" );
+               indent_puts( "static int yy_doing_yy_more = 0;" );
+               indent_puts( "static int yy_more_len = 0;" );
+               indent_puts(
+               "#define yymore() do { yy_more_flag = 1; } while ( 0 )" );
+               indent_puts(
+               "#define YY_MORE_ADJ (yy_doing_yy_more ? yy_more_len : 0)" );
+               }
 
-    skelout();
+       else
+               {
+               indent_puts( "#define yymore() yymore_used_but_not_detected" );
+               indent_puts( "#define YY_MORE_ADJ 0" );
+               }
 
-    set_indent( 2 );
+       skelout();
 
-    if ( yymore_used )
-       {
-       indent_puts( "yy_more_len = 0;" );
-       indent_puts( "yy_doing_yy_more = yy_more_flag;" );
-       indent_puts( "if ( yy_doing_yy_more )" );
-       indent_up();
-       indent_puts( "{" );
-       indent_puts( "yy_more_len = yyleng;" );
-       indent_puts( "yy_more_flag = 0;" );
-       indent_puts( "}" );
-       indent_down();
-       }
+       /* Copy prolog to output file. */
+       fputs( prolog, stdout );
 
-    skelout();
+       skelout();
 
-    gen_start_state();
+       set_indent( 2 );
 
-    /* note, don't use any indentation */
-    puts( "yy_match:" );
-    gen_next_match();
+       if ( yymore_used )
+               {
+               indent_puts( "yy_more_len = 0;" );
+               indent_puts( "yy_doing_yy_more = yy_more_flag;" );
+               indent_puts( "if ( yy_doing_yy_more )" );
+               indent_up();
+               indent_puts( "{" );
+               indent_puts( "yy_more_len = yyleng;" );
+               indent_puts( "yy_more_flag = 0;" );
+               indent_puts( "}" );
+               indent_down();
+               }
 
-    skelout();
-    set_indent( 2 );
-    gen_find_action();
+       skelout();
 
-    skelout();
-    if ( ddebug )
-       {
-       indent_puts( "if ( yy_flex_debug )" );
-       indent_up();
+       gen_start_state();
 
-       indent_puts( "{" );
-       indent_puts( "if ( yy_act == 0 )" );
-       indent_up();
-       indent_puts( "fprintf( stderr, \"--scanner backtracking\\n\" );" );
-       indent_down();
+       /* Note, don't use any indentation. */
+       puts( "yy_match:" );
+       gen_next_match();
 
-       do_indent();
-       printf( "else if ( yy_act < %d )\n", num_rules );
-       indent_up();
-       indent_puts(
-       "fprintf( stderr, \"--accepting rule at line %d (\\\"%s\\\")\\n\"," );
-       indent_puts( "         yy_rule_linenum[yy_act], yytext );" );
-       indent_down();
+       skelout();
+       set_indent( 2 );
+       gen_find_action();
 
-       do_indent();
-       printf( "else if ( yy_act == %d )\n", num_rules );
-       indent_up();
-       indent_puts(
+       skelout();
+       if ( ddebug )
+               {
+               indent_puts( "if ( yy_flex_debug )" );
+               indent_up();
+
+               indent_puts( "{" );
+               indent_puts( "if ( yy_act == 0 )" );
+               indent_up();
+               indent_puts(
+                       "fprintf( stderr, \"--scanner backtracking\\n\" );" );
+               indent_down();
+
+               do_indent();
+               printf( "else if ( yy_act < %d )\n", num_rules );
+               indent_up();
+               indent_puts(
+               "fprintf(
+               stderr, \"--accepting rule at line %d (\\\"%s\\\")\\n\"," );
+               indent_puts( "         yy_rule_linenum[yy_act], yytext );" );
+               indent_down();
+
+               do_indent();
+               printf( "else if ( yy_act == %d )\n", num_rules );
+               indent_up();
+               indent_puts(
        "fprintf( stderr, \"--accepting default rule (\\\"%s\\\")\\n\"," );
-       indent_puts( "         yytext );" );
-       indent_down();
+               indent_puts( "         yytext );" );
+               indent_down();
+
+               do_indent();
+               printf( "else if ( yy_act == %d )\n", num_rules + 1 );
+               indent_up();
+               indent_puts(
+       "fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );" );
+               indent_down();
+
+               do_indent();
+               printf( "else\n" );
+               indent_up();
+               indent_puts( "fprintf( stderr, \"--EOF\\n\" );" );
+               indent_down();
+
+               indent_puts( "}" );
+               indent_down();
+               }
 
-       do_indent();
-       printf( "else if ( yy_act == %d )\n", num_rules + 1 );
+       /* Copy actions to output file. */
+       skelout();
        indent_up();
-       indent_puts( "fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );" );
-       indent_down();
+       gen_bt_action();
+       fputs( action, stdout );
 
-       do_indent();
-       printf( "else\n" );
-       indent_up();
-       indent_puts( "fprintf( stderr, \"--EOF\\n\" );" );
-       indent_down();
+       /* generate cases for any missing EOF rules */
+       for ( i = 1; i <= lastsc; ++i )
+               if ( ! sceof[i] )
+                       {
+                       do_indent();
+                       printf( "case YY_STATE_EOF(%s):\n", scname[i] );
+                       did_eof_rule = true;
+                       }
 
-       indent_puts( "}" );
-       indent_down();
-       }
+       if ( did_eof_rule )
+               {
+               indent_up();
+               indent_puts( "yyterminate();" );
+               indent_down();
+               }
 
-    /* copy actions to output file */
-    skelout();
-    indent_up();
-    gen_bt_action();
-    fputs( action, stdout );
-
-    /* generate cases for any missing EOF rules */
-    for ( i = 1; i <= lastsc; ++i )
-       if ( ! sceof[i] )
-           {
-           do_indent();
-           printf( "case YY_STATE_EOF(%s):\n", scname[i] );
-           did_eof_rule = true;
-           }
-    
-    if ( did_eof_rule )
-       {
-       indent_up();
-       indent_puts( "yyterminate();" );
-       indent_down();
-       }
 
+       /* Generate code for handling NUL's, if needed. */
 
-    /* generate code for handling NUL's, if needed */
-
-    /* first, deal with backtracking and setting up yy_cp if the scanner
-     * finds that it should JAM on the NUL
-     */
-    skelout();
-    set_indent( 7 );
-
-    if ( fullspd || fulltbl )
-       indent_puts( "yy_cp = yy_c_buf_p;" );
-    
-    else
-       { /* compressed table */
-       if ( ! reject && ! interactive )
-           {
-           /* do the guaranteed-needed backtrack to figure out the match */
-           indent_puts( "yy_cp = yy_last_accepting_cpos;" );
-           indent_puts( "yy_current_state = yy_last_accepting_state;" );
-           }
-       }
+       /* First, deal with backtracking and setting up yy_cp if the scanner
+        * finds that it should JAM on the NUL>
+        */
+       skelout();
+       set_indent( 7 );
 
+       if ( fullspd || fulltbl )
+               indent_puts( "yy_cp = yy_c_buf_p;" );
+
+       else
+               { /* compressed table */
+               if ( ! reject && ! interactive )
+                       {
+                       /* Do the guaranteed-needed backtrack to figure
+                        * out the match.
+                        */
+                       indent_puts( "yy_cp = yy_last_accepting_cpos;" );
+                       indent_puts(
+                               "yy_current_state = yy_last_accepting_state;" );
+                       }
+               }
 
-    /* generate code for yy_get_previous_state() */
-    set_indent( 1 );
-    skelout();
 
-    if ( bol_needed )
-       indent_puts( "register YY_CHAR *yy_bp = yytext_ptr;\n" );
+       /* Generate code for yy_get_previous_state(). */
+       set_indent( 1 );
+       skelout();
 
-    gen_start_state();
+       if ( bol_needed )
+               indent_puts( "register YY_CHAR *yy_bp = yytext_ptr;\n" );
+
+       gen_start_state();
 
-    set_indent( 2 );
-    skelout();
-    gen_next_state( true );
+       set_indent( 2 );
+       skelout();
+       gen_next_state( true );
 
-    set_indent( 1 );
-    skelout();
-    gen_NUL_trans();
+       set_indent( 1 );
+       skelout();
+       gen_NUL_trans();
 
-    skelout();
+       skelout();
 
-    /* copy remainder of input to output */
+       /* Copy remainder of input to output. */
 
-    line_directive_out( stdout );
-    (void) flexscan(); /* copy remainder of input to output */
-    }
+       line_directive_out( stdout );
+       (void) flexscan(); /* copy remainder of input to output */
+       }
index 951bdaab92e402e0345b1305512cf71d17711af5..7432ee608a4c429bb2678946a230ce68988d650a 100644 (file)
--- a/libmain.c
+++ b/libmain.c
@@ -7,7 +7,6 @@ extern int yylex();
 int main( argc, argv )
 int argc;
 char *argv[];
-
-    {
-    return yylex();
-    }
+       {
+       return yylex();
+       }
diff --git a/main.c b/main.c
index 2703f4ff7b9a3157d8b6ac02c99fff360a59c52c..1370829a2863743686dae4ca4dc3b78bf9f65422 100644 (file)
--- a/main.c
+++ b/main.c
@@ -104,6 +104,7 @@ static char *outfile = "lex.yy.c";
 #else
 static char *outfile = "lexyy.c";
 #endif
+
 static int outfile_created = 0;
 static int use_stdout;
 static char *skelname = NULL;
@@ -112,743 +113,757 @@ static char *skelname = NULL;
 int main( argc, argv )
 int argc;
 char **argv;
+       {
+       int i;
 
-    {
-    int i;
-
-    flexinit( argc, argv );
+       flexinit( argc, argv );
 
-    readin();
+       readin();
 
-    if ( syntaxerror )
-       flexend( 1 );
+       if ( syntaxerror )
+               flexend( 1 );
 
-    if ( yymore_really_used == REALLY_USED )
-       yymore_used = true;
-    else if ( yymore_really_used == REALLY_NOT_USED )
-       yymore_used = false;
+       if ( yymore_really_used == REALLY_USED )
+               yymore_used = true;
+       else if ( yymore_really_used == REALLY_NOT_USED )
+               yymore_used = false;
 
-    if ( reject_really_used == REALLY_USED )
-       reject = true;
-    else if ( reject_really_used == REALLY_NOT_USED )
-       reject = false;
+       if ( reject_really_used == REALLY_USED )
+               reject = true;
+       else if ( reject_really_used == REALLY_NOT_USED )
+               reject = false;
 
-    if ( performance_report > 0 )
-       {
-       if ( performance_report > 1 )
-           {
-           if ( interactive )
-               fprintf( stderr,
-                    "-I (interactive) entails a minor performance penalty\n" );
+       if ( performance_report > 0 )
+               {
+               if ( performance_report > 1 )
+                       {
+                       if ( interactive )
+                               fprintf( stderr,
+               "-I (interactive) entails a minor performance penalty\n" );
 
-           if ( yymore_used )
-               fprintf( stderr,
-                        "yymore() entails a minor performance penalty\n" );
-           }
+                       if ( yymore_used )
+                               fprintf( stderr,
+                       "yymore() entails a minor performance penalty\n" );
+                       }
 
-       if ( reject )
-           fprintf( stderr, "REJECT entails a large performance penalty\n" );
+               if ( reject )
+                       fprintf( stderr,
+                       "REJECT entails a large performance penalty\n" );
 
-       if ( variable_trailing_context_rules )
-           fprintf( stderr,
+               if ( variable_trailing_context_rules )
+                       fprintf( stderr,
 "Variable trailing context rules entail a large performance penalty\n" );
-       }
+               }
 
-    if ( reject )
-       real_reject = true;
+       if ( reject )
+               real_reject = true;
 
-    if ( variable_trailing_context_rules )
-       reject = true;
+       if ( variable_trailing_context_rules )
+               reject = true;
 
-    if ( (fulltbl || fullspd) && reject )
-       {
-       if ( real_reject )
-           flexerror( "REJECT cannot be used with -f or -F" );
-       else
-           flexerror(
+       if ( (fulltbl || fullspd) && reject )
+               {
+               if ( real_reject )
+                       flexerror( "REJECT cannot be used with -f or -F" );
+               else
+                       flexerror(
        "variable trailing context rules cannot be used with -f or -F" );
-       }
+               }
 
-    ntod();
+       ntod();
 
-    for ( i = 1; i <= num_rules; ++i )
-       if ( ! rule_useful[i] && i != default_rule )
-           line_warning( "rule cannot be matched", rule_linenum[i] );
+       for ( i = 1; i <= num_rules; ++i )
+               if ( ! rule_useful[i] && i != default_rule )
+                       line_warning( "rule cannot be matched",
+                                       rule_linenum[i] );
 
-    if ( spprdflt && ! reject && rule_useful[default_rule] )
-       line_warning( "-s option given but default rule can be matched",
-           rule_linenum[default_rule] );
+       if ( spprdflt && ! reject && rule_useful[default_rule] )
+               line_warning( "-s option given but default rule can be matched",
+                       rule_linenum[default_rule] );
 
-    /* generate the C state transition tables from the DFA */
-    make_tables();
+       /* Generate the C state transition tables from the DFA. */
+       make_tables();
 
-    /* note, flexend does not return.  It exits with its argument as status. */
-    flexend( 0 );
+       /* Note, flexend does not return.  It exits with its argument
+        * as status.
+        */
+       flexend( 0 );
 
-    return 0;  /* keep compilers/lint happy */
-    }
+       return 0;       /* keep compilers/lint happy */
+       }
 
 
 /* flexend - terminate flex
- *
- * synopsis
- *    int status;
- *    flexend( status );
- *
- *    status is exit status.
  *
  * note
  *    This routine does not return.
  */
 
-void flexend( status )
-int status;
-
-    {
-    int tblsiz;
-    char *flex_gettime();
-
-    if ( skelfile != NULL )
-       {
-       if ( ferror( skelfile ) )
-           flexfatal( "error occurred when reading skeleton file" );
-
-       else if ( fclose( skelfile ) )
-           flexfatal( "error occurred when closing skeleton file" );
-       }
+void flexend( exit_status )
+int exit_status;
 
-    if ( status != 0 && outfile_created )
        {
-       if ( ferror( stdout ) )
-           flexfatal( "error occurred when writing output file" );
+       int tblsiz;
+       char *flex_gettime();
 
-       else if ( fclose( stdout ) )
-           flexfatal( "error occurred when closing output file" );
-
-       else if ( unlink( outfile ) )
-           flexfatal( "error occurred when deleting output file" );
-       }
+       if ( skelfile != NULL )
+               {
+               if ( ferror( skelfile ) )
+                       flexfatal(
+                               "error occurred when reading skeleton file" );
 
-    if ( backtrack_report && backtrack_file )
-       {
-       if ( num_backtracking == 0 )
-           fprintf( backtrack_file, "No backtracking.\n" );
-       else if ( fullspd || fulltbl )
-           fprintf( backtrack_file,
-                    "%d backtracking (non-accepting) states.\n",
-                    num_backtracking );
-       else
-           fprintf( backtrack_file, "Compressed tables always backtrack.\n" );
+               else if ( fclose( skelfile ) )
+                       flexfatal(
+                               "error occurred when closing skeleton file" );
+               }
 
-       if ( ferror( backtrack_file ) )
-           flexfatal( "error occurred when writing backtracking file" );
+       if ( exit_status != 0 && outfile_created )
+               {
+               if ( ferror( stdout ) )
+                       flexfatal( "error occurred when writing output file" );
 
-       else if ( fclose( backtrack_file ) )
-           flexfatal( "error occurred when closing backtracking file" );
-       }
+               else if ( fclose( stdout ) )
+                       flexfatal( "error occurred when closing output file" );
 
-    if ( printstats )
-       {
-       fprintf( stderr, "%s version %s usage statistics:\n", program_name,
-                flex_version );
-
-       if ( starttime )
-           {
-           endtime = flex_gettime();
-           fprintf( stderr, "  started at %s, finished at %s\n",
-                    starttime, endtime );
-           }
+               else if ( unlink( outfile ) )
+                       flexfatal( "error occurred when deleting output file" );
+               }
 
-       fprintf( stderr, "  scanner options: -" );
+       if ( backtrack_report && backtrack_file )
+               {
+               if ( num_backtracking == 0 )
+                       fprintf( backtrack_file, "No backtracking.\n" );
+               else if ( fullspd || fulltbl )
+                       fprintf( backtrack_file,
+                               "%d backtracking (non-accepting) states.\n",
+                               num_backtracking );
+               else
+                       fprintf( backtrack_file,
+                               "Compressed tables always backtrack.\n" );
+
+               if ( ferror( backtrack_file ) )
+                       flexfatal(
+                       "error occurred when writing backtracking file" );
+
+               else if ( fclose( backtrack_file ) )
+                       flexfatal(
+                       "error occurred when closing backtracking file" );
+               }
 
-       if ( backtrack_report )
-           putc( 'b', stderr );
-       if ( ddebug )
-           putc( 'd', stderr );
-       if ( caseins )
-           putc( 'i', stderr );
-       if ( performance_report > 0 )
-           putc( 'p', stderr );
-       if ( performance_report > 1 )
-           putc( 'p', stderr );
-       if ( spprdflt )
-           putc( 's', stderr );
-       if ( use_stdout )
-           putc( 't', stderr );
        if ( printstats )
-           putc( 'v', stderr );        /* always true! */
-       if ( nowarn )
-           putc( 'w', stderr );
-       if ( ! interactive )
-           putc( 'B', stderr );
-       if ( interactive )
-           putc( 'I', stderr );
-       if ( ! gen_line_dirs )
-           putc( 'L', stderr );
-       if ( trace )
-           putc( 'T', stderr );
-       if ( csize == 128 )
-           putc( '7', stderr );
-       else
-           putc( '8', stderr );
+               {
+               fprintf( stderr, "%s version %s usage statistics:\n",
+                       program_name, flex_version );
 
-       fprintf( stderr, " -C" );
+               if ( starttime )
+                       {
+                       endtime = flex_gettime();
+                       fprintf( stderr, "  started at %s, finished at %s\n",
+                               starttime, endtime );
+                       }
 
-       if ( fulltbl )
-           putc( 'f', stderr );
-       if ( fullspd )
-           putc( 'F', stderr );
-       if ( useecs )
-           putc( 'e', stderr );
-       if ( usemecs )
-           putc( 'm', stderr );
-
-       if ( skelname )
-           fprintf( stderr, " -S%s", skelname );
-
-       putc( '\n', stderr );
-
-       fprintf( stderr, "  %d/%d NFA states\n", lastnfa, current_mns );
-       fprintf( stderr, "  %d/%d DFA states (%d words)\n", lastdfa,
-                current_max_dfas, totnst );
-       fprintf( stderr, "  %d rules\n",
-                num_rules + num_eof_rules - 1 /* - 1 for def. rule */ );
-
-       if ( num_backtracking == 0 )
-           fprintf( stderr, "  No backtracking\n" );
-       else if ( fullspd || fulltbl )
-           fprintf( stderr, "  %d backtracking (non-accepting) states\n",
-                    num_backtracking );
-       else
-           fprintf( stderr, "  compressed tables always backtrack\n" );
+               fprintf( stderr, "  scanner options: -" );
+
+               if ( backtrack_report )
+                       putc( 'b', stderr );
+               if ( ddebug )
+                       putc( 'd', stderr );
+               if ( caseins )
+                       putc( 'i', stderr );
+               if ( performance_report > 0 )
+                       putc( 'p', stderr );
+               if ( performance_report > 1 )
+                       putc( 'p', stderr );
+               if ( spprdflt )
+                       putc( 's', stderr );
+               if ( use_stdout )
+                       putc( 't', stderr );
+               if ( printstats )
+                       putc( 'v', stderr );    /* always true! */
+               if ( nowarn )
+                       putc( 'w', stderr );
+               if ( ! interactive )
+                       putc( 'B', stderr );
+               if ( interactive )
+                       putc( 'I', stderr );
+               if ( ! gen_line_dirs )
+                       putc( 'L', stderr );
+               if ( trace )
+                       putc( 'T', stderr );
+               if ( csize == 128 )
+                       putc( '7', stderr );
+               else
+                       putc( '8', stderr );
+
+               fprintf( stderr, " -C" );
+
+               if ( fulltbl )
+                       putc( 'f', stderr );
+               if ( fullspd )
+                       putc( 'F', stderr );
+               if ( useecs )
+                       putc( 'e', stderr );
+               if ( usemecs )
+                       putc( 'm', stderr );
+
+               if ( skelname )
+                       fprintf( stderr, " -S%s", skelname );
+
+               putc( '\n', stderr );
+
+               fprintf( stderr, "  %d/%d NFA states\n", lastnfa, current_mns );
+               fprintf( stderr, "  %d/%d DFA states (%d words)\n", lastdfa,
+                       current_max_dfas, totnst );
+               fprintf( stderr, "  %d rules\n",
+               num_rules + num_eof_rules - 1 /* - 1 for def. rule */ );
+
+               if ( num_backtracking == 0 )
+                       fprintf( stderr, "  No backtracking\n" );
+               else if ( fullspd || fulltbl )
+                       fprintf( stderr,
+                               "  %d backtracking (non-accepting) states\n",
+                               num_backtracking );
+               else
+                       fprintf( stderr,
+                               "  compressed tables always backtrack\n" );
+
+               if ( bol_needed )
+                       fprintf( stderr,
+                               "  Beginning-of-line patterns used\n" );
+
+               fprintf( stderr, "  %d/%d start conditions\n", lastsc,
+                       current_max_scs );
+               fprintf( stderr,
+                       "  %d epsilon states, %d double epsilon states\n",
+                       numeps, eps2 );
 
-       if ( bol_needed )
-           fprintf( stderr, "  Beginning-of-line patterns used\n" );
+               if ( lastccl == 0 )
+                       fprintf( stderr, "  no character classes\n" );
+               else
+                       fprintf( stderr,
+       "  %d/%d character classes needed %d/%d words of storage, %d reused\n",
+                               lastccl, current_maxccls,
+                               cclmap[lastccl] + ccllen[lastccl],
+                               current_max_ccl_tbl_size, cclreuse );
 
-       fprintf( stderr, "  %d/%d start conditions\n", lastsc,
-                current_max_scs );
-       fprintf( stderr, "  %d epsilon states, %d double epsilon states\n",
-                numeps, eps2 );
+               fprintf( stderr, "  %d state/nextstate pairs created\n",
+                       numsnpairs );
+               fprintf( stderr, "  %d/%d unique/duplicate transitions\n",
+                       numuniq, numdup );
 
-       if ( lastccl == 0 )
-           fprintf( stderr, "  no character classes\n" );
-       else
-           fprintf( stderr,
-       "  %d/%d character classes needed %d/%d words of storage, %d reused\n",
-                    lastccl, current_maxccls,
-                    cclmap[lastccl] + ccllen[lastccl],
-                    current_max_ccl_tbl_size, cclreuse );
+               if ( fulltbl )
+                       {
+                       tblsiz = lastdfa * numecs;
+                       fprintf( stderr, "  %d table entries\n", tblsiz );
+                       }
 
-       fprintf( stderr, "  %d state/nextstate pairs created\n", numsnpairs );
-       fprintf( stderr, "  %d/%d unique/duplicate transitions\n",
-                numuniq, numdup );
+               else
+                       {
+                       tblsiz = 2 * (lastdfa + numtemps) + 2 * tblend;
+
+                       fprintf( stderr, "  %d/%d base-def entries created\n",
+                               lastdfa + numtemps, current_max_dfas );
+                       fprintf( stderr,
+                               "  %d/%d (peak %d) nxt-chk entries created\n",
+                               tblend, current_max_xpairs, peakpairs );
+                       fprintf( stderr,
+                       "  %d/%d (peak %d) template nxt-chk entries created\n",
+                               numtemps * nummecs, current_max_template_xpairs,
+                               numtemps * numecs );
+                       fprintf( stderr, "  %d empty table entries\n", nummt );
+                       fprintf( stderr, "  %d protos created\n", numprots );
+                       fprintf( stderr, "  %d templates created, %d uses\n",
+                               numtemps, tmpuses );
+                       }
 
-       if ( fulltbl )
-           {
-           tblsiz = lastdfa * numecs;
-           fprintf( stderr, "  %d table entries\n", tblsiz );
-           }
+               if ( useecs )
+                       {
+                       tblsiz = tblsiz + csize;
+                       fprintf( stderr,
+                               "  %d/%d equivalence classes created\n",
+                               numecs, csize );
+                       }
 
-       else
-           {
-           tblsiz = 2 * (lastdfa + numtemps) + 2 * tblend;
-
-           fprintf( stderr, "  %d/%d base-def entries created\n",
-                    lastdfa + numtemps, current_max_dfas );
-           fprintf( stderr, "  %d/%d (peak %d) nxt-chk entries created\n",
-                    tblend, current_max_xpairs, peakpairs );
-           fprintf( stderr,
-                    "  %d/%d (peak %d) template nxt-chk entries created\n",
-                    numtemps * nummecs, current_max_template_xpairs,
-                    numtemps * numecs );
-           fprintf( stderr, "  %d empty table entries\n", nummt );
-           fprintf( stderr, "  %d protos created\n", numprots );
-           fprintf( stderr, "  %d templates created, %d uses\n",
-                    numtemps, tmpuses );
-           }
+               if ( usemecs )
+                       {
+                       tblsiz = tblsiz + numecs;
+                       fprintf( stderr,
+                               "  %d/%d meta-equivalence classes created\n",
+                               nummecs, csize );
+                       }
 
-       if ( useecs )
-           {
-           tblsiz = tblsiz + csize;
-           fprintf( stderr, "  %d/%d equivalence classes created\n",
-                    numecs, csize );
-           }
-
-       if ( usemecs )
-           {
-           tblsiz = tblsiz + numecs;
-           fprintf( stderr, "  %d/%d meta-equivalence classes created\n",
-                    nummecs, csize );
-           }
-
-       fprintf( stderr, "  %d (%d saved) hash collisions, %d DFAs equal\n",
-                hshcol, hshsave, dfaeql );
-       fprintf( stderr, "  %d sets of reallocations needed\n", num_reallocs );
-       fprintf( stderr, "  %d total table entries needed\n", tblsiz );
-       }
+               fprintf( stderr,
+                       "  %d (%d saved) hash collisions, %d DFAs equal\n",
+                       hshcol, hshsave, dfaeql );
+               fprintf( stderr, "  %d sets of reallocations needed\n",
+                       num_reallocs );
+               fprintf( stderr, "  %d total table entries needed\n", tblsiz );
+               }
 
 #ifndef VMS
-    exit( status );
+       exit( exit_status );
 #else
-    exit( status + 1 );
+       exit( exit_status + 1 );
 #endif
-    }
+       }
 
 
-/* flexinit - initialize flex
- *
- * synopsis
- *    int argc;
- *    char **argv;
- *    flexinit( argc, argv );
- */
+/* flexinit - initialize flex */
 
 void flexinit( argc, argv )
 int argc;
 char **argv;
-
-    {
-    int i, sawcmpflag;
-    int csize_given, interactive_given;
-    char *arg, *flex_gettime(), *mktemp();
-
-    printstats = syntaxerror = trace = spprdflt = caseins = false;
-    backtrack_report = ddebug = fulltbl = fullspd = false;
-    nowarn = yymore_used = continued_action = reject = yytext_is_array = false;
-    yymore_really_used = reject_really_used = false;
-    gen_line_dirs = usemecs = useecs = true;
-    performance_report = 0;
-
-    sawcmpflag = false;
-    use_stdout = false;
-    csize_given = false;
-    interactive_given = false;
-
-    /* Initialize dynamic array for holding the rule actions. */
-    action_size = 2048;        /* default size of action array in bytes */
-    prolog = action = action_array = allocate_character_array( action_size );
-    action_offset = action_index = 0;
-
-    starttime = flex_gettime();
-
-    program_name = argv[0];
-
-    /* read flags */
-    for ( --argc, ++argv; argc ; --argc, ++argv )
        {
-       if ( argv[0][0] != '-' || argv[0][1] == '\0' )
-           break;
-
-       arg = argv[0];
-
-       for ( i = 1; arg[i] != '\0'; ++i )
-           switch ( arg[i] )
+       int i, sawcmpflag;
+       int csize_given, interactive_given;
+       char *arg, *flex_gettime(), *mktemp();
+
+       printstats = syntaxerror = trace = spprdflt = caseins = false;
+       backtrack_report = ddebug = fulltbl = fullspd = false;
+       nowarn = yymore_used = continued_action = reject = false;
+       yytext_is_array = yymore_really_used = reject_really_used = false;
+       gen_line_dirs = usemecs = useecs = true;
+       performance_report = 0;
+
+       sawcmpflag = false;
+       use_stdout = false;
+       csize_given = false;
+       interactive_given = false;
+
+       /* Initialize dynamic array for holding the rule actions. */
+       action_size = 2048;     /* default size of action array in bytes */
+       prolog = action = action_array =
+               allocate_character_array( action_size );
+       action_offset = action_index = 0;
+
+       starttime = flex_gettime();
+
+       program_name = argv[0];
+
+       /* read flags */
+       for ( --argc, ++argv; argc ; --argc, ++argv )
                {
-               case 'B':
-                   interactive = false;
-                   interactive_given = true;
-                   break;
-
-               case 'b':
-                   backtrack_report = true;
-                   break;
+               if ( argv[0][0] != '-' || argv[0][1] == '\0' )
+                       break;
 
-               case 'c':
-                   fprintf( stderr,
-       "%s: Assuming use of deprecated -c flag is really intended to be -C\n",
-                            program_name );
-
-                   /* fall through */
-
-               case 'C':
-                   if ( i != 1 )
-                       flexerror( "-C flag must be given separately" );
+               arg = argv[0];
 
-                   if ( ! sawcmpflag )
-                       {
-                       useecs = false;
-                       usemecs = false;
-                       fulltbl = false;
-                       sawcmpflag = true;
-                       }
-
-                   for ( ++i; arg[i] != '\0'; ++i )
+               for ( i = 1; arg[i] != '\0'; ++i )
                        switch ( arg[i] )
-                           {
-                           case 'e':
-                               useecs = true;
-                               break;
-
-                           case 'F':
-                               fullspd = true;
-                               break;
-
-                           case 'f':
-                               fulltbl = true;
-                               break;
-
-                           case 'm':
-                               usemecs = true;
-                               break;
-
-                           default:
-                               lerrif( "unknown -C option '%c'",
-                                       (int) arg[i] );
-                               break;
-                           }
-
-                   goto get_next_arg;
-
-               case 'd':
-                   ddebug = true;
-                   break;
-
-               case 'f':
-                   useecs = usemecs = false;
-                   fulltbl = true;
-                   break;
-
-               case 'F':
-                   useecs = usemecs = false;
-                   fullspd = true;
-                   break;
-
-               case 'h':
-                   usage();
-                   exit( 0 );
-
-               case 'I':
-                   interactive = true;
-                   interactive_given = true;
-                   break;
-
-               case 'i':
-                   caseins = true;
-                   break;
-
-               case 'L':
-                   gen_line_dirs = false;
-                   break;
-
-               case 'n':
-                   /* stupid do-nothing deprecated option */
-                   break;
-
-               case 'p':
-                   ++performance_report;
-                   break;
-
-               case 'S':
-                   if ( i != 1 )
-                       flexerror( "-S flag must be given separately" );
-
-                   skelname = arg + i + 1;
-                   goto get_next_arg;
-
-               case 's':
-                   spprdflt = true;
-                   break;
-
-               case 't':
-                   use_stdout = true;
-                   break;
-
-               case 'T':
-                   trace = true;
-                   break;
-
-               case 'v':
-                   printstats = true;
-                   break;
-
-               case 'V':
-                   fprintf( stderr, "%s version %s\n",
-                            program_name, flex_version );
-                   exit( 0 );
-
-               case 'w':
-                   nowarn = true;
-                   break;
-
-               case '7':
-                   csize = 128;
-                   csize_given = true;
-                   break;
-
-               case '8':
-                   csize = CSIZE;
-                   csize_given = true;
-                   break;
-
-               default:
-                   fprintf( stderr, "%s: unknown flag '%c'\n",
-                            program_name, (int) arg[i] );
-                   usage();
-                   exit( 1 );
+                               {
+                               case 'B':
+                                       interactive = false;
+                                       interactive_given = true;
+                                       break;
+
+                               case 'b':
+                                       backtrack_report = true;
+                                       break;
+
+                               case 'c':
+                                       fprintf( stderr,
+       "%s: Assuming use of deprecated -c flag is really intended to be -C\n",
+                                       program_name );
+
+                                       /* fall through */
+
+                               case 'C':
+                                       if ( i != 1 )
+                                               flexerror(
+                                       "-C flag must be given separately" );
+
+                                       if ( ! sawcmpflag )
+                                               {
+                                               useecs = false;
+                                               usemecs = false;
+                                               fulltbl = false;
+                                               sawcmpflag = true;
+                                               }
+
+                                       for ( ++i; arg[i] != '\0'; ++i )
+                                               switch ( arg[i] )
+                                                       {
+                                                       case 'e':
+                                                               useecs = true;
+                                                               break;
+
+                                                       case 'F':
+                                                               fullspd = true;
+                                                               break;
+
+                                                       case 'f':
+                                                               fulltbl = true;
+                                                               break;
+
+                                                       case 'm':
+                                                               usemecs = true;
+                                                               break;
+
+                                                       default:
+                                                               lerrif(
+                                               "unknown -C option '%c'",
+                                                               (int) arg[i] );
+                                                               break;
+                                                       }
+
+                                       goto get_next_arg;
+
+                               case 'd':
+                                       ddebug = true;
+                                       break;
+
+                               case 'f':
+                                       useecs = usemecs = false;
+                                       fulltbl = true;
+                                       break;
+
+                               case 'F':
+                                       useecs = usemecs = false;
+                                       fullspd = true;
+                                       break;
+
+                               case 'h':
+                                       usage();
+                                       exit( 0 );
+
+                               case 'I':
+                                       interactive = true;
+                                       interactive_given = true;
+                                       break;
+
+                               case 'i':
+                                       caseins = true;
+                                       break;
+
+                               case 'L':
+                                       gen_line_dirs = false;
+                                       break;
+
+                               case 'n':
+                                       /* Stupid do-nothing deprecated
+                                        * option.
+                                        */
+                                       break;
+
+                               case 'p':
+                                       ++performance_report;
+                                       break;
+
+                               case 'S':
+                                       if ( i != 1 )
+                                               flexerror(
+                                       "-S flag must be given separately" );
+
+                                       skelname = arg + i + 1;
+                                       goto get_next_arg;
+
+                               case 's':
+                                       spprdflt = true;
+                                       break;
+
+                               case 't':
+                                       use_stdout = true;
+                                       break;
+
+                               case 'T':
+                                       trace = true;
+                                       break;
+
+                               case 'v':
+                                       printstats = true;
+                                       break;
+
+                               case 'V':
+                                       fprintf( stderr, "%s version %s\n",
+                                               program_name, flex_version );
+                                       exit( 0 );
+
+                               case 'w':
+                                       nowarn = true;
+                                       break;
+
+                               case '7':
+                                       csize = 128;
+                                       csize_given = true;
+                                       break;
+
+                               case '8':
+                                       csize = CSIZE;
+                                       csize_given = true;
+                                       break;
+
+                               default:
+                                       fprintf( stderr,
+                                               "%s: unknown flag '%c'\n",
+                                               program_name, (int) arg[i] );
+                                       usage();
+                                       exit( 1 );
+                               }
+
+               /* Used by -C and -S flags in lieu of a "continue 2" control. */
+               get_next_arg: ;
                }
 
-get_next_arg: /* used by -C and -S flags in lieu of a "continue 2" control */
-       ;
-       }
-
-    if ( ! csize_given )
-       {
-       if ( fulltbl || fullspd )
-           csize = DEFAULT_CSIZE;
-       else
-           csize = CSIZE;
-       }
+       if ( ! csize_given )
+               {
+               if ( fulltbl || fullspd )
+                       csize = DEFAULT_CSIZE;
+               else
+                       csize = CSIZE;
+               }
 
-    if ( ! interactive_given )
-       {
-       if ( fulltbl || fullspd )
-           interactive = false;
-       else
-           interactive = true;
-       }
+       if ( ! interactive_given )
+               {
+               if ( fulltbl || fullspd )
+                       interactive = false;
+               else
+                       interactive = true;
+               }
 
-    if ( (fulltbl || fullspd) && usemecs )
-       flexerror( "full table and -Cm don't make sense together" );
+       if ( (fulltbl || fullspd) && usemecs )
+               flexerror( "full table and -Cm don't make sense together" );
 
-    if ( (fulltbl || fullspd) && interactive )
-       flexerror( "full table and -I are incompatible" );
+       if ( (fulltbl || fullspd) && interactive )
+               flexerror( "full table and -I are incompatible" );
 
-    if ( fulltbl && fullspd )
-       flexerror( "full table and -F are mutually exclusive" );
+       if ( fulltbl && fullspd )
+               flexerror( "full table and -F are mutually exclusive" );
 
-    if ( ! use_stdout )
-       {
-       FILE *prev_stdout = freopen( outfile, "w", stdout );
+       if ( ! use_stdout )
+               {
+               FILE *prev_stdout = freopen( outfile, "w", stdout );
 
-       if ( prev_stdout == NULL )
-           lerrsf( "could not create %s", outfile );
+               if ( prev_stdout == NULL )
+                       lerrsf( "could not create %s", outfile );
 
-       outfile_created = 1;
-       }
+               outfile_created = 1;
+               }
 
-    num_input_files = argc;
-    input_files = argv;
-    set_input_file( num_input_files > 0 ? input_files[0] : NULL );
+       num_input_files = argc;
+       input_files = argv;
+       set_input_file( num_input_files > 0 ? input_files[0] : NULL );
 
-    if ( backtrack_report )
-       {
+       if ( backtrack_report )
+               {
 #ifndef SHORT_FILE_NAMES
-       backtrack_file = fopen( "lex.backtrack", "w" );
+               backtrack_file = fopen( "lex.backtrack", "w" );
 #else
-       backtrack_file = fopen( "lex.bck", "w" );
+               backtrack_file = fopen( "lex.bck", "w" );
 #endif
 
-       if ( backtrack_file == NULL )
-           flexerror( "could not create lex.backtrack" );
-       }
-
-    else
-       backtrack_file = NULL;
+               if ( backtrack_file == NULL )
+                       flexerror( "could not create lex.backtrack" );
+               }
 
+       else
+               backtrack_file = NULL;
 
-    lastccl = 0;
-    lastsc = 0;
 
-    if ( skelname && (skelfile = fopen( skelname, "r" )) == NULL )
-       lerrsf( "can't open skeleton file %s", skelname );
+       lastccl = 0;
+       lastsc = 0;
 
-    lastdfa = lastnfa = 0;
-    num_rules = num_eof_rules = default_rule = numas = numsnpairs = tmpuses = 0;
-    numecs = numeps = eps2 = num_reallocs = hshcol = dfaeql = totnst = 0;
-    numuniq = numdup = hshsave = eofseen = datapos = dataline = 0;
-    num_backtracking = onesp = numprots = 0;
-    variable_trailing_context_rules = bol_needed = false;
+       if ( skelname && (skelfile = fopen( skelname, "r" )) == NULL )
+               lerrsf( "can't open skeleton file %s", skelname );
 
-    linenum = sectnum = 1;
-    firstprot = NIL;
+       lastdfa = lastnfa = 0;
+       num_rules = num_eof_rules = default_rule = 0;
+       numas = numsnpairs = tmpuses = 0;
+       numecs = numeps = eps2 = num_reallocs = hshcol = dfaeql = totnst = 0;
+       numuniq = numdup = hshsave = eofseen = datapos = dataline = 0;
+       num_backtracking = onesp = numprots = 0;
+       variable_trailing_context_rules = bol_needed = false;
 
-    /* used in mkprot() so that the first proto goes in slot 1
-     * of the proto queue
-     */
-    lastprot = 1;
+       linenum = sectnum = 1;
+       firstprot = NIL;
 
-    if ( useecs )
-       { /* set up doubly-linked equivalence classes */
-       /* We loop all the way up to csize, since ecgroup[csize] is the
-        * position used for NUL characters
+       /* Used in mkprot() so that the first proto goes in slot 1
+        * of the proto queue.
         */
-       ecgroup[1] = NIL;
+       lastprot = 1;
 
-       for ( i = 2; i <= csize; ++i )
-           {
-           ecgroup[i] = i - 1;
-           nextecm[i - 1] = i;
-           }
+       if ( useecs )
+               {
+               /* Set up doubly-linked equivalence classes. */
 
-       nextecm[csize] = NIL;
-       }
+               /* We loop all the way up to csize, since ecgroup[csize] is
+                * the position used for NUL characters.
+                */
+               ecgroup[1] = NIL;
 
-    else
-       { /* put everything in its own equivalence class */
-       for ( i = 1; i <= csize; ++i )
-           {
-           ecgroup[i] = i;
-           nextecm[i] = BAD_SUBSCRIPT; /* to catch errors */
-           }
-       }
+               for ( i = 2; i <= csize; ++i )
+                       {
+                       ecgroup[i] = i - 1;
+                       nextecm[i - 1] = i;
+                       }
 
-    set_up_initial_allocations();
-    }
+               nextecm[csize] = NIL;
+               }
 
+       else
+               {
+               /* Put everything in its own equivalence class. */
+               for ( i = 1; i <= csize; ++i )
+                       {
+                       ecgroup[i] = i;
+                       nextecm[i] = BAD_SUBSCRIPT;     /* to catch errors */
+                       }
+               }
 
-/* readin - read in the rules section of the input file(s)
- *
- * synopsis
- *    readin();
- */
+       set_up_initial_allocations();
+       }
 
-void readin()
 
-    {
-    skelout();
+/* readin - read in the rules section of the input file(s) */
 
-    if ( ddebug )
-       puts( "#define FLEX_DEBUG" );
+void readin()
+       {
+       skelout();
 
-    if ( csize == 256 )
-       puts( "typedef unsigned char YY_CHAR;" );
-    else
-       puts( "typedef char YY_CHAR;" );
+       if ( ddebug )
+               puts( "#define FLEX_DEBUG" );
 
-    line_directive_out( stdout );
+       if ( csize == 256 )
+               puts( "typedef unsigned char YY_CHAR;" );
+       else
+               puts( "typedef char YY_CHAR;" );
 
-    if ( yyparse() )
-       {
-       pinpoint_message( "fatal parse error" );
-       flexend( 1 );
-       }
+       line_directive_out( stdout );
 
-    if ( useecs )
-       numecs = cre8ecs( nextecm, ecgroup, csize );
-    else
-       numecs = csize;
+       if ( yyparse() )
+               {
+               pinpoint_message( "fatal parse error" );
+               flexend( 1 );
+               }
 
-    /* now map the equivalence class for NUL to its expected place */
-    ecgroup[0] = ecgroup[csize];
-    NUL_ec = abs( ecgroup[0] );
+       if ( useecs )
+               numecs = cre8ecs( nextecm, ecgroup, csize );
+       else
+               numecs = csize;
 
-    if ( useecs )
-       ccl2ecl();
+       /* Now map the equivalence class for NUL to its expected place. */
+       ecgroup[0] = ecgroup[csize];
+       NUL_ec = abs( ecgroup[0] );
 
-    if ( yytext_is_array )
-       {
-       puts( "extern char yytext[];\n" );
-       puts( "#ifndef YYLMAX" );
-       puts( "#define YYLMAX YY_READ_BUF_SIZE" );
-       puts( "#endif YYLMAX\n" );
-       puts( "char yytext[YYLMAX];" );
-       puts( "YY_CHAR *yytext_ptr;" );
-       }
+       if ( useecs )
+               ccl2ecl();
 
-    else
-       {
-       puts( "extern YY_CHAR *yytext;" );
-       puts( "YY_CHAR *yytext;" );
-       puts( "#define yytext_ptr yytext" );
+       if ( yytext_is_array )
+               {
+               puts( "extern char yytext[];\n" );
+               puts( "#ifndef YYLMAX" );
+               puts( "#define YYLMAX YY_READ_BUF_SIZE" );
+               puts( "#endif YYLMAX\n" );
+               puts( "char yytext[YYLMAX];" );
+               puts( "YY_CHAR *yytext_ptr;" );
+               }
+
+       else
+               {
+               puts( "extern YY_CHAR *yytext;" );
+               puts( "YY_CHAR *yytext;" );
+               puts( "#define yytext_ptr yytext" );
+               }
        }
-    }
 
 
 
 /* set_up_initial_allocations - allocate memory for internal tables */
 
 void set_up_initial_allocations()
-
-    {
-    current_mns = INITIAL_MNS;
-    firstst = allocate_integer_array( current_mns );
-    lastst = allocate_integer_array( current_mns );
-    finalst = allocate_integer_array( current_mns );
-    transchar = allocate_integer_array( current_mns );
-    trans1 = allocate_integer_array( current_mns );
-    trans2 = allocate_integer_array( current_mns );
-    accptnum = allocate_integer_array( current_mns );
-    assoc_rule = allocate_integer_array( current_mns );
-    state_type = allocate_integer_array( current_mns );
-
-    current_max_rules = INITIAL_MAX_RULES;
-    rule_type = allocate_integer_array( current_max_rules );
-    rule_linenum = allocate_integer_array( current_max_rules );
-    rule_useful = allocate_integer_array( current_max_rules );
-
-    current_max_scs = INITIAL_MAX_SCS;
-    scset = allocate_integer_array( current_max_scs );
-    scbol = allocate_integer_array( current_max_scs );
-    scxclu = allocate_integer_array( current_max_scs );
-    sceof = allocate_integer_array( current_max_scs );
-    scname = allocate_char_ptr_array( current_max_scs );
-    actvsc = allocate_integer_array( current_max_scs );
-
-    current_maxccls = INITIAL_MAX_CCLS;
-    cclmap = allocate_integer_array( current_maxccls );
-    ccllen = allocate_integer_array( current_maxccls );
-    cclng = allocate_integer_array( current_maxccls );
-
-    current_max_ccl_tbl_size = INITIAL_MAX_CCL_TBL_SIZE;
-    ccltbl = allocate_Character_array( current_max_ccl_tbl_size );
-
-    current_max_dfa_size = INITIAL_MAX_DFA_SIZE;
-
-    current_max_xpairs = INITIAL_MAX_XPAIRS;
-    nxt = allocate_integer_array( current_max_xpairs );
-    chk = allocate_integer_array( current_max_xpairs );
-
-    current_max_template_xpairs = INITIAL_MAX_TEMPLATE_XPAIRS;
-    tnxt = allocate_integer_array( current_max_template_xpairs );
-
-    current_max_dfas = INITIAL_MAX_DFAS;
-    base = allocate_integer_array( current_max_dfas );
-    def = allocate_integer_array( current_max_dfas );
-    dfasiz = allocate_integer_array( current_max_dfas );
-    accsiz = allocate_integer_array( current_max_dfas );
-    dhash = allocate_integer_array( current_max_dfas );
-    dss = allocate_int_ptr_array( current_max_dfas );
-    dfaacc = allocate_dfaacc_union( current_max_dfas );
-
-    nultrans = (int *) 0;
-    }
+       {
+       current_mns = INITIAL_MNS;
+       firstst = allocate_integer_array( current_mns );
+       lastst = allocate_integer_array( current_mns );
+       finalst = allocate_integer_array( current_mns );
+       transchar = allocate_integer_array( current_mns );
+       trans1 = allocate_integer_array( current_mns );
+       trans2 = allocate_integer_array( current_mns );
+       accptnum = allocate_integer_array( current_mns );
+       assoc_rule = allocate_integer_array( current_mns );
+       state_type = allocate_integer_array( current_mns );
+
+       current_max_rules = INITIAL_MAX_RULES;
+       rule_type = allocate_integer_array( current_max_rules );
+       rule_linenum = allocate_integer_array( current_max_rules );
+       rule_useful = allocate_integer_array( current_max_rules );
+
+       current_max_scs = INITIAL_MAX_SCS;
+       scset = allocate_integer_array( current_max_scs );
+       scbol = allocate_integer_array( current_max_scs );
+       scxclu = allocate_integer_array( current_max_scs );
+       sceof = allocate_integer_array( current_max_scs );
+       scname = allocate_char_ptr_array( current_max_scs );
+       actvsc = allocate_integer_array( current_max_scs );
+
+       current_maxccls = INITIAL_MAX_CCLS;
+       cclmap = allocate_integer_array( current_maxccls );
+       ccllen = allocate_integer_array( current_maxccls );
+       cclng = allocate_integer_array( current_maxccls );
+
+       current_max_ccl_tbl_size = INITIAL_MAX_CCL_TBL_SIZE;
+       ccltbl = allocate_Character_array( current_max_ccl_tbl_size );
+
+       current_max_dfa_size = INITIAL_MAX_DFA_SIZE;
+
+       current_max_xpairs = INITIAL_MAX_XPAIRS;
+       nxt = allocate_integer_array( current_max_xpairs );
+       chk = allocate_integer_array( current_max_xpairs );
+
+       current_max_template_xpairs = INITIAL_MAX_TEMPLATE_XPAIRS;
+       tnxt = allocate_integer_array( current_max_template_xpairs );
+
+       current_max_dfas = INITIAL_MAX_DFAS;
+       base = allocate_integer_array( current_max_dfas );
+       def = allocate_integer_array( current_max_dfas );
+       dfasiz = allocate_integer_array( current_max_dfas );
+       accsiz = allocate_integer_array( current_max_dfas );
+       dhash = allocate_integer_array( current_max_dfas );
+       dss = allocate_int_ptr_array( current_max_dfas );
+       dfaacc = allocate_dfaacc_union( current_max_dfas );
+
+       nultrans = (int *) 0;
+       }
 
 
 void usage()
-    {
-    fprintf( stderr,
+       {
+       fprintf( stderr,
        "%s [-bcdfhinpstvwBFILTV78 -C[efmF] -Sskeleton] [filename ...]\n",
-       program_name );
-
-    fprintf( stderr,
-       "\t-b  generate backtracking information to lex.backtrack\n" );
-    fprintf( stderr, "\t-c  do-nothing POSIX option\n" );
-    fprintf( stderr, "\t-d  turn on debug mode in generated scanner\n" );
-    fprintf( stderr, "\t-f  generate fast, large scanner\n" );
-    fprintf( stderr, "\t-h  produce this help message\n" );
-    fprintf( stderr, "\t-i  generate case-insensitive scanner\n" );
-    fprintf( stderr, "\t-n  do-nothing POSIX option\n" );
-    fprintf( stderr, "\t-p  generate performance report to stderr\n" );
-    fprintf( stderr, "\t-s  suppress default rule to ECHO unmatched text\n" );
-    fprintf( stderr,
+               program_name );
+
+       fprintf( stderr,
+               "\t-b  generate backtracking information to lex.backtrack\n" );
+       fprintf( stderr, "\t-c  do-nothing POSIX option\n" );
+       fprintf( stderr, "\t-d  turn on debug mode in generated scanner\n" );
+       fprintf( stderr, "\t-f  generate fast, large scanner\n" );
+       fprintf( stderr, "\t-h  produce this help message\n" );
+       fprintf( stderr, "\t-i  generate case-insensitive scanner\n" );
+       fprintf( stderr, "\t-n  do-nothing POSIX option\n" );
+       fprintf( stderr, "\t-p  generate performance report to stderr\n" );
+       fprintf( stderr,
+               "\t-s  suppress default rule to ECHO unmatched text\n" );
+       fprintf( stderr,
        "\t-t  write generated scanner on stdout instead of lex.yy.c\n" );
-    fprintf( stderr, "\t-v  write summary of scanner statistics to stderr\n" );
-    fprintf( stderr, "\t-w  do not generate warnings\n" );
-    fprintf( stderr, "\t-B  generate batch scanner (opposite of -I)\n" );
-    fprintf( stderr, "\t-F  use alternative fast scanner representation\n" );
-    fprintf( stderr, "\t-I  generate interactive scanner (opposite of -B)\n" );
-    fprintf( stderr, "\t-L  suppress #line directives in scanner\n" );
-    fprintf( stderr, "\t-T  %s should run in trace mode\n", program_name );
-    fprintf( stderr, "\t-V  report %s version\n", program_name );
-    fprintf( stderr, "\t-7  generate 7-bit scanner\n" );
-    fprintf( stderr, "\t-8  generate 8-bit scanner\n" );
-    fprintf( stderr,
+       fprintf( stderr,
+               "\t-v  write summary of scanner statistics to stderr\n" );
+       fprintf( stderr, "\t-w  do not generate warnings\n" );
+       fprintf( stderr, "\t-B  generate batch scanner (opposite of -I)\n" );
+       fprintf( stderr,
+               "\t-F  use alternative fast scanner representation\n" );
+       fprintf( stderr,
+               "\t-I  generate interactive scanner (opposite of -B)\n" );
+       fprintf( stderr, "\t-L  suppress #line directives in scanner\n" );
+       fprintf( stderr, "\t-T  %s should run in trace mode\n", program_name );
+       fprintf( stderr, "\t-V  report %s version\n", program_name );
+       fprintf( stderr, "\t-7  generate 7-bit scanner\n" );
+       fprintf( stderr, "\t-8  generate 8-bit scanner\n" );
+       fprintf( stderr,
        "\t-C  specify degree of table compression (default is -Cem):\n" );
-    fprintf( stderr, "\t\t-Ce  construct equivalence classes\n" );
-    fprintf( stderr,
+       fprintf( stderr, "\t\t-Ce  construct equivalence classes\n" );
+       fprintf( stderr,
        "\t\t-Cf  do not compress scanner tables; use -f representation\n" );
-    fprintf( stderr, "\t\t-Cm  construct meta-equivalence classes\n" );
-    fprintf( stderr,
+       fprintf( stderr, "\t\t-Cm  construct meta-equivalence classes\n" );
+       fprintf( stderr,
        "\t\t-CF  do not compress scanner tables; use -F representation\n" );
-    fprintf( stderr, "\t-S  specify non-default skeleton file\n" );
-    }
+       fprintf( stderr, "\t-S  specify non-default skeleton file\n" );
+       }
diff --git a/misc.c b/misc.c
index b371a74485e639cde7c08f1766d8b6d5893292cd..b66b0ec148cc17f2f13399ded0de190498e307a3 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -50,98 +50,84 @@ int otoi PROTO((Char []));
 
 void add_action( new_text )
 char *new_text;
-    {
-    int len = strlen( new_text );
-
-    while ( len + action_index + action_offset >= action_size - 10 /* slop */ )
        {
-       action_size *= 2;
-       prolog = action_array =
-           reallocate_character_array( action_array, action_size );
-       action = &action_array[action_offset];
-       }
+       int len = strlen( new_text );
 
-    strcpy( &action[action_index], new_text );
+       while ( len + action_index + action_offset >= action_size - 10
+                                                               /* slop */ )
+               {
+               action_size *= 2;
+               prolog = action_array =
+                       reallocate_character_array( action_array, action_size );
+               action = &action_array[action_offset];
+               }
+
+       strcpy( &action[action_index], new_text );
 
-    action_index += len;
-    }
+       action_index += len;
+       }
 
 
 /* allocate_array - allocate memory for an integer array of the given size */
 
 void *allocate_array( size, element_size )
 int size, element_size;
+       {
+       register void *mem;
 
-    {
-    register void *mem;
+       /* On 16-bit int machines (e.g., 80286) we might be trying to
+        * allocate more than a signed int can hold, and that won't
+        * work.  Cheap test:
+        */
+       if ( element_size * size <= 0 )
+               flexfatal( "request for < 1 byte in allocate_array()" );
 
-    /* on 16-bit int machines (e.g., 80286) we might be trying to
-     * allocate more than a signed int can hold, and that won't
-     * work.  Cheap test:
-     */
-    if ( element_size * size <= 0 )
-        flexfatal( "request for < 1 byte in allocate_array()" );
+       mem = (void *) malloc( (unsigned) (element_size * size) );
 
-    mem = (void *) malloc( (unsigned) (element_size * size) );
+       if ( mem == NULL )
+               flexfatal( "memory allocation failed in allocate_array()" );
 
-    if ( mem == NULL )
-       flexfatal( "memory allocation failed in allocate_array()" );
+       return mem;
+       }
 
-    return ( mem );
-    }
 
-
-/* all_lower - true if a string is all lower-case
- *
- * synopsis:
- *    Char *str;
- *    int all_lower();
- *    true/false = all_lower( str );
- */
+/* all_lower - true if a string is all lower-case */
 
 int all_lower( str )
 register Char *str;
-
-    {
-    while ( *str )
        {
-       if ( ! isascii( *str ) || ! islower( *str ) )
-           return ( 0 );
-       ++str;
+       while ( *str )
+               {
+               if ( ! isascii( *str ) || ! islower( *str ) )
+                       return 0;
+               ++str;
+               }
+
+       return 1;
        }
 
-    return ( 1 );
-    }
 
-
-/* all_upper - true if a string is all upper-case
- *
- * synopsis:
- *    Char *str;
- *    int all_upper();
- *    true/false = all_upper( str );
- */
+/* all_upper - true if a string is all upper-case */
 
 int all_upper( str )
 register Char *str;
-
-    {
-    while ( *str )
        {
-       if ( ! isascii( *str ) || ! isupper( (char) *str ) )
-           return ( 0 );
-       ++str;
-       }
+       while ( *str )
+               {
+               if ( ! isascii( *str ) || ! isupper( (char) *str ) )
+                       return 0;
+               ++str;
+               }
 
-    return ( 1 );
-    }
+       return 1;
+       }
 
 
 /* bubble - bubble sort an integer array in increasing order
  *
  * synopsis
  *   int v[n], n;
- *   bubble( v, n );
+ *   void bubble( v, n );
  *
  * description
  *   sorts the first n elements of array v and replaces them in
@@ -149,97 +135,79 @@ register Char *str;
  *
  * passed
  *   v - the array to be sorted
- *   n - the number of elements of 'v' to be sorted */
+ *   n - the number of elements of 'v' to be sorted
+ */
 
 void bubble( v, n )
 int v[], n;
-
-    {
-    register int i, j, k;
-
-    for ( i = n; i > 1; --i )
-       for ( j = 1; j < i; ++j )
-           if ( v[j] > v[j + 1] )      /* compare */
-               {
-               k = v[j];       /* exchange */
-               v[j] = v[j + 1];
-               v[j + 1] = k;
-               }
-    }
+       {
+       register int i, j, k;
+
+       for ( i = n; i > 1; --i )
+               for ( j = 1; j < i; ++j )
+                       if ( v[j] > v[j + 1] )  /* compare */
+                               {
+                               k = v[j];       /* exchange */
+                               v[j] = v[j + 1];
+                               v[j + 1] = k;
+                               }
+       }
 
 
-/* clower - replace upper-case letter to lower-case
- *
- * synopsis:
- *    Char clower();
- *    int c;
- *    c = clower( c );
- */
+/* clower - replace upper-case letter to lower-case */
 
 Char clower( c )
 register int c;
-
-    {
-    return ( (isascii( c ) && isupper( c )) ? tolower( c ) : c );
-    }
+       {
+       return (isascii( c ) && isupper( c )) ? tolower( c ) : c;
+       }
 
 
-/* copy_string - returns a dynamically allocated copy of a string
- *
- * synopsis
- *    char *str, *copy, *copy_string();
- *    copy = copy_string( str );
- */
+/* copy_string - returns a dynamically allocated copy of a string */
 
 char *copy_string( str )
 register char *str;
+       {
+       register char *c;
+       char *copy;
 
-    {
-    register char *c;
-    char *copy;
-
-    /* find length */
-    for ( c = str; *c; ++c )
-       ;
+       /* find length */
+       for ( c = str; *c; ++c )
+               ;
 
-    copy = malloc( (unsigned) ((c - str + 1) * sizeof( char )) );
+       copy = malloc( (unsigned) ((c - str + 1) * sizeof( char )) );
 
-    if ( copy == NULL )
-       flexfatal( "dynamic memory failure in copy_string()" );
+       if ( copy == NULL )
+               flexfatal( "dynamic memory failure in copy_string()" );
 
-    for ( c = copy; (*c++ = *str++); )
-       ;
+       for ( c = copy; (*c++ = *str++); )
+               ;
 
-    return ( copy );
-    }
+       return copy;
+       }
 
 
 /* copy_unsigned_string -
  *    returns a dynamically allocated copy of a (potentially) unsigned string
- *
- * synopsis
- *    Char *str, *copy, *copy_unsigned_string();
- *    copy = copy_unsigned_string( str );
  */
 
 Char *copy_unsigned_string( str )
 register Char *str;
+       {
+       register Char *c;
+       Char *copy;
 
-    {
-    register Char *c;
-    Char *copy;
-
-    /* find length */
-    for ( c = str; *c; ++c )
-       ;
+       /* find length */
+       for ( c = str; *c; ++c )
+               ;
 
-    copy = allocate_Character_array( c - str + 1 );
+       copy = allocate_Character_array( c - str + 1 );
 
-    for ( c = copy; (*c++ = *str++); )
-       ;
+       for ( c = copy; (*c++ = *str++); )
+               ;
 
-    return ( copy );
-    }
+       return copy;
+       }
 
 
 /* cshell - shell sort a character array in increasing order
@@ -251,7 +219,7 @@ register Char *str;
  *   cshell( v, n, special_case_0 );
  *
  * description
- *   does a shell sort of the first n elements of array v.
+ *   Does a shell sort of the first n elements of array v.
  *   If special_case_0 is true, then any element equal to 0
  *   is instead assumed to have infinite weight.
  *
@@ -263,120 +231,91 @@ register Char *str;
 void cshell( v, n, special_case_0 )
 Char v[];
 int n, special_case_0;
-
-    {
-    int gap, i, j, jg;
-    Char k;
-
-    for ( gap = n / 2; gap > 0; gap = gap / 2 )
-       for ( i = gap; i < n; ++i )
-           for ( j = i - gap; j >= 0; j = j - gap )
-               {
-               jg = j + gap;
-
-               if ( special_case_0 )
-                   {
-                   if ( v[jg] == 0 )
-                       break;
-
-                   else if ( v[j] != 0 && v[j] <= v[jg] )
-                       break;
-                   }
-
-               else if ( v[j] <= v[jg] )
-                   break;
-
-               k = v[j];
-               v[j] = v[jg];
-               v[jg] = k;
-               }
-    }
+       {
+       int gap, i, j, jg;
+       Char k;
+
+       for ( gap = n / 2; gap > 0; gap = gap / 2 )
+               for ( i = gap; i < n; ++i )
+                       for ( j = i - gap; j >= 0; j = j - gap )
+                               {
+                               jg = j + gap;
+
+                               if ( special_case_0 )
+                                       {
+                                       if ( v[jg] == 0 )
+                                               break;
+
+                                       else if ( v[j] != 0 && v[j] <= v[jg] )
+                                               break;
+                                       }
+
+                               else if ( v[j] <= v[jg] )
+                                       break;
+
+                               k = v[j];
+                               v[j] = v[jg];
+                               v[jg] = k;
+                               }
+       }
 
 
-/* dataend - finish up a block of data declarations
- *
- * synopsis
- *    dataend();
- */
+/* dataend - finish up a block of data declarations */
 
 void dataend()
+       {
+       if ( datapos > 0 )
+               dataflush();
 
-    {
-    if ( datapos > 0 )
-       dataflush();
-
-    /* add terminator for initialization */
-    puts( "    } ;\n" );
-
-    dataline = 0;
-    datapos = 0;
-    }
+       /* add terminator for initialization; { for vi */
+       puts( "    } ;\n" );
 
+       dataline = 0;
+       datapos = 0;
+       }
 
 
-/* dataflush - flush generated data statements
- *
- * synopsis
- *    dataflush();
- */
+/* dataflush - flush generated data statements */
 
 void dataflush()
-
-    {
-    putchar( '\n' );
-
-    if ( ++dataline >= NUMDATALINES )
        {
-       /* put out a blank line so that the table is grouped into
-        * large blocks that enable the user to find elements easily
-        */
        putchar( '\n' );
-       dataline = 0;
-       }
 
-    /* reset the number of characters written on the current line */
-    datapos = 0;
-    }
+       if ( ++dataline >= NUMDATALINES )
+               {
+               /* Put out a blank line so that the table is grouped into
+                * large blocks that enable the user to find elements easily.
+                */
+               putchar( '\n' );
+               dataline = 0;
+               }
 
+       /* Reset the number of characters written on the current line. */
+       datapos = 0;
+       }
 
-/* flexerror - report an error message and terminate
- *
- * synopsis
- *    char msg[];
- *    flexerror( msg );
- */
+
+/* flexerror - report an error message and terminate */
 
 void flexerror( msg )
 char msg[];
-
-    {
-    fprintf( stderr, "%s: %s\n", program_name, msg );
-
-    flexend( 1 );
-    }
+       {
+       fprintf( stderr, "%s: %s\n", program_name, msg );
+       flexend( 1 );
+       }
 
 
-/* flexfatal - report a fatal error message and terminate
- *
- * synopsis
- *    char msg[];
- *    flexfatal( msg );
- */
+/* flexfatal - report a fatal error message and terminate */
 
 void flexfatal( msg )
 char msg[];
-
-    {
-    fprintf( stderr, "%s: fatal internal error, %s\n", program_name, msg );
-    exit( 1 );
-    }
+       {
+       fprintf( stderr, "%s: fatal internal error, %s\n", program_name, msg );
+       exit( 1 );
+       }
 
 
 /* flex_gettime - return current time
- *
- * synopsis
- *    char *flex_gettime(), *time_str;
- *    time_str = flex_gettime();
  *
  * note
  *    the routine name has the "flex_" prefix because of name clashes
@@ -399,385 +338,319 @@ typedef long time_t;
 #endif
 
 char *flex_gettime()
+       {
+       time_t t, time();
+       char *result, *ctime(), *copy_string();
 
-    {
-    time_t t, time();
-    char *result, *ctime(), *copy_string();
-
-    t = time( (long *) 0 );
+       t = time( (long *) 0 );
 
-    result = copy_string( ctime( &t ) );
+       result = copy_string( ctime( &t ) );
 
-    /* get rid of trailing newline */
-    result[24] = '\0';
+       /* get rid of trailing newline */
+       result[24] = '\0';
 
-    return ( result );
-    }
+       return result;
+       }
 
 
-/* lerrif - report an error message formatted with one integer argument
- *
- * synopsis
- *    char msg[];
- *    int arg;
- *    lerrif( msg, arg );
- */
+/* lerrif - report an error message formatted with one integer argument */
 
 void lerrif( msg, arg )
 char msg[];
 int arg;
-
-    {
-    char errmsg[MAXLINE];
-    (void) sprintf( errmsg, msg, arg );
-    flexerror( errmsg );
-    }
+       {
+       char errmsg[MAXLINE];
+       (void) sprintf( errmsg, msg, arg );
+       flexerror( errmsg );
+       }
 
 
-/* lerrsf - report an error message formatted with one string argument
- *
- * synopsis
- *    char msg[], arg[];
- *    lerrsf( msg, arg );
- */
+/* lerrsf - report an error message formatted with one string argument */
 
 void lerrsf( msg, arg )
 char msg[], arg[];
+       {
+       char errmsg[MAXLINE];
 
-    {
-    char errmsg[MAXLINE];
-
-    (void) sprintf( errmsg, msg, arg );
-    flexerror( errmsg );
-    }
+       (void) sprintf( errmsg, msg, arg );
+       flexerror( errmsg );
+       }
 
 
-/* htoi - convert a hexadecimal digit string to an integer value
- *
- * synopsis:
- *    int val, htoi();
- *    Char str[];
- *    val = htoi( str );
- */
+/* htoi - convert a hexadecimal digit string to an integer value */
 
 int htoi( str )
 Char str[];
+       {
+       unsigned int result;
 
-    {
-    unsigned int result;
-
-    (void) sscanf( (char *) str, "%x", &result );
+       (void) sscanf( (char *) str, "%x", &result );
 
-    return ( result );
-    }
+       return result;
+       }
 
 
 /* is_hex_digit - returns true if a character is a valid hex digit, false
  *               otherwise
- *
- * synopsis:
- *    int true_or_false, is_hex_digit();
- *    int ch;
- *    val = is_hex_digit( ch );
  */
 
 int is_hex_digit( ch )
 int ch;
-
-    {
-    if ( isdigit( ch ) )
-       return ( 1 );
-
-    switch ( clower( ch ) )
        {
-       case 'a':
-       case 'b':
-       case 'c':
-       case 'd':
-       case 'e':
-       case 'f':
-           return ( 1 );
-
-       default:
-           return ( 0 );
+       if ( isdigit( ch ) )
+               return 1;
+
+       switch ( clower( ch ) )
+               {
+               case 'a':
+               case 'b':
+               case 'c':
+               case 'd':
+               case 'e':
+               case 'f':
+                       return 1;
+
+               default:
+                       return 0;
+               }
        }
-    }
 
 
 /* line_directive_out - spit out a "# line" statement */
 
 void line_directive_out( output_file )
 FILE *output_file;
-
-    {
-    if ( infilename && gen_line_dirs )
        {
-       char directive[MAXLINE];
-        sprintf( directive, "# line %d \"%s\"\n", linenum, infilename );
+       if ( infilename && gen_line_dirs )
+               {
+               char directive[MAXLINE];
+               sprintf( directive, "# line %d \"%s\"\n", linenum, infilename );
 
-       /* if output_file is nil then we should put the directive in
-        * the accumulated actions.
-        */
-       if ( output_file )
-           fputs( directive, output_file );
-       else
-           add_action( directive );
+               /* If output_file is nil then we should put the directive in
+                * the accumulated actions.
+                */
+               if ( output_file )
+                       fputs( directive, output_file );
+               else
+                       add_action( directive );
+               }
        }
-    }
 
 
 /* mark_prolog - mark the current position in the action array as
  *               representing the action prolog
  */
 void mark_prolog()
-    {
-    prolog = action_array;
-    action_array[action_index++] = '\0';
-    action_offset = action_index;
-    action = &action_array[action_offset];
-    action_index = 0;
-    action[action_index] = '\0';
-    }
+       {
+       prolog = action_array;
+       action_array[action_index++] = '\0';
+       action_offset = action_index;
+       action = &action_array[action_offset];
+       action_index = 0;
+       action[action_index] = '\0';
+       }
 
 
 /* mk2data - generate a data statement for a two-dimensional array
  *
- * synopsis
- *    int value;
- *    mk2data( value );
- *
- *  generates a data statement initializing the current 2-D array to "value"
+ * Generates a data statement initializing the current 2-D array to "value".
  */
 void mk2data( value )
 int value;
-
-    {
-    if ( datapos >= NUMDATAITEMS )
        {
-       putchar( ',' );
-       dataflush();
-       }
+       if ( datapos >= NUMDATAITEMS )
+               {
+               putchar( ',' );
+               dataflush();
+               }
 
-    if ( datapos == 0 )
-       /* indent */
-       fputs( "    ", stdout );
+       if ( datapos == 0 )
+               /* Indent. */
+               fputs( "    ", stdout );
 
-    else
-       putchar( ',' );
+       else
+               putchar( ',' );
 
-    ++datapos;
+       ++datapos;
 
-    printf( "%5d", value );
-    }
+       printf( "%5d", value );
+       }
 
 
 /* mkdata - generate a data statement
  *
- * synopsis
- *    int value;
- *    mkdata( value );
- *
- *  generates a data statement initializing the current array element to
- *  "value"
+ * Generates a data statement initializing the current array element to
+ * "value".
  */
 void mkdata( value )
 int value;
-
-    {
-    if ( datapos >= NUMDATAITEMS )
        {
-       putchar( ',' );
-       dataflush();
-       }
-
-    if ( datapos == 0 )
-       /* indent */
-       fputs( "    ", stdout );
+       if ( datapos >= NUMDATAITEMS )
+               {
+               putchar( ',' );
+               dataflush();
+               }
 
-    else
-       putchar( ',' );
+       if ( datapos == 0 )
+               /* Indent. */
+               fputs( "    ", stdout );
+       else
+               putchar( ',' );
 
-    ++datapos;
+       ++datapos;
 
-    printf( "%5d", value );
-    }
+       printf( "%5d", value );
+       }
 
 
-/* myctoi - return the integer represented by a string of digits
- *
- * synopsis
- *    Char array[];
- *    int val, myctoi();
- *    val = myctoi( array );
- *
- */
+/* myctoi - return the integer represented by a string of digits */
 
 int myctoi( array )
 Char array[];
+       {
+       int val = 0;
 
-    {
-    int val = 0;
-
-    (void) sscanf( (char *) array, "%d", &val );
+       (void) sscanf( (char *) array, "%d", &val );
 
-    return ( val );
-    }
+       return val;
+       }
 
 
-/* myesc - return character corresponding to escape sequence
- *
- * synopsis
- *    Char array[], c, myesc();
- *    c = myesc( array );
- *
- */
+/* myesc - return character corresponding to escape sequence */
 
 Char myesc( array )
 Char array[];
-
-    {
-    Char c, esc_char;
-    register int sptr;
-
-    switch ( array[1] )
        {
+       Char c, esc_char;
+       register int sptr;
+
+       switch ( array[1] )
+               {
 #ifdef __STDC__
-       case 'a': return ( '\a' );
+               case 'a': return '\a';
 #else
-       case 'a': return ( '\007' );
+               case 'a': return '\007';
 #endif
-       case 'b': return ( '\b' );
-       case 'f': return ( '\f' );
-       case 'n': return ( '\n' );
-       case 'r': return ( '\r' );
-       case 't': return ( '\t' );
-       case 'v': return ( '\v' );
-
-       case '0':
-       case '1':
-       case '2':
-       case '3':
-       case '4':
-       case '5':
-       case '6':
-       case '7':
-       case '8':
-       case '9':
-           { /* \<octal> */
-           sptr = 1;
-
-           while ( isascii( array[sptr] ) && isdigit( array[sptr] ) )
-               /* don't increment inside loop control because if
-                * isdigit() is a macro it might expand into multiple
-                * increments ...
-                */
-               ++sptr;
-
-           c = array[sptr];
-           array[sptr] = '\0';
-
-           esc_char = otoi( array + 1 );
-
-           array[sptr] = c;
-
-           return ( esc_char );
-           }
-
-       case 'x':
-           { /* \x<hex> */
-           int sptr = 2;
-
-           while ( isascii( array[sptr] ) &&
-                   is_hex_digit( (char) array[sptr] ) )
-               /* don't increment inside loop control because if
-                * isdigit() is a macro it might expand into multiple
-                * increments ...
-                */
-               ++sptr;
-
-           c = array[sptr];
-           array[sptr] = '\0';
-
-           esc_char = htoi( array + 2 );
-
-           array[sptr] = c;
-
-           return ( esc_char );
-           }
-
-       default:
-           return ( array[1] );
+               case 'b': return '\b';
+               case 'f': return '\f';
+               case 'n': return '\n';
+               case 'r': return '\r';
+               case 't': return '\t';
+               case 'v': return '\v';
+
+               case '0':
+               case '1':
+               case '2':
+               case '3':
+               case '4':
+               case '5':
+               case '6':
+               case '7':
+               case '8':
+               case '9':
+                       { /* \<octal> */
+                       sptr = 1;
+
+                       while ( isascii( array[sptr] ) &&
+                               isdigit( array[sptr] ) )
+                               /* Don't increment inside loop control
+                                * because if isdigit() is a macro it might
+                                * expand into multiple increments ...
+                                */
+                               ++sptr;
+
+                       c = array[sptr];
+                       array[sptr] = '\0';
+
+                       esc_char = otoi( array + 1 );
+
+                       array[sptr] = c;
+
+                       return esc_char;
+                       }
+
+               case 'x':
+                       { /* \x<hex> */
+                       int sptr = 2;
+
+                       while ( isascii( array[sptr] ) &&
+                               is_hex_digit( (char) array[sptr] ) )
+                               /* Don't increment inside loop control
+                                * because if isdigit() is a macro it might
+                                * expand into multiple increments ...
+                                */
+                               ++sptr;
+
+                       c = array[sptr];
+                       array[sptr] = '\0';
+
+                       esc_char = htoi( array + 2 );
+
+                       array[sptr] = c;
+
+                       return esc_char;
+                       }
+
+               default:
+                       return array[1];
+               }
        }
-    }
 
 
-/* otoi - convert an octal digit string to an integer value
- *
- * synopsis:
- *    int val, otoi();
- *    Char str[];
- *    val = otoi( str );
- */
+/* otoi - convert an octal digit string to an integer value */
 
 int otoi( str )
 Char str[];
+       {
+       unsigned int result;
 
-    {
-    unsigned int result;
-
-    (void) sscanf( (char *) str, "%o", &result );
-
-    return ( result );
-    }
+       (void) sscanf( (char *) str, "%o", &result );
+       return result;
+       }
 
 
 /* readable_form - return the the human-readable form of a character
- *
- * synopsis:
- *    int c;
- *    char *readable_form();
- *    <string> = readable_form( c );
  *
  * The returned string is in static storage.
  */
 
 char *readable_form( c )
 register int c;
-
-    {
-    static char rform[10];
-
-    if ( (c >= 0 && c < 32) || c >= 127 )
        {
-       switch ( c )
-           {
+       static char rform[10];
+
+       if ( (c >= 0 && c < 32) || c >= 127 )
+               {
+               switch ( c )
+                       {
 #ifdef __STDC__
-           case '\a': return ( "\\a" );
+                       case '\a': return "\\a";
 #endif
-           case '\b': return ( "\\b" );
-           case '\f': return ( "\\f" );
-           case '\n': return ( "\\n" );
-           case '\r': return ( "\\r" );
-           case '\t': return ( "\\t" );
-           case '\v': return ( "\\v" );
-
-           default:
-               (void) sprintf( rform, "\\%.3o", (unsigned int) c );
-               return ( rform );
-           }
-       }
+                       case '\b': return "\\b";
+                       case '\f': return "\\f";
+                       case '\n': return "\\n";
+                       case '\r': return "\\r";
+                       case '\t': return "\\t";
+                       case '\v': return "\\v";
+
+                       default:
+                               (void) sprintf( rform, "\\%.3o",
+                                               (unsigned int) c );
+                               return rform;
+                       }
+               }
 
-    else if ( c == ' ' )
-       return ( "' '" );
+       else if ( c == ' ' )
+               return "' '";
 
-    else
-       {
-       rform[0] = c;
-       rform[1] = '\0';
+       else
+               {
+               rform[0] = c;
+               rform[1] = '\0';
 
-       return ( rform );
+               return rform;
+               }
        }
-    }
 
 
 /* reallocate_array - increase the size of a dynamic array */
@@ -785,65 +658,57 @@ register int c;
 void *reallocate_array( array, size, element_size )
 void *array;
 int size, element_size;
+       {
+       register void *new_array;
 
-    {
-    register void *new_array;
-
-    /* same worry as in allocate_array(): */
-    if ( size * element_size <= 0 )
-        flexfatal( "attempt to increase array size by less than 1 byte" );
+       /* Same worry as in allocate_array(): */
+       if ( size * element_size <= 0 )
+               flexfatal(
+                       "attempt to increase array size by less than 1 byte" );
 
-    new_array =
+       new_array =
        (void *) realloc( (char *)array, (unsigned) (size * element_size ));
 
-    if ( new_array == NULL )
-       flexfatal( "attempt to increase array size failed" );
+       if ( new_array == NULL )
+               flexfatal( "attempt to increase array size failed" );
 
-    return ( new_array );
-    }
+       return new_array;
+       }
 
 
 /* skelout - write out one section of the skeleton file
  *
- * synopsis
- *    skelout();
- *
- * DESCRIPTION
+ * Description
  *    Copies skelfile or skel array to stdout until a line beginning with
  *    "%%" or EOF is found.
  */
 void skelout()
-
-    {
-    if ( skelfile )
        {
-       char buf[MAXLINE];
-
-       while ( fgets( buf, MAXLINE, skelfile ) != NULL )
-           if ( buf[0] == '%' && buf[1] == '%' )
-               break;
-           else
-               fputs( buf, stdout );
-       }
+       if ( skelfile )
+               {
+               char buf[MAXLINE];
 
-    else
-       { /* copy from skel array */
-       char *buf;
+               while ( fgets( buf, MAXLINE, skelfile ) != NULL )
+                       if ( buf[0] == '%' && buf[1] == '%' )
+                               break;
+               else
+                       fputs( buf, stdout );
+               }
 
-       while ( (buf = skel[skel_ind++]) )
-           if ( buf[0] == '%' && buf[1] == '%' )
-               break;
-           else
-               printf( "%s\n", buf );
+       else
+               { /* copy from skel array */
+               char *buf;
+
+               while ( (buf = skel[skel_ind++]) )
+                       if ( buf[0] == '%' && buf[1] == '%' )
+                               break;
+                       else
+                               printf( "%s\n", buf );
+               }
        }
-    }
 
 
 /* transition_struct_out - output a yy_trans_info structure
- *
- * synopsis
- *     int element_v, element_n;
- *     transition_struct_out( element_v, element_n );
  *
  * outputs the yy_trans_info structure with the two elements, element_v and
  * element_n.  Formats the output with spaces and carriage returns.
@@ -851,44 +716,37 @@ void skelout()
 
 void transition_struct_out( element_v, element_n )
 int element_v, element_n;
+       {
+       printf( "%7d, %5d,", element_v, element_n );
 
-    {
-    printf( "%7d, %5d,", element_v, element_n );
-
-    datapos += TRANS_STRUCT_PRINT_LENGTH;
+       datapos += TRANS_STRUCT_PRINT_LENGTH;
 
-    if ( datapos >= 75 )
-       {
-       putchar( '\n' );
+       if ( datapos >= 75 )
+               {
+               putchar( '\n' );
 
-       if ( ++dataline % 10 == 0 )
-           putchar( '\n' );
+               if ( ++dataline % 10 == 0 )
+                       putchar( '\n' );
 
-       datapos = 0;
+               datapos = 0;
+               }
        }
-    }
 
 
 /* zero_out - set a region of memory to 0
  *
- * synopsis
- *     char *region_ptr;
- *     int size_in_bytes;
- *     zero_out( region_ptr, size_in_bytes );
- *
- * sets region_ptr[0] through region_ptr[size_in_bytes - 1] to zero.
+ * Sets region_ptr[0] through region_ptr[size_in_bytes - 1] to zero.
  */
 
 void zero_out( region_ptr, size_in_bytes )
 char *region_ptr;
 int size_in_bytes;
+       {
+       register char *rp, *rp_end;
 
-    {
-    register char *rp, *rp_end;
-
-    rp = region_ptr;
-    rp_end = region_ptr + size_in_bytes;
+       rp = region_ptr;
+       rp_end = region_ptr + size_in_bytes;
 
-    while ( rp < rp_end )
-       *rp++ = 0;
-    }
+       while ( rp < rp_end )
+               *rp++ = 0;
+       }
diff --git a/nfa.c b/nfa.c
index 6e50109c38467c7cfe88b02e0e7913316e3ad119..cca39d68151bb04ef2954b25a226ab22a76d35cf 100644 (file)
--- a/nfa.c
+++ b/nfa.c
@@ -41,34 +41,29 @@ void mkxtion PROTO((int, int));
 
 
 /* add_accept - add an accepting state to a machine
- *
- * synopsis
- *
- *   add_accept( mach, accepting_number );
  *
  * accepting_number becomes mach's accepting number.
  */
 
 void add_accept( mach, accepting_number )
 int mach, accepting_number;
+       {
+       /* Hang the accepting number off an epsilon state.  if it is associated
+        * with a state that has a non-epsilon out-transition, then the state
+        * will accept BEFORE it makes that transition, i.e., one character
+        * too soon.
+        */
 
-    {
-    /* hang the accepting number off an epsilon state.  if it is associated
-     * with a state that has a non-epsilon out-transition, then the state
-     * will accept BEFORE it makes that transition, i.e., one character
-     * too soon
-     */
-
-    if ( transchar[finalst[mach]] == SYM_EPSILON )
-       accptnum[finalst[mach]] = accepting_number;
+       if ( transchar[finalst[mach]] == SYM_EPSILON )
+               accptnum[finalst[mach]] = accepting_number;
 
-    else
-       {
-       int astate = mkstate( SYM_EPSILON );
-       accptnum[astate] = accepting_number;
-       mach = link_machines( mach, astate );
+       else
+               {
+               int astate = mkstate( SYM_EPSILON );
+               accptnum[astate] = accepting_number;
+               mach = link_machines( mach, astate );
+               }
        }
-    }
 
 
 /* copysingl - make a given number of copies of a singleton machine
@@ -84,61 +79,56 @@ int mach, accepting_number;
 
 int copysingl( singl, num )
 int singl, num;
+       {
+       int copy, i;
 
-    {
-    int copy, i;
+       copy = mkstate( SYM_EPSILON );
 
-    copy = mkstate( SYM_EPSILON );
+       for ( i = 1; i <= num; ++i )
+               copy = link_machines( copy, dupmachine( singl ) );
 
-    for ( i = 1; i <= num; ++i )
-       copy = link_machines( copy, dupmachine( singl ) );
+       return copy;
+       }
 
-    return ( copy );
-    }
 
-
-/* dumpnfa - debugging routine to write out an nfa
- *
- * synopsis
- *    int state1;
- *    dumpnfa( state1 );
- */
+/* dumpnfa - debugging routine to write out an nfa */
 
 void dumpnfa( state1 )
 int state1;
 
-    {
-    int sym, tsp1, tsp2, anum, ns;
+       {
+       int sym, tsp1, tsp2, anum, ns;
 
-    fprintf( stderr, "\n\n********** beginning dump of nfa with start state %d\n",
-            state1 );
+       fprintf( stderr,
+               "\n\n********** beginning dump of nfa with start state %d\n",
+               state1 );
 
-    /* we probably should loop starting at firstst[state1] and going to
-     * lastst[state1], but they're not maintained properly when we "or"
-     * all of the rules together.  So we use our knowledge that the machine
-     * starts at state 1 and ends at lastnfa.
-     */
+       /* We probably should loop starting at firstst[state1] and going to
+        * lastst[state1], but they're not maintained properly when we "or"
+        * all of the rules together.  So we use our knowledge that the machine
+        * starts at state 1 and ends at lastnfa.
+        */
 
-    /* for ( ns = firstst[state1]; ns <= lastst[state1]; ++ns ) */
-    for ( ns = 1; ns <= lastnfa; ++ns )
-       {
-       fprintf( stderr, "state # %4d\t", ns );
+       /* for ( ns = firstst[state1]; ns <= lastst[state1]; ++ns ) */
+       for ( ns = 1; ns <= lastnfa; ++ns )
+               {
+               fprintf( stderr, "state # %4d\t", ns );
 
-       sym = transchar[ns];
-       tsp1 = trans1[ns];
-       tsp2 = trans2[ns];
-       anum = accptnum[ns];
+               sym = transchar[ns];
+               tsp1 = trans1[ns];
+               tsp2 = trans2[ns];
+               anum = accptnum[ns];
 
-       fprintf( stderr, "%3d:  %4d, %4d", sym, tsp1, tsp2 );
+               fprintf( stderr, "%3d:  %4d, %4d", sym, tsp1, tsp2 );
 
-       if ( anum != NIL )
-           fprintf( stderr, "  [%d]", anum );
+               if ( anum != NIL )
+                       fprintf( stderr, "  [%d]", anum );
 
-       fprintf( stderr, "\n" );
-       }
+               fprintf( stderr, "\n" );
+               }
 
-    fprintf( stderr, "********** end of dump\n" );
-    }
+       fprintf( stderr, "********** end of dump\n" );
+       }
 
 
 /* dupmachine - make a duplicate of a given machine
@@ -160,46 +150,43 @@ int state1;
 
 int dupmachine( mach )
 int mach;
-
-    {
-    int i, init, state_offset;
-    int state = 0;
-    int last = lastst[mach];
-
-    for ( i = firstst[mach]; i <= last; ++i )
        {
-       state = mkstate( transchar[i] );
+       int i, init, state_offset;
+       int state = 0;
+       int last = lastst[mach];
 
-       if ( trans1[i] != NO_TRANSITION )
-           {
-           mkxtion( finalst[state], trans1[i] + state - i );
+       for ( i = firstst[mach]; i <= last; ++i )
+               {
+               state = mkstate( transchar[i] );
 
-           if ( transchar[i] == SYM_EPSILON && trans2[i] != NO_TRANSITION )
-               mkxtion( finalst[state], trans2[i] + state - i );
-           }
+               if ( trans1[i] != NO_TRANSITION )
+                       {
+                       mkxtion( finalst[state], trans1[i] + state - i );
 
-       accptnum[state] = accptnum[i];
-       }
+                       if ( transchar[i] == SYM_EPSILON &&
+                            trans2[i] != NO_TRANSITION )
+                               mkxtion( finalst[state],
+                                       trans2[i] + state - i );
+                       }
 
-    if ( state == 0 )
-       flexfatal( "empty machine in dupmachine()" );
+               accptnum[state] = accptnum[i];
+               }
+
+       if ( state == 0 )
+               flexfatal( "empty machine in dupmachine()" );
 
-    state_offset = state - i + 1;
+       state_offset = state - i + 1;
 
-    init = mach + state_offset;
-    firstst[init] = firstst[mach] + state_offset;
-    finalst[init] = finalst[mach] + state_offset;
-    lastst[init] = lastst[mach] + state_offset;
+       init = mach + state_offset;
+       firstst[init] = firstst[mach] + state_offset;
+       finalst[init] = finalst[mach] + state_offset;
+       lastst[init] = lastst[mach] + state_offset;
 
-    return ( init );
-    }
+       return init;
+       }
 
 
 /* finish_rule - finish up the processing for a rule
- *
- * synopsis
- *
- *   finish_rule( mach, variable_trail_rule, headcnt, trailcnt );
  *
  * An accepting number is added to the given machine.  If variable_trail_rule
  * is true then the rule has trailing context and both the head and trail
@@ -213,70 +200,74 @@ int mach;
 
 void finish_rule( mach, variable_trail_rule, headcnt, trailcnt )
 int mach, variable_trail_rule, headcnt, trailcnt;
+       {
+       char action_text[MAXLINE];
 
-    {
-    char action_text[MAXLINE];
-
-    add_accept( mach, num_rules );
+       add_accept( mach, num_rules );
 
-    /* we did this in new_rule(), but it often gets the wrong
-     * number because we do it before we start parsing the current rule
-     */
-    rule_linenum[num_rules] = linenum;
+       /* We did this in new_rule(), but it often gets the wrong
+        * number because we do it before we start parsing the current rule.
+        */
+       rule_linenum[num_rules] = linenum;
 
-    /* if this is a continued action, then the line-number has
-     * already been updated, giving us the wrong number
-     */
-    if ( continued_action )
-       --rule_linenum[num_rules];
+       /* If this is a continued action, then the line-number has already
+        * been updated, giving us the wrong number.
+        */
+       if ( continued_action )
+               --rule_linenum[num_rules];
 
-    sprintf( action_text, "case %d:\n", num_rules );
-    add_action( action_text );
+       sprintf( action_text, "case %d:\n", num_rules );
+       add_action( action_text );
 
-    if ( variable_trail_rule )
-       {
-       rule_type[num_rules] = RULE_VARIABLE;
+       if ( variable_trail_rule )
+               {
+               rule_type[num_rules] = RULE_VARIABLE;
 
-       if ( performance_report > 0 )
-           fprintf( stderr, "Variable trailing context rule at line %d\n",
-                    rule_linenum[num_rules] );
+               if ( performance_report > 0 )
+                       fprintf( stderr,
+                               "Variable trailing context rule at line %d\n",
+                               rule_linenum[num_rules] );
 
-       variable_trailing_context_rules = true;
-       }
+               variable_trailing_context_rules = true;
+               }
 
-    else
-       {
-       rule_type[num_rules] = RULE_NORMAL;
+       else
+               {
+               rule_type[num_rules] = RULE_NORMAL;
 
-       if ( headcnt > 0 || trailcnt > 0 )
-           {
-           /* do trailing context magic to not match the trailing characters */
-           char *scanner_cp = "yy_c_buf_p = yy_cp";
-           char *scanner_bp = "yy_bp";
+               if ( headcnt > 0 || trailcnt > 0 )
+                       {
+                       /* Do trailing context magic to not match the trailing
+                        * characters.
+                        */
+                       char *scanner_cp = "yy_c_buf_p = yy_cp";
+                       char *scanner_bp = "yy_bp";
 
-           add_action(
+                       add_action(
        "*yy_cp = yy_hold_char; /* undo effects of setting up yytext */\n" );
 
-           if ( headcnt > 0 )
-               {
-               sprintf( action_text, "%s = %s + %d;\n",
-                        scanner_cp, scanner_bp, headcnt );
-               add_action( action_text );
+                       if ( headcnt > 0 )
+                               {
+                               sprintf( action_text, "%s = %s + %d;\n",
+                               scanner_cp, scanner_bp, headcnt );
+                               add_action( action_text );
+                               }
+
+                       else
+                               {
+                               sprintf( action_text, "%s -= %d;\n",
+                                       scanner_cp, trailcnt );
+                               add_action( action_text );
+                               }
+
+                       add_action(
+                       "YY_DO_BEFORE_ACTION; /* set up yytext again */\n" );
+                       }
                }
 
-           else
-               {
-               sprintf( action_text, "%s -= %d;\n", scanner_cp, trailcnt );
-               add_action( action_text );
-               }
-       
-           add_action( "YY_DO_BEFORE_ACTION; /* set up yytext again */\n" );
-           }
+       line_directive_out( (FILE *) 0 );
        }
 
-    line_directive_out( (FILE *) 0 );
-    }
-
 
 /* link_machines - connect two machines together
  *
@@ -296,67 +287,62 @@ int mach, variable_trail_rule, headcnt, trailcnt;
 
 int link_machines( first, last )
 int first, last;
+       {
+       if ( first == NIL )
+               return last;
 
-    {
-    if ( first == NIL )
-       return ( last );
-
-    else if ( last == NIL )
-       return ( first );
+       else if ( last == NIL )
+               return first;
 
-    else
-       {
-       mkxtion( finalst[first], last );
-       finalst[first] = finalst[last];
-       lastst[first] = max( lastst[first], lastst[last] );
-       firstst[first] = min( firstst[first], firstst[last] );
+       else
+               {
+               mkxtion( finalst[first], last );
+               finalst[first] = finalst[last];
+               lastst[first] = max( lastst[first], lastst[last] );
+               firstst[first] = min( firstst[first], firstst[last] );
 
-       return ( first );
+               return first;
+               }
        }
-    }
 
 
 /* mark_beginning_as_normal - mark each "beginning" state in a machine
  *                            as being a "normal" (i.e., not trailing context-
  *                            associated) states
  *
- * synopsis
- *
- *   mark_beginning_as_normal( mach )
- *
- *     mach - machine to mark
- *
  * The "beginning" states are the epsilon closure of the first state
  */
 
 void mark_beginning_as_normal( mach )
 register int mach;
-
-    {
-    switch ( state_type[mach] )
        {
-       case STATE_NORMAL:
-           /* oh, we've already visited here */
-           return;
-
-       case STATE_TRAILING_CONTEXT:
-           state_type[mach] = STATE_NORMAL;
-
-           if ( transchar[mach] == SYM_EPSILON )
+       switch ( state_type[mach] )
                {
-               if ( trans1[mach] != NO_TRANSITION )
-                   mark_beginning_as_normal( trans1[mach] );
-
-               if ( trans2[mach] != NO_TRANSITION )
-                   mark_beginning_as_normal( trans2[mach] );
+               case STATE_NORMAL:
+                       /* Oh, we've already visited here. */
+                       return;
+
+               case STATE_TRAILING_CONTEXT:
+                       state_type[mach] = STATE_NORMAL;
+
+                       if ( transchar[mach] == SYM_EPSILON )
+                               {
+                               if ( trans1[mach] != NO_TRANSITION )
+                                       mark_beginning_as_normal(
+                                               trans1[mach] );
+
+                               if ( trans2[mach] != NO_TRANSITION )
+                                       mark_beginning_as_normal(
+                                               trans2[mach] );
+                               }
+                       break;
+
+               default:
+                       flexerror(
+                               "bad state type in mark_beginning_as_normal()" );
+                       break;
                }
-           break;
-
-       default:
-           flexerror( "bad state type in mark_beginning_as_normal()" );
-           break;
        }
-    }
 
 
 /* mkbranch - make a machine that branches to two machines
@@ -368,30 +354,29 @@ register int mach;
  *     branch - a machine which matches either first's pattern or second's
  *     first, second - machines whose patterns are to be or'ed (the | operator)
  *
- * note that first and second are NEITHER destroyed by the operation.  Also,
+ * Note that first and second are NEITHER destroyed by the operation.  Also,
  * the resulting machine CANNOT be used with any other "mk" operation except
  * more mkbranch's.  Compare with mkor()
  */
 
 int mkbranch( first, second )
 int first, second;
+       {
+       int eps;
 
-    {
-    int eps;
-
-    if ( first == NO_TRANSITION )
-       return ( second );
+       if ( first == NO_TRANSITION )
+               return second;
 
-    else if ( second == NO_TRANSITION )
-       return ( first );
+       else if ( second == NO_TRANSITION )
+               return first;
 
-    eps = mkstate( SYM_EPSILON );
+       eps = mkstate( SYM_EPSILON );
 
-    mkxtion( eps, first );
-    mkxtion( eps, second );
+       mkxtion( eps, first );
+       mkxtion( eps, second );
 
-    return ( eps );
-    }
+       return eps;
+       }
 
 
 /* mkclos - convert a machine into a closure
@@ -399,15 +384,14 @@ int first, second;
  * synopsis
  *   new = mkclos( state );
  *
- *     new - a new state which matches the closure of "state"
+ * new - a new state which matches the closure of "state"
  */
 
 int mkclos( state )
 int state;
-
-    {
-    return ( mkopt( mkposcl( state ) ) );
-    }
+       {
+       return mkopt( mkposcl( state ) );
+       }
 
 
 /* mkopt - make a machine optional
@@ -426,27 +410,26 @@ int state;
 
 int mkopt( mach )
 int mach;
+       {
+       int eps;
 
-    {
-    int eps;
+       if ( ! SUPER_FREE_EPSILON(finalst[mach]) )
+               {
+               eps = mkstate( SYM_EPSILON );
+               mach = link_machines( mach, eps );
+               }
 
-    if ( ! SUPER_FREE_EPSILON(finalst[mach]) )
-       {
+       /* Can't skimp on the following if FREE_EPSILON(mach) is true because
+        * some state interior to "mach" might point back to the beginning
+        * for a closure.
+        */
        eps = mkstate( SYM_EPSILON );
-       mach = link_machines( mach, eps );
-       }
-
-    /* can't skimp on the following if FREE_EPSILON(mach) is true because
-     * some state interior to "mach" might point back to the beginning
-     * for a closure
-     */
-    eps = mkstate( SYM_EPSILON );
-    mach = link_machines( eps, mach );
+       mach = link_machines( eps, mach );
 
-    mkxtion( mach, finalst[mach] );
+       mkxtion( mach, finalst[mach] );
 
-    return ( mach );
-    }
+       return mach;
+       }
 
 
 /* mkor - make a machine that matches either one of two machines
@@ -465,56 +448,55 @@ int mach;
 
 int mkor( first, second )
 int first, second;
-
-    {
-    int eps, orend;
-
-    if ( first == NIL )
-       return ( second );
-
-    else if ( second == NIL )
-       return ( first );
-
-    else
        {
-       /* see comment in mkopt() about why we can't use the first state
-        * of "first" or "second" if they satisfy "FREE_EPSILON"
-        */
-       eps = mkstate( SYM_EPSILON );
+       int eps, orend;
 
-       first = link_machines( eps, first );
+       if ( first == NIL )
+               return second;
 
-       mkxtion( first, second );
-
-       if ( SUPER_FREE_EPSILON(finalst[first]) &&
-            accptnum[finalst[first]] == NIL )
-           {
-           orend = finalst[first];
-           mkxtion( finalst[second], orend );
-           }
-
-       else if ( SUPER_FREE_EPSILON(finalst[second]) &&
-                 accptnum[finalst[second]] == NIL )
-           {
-           orend = finalst[second];
-           mkxtion( finalst[first], orend );
-           }
+       else if ( second == NIL )
+               return first;
 
        else
-           {
-           eps = mkstate( SYM_EPSILON );
-
-           first = link_machines( first, eps );
-           orend = finalst[first];
+               {
+               /* See comment in mkopt() about why we can't use the first
+                * state of "first" or "second" if they satisfy "FREE_EPSILON".
+                */
+               eps = mkstate( SYM_EPSILON );
+
+               first = link_machines( eps, first );
+
+               mkxtion( first, second );
+
+               if ( SUPER_FREE_EPSILON(finalst[first]) &&
+                    accptnum[finalst[first]] == NIL )
+                       {
+                       orend = finalst[first];
+                       mkxtion( finalst[second], orend );
+                       }
+
+               else if ( SUPER_FREE_EPSILON(finalst[second]) &&
+                         accptnum[finalst[second]] == NIL )
+                       {
+                       orend = finalst[second];
+                       mkxtion( finalst[first], orend );
+                       }
+
+               else
+                       {
+                       eps = mkstate( SYM_EPSILON );
+
+                       first = link_machines( first, eps );
+                       orend = finalst[first];
+
+                       mkxtion( finalst[second], orend );
+                       }
+               }
 
-           mkxtion( finalst[second], orend );
-           }
+       finalst[first] = orend;
+       return first;
        }
 
-    finalst[first] = orend;
-    return ( first );
-    }
-
 
 /* mkposcl - convert a machine into a positive closure
  *
@@ -526,23 +508,22 @@ int first, second;
 
 int mkposcl( state )
 int state;
-
-    {
-    int eps;
-
-    if ( SUPER_FREE_EPSILON(finalst[state]) )
        {
-       mkxtion( finalst[state], state );
-       return ( state );
-       }
+       int eps;
 
-    else
-       {
-       eps = mkstate( SYM_EPSILON );
-       mkxtion( eps, state );
-       return ( link_machines( state, eps ) );
+       if ( SUPER_FREE_EPSILON(finalst[state]) )
+               {
+               mkxtion( finalst[state], state );
+               return state;
+               }
+
+       else
+               {
+               eps = mkstate( SYM_EPSILON );
+               mkxtion( eps, state );
+               return link_machines( state, eps );
+               }
        }
-    }
 
 
 /* mkrep - make a replicated machine
@@ -559,35 +540,34 @@ int state;
 
 int mkrep( mach, lb, ub )
 int mach, lb, ub;
+       {
+       int base_mach, tail, copy, i;
 
-    {
-    int base_mach, tail, copy, i;
+       base_mach = copysingl( mach, lb - 1 );
 
-    base_mach = copysingl( mach, lb - 1 );
+       if ( ub == INFINITY )
+               {
+               copy = dupmachine( mach );
+               mach = link_machines( mach,
+               link_machines( base_mach, mkclos( copy ) ) );
+               }
 
-    if ( ub == INFINITY )
-       {
-       copy = dupmachine( mach );
-       mach = link_machines( mach,
-                             link_machines( base_mach, mkclos( copy ) ) );
-       }
+       else
+               {
+               tail = mkstate( SYM_EPSILON );
 
-    else
-       {
-       tail = mkstate( SYM_EPSILON );
+               for ( i = lb; i < ub; ++i )
+                       {
+                       copy = dupmachine( mach );
+                       tail = mkopt( link_machines( copy, tail ) );
+                       }
 
-       for ( i = lb; i < ub; ++i )
-           {
-           copy = dupmachine( mach );
-           tail = mkopt( link_machines( copy, tail ) );
-           }
+               mach = link_machines( mach, link_machines( base_mach, tail ) );
+               }
 
-       mach = link_machines( mach, link_machines( base_mach, tail ) );
+       return mach;
        }
 
-    return ( mach );
-    }
-
 
 /* mkstate - create a state with a transition on a given symbol
  *
@@ -607,64 +587,68 @@ int mach, lb, ub;
 
 int mkstate( sym )
 int sym;
-
-    {
-    if ( ++lastnfa >= current_mns )
        {
-       if ( (current_mns += MNS_INCREMENT) >= MAXIMUM_MNS )
-           lerrif( "input rules are too complicated (>= %d NFA states)",
-                   current_mns );
-       
-       ++num_reallocs;
-
-       firstst = reallocate_integer_array( firstst, current_mns );
-       lastst = reallocate_integer_array( lastst, current_mns );
-       finalst = reallocate_integer_array( finalst, current_mns );
-       transchar = reallocate_integer_array( transchar, current_mns );
-       trans1 = reallocate_integer_array( trans1, current_mns );
-       trans2 = reallocate_integer_array( trans2, current_mns );
-       accptnum = reallocate_integer_array( accptnum, current_mns );
-       assoc_rule = reallocate_integer_array( assoc_rule, current_mns );
-       state_type = reallocate_integer_array( state_type, current_mns );
-       }
+       if ( ++lastnfa >= current_mns )
+               {
+               if ( (current_mns += MNS_INCREMENT) >= MAXIMUM_MNS )
+                       lerrif(
+                       "input rules are too complicated (>= %d NFA states)",
+                               current_mns );
+
+               ++num_reallocs;
+
+               firstst = reallocate_integer_array( firstst, current_mns );
+               lastst = reallocate_integer_array( lastst, current_mns );
+               finalst = reallocate_integer_array( finalst, current_mns );
+               transchar = reallocate_integer_array( transchar, current_mns );
+               trans1 = reallocate_integer_array( trans1, current_mns );
+               trans2 = reallocate_integer_array( trans2, current_mns );
+               accptnum = reallocate_integer_array( accptnum, current_mns );
+               assoc_rule =
+                       reallocate_integer_array( assoc_rule, current_mns );
+               state_type =
+                       reallocate_integer_array( state_type, current_mns );
+               }
 
-    firstst[lastnfa] = lastnfa;
-    finalst[lastnfa] = lastnfa;
-    lastst[lastnfa] = lastnfa;
-    transchar[lastnfa] = sym;
-    trans1[lastnfa] = NO_TRANSITION;
-    trans2[lastnfa] = NO_TRANSITION;
-    accptnum[lastnfa] = NIL;
-    assoc_rule[lastnfa] = num_rules;
-    state_type[lastnfa] = current_state_type;
-
-    /* fix up equivalence classes base on this transition.  Note that any
-     * character which has its own transition gets its own equivalence class.
-     * Thus only characters which are only in character classes have a chance
-     * at being in the same equivalence class.  E.g. "a|b" puts 'a' and 'b'
-     * into two different equivalence classes.  "[ab]" puts them in the same
-     * equivalence class (barring other differences elsewhere in the input).
-     */
-
-    if ( sym < 0 )
-       {
-       /* we don't have to update the equivalence classes since that was
-        * already done when the ccl was created for the first time
+       firstst[lastnfa] = lastnfa;
+       finalst[lastnfa] = lastnfa;
+       lastst[lastnfa] = lastnfa;
+       transchar[lastnfa] = sym;
+       trans1[lastnfa] = NO_TRANSITION;
+       trans2[lastnfa] = NO_TRANSITION;
+       accptnum[lastnfa] = NIL;
+       assoc_rule[lastnfa] = num_rules;
+       state_type[lastnfa] = current_state_type;
+
+       /* Fix up equivalence classes base on this transition.  Note that any
+        * character which has its own transition gets its own equivalence
+        * class.  Thus only characters which are only in character classes
+        * have a chance at being in the same equivalence class.  E.g. "a|b"
+        * puts 'a' and 'b' into two different equivalence classes.  "[ab]"
+        * puts them in the same equivalence class (barring other differences
+        * elsewhere in the input).
         */
-       }
 
-    else if ( sym == SYM_EPSILON )
-       ++numeps;
+       if ( sym < 0 )
+               {
+               /* We don't have to update the equivalence classes since
+                * that was already done when the ccl was created for the
+                * first time.
+                */
+               }
 
-    else
-       {
-       if ( useecs )
-           /* map NUL's to csize */
-           mkechar( sym ? sym : csize, nextecm, ecgroup );
-       }
+       else if ( sym == SYM_EPSILON )
+               ++numeps;
 
-    return ( lastnfa );
-    }
+       else
+               {
+               if ( useecs )
+                       /* Map NUL's to csize. */
+                       mkechar( sym ? sym : csize, nextecm, ecgroup );
+               }
+
+       return lastnfa;
+       }
 
 
 /* mkxtion - make a transition from one state to another
@@ -679,49 +663,40 @@ int sym;
 
 void mkxtion( statefrom, stateto )
 int statefrom, stateto;
+       {
+       if ( trans1[statefrom] == NO_TRANSITION )
+               trans1[statefrom] = stateto;
 
-    {
-    if ( trans1[statefrom] == NO_TRANSITION )
-       trans1[statefrom] = stateto;
-
-    else if ( (transchar[statefrom] != SYM_EPSILON) ||
-             (trans2[statefrom] != NO_TRANSITION) )
-       flexfatal( "found too many transitions in mkxtion()" );
+       else if ( (transchar[statefrom] != SYM_EPSILON) ||
+                 (trans2[statefrom] != NO_TRANSITION) )
+               flexfatal( "found too many transitions in mkxtion()" );
 
-    else
-       { /* second out-transition for an epsilon state */
-       ++eps2;
-       trans2[statefrom] = stateto;
+       else
+               { /* second out-transition for an epsilon state */
+               ++eps2;
+               trans2[statefrom] = stateto;
+               }
        }
-    }
 
-/* new_rule - initialize for a new rule
- *
- * synopsis
- *
- *   new_rule();
- *
- * the global num_rules is incremented and the any corresponding dynamic
- * arrays (such as rule_type[]) are grown as needed.
- */
+/* new_rule - initialize for a new rule */
 
 void new_rule()
-
-    {
-    if ( ++num_rules >= current_max_rules )
        {
-       ++num_reallocs;
-       current_max_rules += MAX_RULES_INCREMENT;
-       rule_type = reallocate_integer_array( rule_type, current_max_rules );
-       rule_linenum =
-           reallocate_integer_array( rule_linenum, current_max_rules );
-       rule_useful =
-           reallocate_integer_array( rule_useful, current_max_rules );
-       }
+       if ( ++num_rules >= current_max_rules )
+               {
+               ++num_reallocs;
+               current_max_rules += MAX_RULES_INCREMENT;
+               rule_type = reallocate_integer_array( rule_type,
+                                                       current_max_rules );
+               rule_linenum = reallocate_integer_array( rule_linenum,
+                                                       current_max_rules );
+               rule_useful = reallocate_integer_array( rule_useful,
+                                                       current_max_rules );
+               }
 
-    if ( num_rules > MAX_RULE )
-       lerrif( "too many rules (> %d)!", MAX_RULE );
+       if ( num_rules > MAX_RULE )
+               lerrif( "too many rules (> %d)!", MAX_RULE );
 
-    rule_linenum[num_rules] = linenum;
-    rule_useful[num_rules] = false;
-    }
+       rule_linenum[num_rules] = linenum;
+       rule_useful[num_rules] = false;
+       }
diff --git a/parse.y b/parse.y
index 4eca06558d5baebce7d05bc2b39f2e5c0423106d..828e0e20a4bda720e1b34ac66de9869be541c91c 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -58,7 +58,7 @@ goal          :  initlex sect1 sect1end sect2 initforrule
 
                        def_rule = mkstate( -pat );
 
-                       /* remember the number of the default rule so we
+                       /* Remember the number of the default rule so we
                         * don't generate "can't match" warnings for it.
                         */
                        default_rule = num_rules;
@@ -66,13 +66,13 @@ goal                :  initlex sect1 sect1end sect2 initforrule
                        finish_rule( def_rule, false, 0, 0 );
 
                        for ( i = 1; i <= lastsc; ++i )
-                           scset[i] = mkbranch( scset[i], def_rule );
+                               scset[i] = mkbranch( scset[i], def_rule );
 
                        if ( spprdflt )
-                           add_action(
+                               add_action(
                                "YY_FATAL_ERROR( \"flex scanner jammed\" )" );
                        else
-                           add_action( "ECHO" );
+                               add_action( "ECHO" );
 
                        add_action( ";\n\tYY_BREAK\n" );
                        }
@@ -81,11 +81,11 @@ goal                :  initlex sect1 sect1end sect2 initforrule
 initlex                :
                        { /* initialize for processing rules */
 
-                       /* create default DFA start condition */
+                       /* Create default DFA start condition. */
                        scinstal( "INITIAL", false );
 
-                       /* initially, the start condition scoping is
-                        * "no start conditions active"
+                       /* Initially, the start condition scoping is
+                        * "no start conditions active".
                         */
                        actvp = 0;
                        }
@@ -99,26 +99,19 @@ sect1               :  sect1 startconddecl WHITESPACE namelist1 '\n'
 
 sect1end       :  SECTEND
                        {
-                       /* we now know how many start conditions there
+                       /* We now know how many start conditions there
                         * are, so create the "activity" map indicating
                         * which conditions are active.
                         */
                        active_ss = allocate_integer_array( lastsc + 1 );
 
                        for ( i = 1; i <= lastsc; ++i )
-                           active_ss[i] = 0;
+                               active_ss[i] = 0;
                        }
                ;
 
 startconddecl  :  SCDECL
-                       {
-                       /* these productions are separate from the s1object
-                        * rule because the semantics must be done before
-                        * we parse the remainder of an s1object
-                        */
-
-                       xcluflg = false;
-                       }
+                       { xcluflg = false; }
 
                |  XSCDECL
                        { xcluflg = true; }
@@ -131,7 +124,7 @@ namelist1   :  namelist1 WHITESPACE NAME
                        { scinstal( nmstr, xcluflg ); }
 
                |  error
-                        { synerr( "bad start condition list" ); }
+                       { synerr( "bad start condition list" ); }
                ;
 
 sect2          :  sect2 initforrule flexrule '\n'
@@ -140,7 +133,7 @@ sect2               :  sect2 initforrule flexrule '\n'
 
 initforrule    :
                        {
-                       /* initialize for a parse of one rule */
+                       /* Initialize for a parse of one rule. */
                        trlcontxt = variable_trail_rule = varlength = false;
                        trailcnt = headcnt = rulelen = 0;
                        current_state_type = STATE_NORMAL;
@@ -150,69 +143,69 @@ initforrule       :
                ;
 
 flexrule       :  scon '^' rule
-                        {
+                       {
                        pat = $3;
                        finish_rule( pat, variable_trail_rule,
-                                    headcnt, trailcnt );
+                               headcnt, trailcnt );
 
                        for ( i = 1; i <= actvp; ++i )
-                           scbol[actvsc[i]] =
-                               mkbranch( scbol[actvsc[i]], pat );
+                               scbol[actvsc[i]] =
+                                       mkbranch( scbol[actvsc[i]], pat );
 
                        if ( ! bol_needed )
-                           {
-                           bol_needed = true;
+                               {
+                               bol_needed = true;
 
-                           if ( performance_report > 1 )
-                               pinpoint_message( 
-                           "'^' operator results in sub-optimal performance" );
-                           }
+                               if ( performance_report > 1 )
+                                       pinpoint_message( 
+                       "'^' operator results in sub-optimal performance" );
+                               }
                        }
 
                |  scon rule
-                        {
+                       {
                        pat = $2;
                        finish_rule( pat, variable_trail_rule,
-                                    headcnt, trailcnt );
+                               headcnt, trailcnt );
 
                        for ( i = 1; i <= actvp; ++i )
-                           scset[actvsc[i]] =
-                               mkbranch( scset[actvsc[i]], pat );
+                               scset[actvsc[i]] =
+                                       mkbranch( scset[actvsc[i]], pat );
                        }
 
                |  '^' rule
                        {
                        pat = $2;
                        finish_rule( pat, variable_trail_rule,
-                                    headcnt, trailcnt );
+                               headcnt, trailcnt );
 
-                       /* add to all non-exclusive start conditions,
-                        * including the default (0) start condition
+                       /* Add to all non-exclusive start conditions,
+                        * including the default (0) start condition.
                         */
 
                        for ( i = 1; i <= lastsc; ++i )
-                           if ( ! scxclu[i] )
-                               scbol[i] = mkbranch( scbol[i], pat );
+                               if ( ! scxclu[i] )
+                                       scbol[i] = mkbranch( scbol[i], pat );
 
                        if ( ! bol_needed )
-                           {
-                           bol_needed = true;
+                               {
+                               bol_needed = true;
 
-                           if ( performance_report > 1 )
-                               pinpoint_message(
-                           "'^' operator results in sub-optimal performance" );
-                           }
+                               if ( performance_report > 1 )
+                                       pinpoint_message(
+                       "'^' operator results in sub-optimal performance" );
+                               }
                        }
 
                |  rule
                        {
                        pat = $1;
                        finish_rule( pat, variable_trail_rule,
-                                    headcnt, trailcnt );
+                               headcnt, trailcnt );
 
                        for ( i = 1; i <= lastsc; ++i )
-                           if ( ! scxclu[i] )
-                               scset[i] = mkbranch( scset[i], pat );
+                               if ( ! scxclu[i] )
+                                       scset[i] = mkbranch( scset[i], pat );
                        }
 
                |  scon EOF_OP
@@ -220,21 +213,21 @@ flexrule  :  scon '^' rule
 
                |  EOF_OP
                        {
-                       /* this EOF applies to all start conditions
-                        * which don't already have EOF actions
+                       /* This EOF applies to all start conditions
+                        * which don't already have EOF actions.
                         */
                        actvp = 0;
 
                        for ( i = 1; i <= lastsc; ++i )
-                           if ( ! sceof[i] )
-                               actvsc[++actvp] = i;
+                               if ( ! sceof[i] )
+                                       actvsc[++actvp] = i;
 
                        if ( actvp == 0 )
-                           warn(
-                           "all start conditions already have <<EOF>> rules" );
+                               warn(
+                       "all start conditions already have <<EOF>> rules" );
 
                        else
-                           build_eof_action();
+                               build_eof_action();
                        }
 
                |  error
@@ -263,71 +256,75 @@ namelist2 :  namelist2 ',' sconname
 sconname       :  NAME
                        {
                        if ( (scnum = sclookup( nmstr )) == 0 )
-                           format_pinpoint_message(
-                               "undeclared start condition %s", nmstr );
+                               format_pinpoint_message(
+                                       "undeclared start condition %s",
+                                       nmstr );
                        else
-                           {
-                           if ( ++actvp >= current_max_scs )
-                               /* some bozo has included multiple instances
-                                * of start condition names
-                                */
-                               pinpoint_message(
+                               {
+                               if ( ++actvp >= current_max_scs )
+                                       /* Some bozo has included multiple
+                                        * instances of start condition names.
+                                        */
+                                       pinpoint_message(
                                "too many start conditions in <> construct!" );
 
-                           else
-                               actvsc[actvp] = scnum;
-                           }
+                               else
+                                       actvsc[actvp] = scnum;
+                               }
                        }
                ;
 
 rule           :  re2 re
                        {
                        if ( transchar[lastst[$2]] != SYM_EPSILON )
-                           /* provide final transition \now/ so it
-                            * will be marked as a trailing context
-                            * state
-                            */
-                           $2 = link_machines( $2, mkstate( SYM_EPSILON ) );
+                               /* Provide final transition \now/ so it
+                                * will be marked as a trailing context
+                                * state.
+                                */
+                               $2 = link_machines( $2,
+                                               mkstate( SYM_EPSILON ) );
 
                        mark_beginning_as_normal( $2 );
                        current_state_type = STATE_NORMAL;
 
                        if ( previous_continued_action )
-                           {
-                           /* we need to treat this as variable trailing
-                            * context so that the backup does not happen
-                            * in the action but before the action switch
-                            * statement.  If the backup happens in the
-                            * action, then the rules "falling into" this
-                            * one's action will *also* do the backup,
-                            * erroneously.
-                            */
-                           if ( ! varlength || headcnt != 0 )
-                               warn(
+                               {
+                               /* We need to treat this as variable trailing
+                                * context so that the backup does not happen
+                                * in the action but before the action switch
+                                * statement.  If the backup happens in the
+                                * action, then the rules "falling into" this
+                                * one's action will *also* do the backup,
+                                * erroneously.
+                                */
+                               if ( ! varlength || headcnt != 0 )
+                                       warn(
                "trailing context made variable due to preceding '|' action" );
 
-                           /* mark as variable */
-                           varlength = true;
-                           headcnt = 0;
-                           }
+                               /* Mark as variable. */
+                               varlength = true;
+                               headcnt = 0;
+                               }
 
                        if ( varlength && headcnt == 0 )
-                           { /* variable trailing context rule */
-                           /* mark the first part of the rule as the accepting
-                            * "head" part of a trailing context rule
-                            */
-                           /* by the way, we didn't do this at the beginning
-                            * of this production because back then
-                            * current_state_type was set up for a trail
-                            * rule, and add_accept() can create a new
-                            * state ...
-                            */
-                           add_accept( $1, num_rules | YY_TRAILING_HEAD_MASK );
-                           variable_trail_rule = true;
-                           }
+                               { /* variable trailing context rule */
+                               /* Mark the first part of the rule as the
+                                * accepting "head" part of a trailing
+                                * context rule.
+                                *
+                                * By the way, we didn't do this at the
+                                * beginning of this production because back
+                                * then current_state_type was set up for a
+                                * trail rule, and add_accept() can create
+                                * a new state ...
+                                */
+                               add_accept( $1,
+                                       num_rules | YY_TRAILING_HEAD_MASK );
+                               variable_trail_rule = true;
+                               }
                        
                        else
-                           trailcnt = rulelen;
+                               trailcnt = rulelen;
 
                        $$ = link_machines( $1, $2 );
                        }
@@ -336,70 +333,73 @@ rule              :  re2 re
                        { synerr( "trailing context used twice" ); }
 
                |  re '$'
-                        {
+                       {
                        if ( trlcontxt )
-                           {
-                           synerr( "trailing context used twice" );
-                           $$ = mkstate( SYM_EPSILON );
-                           }
+                               {
+                               synerr( "trailing context used twice" );
+                               $$ = mkstate( SYM_EPSILON );
+                               }
 
                        else if ( previous_continued_action )
-                           {
-                           /* see the comment in the rule for "re2 re"
-                            * above
-                            */
-                           if ( ! varlength || headcnt != 0 )
-                               warn(
+                               {
+                               /* See the comment in the rule for "re2 re"
+                                * above.
+                                */
+                               if ( ! varlength || headcnt != 0 )
+                                       warn(
                "trailing context made variable due to preceding '|' action" );
 
-                           /* mark as variable */
-                           varlength = true;
-                           headcnt = 0;
-                           }
+                               /* Mark as variable. */
+                               varlength = true;
+                               headcnt = 0;
+                               }
 
                        if ( varlength && headcnt == 0 )
-                           {
-                           /* again, see the comment in the rule for "re2 re"
-                            * above
-                            */
-                           add_accept( $1, num_rules | YY_TRAILING_HEAD_MASK );
-                           variable_trail_rule = true;
-                           }
+                               {
+                               /* Again, see the comment in the rule for
+                                * "re2 re" above.
+                                */
+                               add_accept( $1,
+                                       num_rules | YY_TRAILING_HEAD_MASK );
+                               variable_trail_rule = true;
+                               }
 
                        else
-                           {
-                           if ( ! varlength )
-                               headcnt = rulelen;
+                               {
+                               if ( ! varlength )
+                                       headcnt = rulelen;
 
-                           ++rulelen;
-                           trailcnt = 1;
-                           }
+                               ++rulelen;
+                               trailcnt = 1;
+                               }
 
                        trlcontxt = true;
 
                        eps = mkstate( SYM_EPSILON );
                        $$ = link_machines( $1,
-                                link_machines( eps, mkstate( '\n' ) ) );
+                               link_machines( eps, mkstate( '\n' ) ) );
                        }
 
                |  re
                        {
-                       $$ = $1;
+                       $$ = $1;
 
                        if ( trlcontxt )
-                           {
-                           if ( varlength && headcnt == 0 )
-                               /* both head and trail are variable-length */
-                               variable_trail_rule = true;
-                           else
-                               trailcnt = rulelen;
-                           }
-                       }
+                               {
+                               if ( varlength && headcnt == 0 )
+                                       /* Both head and trail are
+                                        * variable-length.
+                                        */
+                                       variable_trail_rule = true;
+                               else
+                                       trailcnt = rulelen;
+                               }
+                       }
                ;
 
 
 re             :  re '|' series
-                        {
+                       {
                        varlength = true;
                        $$ = mkor( $1, $3 );
                        }
@@ -411,21 +411,23 @@ re                :  re '|' series
 
 re2            :  re '/'
                        {
-                       /* this rule is written separately so
-                        * the reduction will occur before the trailing
-                        * series is parsed
+                       /* This rule is written separately so the
+                        * reduction will occur before the trailing
+                        * series is parsed.
                         */
 
                        if ( trlcontxt )
-                           synerr( "trailing context used twice" );
+                               synerr( "trailing context used twice" );
                        else
-                           trlcontxt = true;
+                               trlcontxt = true;
 
                        if ( varlength )
-                           /* we hope the trailing context is fixed-length */
-                           varlength = false;
+                               /* We hope the trailing context is
+                                * fixed-length.
+                                */
+                               varlength = false;
                        else
-                           headcnt = rulelen;
+                               headcnt = rulelen;
 
                        rulelen = 0;
 
@@ -435,9 +437,9 @@ re2         :  re '/'
                ;
 
 series         :  series singleton
-                        {
-                       /* this is where concatenation of adjacent patterns
-                        * gets done
+                       {
+                       /* This is where concatenation of adjacent patterns
+                        * gets done.
                         */
                        $$ = link_machines( $1, $2 );
                        }
@@ -447,7 +449,7 @@ series              :  series singleton
                ;
 
 singleton      :  singleton '*'
-                        {
+                       {
                        varlength = true;
 
                        $$ = mkclos( $1 );
@@ -456,14 +458,12 @@ singleton :  singleton '*'
                |  singleton '+'
                        {
                        varlength = true;
-
                        $$ = mkposcl( $1 );
                        }
 
                |  singleton '?'
                        {
                        varlength = true;
-
                        $$ = mkopt( $1 );
                        }
 
@@ -472,25 +472,27 @@ singleton :  singleton '*'
                        varlength = true;
 
                        if ( $3 > $5 || $3 < 0 )
-                           {
-                           synerr( "bad iteration values" );
-                           $$ = $1;
-                           }
+                               {
+                               synerr( "bad iteration values" );
+                               $$ = $1;
+                               }
                        else
-                           {
-                           if ( $3 == 0 )
                                {
-                               if ( $5 <= 0 )
-                                   {
-                                   synerr( "bad iteration values" );
-                                   $$ = $1;
-                                   }
+                               if ( $3 == 0 )
+                                       {
+                                       if ( $5 <= 0 )
+                                               {
+                                               synerr(
+                                               "bad iteration values" );
+                                               $$ = $1;
+                                               }
+                                       else
+                                               $$ = mkopt(
+                                                       mkrep( $1, 1, $5 ) );
+                                       }
                                else
-                                   $$ = mkopt( mkrep( $1, 1, $5 ) );
+                                       $$ = mkrep( $1, $3, $5 );
                                }
-                           else
-                               $$ = mkrep( $1, $3, $5 );
-                           }
                        }
 
                |  singleton '{' NUMBER ',' '}'
@@ -498,49 +500,50 @@ singleton :  singleton '*'
                        varlength = true;
 
                        if ( $3 <= 0 )
-                           {
-                           synerr( "iteration value must be positive" );
-                           $$ = $1;
-                           }
+                               {
+                               synerr( "iteration value must be positive" );
+                               $$ = $1;
+                               }
 
                        else
-                           $$ = mkrep( $1, $3, INFINITY );
+                               $$ = mkrep( $1, $3, INFINITY );
                        }
 
                |  singleton '{' NUMBER '}'
                        {
-                       /* the singleton could be something like "(foo)",
+                       /* The singleton could be something like "(foo)",
                         * in which case we have no idea what its length
                         * is, so we punt here.
                         */
                        varlength = true;
 
                        if ( $3 <= 0 )
-                           {
-                           synerr( "iteration value must be positive" );
-                           $$ = $1;
-                           }
+                               {
+                               synerr( "iteration value must be positive" );
+                               $$ = $1;
+                               }
 
                        else
-                           $$ = link_machines( $1, copysingl( $1, $3 - 1 ) );
+                               $$ = link_machines( $1,
+                                               copysingl( $1, $3 - 1 ) );
                        }
 
                |  '.'
                        {
                        if ( ! madeany )
-                           {
-                           /* create the '.' character class */
-                           anyccl = cclinit();
-                           ccladd( anyccl, '\n' );
-                           cclnegate( anyccl );
+                               {
+                               /* Create the '.' character class. */
+                               anyccl = cclinit();
+                               ccladd( anyccl, '\n' );
+                               cclnegate( anyccl );
 
-                           if ( useecs )
-                               mkeccl( ccltbl + cclmap[anyccl],
-                                       ccllen[anyccl], nextecm,
-                                       ecgroup, csize, csize );
+                               if ( useecs )
+                                       mkeccl( ccltbl + cclmap[anyccl],
+                                               ccllen[anyccl], nextecm,
+                                               ecgroup, csize, csize );
 
-                           madeany = true;
-                           }
+                               madeany = true;
+                               }
 
                        ++rulelen;
 
@@ -550,14 +553,15 @@ singleton :  singleton '*'
                |  fullccl
                        {
                        if ( ! cclsorted )
-                           /* sort characters for fast searching.  We use a
-                            * shell sort since this list could be large.
-                            */
-                           cshell( ccltbl + cclmap[$1], ccllen[$1], true );
+                               /* Sort characters for fast searching.  We
+                                * use a shell sort since this list could
+                                * be large.
+                                */
+                               cshell( ccltbl + cclmap[$1], ccllen[$1], true );
 
                        if ( useecs )
-                           mkeccl( ccltbl + cclmap[$1], ccllen[$1],
-                                   nextecm, ecgroup, csize, csize );
+                               mkeccl( ccltbl + cclmap[$1], ccllen[$1],
+                                       nextecm, ecgroup, csize, csize );
 
                        ++rulelen;
 
@@ -582,7 +586,7 @@ singleton   :  singleton '*'
                        ++rulelen;
 
                        if ( caseins && $1 >= 'A' && $1 <= 'Z' )
-                           $1 = clower( $1 );
+                               $1 = clower( $1 );
 
                        $$ = mkstate( $1 );
                        }
@@ -593,50 +597,42 @@ fullccl           :  '[' ccl ']'
 
                |  '[' '^' ccl ']'
                        {
-                       /* *Sigh* - to be compatible Unix lex, negated ccls
-                        * match newlines
-                        */
-#if 0
-                       ccladd( $3, '\n' ); /* negated ccls don't match '\n' */
-                       cclsorted = false; /* because we added the newline */
-#endif
                        cclnegate( $3 );
                        $$ = $3;
                        }
                ;
 
 ccl            :  ccl CHAR '-' CHAR
-                        {
+                       {
                        if ( $2 > $4 )
-                           synerr( "negative range in character class" );
+                               synerr( "negative range in character class" );
 
                        else
-                           {
-                           if ( caseins )
                                {
-                               if ( $2 >= 'A' && $2 <= 'Z' )
-                                   $2 = clower( $2 );
-                               if ( $4 >= 'A' && $4 <= 'Z' )
-                                   $4 = clower( $4 );
+                               if ( caseins )
+                                       {
+                                       if ( $2 >= 'A' && $2 <= 'Z' )
+                                               $2 = clower( $2 );
+                                       if ( $4 >= 'A' && $4 <= 'Z' )
+                                               $4 = clower( $4 );
+                                       }
+
+                               for ( i = $2; i <= $4; ++i )
+                                       ccladd( $1, i );
+
+                               /* Keep track if this ccl is staying in
+                                * alphabetical order.
+                                */
+                               cclsorted = cclsorted && ($2 > lastchar);
+                               lastchar = $4;
                                }
 
-                           for ( i = $2; i <= $4; ++i )
-                               ccladd( $1, i );
-
-                           /* keep track if this ccl is staying in alphabetical
-                            * order
-                            */
-                           cclsorted = cclsorted && ($2 > lastchar);
-                           lastchar = $4;
-                           }
-
                        $$ = $1;
                        }
 
                |  ccl CHAR
-                       {
-                       if ( caseins )
-                           if ( $2 >= 'A' && $2 <= 'Z' )
+                       {
+                       if ( caseins && $2 >= 'A' && $2 <= 'Z' )
                                $2 = clower( $2 );
 
                        ccladd( $1, $2 );
@@ -654,9 +650,8 @@ ccl         :  ccl CHAR '-' CHAR
                ;
 
 string         :  string CHAR
-                        {
-                       if ( caseins )
-                           if ( $2 >= 'A' && $2 <= 'Z' )
+                       {
+                       if ( caseins && $2 >= 'A' && $2 <= 'Z' )
                                $2 = clower( $2 );
 
                        ++rulelen;
@@ -676,70 +671,67 @@ string            :  string CHAR
  */
 
 void build_eof_action()
-
-    {
-    register int i;
-    char action_text[MAXLINE];
-
-    for ( i = 1; i <= actvp; ++i )
        {
-       if ( sceof[actvsc[i]] )
-           format_pinpoint_message(
-               "multiple <<EOF>> rules for start condition %s",
-                   scname[actvsc[i]] );
-
-       else
-           {
-           sceof[actvsc[i]] = true;
-           sprintf( action_text, "case YY_STATE_EOF(%s):\n",
-                    scname[actvsc[i]] );
-           add_action( action_text );
-           }
-       }
+       register int i;
+       char action_text[MAXLINE];
 
-    line_directive_out( (FILE *) 0 );
+       for ( i = 1; i <= actvp; ++i )
+               {
+               if ( sceof[actvsc[i]] )
+                       format_pinpoint_message(
+                               "multiple <<EOF>> rules for start condition %s",
+                               scname[actvsc[i]] );
 
-    /* this isn't a normal rule after all - don't count it as
-     * such, so we don't have any holes in the rule numbering
-     * (which make generating "rule can never match" warnings
-     * more difficult
-     */
-    --num_rules;
-    ++num_eof_rules;
-    }
+               else
+                       {
+                       sceof[actvsc[i]] = true;
+                       sprintf( action_text, "case YY_STATE_EOF(%s):\n",
+                       scname[actvsc[i]] );
+                       add_action( action_text );
+                       }
+               }
+
+       line_directive_out( (FILE *) 0 );
+
+       /* This isn't a normal rule after all - don't count it as
+        * such, so we don't have any holes in the rule numbering
+        * (which make generating "rule can never match" warnings
+        * more difficult.
+        */
+       --num_rules;
+       ++num_eof_rules;
+       }
 
 
 /* format_synerr - write out formatted syntax error */
 
 void format_synerr( msg, arg )
 char msg[], arg[];
+       {
+       char errmsg[MAXLINE];
 
-    {
-    char errmsg[MAXLINE];
-
-    (void) sprintf( errmsg, msg, arg );
-    synerr( errmsg );
-    }
+       (void) sprintf( errmsg, msg, arg );
+       synerr( errmsg );
+       }
 
 
 /* synerr - report a syntax error */
 
 void synerr( str )
 char str[];
-
-    {
-    syntaxerror = true;
-    pinpoint_message( str );
-    }
+       {
+       syntaxerror = true;
+       pinpoint_message( str );
+       }
 
 
 /* warn - report a warning, unless -w was given */
 
 void warn( str )
 char str[];
-    {
-    line_warning( str, linenum );
-    }
+       {
+       line_warning( str, linenum );
+       }
 
 /* format_pinpoint_message - write out a message formatted with one string,
  *                          pinpointing its location
@@ -747,23 +739,21 @@ char str[];
 
 void format_pinpoint_message( msg, arg )
 char msg[], arg[];
+       {
+       char errmsg[MAXLINE];
 
-    {
-    char errmsg[MAXLINE];
-
-    (void) sprintf( errmsg, msg, arg );
-    pinpoint_message( errmsg );
-    }
+       (void) sprintf( errmsg, msg, arg );
+       pinpoint_message( errmsg );
+       }
 
 
 /* pinpoint_message - write out a message, pinpointing its location */
 
 void pinpoint_message( str )
 char str[];
-
-    {
-    line_pinpoint( str, linenum );
-    }
+       {
+       line_pinpoint( str, linenum );
+       }
 
 
 /* line_warning - report a warning at a given line, unless -w was given */
@@ -771,15 +761,15 @@ char str[];
 void line_warning( str, line )
 char str[];
 int line;
-    {
-    char warning[MAXLINE];
-
-    if ( ! nowarn )
        {
-       sprintf( warning, "warning, %s", str );
-       line_pinpoint( warning, line );
+       char warning[MAXLINE];
+
+       if ( ! nowarn )
+               {
+               sprintf( warning, "warning, %s", str );
+               line_pinpoint( warning, line );
+               }
        }
-    }
 
 
 /* line_pinpoint - write out a message, pinpointing it at the given line */
@@ -787,10 +777,9 @@ int line;
 void line_pinpoint( str, line )
 char str[];
 int line;
-
-    {
-    fprintf( stderr, "\"%s\", line %d: %s\n", infilename, line, str );
-    }
+       {
+       fprintf( stderr, "\"%s\", line %d: %s\n", infilename, line, str );
+       }
 
 
 /* yyerror - eat up an error message from the parser;
@@ -799,6 +788,5 @@ int line;
 
 void yyerror( msg )
 char msg[];
-
-    {
-    }
+       {
+       }
diff --git a/scan.l b/scan.l
index 88add7b3ee4435ed77ead902079f46d157febcb3..0566a2bb8943f42639855b133b8e1b316286cd82 100644 (file)
--- a/scan.l
+++ b/scan.l
@@ -54,15 +54,15 @@ static char rcsid[] =
 
 #define PUT_BACK_STRING(str, start) \
        for ( i = strlen( (char *) (str) ) - 1; i >= start; --i ) \
-           unput((str)[i])
+               unput((str)[i])
 
 #define CHECK_REJECT(str) \
        if ( all_upper( str ) ) \
-           reject = true;
+               reject = true;
 
 #define CHECK_YYMORE(str) \
        if ( all_lower( str ) ) \
-           yymore_used = true;
+               yymore_used = true;
 %}
 
 %x SECT2 SECT2PROLOG SECT3 CODEBLOCK PICKUPDEF SC CARETISBOL NUM QUOTE
@@ -86,11 +86,11 @@ FIRST_CCL_CHAR      [^\\\n]|{ESCSEQ}
 CCL_CHAR       [^\\\n\]]|{ESCSEQ}
 
 %%
-    static int bracelevel, didadef, indented_code, checking_used;
+       static int bracelevel, didadef, indented_code, checking_used;
 
-    int doing_codeblock = false;
-    int i;
-    Char nmdef[MAXLINE], myesc();
+       int doing_codeblock = false;
+       int i;
+       Char nmdef[MAXLINE], myesc();
 
 
 ^{WS}                  indented_code = true; BEGIN(CODEBLOCK);
@@ -156,7 +156,7 @@ CCL_CHAR    [^\\\n\]]|{ESCSEQ}
                        ++linenum;
                        ECHO;
                        if ( indented_code )
-                           BEGIN(INITIAL);
+                               BEGIN(INITIAL);
                        }
 
 
@@ -165,22 +165,21 @@ CCL_CHAR  [^\\\n\]]|{ESCSEQ}
 <PICKUPDEF>{NOT_WS}.*  {
                        (void) strcpy( (char *) nmdef, (char *) yytext );
 
-                       /* skip trailing whitespace */
+                       /* Skip trailing whitespace. */
                        for ( i = strlen( (char *) nmdef ) - 1;
-                             i >= 0 &&
-                             (nmdef[i] == ' ' || nmdef[i] == '\t');
+                             i >= 0 && (nmdef[i] == ' ' || nmdef[i] == '\t');
                              --i )
-                           ;
+                               ;
 
                        nmdef[i + 1] = '\0';
 
-                        ndinstal( nmstr, nmdef );
+                       ndinstal( nmstr, nmdef );
                        didadef = true;
                        }
 
 <PICKUPDEF>{NL}                {
                        if ( ! didadef )
-                           synerr( "incomplete name definition" );
+                               synerr( "incomplete name definition" );
                        BEGIN(INITIAL);
                        ++linenum;
                        }
@@ -192,15 +191,17 @@ CCL_CHAR  [^\\\n\]]|{ESCSEQ}
 <USED_LIST>{WS}
 <USED_LIST>"reject"    {
                        if ( all_upper( yytext ) )
-                           reject_really_used = checking_used;
+                               reject_really_used = checking_used;
                        else
-                           synerr( "unrecognized %used/%unused construct" );
+                               synerr(
+                               "unrecognized %used/%unused construct" );
                        }
 <USED_LIST>"yymore"    {
                        if ( all_lower( yytext ) )
-                           yymore_really_used = checking_used;
+                               yymore_really_used = checking_used;
                        else
-                           synerr( "unrecognized %used/%unused construct" );
+                               synerr(
+                               "unrecognized %used/%unused construct" );
                        }
 <USED_LIST>{NOT_WS}+   synerr( "unrecognized %used/%unused construct" );
 
@@ -224,7 +225,7 @@ CCL_CHAR    [^\\\n\]]|{ESCSEQ}
                        bracelevel = 1;
 
                        if ( indented_code )
-                           ACTION_ECHO;
+                               ACTION_ECHO;
 
                        BEGIN(CODEBLOCK_2);
                        }
@@ -244,9 +245,9 @@ CCL_CHAR    [^\\\n\]]|{ESCSEQ}
 <SECT2>{WS}"|".*{NL}   continued_action = true; ++linenum; return '\n';
 
 <SECT2>{WS}            {
-                       /* this rule is separate from the one below because
+                       /* This rule is separate from the one below because
                         * otherwise we get variable trailing context, so
-                        * we can't build the scanner using -{f,F}
+                        * we can't build the scanner using -{f,F}.
                         */
                        bracelevel = 0;
                        continued_action = false;
@@ -275,31 +276,33 @@ CCL_CHAR  [^\\\n\]]|{ESCSEQ}
 
                        (void) strcpy( nmstr, (char *) yytext );
 
-                       /* check to see if we've already encountered this ccl */
+                       /* Check to see if we've already encountered this
+                        * ccl.
+                        */
                        if ( (cclval = ccllookup( (Char *) nmstr )) )
-                           {
-                           if ( input() != ']' )
-                               synerr( "bad character class" );
-
-                           yylval = cclval;
-                           ++cclreuse;
-                           return PREVCCL;
-                           }
-                       else
-                           {
-                           /* we fudge a bit.  We know that this ccl will
-                            * soon be numbered as lastccl + 1 by cclinit
-                            */
-                           cclinstal( (Char *) nmstr, lastccl + 1 );
-
-                           /* push back everything but the leading bracket
-                            * so the ccl can be rescanned
-                            */
-                           yyless( 1 );
+                               {
+                               if ( input() != ']' )
+                                       synerr( "bad character class" );
 
-                           BEGIN(FIRSTCCL);
-                           return '[';
-                           }
+                               yylval = cclval;
+                               ++cclreuse;
+                               return PREVCCL;
+                               }
+                       else
+                               {
+                               /* We fudge a bit.  We know that this ccl will
+                                * soon be numbered as lastccl + 1 by cclinit.
+                                */
+                               cclinstal( (Char *) nmstr, lastccl + 1 );
+
+                               /* Push back everything but the leading bracket
+                                * so the ccl can be rescanned.
+                                */
+                               yyless( 1 );
+
+                               BEGIN(FIRSTCCL);
+                               return '[';
+                               }
                        }
 
 <SECT2>"{"{NAME}"}"    {
@@ -310,28 +313,29 @@ CCL_CHAR  [^\\\n\]]|{ESCSEQ}
                        nmstr[yyleng - 2] = '\0';  /* chop trailing brace */
 
                        if ( ! (nmdefptr = ndlookup( nmstr )) )
-                           format_synerr( "undefined definition {%s}", nmstr );
+                               format_synerr( "undefined definition {%s}",
+                                               nmstr );
 
                        else
-                           { /* push back name surrounded by ()'s */
-                           int len = strlen( nmdefptr );
-
-                           if ( nmdefptr[0] == '^' ||
-                                (len > 0 && nmdefptr[len - 1] == '$') )
-                               {
-                               PUT_BACK_STRING(nmdefptr, 0);
-
-                               if ( nmdefptr[0] == '^' )
-                                       BEGIN(CARETISBOL);
-                               }
-
-                           else
-                               {
-                               unput(')');
-                               PUT_BACK_STRING(nmdefptr, 0);
-                               unput('(');
+                               { /* push back name surrounded by ()'s */
+                               int len = strlen( nmdefptr );
+
+                               if ( nmdefptr[0] == '^' ||
+                                    (len > 0 && nmdefptr[len - 1] == '$') )
+                                       {
+                                       PUT_BACK_STRING(nmdefptr, 0);
+
+                                       if ( nmdefptr[0] == '^' )
+                                               BEGIN(CARETISBOL);
+                                       }
+
+                               else
+                                       {
+                                       unput(')');
+                                       PUT_BACK_STRING(nmdefptr, 0);
+                                       unput('(');
+                                       }
                                }
-                           }
                        }
 
 <SECT2>[/|*+?.()]      return yytext[0];
@@ -417,13 +421,13 @@ CCL_CHAR  [^\\\n\]]|{ESCSEQ}
                        ACTION_ECHO;
                        if ( bracelevel == 0 ||
                             (doing_codeblock && indented_code) )
-                           {
-                           if ( ! doing_codeblock )
-                               add_action( "\tYY_BREAK\n" );
-                           
-                           doing_codeblock = false;
-                           BEGIN(SECT2);
-                           }
+                               {
+                               if ( ! doing_codeblock )
+                                       add_action( "\tYY_BREAK\n" );
+                               
+                               doing_codeblock = false;
+                               BEGIN(SECT2);
+                               }
                        }
 
 
@@ -439,19 +443,19 @@ CCL_CHAR  [^\\\n\]]|{ESCSEQ}
                        ++linenum;
                        ACTION_ECHO;
                        if ( bracelevel == 0 )
-                           {
-                           add_action( "\tYY_BREAK\n" );
-                           BEGIN(SECT2);
-                           }
+                               {
+                               add_action( "\tYY_BREAK\n" );
+                               BEGIN(SECT2);
+                               }
                        }
 <ACTION>.              ACTION_ECHO;
 
 <ACTION_COMMENT>"*/"   {
                        ACTION_ECHO;
                        if ( doing_codeblock )
-                           BEGIN(CODEBLOCK_2);
+                               BEGIN(CODEBLOCK_2);
                        else
-                           BEGIN(ACTION);
+                               BEGIN(ACTION);
                        }
 
 <ACTION_COMMENT>"*"    ACTION_ECHO;
@@ -490,37 +494,35 @@ CCL_CHAR  [^\\\n\]]|{ESCSEQ}
 
 
 int yywrap()
-
-    {
-    if ( --num_input_files > 0 )
        {
-       set_input_file( *++input_files );
-       return 0;
+       if ( --num_input_files > 0 )
+               {
+               set_input_file( *++input_files );
+               return 0;
+               }
+
+       else
+               return 1;
        }
 
-    else
-       return 1;
-    }
-
 
 /* set_input_file - open the given file (if NULL, stdin) for scanning */
 
 void set_input_file( file )
 char *file;
-
-    {
-    if ( file )
-       {
-       infilename = file;
-       yyin = fopen( infilename, "r" );
-
-       if ( yyin == NULL )
-           lerrsf( "can't open %s", file );
-       }
-
-    else
        {
-       yyin = stdin;
-       infilename = "<stdin>";
+       if ( file )
+               {
+               infilename = file;
+               yyin = fopen( infilename, "r" );
+
+               if ( yyin == NULL )
+                       lerrsf( "can't open %s", file );
+               }
+
+       else
+               {
+               yyin = stdin;
+               infilename = "<stdin>";
+               }
        }
-    }
diff --git a/sym.c b/sym.c
index 3ab3890da6b1c88fb155c6f3cab62dfe78df4d08..1558cf4bb860d40a879ffad6239b8650f35b5d96 100644 (file)
--- a/sym.c
+++ b/sym.c
@@ -47,13 +47,6 @@ struct hash_entry *findsym();
 
 
 /* addsym - add symbol and definitions to symbol table
- *
- * synopsis
- *    char sym[], *str_def;
- *    int int_def;
- *    hash_table table;
- *    int table_size;
- *    0 / -1 = addsym( sym, def, int_def, table, table_size );
  *
  * -1 is returned if the symbol already exists, and the change not made.
  */
@@ -64,263 +57,204 @@ char *str_def;
 int int_def;
 hash_table table;
 int table_size;
-
-    {
-    int hash_val = hashfunct( sym, table_size );
-    register struct hash_entry *sym_entry = table[hash_val];
-    register struct hash_entry *new_entry;
-    register struct hash_entry *successor;
-
-    while ( sym_entry )
        {
-       if ( ! strcmp( sym, sym_entry->name ) )
-           { /* entry already exists */
-           return ( -1 );
-           }
-       
-       sym_entry = sym_entry->next;
+       int hash_val = hashfunct( sym, table_size );
+       register struct hash_entry *sym_entry = table[hash_val];
+       register struct hash_entry *new_entry;
+       register struct hash_entry *successor;
+
+       while ( sym_entry )
+               {
+               if ( ! strcmp( sym, sym_entry->name ) )
+                       { /* entry already exists */
+                       return -1;
+                       }
+
+               sym_entry = sym_entry->next;
+               }
+
+       /* create new entry */
+       new_entry = (struct hash_entry *) malloc( sizeof( struct hash_entry ) );
+
+       if ( new_entry == NULL )
+               flexfatal( "symbol table memory allocation failed" );
+
+       if ( (successor = table[hash_val]) )
+               {
+               new_entry->next = successor;
+               successor->prev = new_entry;
+               }
+       else
+               new_entry->next = NULL;
+
+       new_entry->prev = NULL;
+       new_entry->name = sym;
+       new_entry->str_val = str_def;
+       new_entry->int_val = int_def;
+
+       table[hash_val] = new_entry;
+
+       return 0;
        }
 
-    /* create new entry */
-    new_entry = (struct hash_entry *) malloc( sizeof( struct hash_entry ) );
-
-    if ( new_entry == NULL )
-       flexfatal( "symbol table memory allocation failed" );
-
-    if ( (successor = table[hash_val]) )
-       {
-       new_entry->next = successor;
-       successor->prev = new_entry;
-       }
-    else
-       new_entry->next = NULL;
 
-    new_entry->prev = NULL;
-    new_entry->name = sym;
-    new_entry->str_val = str_def;
-    new_entry->int_val = int_def;
-
-    table[hash_val] = new_entry;
-
-    return ( 0 );
-    }
-
-
-/* cclinstal - save the text of a character class
- *
- * synopsis
- *    Char ccltxt[];
- *    int cclnum;
- *    cclinstal( ccltxt, cclnum );
- */
+/* cclinstal - save the text of a character class */
 
 void cclinstal( ccltxt, cclnum )
 Char ccltxt[];
 int cclnum;
-
-    {
-    /* we don't bother checking the return status because we are not called
-     * unless the symbol is new
-     */
-    Char *copy_unsigned_string();
-
-    (void) addsym( (char *) copy_unsigned_string( ccltxt ), (char *) 0, cclnum,
-                  ccltab, CCL_HASH_SIZE );
-    }
+       {
+       /* We don't bother checking the return status because we are not
+        * called unless the symbol is new.
+        */
+       Char *copy_unsigned_string();
+
+       (void) addsym( (char *) copy_unsigned_string( ccltxt ),
+                       (char *) 0, cclnum,
+                       ccltab, CCL_HASH_SIZE );
+       }
 
 
 /* ccllookup - lookup the number associated with character class text
  *
- * synopsis
- *    Char ccltxt[];
- *    int ccllookup, cclval;
- *    cclval/0 = ccllookup( ccltxt );
+ * Returns 0 if there's no CCL associated with the text.
  */
 
 int ccllookup( ccltxt )
 Char ccltxt[];
+       {
+       return findsym( (char *) ccltxt, ccltab, CCL_HASH_SIZE )->int_val;
+       }
 
-    {
-    return ( findsym( (char *) ccltxt, ccltab, CCL_HASH_SIZE )->int_val );
-    }
 
-
-/* findsym - find symbol in symbol table
- *
- * synopsis
- *    char sym[];
- *    hash_table table;
- *    int table_size;
- *    struct hash_entry *sym_entry, *findsym();
- *    sym_entry = findsym( sym, table, table_size );
- */
+/* findsym - find symbol in symbol table */
 
 struct hash_entry *findsym( sym, table, table_size )
 register char sym[];
 hash_table table;
 int table_size;
-
-    {
-    register struct hash_entry *sym_entry = table[hashfunct( sym, table_size )];
-    static struct hash_entry empty_entry =
        {
-       (struct hash_entry *) 0, (struct hash_entry *) 0, NULL, NULL, 0,
-       } ;
-
-    while ( sym_entry )
-       {
-       if ( ! strcmp( sym, sym_entry->name ) )
-           return ( sym_entry );
-       sym_entry = sym_entry->next;
+       static struct hash_entry empty_entry =
+               {
+               (struct hash_entry *) 0, (struct hash_entry *) 0, NULL, NULL, 0,
+               } ;
+       register struct hash_entry *sym_entry =
+               table[hashfunct( sym, table_size )];
+
+       while ( sym_entry )
+               {
+               if ( ! strcmp( sym, sym_entry->name ) )
+                       return sym_entry;
+               sym_entry = sym_entry->next;
+               }
+
+       return &empty_entry;
        }
 
-    return ( &empty_entry );
-    }
-
     
-/* hashfunct - compute the hash value for "str" and hash size "hash_size"
- *
- * synopsis
- *    char str[];
- *    int hash_size, hash_val;
- *    hash_val = hashfunct( str, hash_size );
- */
+/* hashfunct - compute the hash value for "str" and hash size "hash_size" */
 
 int hashfunct( str, hash_size )
 register char str[];
 int hash_size;
+       {
+       register int hashval;
+       register int locstr;
 
-    {
-    register int hashval;
-    register int locstr;
-
-    hashval = 0;
-    locstr = 0;
+       hashval = 0;
+       locstr = 0;
 
-    while ( str[locstr] )
-       hashval = ((hashval << 1) + (unsigned char) str[locstr++]) % hash_size;
+       while ( str[locstr] )
+               hashval = ((hashval << 1) + (unsigned char) str[locstr++]) %
+                       hash_size;
 
-    return ( hashval );
-    }
+       return hashval;
+       }
 
 
-/* ndinstal - install a name definition
- *
- * synopsis
- *    char nd[];
- *    Char def[];
- *    ndinstal( nd, def );
- */
+/* ndinstal - install a name definition */
 
 void ndinstal( nd, def )
 char nd[];
 Char def[];
+       {
+       char *copy_string();
+       Char *copy_unsigned_string();
 
-    {
-    char *copy_string();
-    Char *copy_unsigned_string();
-
-    if ( addsym( copy_string( nd ), (char *) copy_unsigned_string( def ), 0,
-                ndtbl, NAME_TABLE_HASH_SIZE ) )
-       synerr( "name defined twice" );
-    }
+       if ( addsym( copy_string( nd ), (char *) copy_unsigned_string( def ), 0,
+                       ndtbl, NAME_TABLE_HASH_SIZE ) )
+               synerr( "name defined twice" );
+       }
 
 
 /* ndlookup - lookup a name definition
  *
- * synopsis
- *    char nd[], *def;
- *    char *ndlookup();
- *    def/NULL = ndlookup( nd );
+ * Returns a nil pointer if the name definition does not exist.
  */
 
 Char *ndlookup( nd )
 char nd[];
-
-    {
-    return ( (Char *) findsym( nd, ndtbl, NAME_TABLE_HASH_SIZE )->str_val );
-    }
+       {
+       return (Char *) findsym( nd, ndtbl, NAME_TABLE_HASH_SIZE )->str_val;
+       }
 
 
-/* scextend - increase the maximum number of start conditions
- *
- * synopsis
- *    scextend();
- */
+/* scextend - increase the maximum number of start conditions */
 
 void scextend()
+       {
+       current_max_scs += MAX_SCS_INCREMENT;
 
-    {
-    current_max_scs += MAX_SCS_INCREMENT;
-
-    ++num_reallocs;
+       ++num_reallocs;
 
-    scset = reallocate_integer_array( scset, current_max_scs );
-    scbol = reallocate_integer_array( scbol, current_max_scs );
-    scxclu = reallocate_integer_array( scxclu, current_max_scs );
-    sceof = reallocate_integer_array( sceof, current_max_scs );
-    scname = reallocate_char_ptr_array( scname, current_max_scs );
-    actvsc = reallocate_integer_array( actvsc, current_max_scs );
-    }
+       scset = reallocate_integer_array( scset, current_max_scs );
+       scbol = reallocate_integer_array( scbol, current_max_scs );
+       scxclu = reallocate_integer_array( scxclu, current_max_scs );
+       sceof = reallocate_integer_array( sceof, current_max_scs );
+       scname = reallocate_char_ptr_array( scname, current_max_scs );
+       actvsc = reallocate_integer_array( actvsc, current_max_scs );
+       }
 
 
 /* scinstal - make a start condition
- *
- * synopsis
- *    char str[];
- *    int xcluflg;
- *    scinstal( str, xcluflg );
  *
  * NOTE
- *    the start condition is Exclusive if xcluflg is true
+ *    The start condition is "exclusive" if xcluflg is true.
  */
 
 void scinstal( str, xcluflg )
 char str[];
 int xcluflg;
+       {
+       char *copy_string();
 
-    {
-    char *copy_string();
-
-    /* bit of a hack.  We know how the default start-condition is
-     * declared, and don't put out a define for it, because it
-     * would come out as "#define 0 1"
-     */
-    /* actually, this is no longer the case.  The default start-condition
-     * is now called "INITIAL".  But we keep the following for the sake
-     * of future robustness.
-     */
-
-    if ( strcmp( str, "0" ) )
+       /* Generate start condition definition, for use in BEGIN et al. */
        printf( "#define %s %d\n", str, lastsc );
 
-    if ( ++lastsc >= current_max_scs )
-       scextend();
+       if ( ++lastsc >= current_max_scs )
+               scextend();
 
-    scname[lastsc] = copy_string( str );
+       scname[lastsc] = copy_string( str );
 
-    if ( addsym( scname[lastsc], (char *) 0, lastsc,
-                sctbl, START_COND_HASH_SIZE ) )
-       format_pinpoint_message( "start condition %s declared twice", str );
+       if ( addsym( scname[lastsc], (char *) 0, lastsc,
+                       sctbl, START_COND_HASH_SIZE ) )
+               format_pinpoint_message( "start condition %s declared twice",
+                                       str );
 
-    scset[lastsc] = mkstate( SYM_EPSILON );
-    scbol[lastsc] = mkstate( SYM_EPSILON );
-    scxclu[lastsc] = xcluflg;
-    sceof[lastsc] = false;
-    }
+       scset[lastsc] = mkstate( SYM_EPSILON );
+       scbol[lastsc] = mkstate( SYM_EPSILON );
+       scxclu[lastsc] = xcluflg;
+       sceof[lastsc] = false;
+       }
 
 
 /* sclookup - lookup the number associated with a start condition
  *
- * synopsis
- *    char str[], scnum;
- *    int sclookup;
- *    scnum/0 = sclookup( str );
+ * Returns 0 if no such start condition.
  */
 
 int sclookup( str )
 char str[];
-
-    {
-    return ( findsym( str, sctbl, START_COND_HASH_SIZE )->int_val );
-    }
+       {
+       return findsym( str, sctbl, START_COND_HASH_SIZE )->int_val;
+       }
index 7e4f74a131c96a1a841f52943b13a44624bf25d6..26e7cb699ad16cefbf37e3b251f35e3cef22e22c 100644 (file)
--- a/tblcmp.c
+++ b/tblcmp.c
@@ -80,237 +80,243 @@ int tbldiff PROTO((int[], int, int[]));
 
 void bldtbl( state, statenum, totaltrans, comstate, comfreq )
 int state[], statenum, totaltrans, comstate, comfreq;
+       {
+       int extptr, extrct[2][CSIZE + 1];
+       int mindiff, minprot, i, d;
+
+       /* If extptr is 0 then the first array of extrct holds the result
+        * of the "best difference" to date, which is those transitions
+        * which occur in "state" but not in the proto which, to date,
+        * has the fewest differences between itself and "state".  If
+        * extptr is 1 then the second array of extrct hold the best
+        * difference.  The two arrays are toggled between so that the
+        * best difference to date can be kept around and also a difference
+        * just created by checking against a candidate "best" proto.
+        */
 
-    {
-    int extptr, extrct[2][CSIZE + 1];
-    int mindiff, minprot, i, d;
-    int checkcom;
+       extptr = 0;
 
-    /* If extptr is 0 then the first array of extrct holds the result of the
-     * "best difference" to date, which is those transitions which occur in
-     * "state" but not in the proto which, to date, has the fewest differences
-     * between itself and "state".  If extptr is 1 then the second array of
-     * extrct hold the best difference.  The two arrays are toggled
-     * between so that the best difference to date can be kept around and
-     * also a difference just created by checking against a candidate "best"
-     * proto.
-     */
+       /* If the state has too few out-transitions, don't bother trying to
+        * compact its tables.
+        */
 
-    extptr = 0;
+       if ( (totaltrans * 100) < (numecs * PROTO_SIZE_PERCENTAGE) )
+               mkentry( state, numecs, statenum, JAMSTATE, totaltrans );
 
-    /* if the state has too few out-transitions, don't bother trying to
-     * compact its tables
-     */
+       else
+               {
+               /* "checkcom" is true if we should only check "state" against
+                * protos which have the same "comstate" value.
+                */
+               int checkcom =
+                       comfreq * 100 > totaltrans * CHECK_COM_PERCENTAGE;
 
-    if ( (totaltrans * 100) < (numecs * PROTO_SIZE_PERCENTAGE) )
-       mkentry( state, numecs, statenum, JAMSTATE, totaltrans );
+               minprot = firstprot;
+               mindiff = totaltrans;
+
+               if ( checkcom )
+                       {
+                       /* Find first proto which has the same "comstate". */
+                       for ( i = firstprot; i != NIL; i = protnext[i] )
+                               if ( protcomst[i] == comstate )
+                                       {
+                                       minprot = i;
+                                       mindiff = tbldiff( state, minprot,
+                                                       extrct[extptr] );
+                                       break;
+                                       }
+                       }
 
-    else
-       {
-       /* checkcom is true if we should only check "state" against
-        * protos which have the same "comstate" value
-        */
+               else
+                       {
+                       /* Since we've decided that the most common destination
+                        * out of "state" does not occur with a high enough
+                        * frequency, we set the "comstate" to zero, assuring
+                        * that if this state is entered into the proto list,
+                        * it will not be considered a template.
+                        */
+                       comstate = 0;
+
+                       if ( firstprot != NIL )
+                               {
+                               minprot = firstprot;
+                               mindiff = tbldiff( state, minprot,
+                                               extrct[extptr] );
+                               }
+                       }
 
-       checkcom = comfreq * 100 > totaltrans * CHECK_COM_PERCENTAGE;
+               /* We now have the first interesting proto in "minprot".  If
+                * it matches within the tolerances set for the first proto,
+                * we don't want to bother scanning the rest of the proto list
+                * to see if we have any other reasonable matches.
+                */
 
-       minprot = firstprot;
-       mindiff = totaltrans;
+               if ( mindiff * 100 > totaltrans * FIRST_MATCH_DIFF_PERCENTAGE )
+                       {
+                       /* Not a good enough match.  Scan the rest of the
+                        * protos.
+                        */
+                       for ( i = minprot; i != NIL; i = protnext[i] )
+                               {
+                               d = tbldiff( state, i, extrct[1 - extptr] );
+                               if ( d < mindiff )
+                                       {
+                                       extptr = 1 - extptr;
+                                       mindiff = d;
+                                       minprot = i;
+                                       }
+                               }
+                       }
 
-       if ( checkcom )
-           {
-           /* find first proto which has the same "comstate" */
-           for ( i = firstprot; i != NIL; i = protnext[i] )
-               if ( protcomst[i] == comstate )
-                   {
-                   minprot = i;
-                   mindiff = tbldiff( state, minprot, extrct[extptr] );
-                   break;
-                   }
-           }
+               /* Check if the proto we've decided on as our best bet is close
+                * enough to the state we want to match to be usable.
+                */
 
-       else
-           {
-           /* since we've decided that the most common destination out
-            * of "state" does not occur with a high enough frequency,
-            * we set the "comstate" to zero, assuring that if this state
-            * is entered into the proto list, it will not be considered
-            * a template.
-            */
-           comstate = 0;
-
-           if ( firstprot != NIL )
-               {
-               minprot = firstprot;
-               mindiff = tbldiff( state, minprot, extrct[extptr] );
-               }
-           }
+               if ( mindiff * 100 > totaltrans * ACCEPTABLE_DIFF_PERCENTAGE )
+                       {
+                       /* No good.  If the state is homogeneous enough,
+                        * we make a template out of it.  Otherwise, we
+                        * make a proto.
+                        */
 
-       /* we now have the first interesting proto in "minprot".  If
-        * it matches within the tolerances set for the first proto,
-        * we don't want to bother scanning the rest of the proto list
-        * to see if we have any other reasonable matches.
-        */
+                       if ( comfreq * 100 >=
+                            totaltrans * TEMPLATE_SAME_PERCENTAGE )
+                               mktemplate( state, statenum, comstate );
 
-       if ( mindiff * 100 > totaltrans * FIRST_MATCH_DIFF_PERCENTAGE )
-           { /* not a good enough match.  Scan the rest of the protos */
-           for ( i = minprot; i != NIL; i = protnext[i] )
-               {
-               d = tbldiff( state, i, extrct[1 - extptr] );
-               if ( d < mindiff )
-                   {
-                   extptr = 1 - extptr;
-                   mindiff = d;
-                   minprot = i;
-                   }
-               }
-           }
+                       else
+                               {
+                               mkprot( state, statenum, comstate );
+                               mkentry( state, numecs, statenum,
+                                       JAMSTATE, totaltrans );
+                               }
+                       }
 
-       /* check if the proto we've decided on as our best bet is close
-        * enough to the state we want to match to be usable
-        */
+               else
+                       { /* use the proto */
+                       mkentry( extrct[extptr], numecs, statenum,
+                               prottbl[minprot], mindiff );
 
-       if ( mindiff * 100 > totaltrans * ACCEPTABLE_DIFF_PERCENTAGE )
-           {
-           /* no good.  If the state is homogeneous enough, we make a
-            * template out of it.  Otherwise, we make a proto.
-            */
+                       /* If this state was sufficiently different from the
+                        * proto we built it from, make it, too, a proto.
+                        */
 
-           if ( comfreq * 100 >= totaltrans * TEMPLATE_SAME_PERCENTAGE )
-               mktemplate( state, statenum, comstate );
+                       if ( mindiff * 100 >=
+                            totaltrans * NEW_PROTO_DIFF_PERCENTAGE )
+                               mkprot( state, statenum, comstate );
+
+                       /* Since mkprot added a new proto to the proto queue,
+                        * it's possible that "minprot" is no longer on the
+                        * proto queue (if it happened to have been the last
+                        * entry, it would have been bumped off).  If it's
+                        * not there, then the new proto took its physical
+                        * place (though logically the new proto is at the
+                        * beginning of the queue), so in that case the
+                        * following call will do nothing.
+                        */
 
-           else
-               {
-               mkprot( state, statenum, comstate );
-               mkentry( state, numecs, statenum, JAMSTATE, totaltrans );
+                       mv2front( minprot );
+                       }
                }
-           }
-
-       else
-           { /* use the proto */
-           mkentry( extrct[extptr], numecs, statenum,
-                    prottbl[minprot], mindiff );
-
-           /* if this state was sufficiently different from the proto
-            * we built it from, make it, too, a proto
-            */
-
-           if ( mindiff * 100 >= totaltrans * NEW_PROTO_DIFF_PERCENTAGE )
-               mkprot( state, statenum, comstate );
-
-           /* since mkprot added a new proto to the proto queue, it's possible
-            * that "minprot" is no longer on the proto queue (if it happened
-            * to have been the last entry, it would have been bumped off).
-            * If it's not there, then the new proto took its physical place
-            * (though logically the new proto is at the beginning of the
-            * queue), so in that case the following call will do nothing.
-            */
-
-           mv2front( minprot );
-           }
        }
-    }
 
 
 /* cmptmps - compress template table entries
  *
- * synopsis
- *    cmptmps();
- *
- *  template tables are compressed by using the 'template equivalence
- *  classes', which are collections of transition character equivalence
- *  classes which always appear together in templates - really meta-equivalence
- *  classes.  until this point, the tables for templates have been stored
- *  up at the top end of the nxt array; they will now be compressed and have
- *  table entries made for them.
+ * Template tables are compressed by using the 'template equivalence
+ * classes', which are collections of transition character equivalence
+ * classes which always appear together in templates - really meta-equivalence
+ * classes.  until this point, the tables for templates have been stored
+ * up at the top end of the nxt array; they will now be compressed and have
+ * table entries made for them.
  */
 
 void cmptmps()
-
-    {
-    int tmpstorage[CSIZE + 1];
-    register int *tmp = tmpstorage, i, j;
-    int totaltrans, trans;
-
-    peakpairs = numtemps * numecs + tblend;
-
-    if ( usemecs )
        {
-       /* create equivalence classes based on data gathered on template
-        * transitions
-        */
+       int tmpstorage[CSIZE + 1];
+       register int *tmp = tmpstorage, i, j;
+       int totaltrans, trans;
 
-       nummecs = cre8ecs( tecfwd, tecbck, numecs );
-       }
-    
-    else
-       nummecs = numecs;
+       peakpairs = numtemps * numecs + tblend;
 
-    while ( lastdfa + numtemps + 1 >= current_max_dfas )
-       increase_max_dfas();
+       if ( usemecs )
+               {
+               /* Create equivalence classes based on data gathered on
+                * template transitions.
+                */
+               nummecs = cre8ecs( tecfwd, tecbck, numecs );
+               }
 
-    /* loop through each template */
+       else
+               nummecs = numecs;
 
-    for ( i = 1; i <= numtemps; ++i )
-       {
-       totaltrans = 0; /* number of non-jam transitions out of this template */
+       while ( lastdfa + numtemps + 1 >= current_max_dfas )
+               increase_max_dfas();
 
-       for ( j = 1; j <= numecs; ++j )
-           {
-           trans = tnxt[numecs * i + j];
+       /* Loop through each template. */
 
-           if ( usemecs )
+       for ( i = 1; i <= numtemps; ++i )
                {
-               /* the absolute value of tecbck is the meta-equivalence class
-                * of a given equivalence class, as set up by cre8ecs
-                */
-               if ( tecbck[j] > 0 )
-                   {
-                   tmp[tecbck[j]] = trans;
-
-                   if ( trans > 0 )
-                       ++totaltrans;
-                   }
-               }
+               /* Number of non-jam transitions out of this template. */
+               totaltrans = 0;
+
+               for ( j = 1; j <= numecs; ++j )
+                       {
+                       trans = tnxt[numecs * i + j];
+
+                       if ( usemecs )
+                               {
+                               /* The absolute value of tecbck is the
+                                * meta-equivalence class of a given
+                                * equivalence class, as set up by cre8ecs().
+                                */
+                               if ( tecbck[j] > 0 )
+                                       {
+                                       tmp[tecbck[j]] = trans;
+
+                                       if ( trans > 0 )
+                                               ++totaltrans;
+                                       }
+                               }
+
+                       else
+                               {
+                               tmp[j] = trans;
+
+                               if ( trans > 0 )
+                                       ++totaltrans;
+                               }
+                       }
 
-           else
-               {
-               tmp[j] = trans;
+               /* It is assumed (in a rather subtle way) in the skeleton
+                * that if we're using meta-equivalence classes, the def[]
+                * entry for all templates is the jam template, i.e.,
+                * templates never default to other non-jam table entries
+                * (e.g., another template)
+                */
 
-               if ( trans > 0 )
-                   ++totaltrans;
+               /* Leave room for the jam-state after the last real state. */
+               mkentry( tmp, nummecs, lastdfa + i + 1, JAMSTATE, totaltrans );
                }
-           }
-
-       /* it is assumed (in a rather subtle way) in the skeleton that
-        * if we're using meta-equivalence classes, the def[] entry for
-        * all templates is the jam template, i.e., templates never default
-        * to other non-jam table entries (e.g., another template)
-        */
-
-       /* leave room for the jam-state after the last real state */
-       mkentry( tmp, nummecs, lastdfa + i + 1, JAMSTATE, totaltrans );
        }
-    }
 
 
 
 /* expand_nxt_chk - expand the next check arrays */
 
 void expand_nxt_chk()
+       {
+       register int old_max = current_max_xpairs;
 
-    {
-    register int old_max = current_max_xpairs;
-
-    current_max_xpairs += MAX_XPAIRS_INCREMENT;
+       current_max_xpairs += MAX_XPAIRS_INCREMENT;
 
-    ++num_reallocs;
+       ++num_reallocs;
 
-    nxt = reallocate_integer_array( nxt, current_max_xpairs );
-    chk = reallocate_integer_array( chk, current_max_xpairs );
+       nxt = reallocate_integer_array( nxt, current_max_xpairs );
+       chk = reallocate_integer_array( chk, current_max_xpairs );
 
-    zero_out( (char *) (chk + old_max),
-             MAX_XPAIRS_INCREMENT * sizeof( int ) / sizeof( char ) );
-    }
+       zero_out( (char *) (chk + old_max),
+               MAX_XPAIRS_INCREMENT * sizeof( int ) / sizeof( char ) );
+       }
 
 
 /* find_table_space - finds a space in the table for a state to be placed
@@ -334,96 +340,99 @@ void expand_nxt_chk()
 
 int find_table_space( state, numtrans )
 int *state, numtrans;
-    
-    {
-    /* firstfree is the position of the first possible occurrence of two
-     * consecutive unused records in the chk and nxt arrays
-     */
-    register int i;
-    register int *state_ptr, *chk_ptr;
-    register int *ptr_to_last_entry_in_state;
-
-    /* if there are too many out-transitions, put the state at the end of
-     * nxt and chk
-     */
-    if ( numtrans > MAX_XTIONS_FULL_INTERIOR_FIT )
        {
-       /* if table is empty, return the first available spot in chk/nxt,
-        * which should be 1
+       /* Firstfree is the position of the first possible occurrence of two
+        * consecutive unused records in the chk and nxt arrays.
         */
-       if ( tblend < 2 )
-           return ( 1 );
-
-       i = tblend - numecs;    /* start searching for table space near the
-                                * end of chk/nxt arrays
-                                */
-       }
-
-    else
-       i = firstfree;          /* start searching for table space from the
-                                * beginning (skipping only the elements
-                                * which will definitely not hold the new
-                                * state)
-                                */
+       register int i;
+       register int *state_ptr, *chk_ptr;
+       register int *ptr_to_last_entry_in_state;
 
-    while ( 1 )                /* loops until a space is found */
-       {
-       while ( i + numecs >= current_max_xpairs )
-           expand_nxt_chk();
-
-       /* loops until space for end-of-buffer and action number are found */
-       while ( 1 )
-           {
-           if ( chk[i - 1] == 0 )      /* check for action number space */
+       /* If there are too many out-transitions, put the state at the end of
+        * nxt and chk.
+        */
+       if ( numtrans > MAX_XTIONS_FULL_INTERIOR_FIT )
                {
-               if ( chk[i] == 0 )      /* check for end-of-buffer space */
-                   break;
+               /* If table is empty, return the first available spot in
+                * chk/nxt, which should be 1.
+                */
+               if ( tblend < 2 )
+                       return 1;
 
-               else
-                   i += 2;     /* since i != 0, there is no use checking to
-                                * see if (++i) - 1 == 0, because that's the
-                                * same as i == 0, so we skip a space
-                                */
+               /* Start searching for table space near the end of
+                * chk/nxt arrays.
+                */
+               i = tblend - numecs;
                }
 
-           else
-               ++i;
+       else
+               /* Start searching for table space from the beginning
+                * (skipping only the elements which will definitely not
+                * hold the new state).
+                */
+               i = firstfree;
 
-           while ( i + numecs >= current_max_xpairs )
-               expand_nxt_chk();
-           }
+       while ( 1 )     /* loops until a space is found */
+               {
+               while ( i + numecs >= current_max_xpairs )
+                       expand_nxt_chk();
 
-       /* if we started search from the beginning, store the new firstfree for
-        * the next call of find_table_space()
-        */
-       if ( numtrans <= MAX_XTIONS_FULL_INTERIOR_FIT )
-           firstfree = i + 1;
+               /* Loops until space for end-of-buffer and action number
+                * are found.
+                */
+               while ( 1 )
+                       {
+                       /* Check for action number space. */
+                       if ( chk[i - 1] == 0 )
+                               {
+                               /* Check for end-of-buffer space. */
+                               if ( chk[i] == 0 )
+                                       break;
+
+                               else
+                                       /* Since i != 0, there is no use
+                                        * checking to see if (++i) - 1 == 0,
+                                        * because that's the same as i == 0,
+                                        * so we skip a space.
+                                        */
+                                       i += 2;
+                               }
+
+                       else
+                               ++i;
+
+                       while ( i + numecs >= current_max_xpairs )
+                               expand_nxt_chk();
+                       }
 
-       /* check to see if all elements in chk (and therefore nxt) that are
-        * needed for the new state have not yet been taken
-        */
+               /* If we started search from the beginning, store the new
+                * firstfree for the next call of find_table_space().
+                */
+               if ( numtrans <= MAX_XTIONS_FULL_INTERIOR_FIT )
+                       firstfree = i + 1;
 
-       state_ptr = &state[1];
-       ptr_to_last_entry_in_state = &chk[i + numecs + 1];
+               /* Check to see if all elements in chk (and therefore nxt)
+                * that are needed for the new state have not yet been taken.
+                */
 
-       for ( chk_ptr = &chk[i + 1]; chk_ptr != ptr_to_last_entry_in_state;
-             ++chk_ptr )
-           if ( *(state_ptr++) != 0 && *chk_ptr != 0 )
-               break;
+               state_ptr = &state[1];
+               ptr_to_last_entry_in_state = &chk[i + numecs + 1];
 
-       if ( chk_ptr == ptr_to_last_entry_in_state )
-           return ( i );
+               for ( chk_ptr = &chk[i + 1];
+                     chk_ptr != ptr_to_last_entry_in_state; ++chk_ptr )
+                       if ( *(state_ptr++) != 0 && *chk_ptr != 0 )
+                               break;
 
-       else
-           ++i;
+               if ( chk_ptr == ptr_to_last_entry_in_state )
+                       return i;
+
+               else
+               ++i;
+               }
        }
-    }
 
 
 /* inittbl - initialize transition tables
- *
- * synopsis
- *   inittbl();
  *
  * Initializes "firstfree" to be one beyond the end of the table.  Initializes
  * all "chk" entries to be zero.  Note that templates are built in their
@@ -431,73 +440,67 @@ int *state, numtrans;
  * with the non-template entries during table generation.
  */
 void inittbl()
+       {
+       register int i;
 
-    {
-    register int i;
-
-    zero_out( (char *) chk,
-             current_max_xpairs * sizeof( int ) / sizeof( char ) );
+       zero_out( (char *) chk,
+               current_max_xpairs * sizeof( int ) / sizeof( char ) );
 
-    tblend = 0;
-    firstfree = tblend + 1;
-    numtemps = 0;
+       tblend = 0;
+       firstfree = tblend + 1;
+       numtemps = 0;
 
-    if ( usemecs )
-       {
-       /* set up doubly-linked meta-equivalence classes
-        * these are sets of equivalence classes which all have identical
-        * transitions out of TEMPLATES
-        */
+       if ( usemecs )
+               {
+               /* Set up doubly-linked meta-equivalence classes; these
+                * are sets of equivalence classes which all have identical
+                * transitions out of TEMPLATES.
+                */
 
-       tecbck[1] = NIL;
+               tecbck[1] = NIL;
 
-       for ( i = 2; i <= numecs; ++i )
-           {
-           tecbck[i] = i - 1;
-           tecfwd[i - 1] = i;
-           }
+               for ( i = 2; i <= numecs; ++i )
+                       {
+                       tecbck[i] = i - 1;
+                       tecfwd[i - 1] = i;
+                       }
 
-       tecfwd[numecs] = NIL;
+               tecfwd[numecs] = NIL;
+               }
        }
-    }
 
 
-/* mkdeftbl - make the default, "jam" table entries
- *
- * synopsis
- *   mkdeftbl();
- */
+/* mkdeftbl - make the default, "jam" table entries */
 
 void mkdeftbl()
+       {
+       int i;
 
-    {
-    int i;
-
-    jamstate = lastdfa + 1;
+       jamstate = lastdfa + 1;
 
-    ++tblend; /* room for transition on end-of-buffer character */
+       ++tblend; /* room for transition on end-of-buffer character */
 
-    while ( tblend + numecs >= current_max_xpairs )
-       expand_nxt_chk();
+       while ( tblend + numecs >= current_max_xpairs )
+               expand_nxt_chk();
 
-    /* add in default end-of-buffer transition */
-    nxt[tblend] = end_of_buffer_state;
-    chk[tblend] = jamstate;
+       /* Add in default end-of-buffer transition. */
+       nxt[tblend] = end_of_buffer_state;
+       chk[tblend] = jamstate;
 
-    for ( i = 1; i <= numecs; ++i )
-       {
-       nxt[tblend + i] = 0;
-       chk[tblend + i] = jamstate;
-       }
+       for ( i = 1; i <= numecs; ++i )
+               {
+               nxt[tblend + i] = 0;
+               chk[tblend + i] = jamstate;
+               }
 
-    jambase = tblend;
+       jambase = tblend;
 
-    base[jamstate] = jambase;
-    def[jamstate] = 0;
+       base[jamstate] = jambase;
+       def[jamstate] = 0;
 
-    tblend += numecs;
-    ++numtemps;
-    }
+       tblend += numecs;
+       ++numtemps;
+       }
 
 
 /* mkentry - create base/def and nxt/chk entries for transition array
@@ -522,299 +525,273 @@ void mkdeftbl()
 void mkentry( state, numchars, statenum, deflink, totaltrans )
 register int *state;
 int numchars, statenum, deflink, totaltrans;
+       {
+       register int minec, maxec, i, baseaddr;
+       int tblbase, tbllast;
 
-    {
-    register int minec, maxec, i, baseaddr;
-    int tblbase, tbllast;
+       if ( totaltrans == 0 )
+               { /* there are no out-transitions */
+               if ( deflink == JAMSTATE )
+                       base[statenum] = JAMSTATE;
+               else
+                       base[statenum] = 0;
 
-    if ( totaltrans == 0 )
-       { /* there are no out-transitions */
-       if ( deflink == JAMSTATE )
-           base[statenum] = JAMSTATE;
-       else
-           base[statenum] = 0;
+               def[statenum] = deflink;
+               return;
+               }
 
-       def[statenum] = deflink;
-       return;
-       }
+       for ( minec = 1; minec <= numchars; ++minec )
+               {
+               if ( state[minec] != SAME_TRANS )
+                       if ( state[minec] != 0 || deflink != JAMSTATE )
+                               break;
+               }
 
-    for ( minec = 1; minec <= numchars; ++minec )
-       {
-       if ( state[minec] != SAME_TRANS )
-           if ( state[minec] != 0 || deflink != JAMSTATE )
-               break;
-       }
+       if ( totaltrans == 1 )
+               {
+               /* There's only one out-transition.  Save it for later to fill
+                * in holes in the tables.
+                */
+               stack1( statenum, minec, state[minec], deflink );
+               return;
+               }
 
-    if ( totaltrans == 1 )
-       {
-       /* there's only one out-transition.  Save it for later to fill
-        * in holes in the tables.
-        */
-       stack1( statenum, minec, state[minec], deflink );
-       return;
-       }
+       for ( maxec = numchars; maxec > 0; --maxec )
+               {
+               if ( state[maxec] != SAME_TRANS )
+                       if ( state[maxec] != 0 || deflink != JAMSTATE )
+                               break;
+               }
 
-    for ( maxec = numchars; maxec > 0; --maxec )
-       {
-       if ( state[maxec] != SAME_TRANS )
-           if ( state[maxec] != 0 || deflink != JAMSTATE )
-               break;
-       }
+       /* Whether we try to fit the state table in the middle of the table
+        * entries we have already generated, or if we just take the state
+        * table at the end of the nxt/chk tables, we must make sure that we
+        * have a valid base address (i.e., non-negative).  Note that not
+        * only are negative base addresses dangerous at run-time (because
+        * indexing the next array with one and a low-valued character might
+        * generate an array-out-of-bounds error message), but at compile-time
+        * negative base addresses denote TEMPLATES.
+        */
 
-    /* Whether we try to fit the state table in the middle of the table
-     * entries we have already generated, or if we just take the state
-     * table at the end of the nxt/chk tables, we must make sure that we
-     * have a valid base address (i.e., non-negative).  Note that not only are
-     * negative base addresses dangerous at run-time (because indexing the
-     * next array with one and a low-valued character might generate an
-     * array-out-of-bounds error message), but at compile-time negative
-     * base addresses denote TEMPLATES.
-     */
-
-    /* find the first transition of state that we need to worry about. */
-    if ( totaltrans * 100 <= numchars * INTERIOR_FIT_PERCENTAGE )
-       { /* attempt to squeeze it into the middle of the tabls */
-       baseaddr = firstfree;
-
-       while ( baseaddr < minec )
-           {
-           /* using baseaddr would result in a negative base address below
-            * find the next free slot
-            */
-           for ( ++baseaddr; chk[baseaddr] != 0; ++baseaddr )
-               ;
-           }
-
-       while ( baseaddr + maxec - minec + 1 >= current_max_xpairs )
-           expand_nxt_chk();
+       /* Find the first transition of state that we need to worry about. */
+       if ( totaltrans * 100 <= numchars * INTERIOR_FIT_PERCENTAGE )
+               {
+               /* Attempt to squeeze it into the middle of the tables. */
+               baseaddr = firstfree;
 
-       for ( i = minec; i <= maxec; ++i )
-           if ( state[i] != SAME_TRANS )
-               if ( state[i] != 0 || deflink != JAMSTATE )
-                   if ( chk[baseaddr + i - minec] != 0 )
-                       { /* baseaddr unsuitable - find another */
-                       for ( ++baseaddr;
-                             baseaddr < current_max_xpairs &&
-                             chk[baseaddr] != 0;
-                             ++baseaddr )
-                           ;
-
-                       while ( baseaddr + maxec - minec + 1 >=
-                            current_max_xpairs )
-                           expand_nxt_chk();
-
-                       /* reset the loop counter so we'll start all
-                        * over again next time it's incremented
+               while ( baseaddr < minec )
+                       {
+                       /* Using baseaddr would result in a negative base
+                        * address below; find the next free slot.
                         */
-
-                       i = minec - 1;
+                       for ( ++baseaddr; chk[baseaddr] != 0; ++baseaddr )
+                               ;
                        }
-       }
 
-    else
-       {
-       /* ensure that the base address we eventually generate is
-        * non-negative
-        */
-       baseaddr = max( tblend + 1, minec );
-       }
-
-    tblbase = baseaddr - minec;
-    tbllast = tblbase + maxec;
-
-    while ( tbllast + 1 >= current_max_xpairs )
-       expand_nxt_chk();
+               while ( baseaddr + maxec - minec + 1 >= current_max_xpairs )
+                       expand_nxt_chk();
+
+               for ( i = minec; i <= maxec; ++i )
+                       if ( state[i] != SAME_TRANS &&
+                            (state[i] != 0 || deflink != JAMSTATE) &&
+                            chk[baseaddr + i - minec] != 0 )
+                               { /* baseaddr unsuitable - find another */
+                               for ( ++baseaddr;
+                                     baseaddr < current_max_xpairs &&
+                                     chk[baseaddr] != 0; ++baseaddr )
+                                       ;
+
+                               while ( baseaddr + maxec - minec + 1 >=
+                                       current_max_xpairs )
+                                       expand_nxt_chk();
+
+                               /* Reset the loop counter so we'll start all
+                                * over again next time it's incremented.
+                                */
 
-    base[statenum] = tblbase;
-    def[statenum] = deflink;
+                               i = minec - 1;
+                               }
+               }
 
-    for ( i = minec; i <= maxec; ++i )
-       if ( state[i] != SAME_TRANS )
-           if ( state[i] != 0 || deflink != JAMSTATE )
+       else
                {
-               nxt[tblbase + i] = state[i];
-               chk[tblbase + i] = statenum;
+               /* Ensure that the base address we eventually generate is
+                * non-negative.
+                */
+               baseaddr = max( tblend + 1, minec );
                }
 
-    if ( baseaddr == firstfree )
-       /* find next free slot in tables */
-       for ( ++firstfree; chk[firstfree] != 0; ++firstfree )
-           ;
+       tblbase = baseaddr - minec;
+       tbllast = tblbase + maxec;
 
-    tblend = max( tblend, tbllast );
-    }
+       while ( tbllast + 1 >= current_max_xpairs )
+               expand_nxt_chk();
+
+       base[statenum] = tblbase;
+       def[statenum] = deflink;
+
+       for ( i = minec; i <= maxec; ++i )
+               if ( state[i] != SAME_TRANS )
+                       if ( state[i] != 0 || deflink != JAMSTATE )
+                               {
+                               nxt[tblbase + i] = state[i];
+                               chk[tblbase + i] = statenum;
+                               }
+
+       if ( baseaddr == firstfree )
+               /* Find next free slot in tables. */
+               for ( ++firstfree; chk[firstfree] != 0; ++firstfree )
+                       ;
+
+       tblend = max( tblend, tbllast );
+       }
 
 
 /* mk1tbl - create table entries for a state (or state fragment) which
  *            has only one out-transition
- *
- * synopsis
- *   int state, sym, onenxt, onedef;
- *   mk1tbl( state, sym, onenxt, onedef );
  */
 
 void mk1tbl( state, sym, onenxt, onedef )
 int state, sym, onenxt, onedef;
+       {
+       if ( firstfree < sym )
+               firstfree = sym;
 
-    {
-    if ( firstfree < sym )
-       firstfree = sym;
-
-    while ( chk[firstfree] != 0 )
-       if ( ++firstfree >= current_max_xpairs )
-           expand_nxt_chk();
+       while ( chk[firstfree] != 0 )
+               if ( ++firstfree >= current_max_xpairs )
+                       expand_nxt_chk();
 
-    base[state] = firstfree - sym;
-    def[state] = onedef;
-    chk[firstfree] = state;
-    nxt[firstfree] = onenxt;
+       base[state] = firstfree - sym;
+       def[state] = onedef;
+       chk[firstfree] = state;
+       nxt[firstfree] = onenxt;
 
-    if ( firstfree > tblend )
-       {
-       tblend = firstfree++;
+       if ( firstfree > tblend )
+               {
+               tblend = firstfree++;
 
-       if ( firstfree >= current_max_xpairs )
-           expand_nxt_chk();
+               if ( firstfree >= current_max_xpairs )
+                       expand_nxt_chk();
+               }
        }
-    }
 
 
-/* mkprot - create new proto entry
- *
- * synopsis
- *   int state[], statenum, comstate;
- *   mkprot( state, statenum, comstate );
- */
+/* mkprot - create new proto entry */
 
 void mkprot( state, statenum, comstate )
 int state[], statenum, comstate;
-
-    {
-    int i, slot, tblbase;
-
-    if ( ++numprots >= MSP || numecs * numprots >= PROT_SAVE_SIZE )
        {
-       /* gotta make room for the new proto by dropping last entry in
-        * the queue
-        */
-       slot = lastprot;
-       lastprot = protprev[lastprot];
-       protnext[lastprot] = NIL;
-       }
+       int i, slot, tblbase;
 
-    else
-       slot = numprots;
+       if ( ++numprots >= MSP || numecs * numprots >= PROT_SAVE_SIZE )
+               {
+               /* Gotta make room for the new proto by dropping last entry in
+                * the queue.
+                */
+               slot = lastprot;
+               lastprot = protprev[lastprot];
+               protnext[lastprot] = NIL;
+               }
 
-    protnext[slot] = firstprot;
+       else
+               slot = numprots;
 
-    if ( firstprot != NIL )
-       protprev[firstprot] = slot;
+       protnext[slot] = firstprot;
 
-    firstprot = slot;
-    prottbl[slot] = statenum;
-    protcomst[slot] = comstate;
+       if ( firstprot != NIL )
+               protprev[firstprot] = slot;
 
-    /* copy state into save area so it can be compared with rapidly */
-    tblbase = numecs * (slot - 1);
+       firstprot = slot;
+       prottbl[slot] = statenum;
+       protcomst[slot] = comstate;
 
-    for ( i = 1; i <= numecs; ++i )
-       protsave[tblbase + i] = state[i];
-    }
+       /* Copy state into save area so it can be compared with rapidly. */
+       tblbase = numecs * (slot - 1);
+
+       for ( i = 1; i <= numecs; ++i )
+               protsave[tblbase + i] = state[i];
+       }
 
 
 /* mktemplate - create a template entry based on a state, and connect the state
  *              to it
- *
- * synopsis
- *   int state[], statenum, comstate, totaltrans;
- *   mktemplate( state, statenum, comstate, totaltrans );
  */
 
 void mktemplate( state, statenum, comstate )
 int state[], statenum, comstate;
+       {
+       int i, numdiff, tmpbase, tmp[CSIZE + 1];
+       Char transset[CSIZE + 1];
+       int tsptr;
 
-    {
-    int i, numdiff, tmpbase, tmp[CSIZE + 1];
-    Char transset[CSIZE + 1];
-    int tsptr;
-
-    ++numtemps;
+       ++numtemps;
 
-    tsptr = 0;
+       tsptr = 0;
 
-    /* calculate where we will temporarily store the transition table
-     * of the template in the tnxt[] array.  The final transition table
-     * gets created by cmptmps()
-     */
+       /* Calculate where we will temporarily store the transition table
+        * of the template in the tnxt[] array.  The final transition table
+        * gets created by cmptmps().
+        */
 
-    tmpbase = numtemps * numecs;
+       tmpbase = numtemps * numecs;
 
-    if ( tmpbase + numecs >= current_max_template_xpairs )
-       {
-       current_max_template_xpairs += MAX_TEMPLATE_XPAIRS_INCREMENT;
+       if ( tmpbase + numecs >= current_max_template_xpairs )
+               {
+               current_max_template_xpairs += MAX_TEMPLATE_XPAIRS_INCREMENT;
 
-       ++num_reallocs;
+               ++num_reallocs;
 
-       tnxt = reallocate_integer_array( tnxt, current_max_template_xpairs );
-       }
+               tnxt = reallocate_integer_array( tnxt,
+                       current_max_template_xpairs );
+               }
 
-    for ( i = 1; i <= numecs; ++i )
-       if ( state[i] == 0 )
-           tnxt[tmpbase + i] = 0;
-       else
-           {
-           transset[tsptr++] = i;
-           tnxt[tmpbase + i] = comstate;
-           }
+       for ( i = 1; i <= numecs; ++i )
+               if ( state[i] == 0 )
+                       tnxt[tmpbase + i] = 0;
+               else
+                       {
+                       transset[tsptr++] = i;
+                       tnxt[tmpbase + i] = comstate;
+                       }
 
-    if ( usemecs )
-       mkeccl( transset, tsptr, tecfwd, tecbck, numecs, 0 );
+       if ( usemecs )
+               mkeccl( transset, tsptr, tecfwd, tecbck, numecs, 0 );
 
-    mkprot( tnxt + tmpbase, -numtemps, comstate );
+       mkprot( tnxt + tmpbase, -numtemps, comstate );
 
-    /* we rely on the fact that mkprot adds things to the beginning
-     * of the proto queue
-     */
+       /* We rely on the fact that mkprot adds things to the beginning
+        * of the proto queue.
+        */
 
-    numdiff = tbldiff( state, firstprot, tmp );
-    mkentry( tmp, numecs, statenum, -numtemps, numdiff );
-    }
+       numdiff = tbldiff( state, firstprot, tmp );
+       mkentry( tmp, numecs, statenum, -numtemps, numdiff );
+       }
 
 
-/* mv2front - move proto queue element to front of queue
- *
- * synopsis
- *   int qelm;
- *   mv2front( qelm );
- */
+/* mv2front - move proto queue element to front of queue */
 
 void mv2front( qelm )
 int qelm;
-
-    {
-    if ( firstprot != qelm )
        {
-       if ( qelm == lastprot )
-           lastprot = protprev[lastprot];
+       if ( firstprot != qelm )
+               {
+               if ( qelm == lastprot )
+                       lastprot = protprev[lastprot];
 
-       protnext[protprev[qelm]] = protnext[qelm];
+               protnext[protprev[qelm]] = protnext[qelm];
 
-       if ( protnext[qelm] != NIL )
-           protprev[protnext[qelm]] = protprev[qelm];
+               if ( protnext[qelm] != NIL )
+                       protprev[protnext[qelm]] = protprev[qelm];
 
-       protprev[qelm] = NIL;
-       protnext[qelm] = firstprot;
-       protprev[firstprot] = qelm;
-       firstprot = qelm;
+               protprev[qelm] = NIL;
+               protnext[qelm] = firstprot;
+               protprev[firstprot] = qelm;
+               firstprot = qelm;
+               }
        }
-    }
 
 
 /* place_state - place a state into full speed transition table
- *
- * synopsis
- *     int *state, statenum, transnum;
- *     place_state( state, statenum, transnum );
  *
  * State is the statenum'th state.  It is indexed by equivalence class and
  * gives the number of the state to enter for a given equivalence class.
@@ -823,44 +800,42 @@ int qelm;
 
 void place_state( state, statenum, transnum )
 int *state, statenum, transnum;
+       {
+       register int i;
+       register int *state_ptr;
+       int position = find_table_space( state, transnum );
 
-    {
-    register int i;
-    register int *state_ptr;
-    int position = find_table_space( state, transnum );
-
-    /* base is the table of start positions */
-    base[statenum] = position;
+       /* "base" is the table of start positions. */
+       base[statenum] = position;
 
-    /* put in action number marker; this non-zero number makes sure that
-     * find_table_space() knows that this position in chk/nxt is taken
-     * and should not be used for another accepting number in another state
-     */
-    chk[position - 1] = 1;
+       /* Put in action number marker; this non-zero number makes sure that
+        * find_table_space() knows that this position in chk/nxt is taken
+        * and should not be used for another accepting number in another
+        * state.
+        */
+       chk[position - 1] = 1;
 
-    /* put in end-of-buffer marker; this is for the same purposes as above */
-    chk[position] = 1;
+       /* Put in end-of-buffer marker; this is for the same purposes as
+        * above.
+        */
+       chk[position] = 1;
 
-    /* place the state into chk and nxt */
-    state_ptr = &state[1];
+       /* Place the state into chk and nxt. */
+       state_ptr = &state[1];
 
-    for ( i = 1; i <= numecs; ++i, ++state_ptr )
-       if ( *state_ptr != 0 )
-           {
-           chk[position + i] = i;
-           nxt[position + i] = *state_ptr;
-           }
+       for ( i = 1; i <= numecs; ++i, ++state_ptr )
+               if ( *state_ptr != 0 )
+                       {
+                       chk[position + i] = i;
+                       nxt[position + i] = *state_ptr;
+                       }
 
-    if ( position + numecs > tblend )
-       tblend = position + numecs;
-    }
+       if ( position + numecs > tblend )
+               tblend = position + numecs;
+       }
 
 
 /* stack1 - save states with only one out-transition to be processed later
- *
- * synopsis
- *   int statenum, sym, nextstate, deflink;
- *   stack1( statenum, sym, nextstate, deflink );
  *
  * if there's room for another state on the "one-transition" stack, the
  * state is pushed onto it, to be processed later by mk1tbl.  If there's
@@ -869,34 +844,29 @@ int *state, statenum, transnum;
 
 void stack1( statenum, sym, nextstate, deflink )
 int statenum, sym, nextstate, deflink;
-
-    {
-    if ( onesp >= ONE_STACK_SIZE - 1 )
-       mk1tbl( statenum, sym, nextstate, deflink );
-
-    else
        {
-       ++onesp;
-       onestate[onesp] = statenum;
-       onesym[onesp] = sym;
-       onenext[onesp] = nextstate;
-       onedef[onesp] = deflink;
+       if ( onesp >= ONE_STACK_SIZE - 1 )
+               mk1tbl( statenum, sym, nextstate, deflink );
+
+       else
+               {
+               ++onesp;
+               onestate[onesp] = statenum;
+               onesym[onesp] = sym;
+               onenext[onesp] = nextstate;
+               onedef[onesp] = deflink;
+               }
        }
-    }
 
 
 /* tbldiff - compute differences between two state tables
- *
- * synopsis
- *   int state[], pr, ext[];
- *   int tbldiff, numdifferences;
- *   numdifferences = tbldiff( state, pr, ext )
  *
  * "state" is the state array which is to be extracted from the pr'th
  * proto.  "pr" is both the number of the proto we are extracting from
  * and an index into the save area where we can find the proto's complete
  * state table.  Each entry in "state" which differs from the corresponding
  * entry of "pr" will appear in "ext".
+ *
  * Entries which are the same in both "state" and "pr" will be marked
  * as transitions to "SAME_TRANS" in "ext".  The total number of differences
  * between "state" and "pr" is returned as function value.  Note that this
@@ -905,23 +875,22 @@ int statenum, sym, nextstate, deflink;
 
 int tbldiff( state, pr, ext )
 int state[], pr, ext[];
+       {
+       register int i, *sp = state, *ep = ext, *protp;
+       register int numdiff = 0;
 
-    {
-    register int i, *sp = state, *ep = ext, *protp;
-    register int numdiff = 0;
+       protp = &protsave[numecs * (pr - 1)];
 
-    protp = &protsave[numecs * (pr - 1)];
+       for ( i = numecs; i > 0; --i )
+               {
+               if ( *++protp == *++sp )
+                       *++ep = SAME_TRANS;
+               else
+                       {
+                       *++ep = *sp;
+                       ++numdiff;
+                       }
+               }
 
-    for ( i = numecs; i > 0; --i )
-       {
-       if ( *++protp == *++sp )
-           *++ep = SAME_TRANS;
-       else
-           {
-           *++ep = *sp;
-           ++numdiff;
-           }
+       return numdiff;
        }
-
-    return ( numdiff );
-    }
diff --git a/yylex.c b/yylex.c
index a4a3d4776e6a54612cd6a9eb4b8e01b1ae3fe630..6b90652b18ef362b50b3e9571171bf429d166748 100644 (file)
--- a/yylex.c
+++ b/yylex.c
@@ -42,175 +42,173 @@ static char rcsid[] =
 #endif
 
 
-/* yylex - scan for a regular expression token
- *
- * synopsis
- *
- *   token = yylex();
- *
- *     token - return token found
- */
+/* yylex - scan for a regular expression token */
 
 int yylex()
-
-    {
-    int toktype;
-    static int beglin = false;
-
-    if ( eofseen )
-       toktype = EOF;
-    else
-       toktype = flexscan();
-
-    if ( toktype == EOF || toktype == 0 )
        {
-       eofseen = 1;
-
-       if ( sectnum == 1 )
-           {
-           synerr( "premature EOF" );
-           sectnum = 2;
-           toktype = SECTEND;
-           }
-
-       else if ( sectnum == 2 )
-           {
-           sectnum = 3;
-           toktype = 0;
-           }
+       int toktype;
+       static int beglin = false;
 
+       if ( eofseen )
+               toktype = EOF;
        else
-           toktype = 0;
-       }
-
-    if ( trace )
-       {
-       if ( beglin )
-           {
-           fprintf( stderr, "%d\t", num_rules + 1 );
-           beglin = 0;
-           }
-
-       switch ( toktype )
-           {
-           case '<':
-           case '>':
-           case '^':
-           case '$':
-           case '"':
-           case '[':
-           case ']':
-           case '{':
-           case '}':
-           case '|':
-           case '(':
-           case ')':
-           case '-':
-           case '/':
-           case '\\':
-           case '?':
-           case '.':
-           case '*':
-           case '+':
-           case ',':
-               (void) putc( toktype, stderr );
-               break;
-
-           case '\n':
-               (void) putc( '\n', stderr );
-
-               if ( sectnum == 2 )
-                   beglin = 1;
-
-               break;
-
-           case SCDECL:
-               fputs( "%s", stderr );
-               break;
-
-           case XSCDECL:
-               fputs( "%x", stderr );
-               break;
-
-           case WHITESPACE:
-               (void) putc( ' ', stderr );
-               break;
-
-           case SECTEND:
-               fputs( "%%\n", stderr );
-
-               /* we set beglin to be true so we'll start
-                * writing out numbers as we echo rules.  flexscan() has
-                * already assigned sectnum
-                */
-
-               if ( sectnum == 2 )
-                   beglin = 1;
-
-               break;
-
-           case NAME:
-               fprintf( stderr, "'%s'", nmstr );
-               break;
-
-           case CHAR:
-               switch ( yylval )
-                   {
-                   case '<':
-                   case '>':
-                   case '^':
-                   case '$':
-                   case '"':
-                   case '[':
-                   case ']':
-                   case '{':
-                   case '}':
-                   case '|':
-                   case '(':
-                   case ')':
-                   case '-':
-                   case '/':
-                   case '\\':
-                   case '?':
-                   case '.':
-                   case '*':
-                   case '+':
-                   case ',':
-                       fprintf( stderr, "\\%c", yylval );
-                       break;
-
-                   default:
-                       if ( ! isascii( yylval ) || ! isprint( yylval ) )
-                           fprintf( stderr, "\\%.3o", (unsigned int) yylval );
-                       else
-                           (void) putc( yylval, stderr );
-                       break;
-                   }
-                       
-               break;
-
-           case NUMBER:
-               fprintf( stderr, "%d", yylval );
-               break;
-
-           case PREVCCL:
-               fprintf( stderr, "[%d]", yylval );
-               break;
-
-           case EOF_OP:
-               fprintf( stderr, "<<EOF>>" );
-               break;
-
-           case 0:
-               fprintf( stderr, "End Marker" );
-               break;
-
-           default:
-               fprintf( stderr, "*Something Weird* - tok: %d val: %d\n",
-                        toktype, yylval );
-               break;
-           }
+               toktype = flexscan();
+
+       if ( toktype == EOF || toktype == 0 )
+               {
+               eofseen = 1;
+
+               if ( sectnum == 1 )
+                       {
+                       synerr( "premature EOF" );
+                       sectnum = 2;
+                       toktype = SECTEND;
+                       }
+
+               else if ( sectnum == 2 )
+                       {
+                       sectnum = 3;
+                       toktype = 0;
+                       }
+
+               else
+                       toktype = 0;
+               }
+
+       if ( trace )
+               {
+               if ( beglin )
+                       {
+                       fprintf( stderr, "%d\t", num_rules + 1 );
+                       beglin = 0;
+                       }
+
+               switch ( toktype )
+                       {
+                       case '<':
+                       case '>':
+                       case '^':
+                       case '$':
+                       case '"':
+                       case '[':
+                       case ']':
+                       case '{':
+                       case '}':
+                       case '|':
+                       case '(':
+                       case ')':
+                       case '-':
+                       case '/':
+                       case '\\':
+                       case '?':
+                       case '.':
+                       case '*':
+                       case '+':
+                       case ',':
+                               (void) putc( toktype, stderr );
+                               break;
+
+                       case '\n':
+                               (void) putc( '\n', stderr );
+
+                               if ( sectnum == 2 )
+                               beglin = 1;
+
+                               break;
+
+                       case SCDECL:
+                               fputs( "%s", stderr );
+                               break;
+
+                       case XSCDECL:
+                               fputs( "%x", stderr );
+                               break;
+
+                       case WHITESPACE:
+                               (void) putc( ' ', stderr );
+                               break;
+
+                       case SECTEND:
+                               fputs( "%%\n", stderr );
+
+                               /* We set beglin to be true so we'll start
+                                * writing out numbers as we echo rules.
+                                * flexscan() has already assigned sectnum.
+                                */
+
+                               if ( sectnum == 2 )
+                               beglin = 1;
+
+                               break;
+
+                       case NAME:
+                               fprintf( stderr, "'%s'", nmstr );
+                               break;
+
+                       case CHAR:
+                               switch ( yylval )
+                                       {
+                                       case '<':
+                                       case '>':
+                                       case '^':
+                                       case '$':
+                                       case '"':
+                                       case '[':
+                                       case ']':
+                                       case '{':
+                                       case '}':
+                                       case '|':
+                                       case '(':
+                                       case ')':
+                                       case '-':
+                                       case '/':
+                                       case '\\':
+                                       case '?':
+                                       case '.':
+                                       case '*':
+                                       case '+':
+                                       case ',':
+                                               fprintf( stderr, "\\%c",
+                                                       yylval );
+                                               break;
+
+                                       default:
+                                               if ( ! isascii( yylval ) ||
+                                                    ! isprint( yylval ) )
+                                                       fprintf( stderr,
+                                                               "\\%.3o",
+                                                       (unsigned int) yylval );
+                                               else
+                                                       (void) putc( yylval,
+                                                               stderr );
+                                       break;
+                                       }
+
+                               break;
+
+                       case NUMBER:
+                               fprintf( stderr, "%d", yylval );
+                               break;
+
+                       case PREVCCL:
+                               fprintf( stderr, "[%d]", yylval );
+                               break;
+
+                       case EOF_OP:
+                               fprintf( stderr, "<<EOF>>" );
+                               break;
+
+                       case 0:
+                               fprintf( stderr, "End Marker" );
+                               break;
+
+                       default:
+                               fprintf( stderr,
+                                       "*Something Weird* - tok: %d val: %d\n",
+                                       toktype, yylval );
+                               break;
+                       }
+               }
+
+       return toktype;
        }
-           
-    return ( toktype );
-    }