01: package java_cup;
02:
03: /** This class represents a shift/reduce nonassociative error within the
04: * parse table. If action_table element is assign to type
05: * nonassoc_action, it cannot be changed, and signifies that there
06: * is a conflict between shifting and reducing a production and a
07: * terminal that shouldn't be next to each other.
08: *
09: * @version last updated: 7/2/96
10: * @author Frank Flannery
11: */
12: public class nonassoc_action extends parse_action {
13:
14: /*-----------------------------------------------------------*/
15: /*--- Constructor(s) ----------------------------------------*/
16: /*-----------------------------------------------------------*/
17:
18: /** Simple constructor.
19: */
20: public nonassoc_action() throws internal_error {
21: /* don't need to set anything, since it signifies error */
22: }
23:
24: /*-----------------------------------------------------------*/
25: /*--- General Methods ---------------------------------------*/
26: /*-----------------------------------------------------------*/
27:
28: /** Quick access to type of action. */
29: public int kind() {
30: return NONASSOC;
31: }
32:
33: /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
34:
35: /** Equality test. */
36: public boolean equals(parse_action other) {
37: return other != null && other.kind() == NONASSOC;
38: }
39:
40: /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
41:
42: /** Generic equality test. */
43: public boolean equals(Object other) {
44: if (other instanceof parse_action)
45: return equals((parse_action) other);
46: else
47: return false;
48: }
49:
50: /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
51:
52: /** Compute a hash code. */
53: public int hashCode() {
54: /* all objects of this class hash together */
55: return 0xCafe321;
56: }
57:
58: /** Convert to string. */
59: public String toString() {
60: return "NONASSOC";
61: }
62:
63: /*-----------------------------------------------------------*/
64:
65: }
|