Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 package java_cup; 2 3 11 public class symbol_part extends production_part { 12 13 14 15 16 17 21 public symbol_part(symbol sym, String lab) throws internal_error 22 { 23 super(lab); 24 25 if (sym == null) 26 throw new internal_error( 27 "Attempt to construct a symbol_part with a null symbol"); 28 _the_symbol = sym; 29 } 30 31 32 33 36 public symbol_part(symbol sym) throws internal_error 37 { 38 this(sym,null); 39 } 40 41 42 43 44 45 46 protected symbol _the_symbol; 47 48 49 public symbol the_symbol() {return _the_symbol;} 50 51 52 53 54 55 56 public boolean is_action() { return false; } 57 58 59 60 61 public boolean equals(symbol_part other) 62 { 63 return other != null && super.equals(other) && 64 the_symbol().equals(other.the_symbol()); 65 } 66 67 68 69 70 public boolean equals(Object other) 71 { 72 if (!(other instanceof symbol_part)) 73 return false; 74 else 75 return equals((symbol_part)other); 76 } 77 78 79 80 81 public int hashCode() 82 { 83 return super.hashCode() ^ 84 (the_symbol()==null ? 0 : the_symbol().hashCode()); 85 } 86 87 88 89 90 public String toString() 91 { 92 if (the_symbol() != null) 93 return super.toString() + the_symbol(); 94 else 95 return super.toString() + "$$MISSING-SYMBOL$$"; 96 } 97 98 99 100 } 101
| Popular Tags
|