1 4 package com.tc.aspectwerkz.expression; 5 6 import java.util.List ; 7 8 import com.tc.aspectwerkz.expression.ast.*; 9 import com.tc.aspectwerkz.expression.regexp.TypePattern; 10 11 19 public class ExpressionValidateVisitor implements ExpressionParserVisitor { 20 21 protected Node m_root; 22 protected String m_expression; 23 protected String m_namespace; 24 25 32 public ExpressionValidateVisitor(final String expression, 33 final String namespace, 34 final Node root) { 35 m_expression = expression; 36 m_namespace = namespace; 37 m_root = root; 38 } 39 40 45 public void populate(List data) { 46 visit(m_root, data); 47 } 48 49 public Object visit(Node node, Object data) { 51 return node.jjtGetChild(0).jjtAccept(this, data); 52 } 53 54 public Object visit(SimpleNode node, Object data) { 55 return node.jjtGetChild(0).jjtAccept(this, data); 56 } 57 58 public Object visit(ASTRoot node, Object data) { 59 return node.jjtGetChild(0).jjtAccept(this, data); 60 } 61 62 public Object visit(ASTExpression node, Object data) { 63 return node.jjtGetChild(0).jjtAccept(this, data); 64 } 65 66 public Object visit(ASTOr node, Object data) { 68 for (int i = 0; i < node.jjtGetNumChildren(); i++) { 69 List args = (List ) node.jjtGetChild(i).jjtAccept(this, data); 70 } 72 return data; 73 } 74 75 public Object visit(ASTAnd node, Object data) { 76 for (int i = 0; i < node.jjtGetNumChildren(); i++) { 77 node.jjtGetChild(i).jjtAccept(this, data); 78 } 79 return data; 80 } 81 82 public Object visit(ASTNot node, Object data) { 83 for (int i = 0; i < node.jjtGetNumChildren(); i++) { 84 node.jjtGetChild(i).jjtAccept(this, data); 85 } 86 return data; 87 } 88 89 public Object visit(ASTPointcutReference node, Object data) { 91 for (int i = 0; i < node.jjtGetNumChildren(); i++) { 93 node.jjtGetChild(i).jjtAccept(this, data); 94 } 95 return data; 96 } 97 98 public Object visit(ASTExecution node, Object data) { 99 return data; 100 } 101 102 public Object visit(ASTCall node, Object data) { 103 return data; 104 } 105 106 public Object visit(ASTSet node, Object data) { 107 return data; 108 } 109 110 public Object visit(ASTGet node, Object data) { 111 return data; 112 } 113 114 public Object visit(ASTHandler node, Object data) { 115 return data; 116 } 117 118 public Object visit(ASTStaticInitialization node, Object data) { 119 return data; 120 } 121 122 public Object visit(ASTIf node, Object data) { 123 return data; 124 } 125 126 public Object visit(ASTWithin node, Object data) { 127 return data; 128 } 129 130 public Object visit(ASTWithinCode node, Object data) { 131 return data; 132 } 133 134 135 public Object visit(ASTHasMethod node, Object data) { 136 return data; 137 } 138 139 public Object visit(ASTHasField node, Object data) { 140 return data; 141 } 142 143 public Object visit(ASTCflow node, Object data) { 144 for (int i = 0; i < node.jjtGetNumChildren(); i++) { 146 node.jjtGetChild(i).jjtAccept(this, data); 147 } 148 return data; 149 } 150 151 public Object visit(ASTCflowBelow node, Object data) { 152 for (int i = 0; i < node.jjtGetNumChildren(); i++) { 154 node.jjtGetChild(i).jjtAccept(this, data); 155 } 156 return data; 157 } 158 159 public Object visit(ASTTarget node, Object data) { 160 ((List ) data).add(node.getIdentifier()); 161 return data; 162 } 163 164 public Object visit(ASTThis node, Object data) { 165 ((List ) data).add(node.getIdentifier()); 166 return data; 167 } 168 169 public Object visit(ASTClassPattern node, Object data) { 171 return data; 172 } 173 174 public Object visit(ASTMethodPattern node, Object data) { 175 return data; 176 } 177 178 public Object visit(ASTConstructorPattern node, Object data) { 179 return data; 180 } 181 182 public Object visit(ASTFieldPattern node, Object data) { 183 return data; 184 } 185 186 public Object visit(ASTParameter node, Object data) { 187 return data; 188 } 189 190 public Object visit(ASTArgs node, Object data) { 191 for (int i = 0; i < node.jjtGetNumChildren(); i++) { 192 List args = (List ) node.jjtGetChild(i).jjtAccept(this, data); 193 ((List ) data).addAll(args); 194 } 195 return data; 196 } 197 198 public Object visit(ASTArgParameter node, Object data) { 199 TypePattern typePattern = node.getTypePattern(); 200 ((List ) data).add(typePattern.getPattern()); 201 return data; 202 } 203 204 public Object visit(ASTAttribute node, Object data) { 205 return data; 206 } 207 208 public Object visit(ASTModifier node, Object data) { 209 return data; 210 } 211 212 217 public String toString() { 218 return m_expression; 219 } 220 221 } | Popular Tags |