01: package java_cup;
02:
03: /** A specialized version of a production used when we split an existing
04: * production in order to remove an embedded action. Here we keep a bit
05: * of extra bookkeeping so that we know where we came from.
06: * @version last updated: 11/25/95
07: * @author Scott Hudson
08: */
09:
10: public class action_production extends production {
11:
12: /** Constructor.
13: * @param base the production we are being factored out of.
14: * @param lhs_sym the LHS symbol for this production.
15: * @param rhs_parts array of production parts for the RHS.
16: * @param rhs_len how much of the rhs_parts array is valid.
17: * @param action_str the trailing reduce action for this production.
18: * @param indexOfIntermediateResult the index of the result of the previous intermediate action on the stack relative to top, -1 if no previous action
19: */
20: public action_production(production base, non_terminal lhs_sym,
21: production_part rhs_parts[], int rhs_len,
22: String action_str, int indexOfIntermediateResult)
23: throws internal_error {
24: super (lhs_sym, rhs_parts, rhs_len, action_str);
25: _base_production = base;
26: this .indexOfIntermediateResult = indexOfIntermediateResult;
27: }
28:
29: private int indexOfIntermediateResult;
30:
31: /**
32: * @return the index of the result of the previous intermediate action on the stack relative to top, -1 if no previous action
33: */
34: public int getIndexOfIntermediateResult() {
35: return indexOfIntermediateResult;
36: }
37:
38: /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
39:
40: /** The production we were taken out of. */
41: protected production _base_production;
42:
43: /** The production we were taken out of. */
44: public production base_production() {
45: return _base_production;
46: }
47: }
|