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