1 2 3 package org.sablecc.sablecc.syntax3.node; 4 5 import org.sablecc.sablecc.syntax3.analysis.*; 6 7 @SuppressWarnings ("nls") 8 public final class ASpecification extends PSpecification 9 { 10 private PHeader _header_; 11 private PLexer _lexer_; 12 13 public ASpecification() 14 { 15 } 17 18 public ASpecification( 19 @SuppressWarnings ("hiding") PHeader _header_, 20 @SuppressWarnings ("hiding") PLexer _lexer_) 21 { 22 setHeader(_header_); 24 25 setLexer(_lexer_); 26 27 } 28 29 @Override 30 public Object clone() 31 { 32 return new ASpecification( 33 cloneNode(this._header_), 34 cloneNode(this._lexer_)); 35 } 36 37 public void apply(Switch sw) 38 { 39 ((Analysis) sw).caseASpecification(this); 40 } 41 42 public PHeader getHeader() 43 { 44 return this._header_; 45 } 46 47 public void setHeader(PHeader node) 48 { 49 if(this._header_ != null) 50 { 51 this._header_.parent(null); 52 } 53 54 if(node != null) 55 { 56 if(node.parent() != null) 57 { 58 node.parent().removeChild(node); 59 } 60 61 node.parent(this); 62 } 63 64 this._header_ = node; 65 } 66 67 public PLexer getLexer() 68 { 69 return this._lexer_; 70 } 71 72 public void setLexer(PLexer node) 73 { 74 if(this._lexer_ != null) 75 { 76 this._lexer_.parent(null); 77 } 78 79 if(node != null) 80 { 81 if(node.parent() != null) 82 { 83 node.parent().removeChild(node); 84 } 85 86 node.parent(this); 87 } 88 89 this._lexer_ = node; 90 } 91 92 @Override 93 public String toString() 94 { 95 return "" 96 + toString(this._header_) 97 + toString(this._lexer_); 98 } 99 100 @Override 101 void removeChild(@SuppressWarnings ("unused") Node child) 102 { 103 if(this._header_ == child) 105 { 106 this._header_ = null; 107 return; 108 } 109 110 if(this._lexer_ == child) 111 { 112 this._lexer_ = null; 113 return; 114 } 115 116 throw new RuntimeException ("Not a child."); 117 } 118 119 @Override 120 void replaceChild(@SuppressWarnings ("unused") Node oldChild, @SuppressWarnings ("unused") Node newChild) 121 { 122 if(this._header_ == oldChild) 124 { 125 setHeader((PHeader) newChild); 126 return; 127 } 128 129 if(this._lexer_ == oldChild) 130 { 131 setLexer((PLexer) newChild); 132 return; 133 } 134 135 throw new RuntimeException ("Not a child."); 136 } 137 } 138 | Popular Tags |