KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > java_cup > internal > nonassoc_action


1
2 package com.sun.java_cup.internal;
3
4 /** This class represents a shift/reduce nonassociative error within the
5  * parse table. If action_table element is assign to type
6  * nonassoc_action, it cannot be changed, and signifies that there
7  * is a conflict between shifting and reducing a production and a
8  * terminal that shouldn't be next to each other.
9  *
10  * @version last updated: 7/2/96
11  * @author Frank Flannery
12  */

13 public class nonassoc_action extends parse_action {
14  
15   /*-----------------------------------------------------------*/
16   /*--- Constructor(s) ----------------------------------------*/
17   /*-----------------------------------------------------------*/
18
19   /** Simple constructor.
20    */

21   public nonassoc_action() throws internal_error
22     {
23     /* don't need to set anything, since it signifies error */
24     }
25
26     /*-----------------------------------------------------------*/
27   /*--- General Methods ---------------------------------------*/
28   /*-----------------------------------------------------------*/
29
30   /** Quick access to type of action. */
31   public int kind() {return NONASSOC;}
32
33   /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
34
35   /** Equality test. */
36   public boolean equals(parse_action other)
37     {
38       return other != null && other.kind() == NONASSOC;
39     }
40
41   /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
42
43   /** Generic equality test. */
44   public boolean equals(Object JavaDoc other)
45     {
46       if (other instanceof parse_action)
47     return equals((parse_action)other);
48       else
49        return false;
50     }
51
52   /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
53
54   /** Compute a hash code. */
55   public int hashCode()
56     {
57       /* all objects of this class hash together */
58       return 0xCafe321;
59     }
60
61
62
63   /** Convert to string. */
64   public String JavaDoc toString()
65     {
66       return "NONASSOC";
67     }
68
69   /*-----------------------------------------------------------*/
70
71 }
72
Popular Tags