01: package java_cup;
02:
03: /** This class represents one row (corresponding to one machine state) of the
04: * reduce-goto parse table.
05: */
06: public class parse_reduce_row {
07: /*-----------------------------------------------------------*/
08: /*--- Constructor(s) ----------------------------------------*/
09: /*-----------------------------------------------------------*/
10:
11: /** Simple constructor. Note: this should not be used until the number
12: * of terminals in the grammar has been established.
13: */
14: public parse_reduce_row() {
15: /* make sure the size is set */
16: if (_size <= 0)
17: _size = non_terminal.number();
18:
19: /* allocate the array */
20: under_non_term = new lalr_state[size()];
21: }
22:
23: /*-----------------------------------------------------------*/
24: /*--- (Access to) Static (Class) Variables ------------------*/
25: /*-----------------------------------------------------------*/
26:
27: /** Number of columns (non terminals) in every row. */
28: protected static int _size = 0;
29:
30: /** Number of columns (non terminals) in every row. */
31: public static int size() {
32: return _size;
33: }
34:
35: //Hm Added clear to clear all static fields
36: public static void clear() {
37: _size = 0;
38: }
39:
40: /*-----------------------------------------------------------*/
41: /*--- (Access to) Instance Variables ------------------------*/
42: /*-----------------------------------------------------------*/
43:
44: /** Actual entries for the row. */
45: public lalr_state under_non_term[];
46: }
|