AEscapeCommand.java revision 56ed4167b942ec265f9cee70ac4d71d10b3835ce
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com/* This file was generated by SableCC (http://www.sablecc.org/). */ 28a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.compackage com.google.clearsilver.jsilver.syntax.node; 48a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.comimport com.google.clearsilver.jsilver.syntax.analysis.*; 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 78a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com@SuppressWarnings("nls") 88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic final class AEscapeCommand extends PCommand 9ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com{ 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com private PPosition _position_; 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com private PExpression _expression_; 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com private PCommand _command_; 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 14629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com public AEscapeCommand() 15629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com { 16629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com // Constructor 175f74cf8c49701f514b69dc6f1a8b5c0ffd78af0asugoi@google.com } 18629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com public AEscapeCommand( 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com @SuppressWarnings("hiding") PPosition _position_, 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com @SuppressWarnings("hiding") PExpression _expression_, 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com @SuppressWarnings("hiding") PCommand _command_) 238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // Constructor 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com setPosition(_position_); 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com setExpression(_expression_); 288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com setCommand(_command_); 307ffb1b21abcc7bbed5a0fc711f6dd7b9dbb4f577ctguil@chromium.org 318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 320456e0b7b85060e9b9597ce414c4c2b19aff4f58robertphillips@google.com 330456e0b7b85060e9b9597ce414c4c2b19aff4f58robertphillips@google.com @Override 348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com public Object clone() 358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 36fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com return new AEscapeCommand( 37fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com cloneNode(this._position_), 38fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com cloneNode(this._expression_), 39fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com cloneNode(this._command_)); 40fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com } 41fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com 42fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com public void apply(Switch sw) 43fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com { 44fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com ((Analysis) sw).caseAEscapeCommand(this); 45fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com } 46fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com 47fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com public PPosition getPosition() 48fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com { 49fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com return this._position_; 50fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com } 51fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com public void setPosition(PPosition node) 53e4f10a70807166484e5a6303a5cd0034e5e87abareed@google.com { 54e4f10a70807166484e5a6303a5cd0034e5e87abareed@google.com if(this._position_ != null) 55e4f10a70807166484e5a6303a5cd0034e5e87abareed@google.com { 56e4f10a70807166484e5a6303a5cd0034e5e87abareed@google.com this._position_.parent(null); 57e4f10a70807166484e5a6303a5cd0034e5e87abareed@google.com } 58e4f10a70807166484e5a6303a5cd0034e5e87abareed@google.com 59629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com if(node != null) 60629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com { 61629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com if(node.parent() != null) 62687c57c7d5a17549f63e0b15208db18b220e2a91skia.committer@gmail.com { 63629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com node.parent().removeChild(node); 64629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com } 65629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com 66629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com node.parent(this); 67935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com } 68935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com 69935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com this._position_ = node; 70629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com } 71687c57c7d5a17549f63e0b15208db18b220e2a91skia.committer@gmail.com 72629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com public PExpression getExpression() 73629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com { 74935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com return this._expression_; 75935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com } 76935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com 77629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com public void setExpression(PExpression node) 78629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com { 79629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com if(this._expression_ != null) 80629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com { 81629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com this._expression_.parent(null); 82629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com } 83629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com 84629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com if(node != null) 85629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com { 86629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com if(node.parent() != null) 87629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com { 88629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com node.parent().removeChild(node); 89629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com } 90935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com 91935ad026826fb7d31d562ff7326b84ec3a827456robertphillips@google.com node.parent(this); 92629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com } 93629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com 94629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com this._expression_ = node; 956d87557278052c131957e5d6e093d3a675162d22robertphillips@google.com } 966d87557278052c131957e5d6e093d3a675162d22robertphillips@google.com 976d87557278052c131957e5d6e093d3a675162d22robertphillips@google.com public PCommand getCommand() 98629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com { 99629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com return this._command_; 100629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com } 101629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com 102629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com public void setCommand(PCommand node) 103629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com { 104687c57c7d5a17549f63e0b15208db18b220e2a91skia.committer@gmail.com if(this._command_ != null) 105629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com { 106629ab540667422d3edcb97c51e9628b7051e1ba4robertphillips@google.com this._command_.parent(null); 107ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com } 108ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com 109ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com if(node != null) 1108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 1118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if(node.parent() != null) 1128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 1138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com node.parent().removeChild(node); 114ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com } 115ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com 1168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com node.parent(this); 1178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com this._command_ = node; 1208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com @Override 1238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com public String toString() 1248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 1258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return "" 1268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com + toString(this._position_) 1278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com + toString(this._expression_) 1288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com + toString(this._command_); 1298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 13154924243c1b65b3ee6d8fa064b50a9b1bb2a19a5djsollen@google.com @Override 13254924243c1b65b3ee6d8fa064b50a9b1bb2a19a5djsollen@google.com void removeChild(@SuppressWarnings("unused") Node child) 1338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 1348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // Remove child 135fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com if(this._position_ == child) 1368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 1378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com this._position_ = null; 1388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return; 1398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if(this._expression_ == child) 1428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 1438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com this._expression_ = null; 1448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return; 1458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if(this._command_ == child) 1488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 1498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com this._command_ = null; 1508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return; 1518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com throw new RuntimeException("Not a child."); 1548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 155fd4be26c4202ae91f0f7cf2c03e44b5169d885ebreed@google.com 1568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com @Override 157ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) 1588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 15954924243c1b65b3ee6d8fa064b50a9b1bb2a19a5djsollen@google.com // Replace child 1608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if(this._position_ == oldChild) 1618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 16254924243c1b65b3ee6d8fa064b50a9b1bb2a19a5djsollen@google.com setPosition((PPosition) newChild); 1638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return; 1648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 166fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com if(this._expression_ == oldChild) 1678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 1688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com setExpression((PExpression) newChild); 1698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return; 1708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com if(this._command_ == oldChild) 1738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com { 1748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com setCommand((PCommand) newChild); 1758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com return; 1768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 1788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com throw new RuntimeException("Not a child."); 1798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 1808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com} 1818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com