Logo Search packages:      
Sourcecode: jasmin-sable version File versions  Download package

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

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 478 of file lr_parser.java.

References java_cup::runtime::lr_parser::reduce_tab.

Referenced by java_cup::runtime::lr_parser::debug_parse(), java_cup::runtime::lr_parser::parse(), java_cup::runtime::lr_parser::parse_lookahead(), and java_cup::runtime::lr_parser::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