001// 002// Generated by JTB 1.3.2 003// 004 005package jtb.syntaxtree; 006 007// Grammar production: 008// f0 -> "if" 009// f1 -> "(" 010// f2 -> Expression() 011// f3 -> ")" 012// f4 -> Statement() 013// f5 -> [ "else" Statement() ] 014public class IfStatement implements Node { 015 // This was added after running jtb to remove serializable warning. 016 static final long serialVersionUID = 20150406L; 017 018 private Node parent; 019 public NodeToken f0; 020 public NodeToken f1; 021 public Expression f2; 022 public NodeToken f3; 023 public Statement f4; 024 public NodeOptional f5; 025 026 public IfStatement(NodeToken n0, NodeToken n1, Expression n2, NodeToken n3, Statement n4, NodeOptional n5) { 027 f0 = n0; 028 if ( f0 != null ) f0.setParent(this); 029 f1 = n1; 030 if ( f1 != null ) f1.setParent(this); 031 f2 = n2; 032 if ( f2 != null ) f2.setParent(this); 033 f3 = n3; 034 if ( f3 != null ) f3.setParent(this); 035 f4 = n4; 036 if ( f4 != null ) f4.setParent(this); 037 f5 = n5; 038 if ( f5 != null ) f5.setParent(this); 039 } 040 041 public IfStatement(Expression n0, Statement n1, NodeOptional n2) { 042 f0 = new NodeToken("if"); 043 if ( f0 != null ) f0.setParent(this); 044 f1 = new NodeToken("("); 045 if ( f1 != null ) f1.setParent(this); 046 f2 = n0; 047 if ( f2 != null ) f2.setParent(this); 048 f3 = new NodeToken(")"); 049 if ( f3 != null ) f3.setParent(this); 050 f4 = n1; 051 if ( f4 != null ) f4.setParent(this); 052 f5 = n2; 053 if ( f5 != null ) f5.setParent(this); 054 } 055 056 public void accept(jtb.visitor.Visitor v) { 057 v.visit(this); 058 } 059 public <R,A> R accept(jtb.visitor.GJVisitor<R,A> v, A argu) { 060 return v.visit(this,argu); 061 } 062 public <R> R accept(jtb.visitor.GJNoArguVisitor<R> v) { 063 return v.visit(this); 064 } 065 public <A> void accept(jtb.visitor.GJVoidVisitor<A> v, A argu) { 066 v.visit(this,argu); 067 } 068 public void setParent(Node n) { parent = n; } 069 public Node getParent() { return parent; } 070} 071