1 2 package java_cup; 3 4 /** This class represents one row (corresponding to one machine state) of the 5 * reduce-goto parse table. 6 */ 7 public class parse_reduce_row { 8 /*-----------------------------------------------------------*/ 9 /*--- Constructor(s) ----------------------------------------*/ 10 /*-----------------------------------------------------------*/ 11 12 /** Simple constructor. Note: this should not be used until the number 13 * of terminals in the grammar has been established. 14 */ parse_reduce_row()15 public parse_reduce_row() 16 { 17 /* make sure the size is set */ 18 if (_size <= 0 ) _size = non_terminal.number(); 19 20 /* allocate the array */ 21 under_non_term = new lalr_state[size()]; 22 } 23 24 /*-----------------------------------------------------------*/ 25 /*--- (Access to) Static (Class) Variables ------------------*/ 26 /*-----------------------------------------------------------*/ 27 28 /** Number of columns (non terminals) in every row. */ 29 protected static int _size = 0; 30 31 /** Number of columns (non terminals) in every row. */ size()32 public static int size() {return _size;} 33 34 /*-----------------------------------------------------------*/ 35 /*--- (Access to) Instance Variables ------------------------*/ 36 /*-----------------------------------------------------------*/ 37 38 /** Actual entries for the row. */ 39 public lalr_state under_non_term[]; 40 }; 41 42