Logo Search packages:      
Sourcecode: jflex version File versions

final short java_cup::runtime::lr_parser::get_reduce ( int  state,
int  sym 
) [inline, protected]

Fetch a state from the reduce-goto table. The table is broken up into rows, one per state (rows are indexed directly by state number). Within each row, a list of index, value pairs are given (as sequential entries in the table), and the list is terminated by a default entry (denoted with a Symbol index of -1). To find the proper entry in a row we do a linear search.

state the state index of the entry being accessed.
sym the Symbol index of the entry being accessed.

Definition at line 479 of file lr_parser.java.

References reduce_tab.

Referenced by debug_parse(), parse(), parse_lookahead(), and try_parse_ahead().

      short tag;
      short[] row = reduce_tab[state];

      /* if we have a null row we go with the default */
      if (row == null)
        return -1;

      for (int probe = 0; probe < row.length; probe++)
        /* is this entry labeled with our Symbol or the default? */
        tag = row[probe++];
        if (tag == sym || tag == -1)
            /* return the next entry */
            return row[probe];
      /* if we run off the end we return the default (error == -1) */
      return -1;

Generated by  Doxygen 1.6.0   Back to index