001 /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.3 */ 002 package AST; 003 004 import java.util.Collection; 005 import java.util.ArrayList; 006 import java.util.HashSet; 007 /** 008 * @ast node 009 * @declaredat /home/csz-naf/examples/PicoJava/spec/picojava.ast:17 010 * @production BooleanLiteral : {@link Exp} ::= <span class="component"><Value:String></span>; 011 012 */ 013 public class BooleanLiteral extends Exp implements Cloneable { 014 /** 015 * @apilevel internal 016 */ 017 public BooleanLiteral clone() throws CloneNotSupportedException { 018 BooleanLiteral node = (BooleanLiteral) super.clone(); 019 node.type_visited = -1; 020 node.type_computed = false; 021 node.type_value = null; 022 node.booleanType_visited = -1; 023 node.in$Circle(false); 024 node.is$Final(false); 025 return node; 026 } 027 /** 028 * @apilevel internal 029 */ 030 public BooleanLiteral copy() { 031 try { 032 BooleanLiteral node = (BooleanLiteral) clone(); 033 node.parent = null; 034 if(children != null) { 035 node.children = (ASTNode[]) children.clone(); 036 } 037 return node; 038 } catch (CloneNotSupportedException e) { 039 throw new Error("Error: clone not supported for " + getClass().getName()); 040 } 041 } 042 /** 043 * Create a deep copy of the AST subtree at this node. 044 * The copy is dangling, i.e. has no parent. 045 * @return dangling copy of the subtree at this node 046 * @apilevel low-level 047 */ 048 public BooleanLiteral fullCopy() { 049 BooleanLiteral tree = (BooleanLiteral) copy(); 050 if (children != null) { 051 for (int i = 0; i < children.length; ++i) { 052 ASTNode child = (ASTNode) children[i]; 053 if(child != null) { 054 child = child.fullCopy(); 055 tree.setChild(child, i); 056 } 057 } 058 } 059 return tree; 060 } 061 /** 062 * @aspect PrettyPrint 063 * @declaredat /home/csz-naf/examples/PicoJava/spec/PrettyPrint.jadd:73 064 */ 065 public String toString() { 066 return getValue(); 067 } 068 /** 069 */ 070 public BooleanLiteral() { 071 super(); 072 } 073 /** 074 * Initializes the child array to the correct size. 075 * Initializes List and Opt nta children. 076 * @apilevel internal 077 * @ast method 078 */ 079 public void init$Children() { 080 } 081 /** 082 */ 083 public BooleanLiteral(String p0) { 084 setValue(p0); 085 } 086 /** 087 * @apilevel low-level 088 */ 089 protected int numChildren() { 090 return 0; 091 } 092 /** 093 * @apilevel internal 094 */ 095 public boolean mayHaveRewrite() { 096 return false; 097 } 098 /** 099 * @apilevel low-level 100 */ 101 public void flushCache() { 102 super.flushCache(); 103 type_visited = -1; 104 type_computed = false; 105 type_value = null; 106 booleanType_visited = -1; 107 } 108 /** 109 * @apilevel internal 110 */ 111 public void flushCollectionCache() { 112 super.flushCollectionCache(); 113 } 114 /** 115 * Replaces the lexeme Value. 116 * @param value The new value for the lexeme Value. 117 * @apilevel high-level 118 */ 119 public void setValue(String value) { 120 tokenString_Value = value; 121 } 122 /** 123 * @apilevel internal 124 */ 125 protected String tokenString_Value; 126 /** 127 * Retrieves the value for the lexeme Value. 128 * @return The value for the lexeme Value. 129 * @apilevel high-level 130 */ 131 public String getValue() { 132 return tokenString_Value != null ? tokenString_Value : ""; 133 } 134 /** 135 * @apilevel internal 136 */ 137 protected int type_visited = -1; 138 /** 139 * @apilevel internal 140 */ 141 protected boolean type_computed = false; 142 /** 143 * @apilevel internal 144 */ 145 protected TypeDecl type_value; 146 /** 147 * @attribute syn 148 * @aspect TypeAnalysis 149 * @declaredat /home/csz-naf/examples/PicoJava/spec/TypeAnalysis.jrag:39 150 */ 151 public TypeDecl type() { 152 if(type_computed) { 153 return type_value; 154 } 155 ASTNode$State state = state(); 156 if (type_visited == state().boundariesCrossed) { 157 throw new RuntimeException("Circular definition of attr: type in class: org.jastadd.ast.AST.SynDecl"); 158 } 159 type_visited = state().boundariesCrossed; 160 int num = state.boundariesCrossed; 161 boolean isFinal = this.is$Final(); 162 type_value = type_compute(); 163 if(isFinal && num == state().boundariesCrossed) { 164 type_computed = true; 165 } else { 166 } 167 168 type_visited = -1; 169 return type_value; 170 } 171 /** 172 * @apilevel internal 173 */ 174 private TypeDecl type_compute() { return booleanType(); } 175 /** 176 * @attribute inh 177 * @aspect PredefinedTypes 178 * @declaredat /home/csz-naf/examples/PicoJava/spec/PredefinedTypes.jrag:13 179 */ 180 public PrimitiveDecl booleanType() { 181 ASTNode$State state = state(); 182 if (booleanType_visited == state().boundariesCrossed) { 183 throw new RuntimeException("Circular definition of attr: booleanType in class: org.jastadd.ast.AST.InhDecl"); 184 } 185 booleanType_visited = state().boundariesCrossed; 186 PrimitiveDecl booleanType_value = getParent().Define_PrimitiveDecl_booleanType(this, null); 187 188 booleanType_visited = -1; 189 return booleanType_value; 190 } 191 /** 192 * @apilevel internal 193 */ 194 protected int booleanType_visited = -1; 195 /** 196 * @apilevel internal 197 */ 198 public ASTNode rewriteTo() { return super.rewriteTo(); 199 }}