001// 002// Generated by JTB 1.3.2 003// 004 005package com.randomnoun.common.jexl.visitor; 006import com.randomnoun.common.jexl.ast.*; 007import java.util.*; 008 009/** 010 * Provides default methods which visit each node in the tree in depth-first 011 * order. Your visitors may extend this class. 012 */ 013public class GJDepthFirst<R,A> implements GJVisitor<R,A> { 014 // 015 // Auto class visitors--probably don't need to be overridden. 016 // 017 public R visit(NodeList n, A argu) { 018 R _ret=null; 019 int _count=0; 020 for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) { 021 e.nextElement().accept(this,argu); 022 _count++; 023 } 024 return _ret; 025 } 026 027 public R visit(NodeListOptional n, A argu) { 028 if ( n.present() ) { 029 R _ret=null; 030 int _count=0; 031 for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) { 032 e.nextElement().accept(this,argu); 033 _count++; 034 } 035 return _ret; 036 } 037 else 038 return null; 039 } 040 041 public R visit(NodeOptional n, A argu) { 042 if ( n.present() ) 043 return n.node.accept(this,argu); 044 else 045 return null; 046 } 047 048 public R visit(NodeSequence n, A argu) { 049 R _ret=null; 050 int _count=0; 051 for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) { 052 e.nextElement().accept(this,argu); 053 _count++; 054 } 055 return _ret; 056 } 057 058 public R visit(NodeToken n, A argu) { return null; } 059 060 // 061 // User-generated visitor methods below 062 // 063 064 /** 065 * <PRE> 066 * expression -> Expression() 067 * nodeToken -> <EOF> 068 * </PRE> 069 */ 070 public R visit(TopLevelExpression n, A argu) { 071 R _ret=null; 072 n.expression.accept(this, argu); 073 n.nodeToken.accept(this, argu); 074 return _ret; 075 } 076 077 /** 078 * <PRE> 079 * conditionalAndExpression -> ConditionalAndExpression() 080 * nodeListOptional -> ( "||" ConditionalAndExpression() )* 081 * </PRE> 082 */ 083 public R visit(Expression n, A argu) { 084 R _ret=null; 085 n.conditionalAndExpression.accept(this, argu); 086 n.nodeListOptional.accept(this, argu); 087 return _ret; 088 } 089 090 /** 091 * <PRE> 092 * equalityExpression -> EqualityExpression() 093 * nodeListOptional -> ( "&&" EqualityExpression() )* 094 * </PRE> 095 */ 096 public R visit(ConditionalAndExpression n, A argu) { 097 R _ret=null; 098 n.equalityExpression.accept(this, argu); 099 n.nodeListOptional.accept(this, argu); 100 return _ret; 101 } 102 103 /** 104 * <PRE> 105 * relationalExpression -> RelationalExpression() 106 * nodeListOptional -> ( ( "==" | "!=" ) RelationalExpression() )* 107 * </PRE> 108 */ 109 public R visit(EqualityExpression n, A argu) { 110 R _ret=null; 111 n.relationalExpression.accept(this, argu); 112 n.nodeListOptional.accept(this, argu); 113 return _ret; 114 } 115 116 /** 117 * <PRE> 118 * additiveExpression -> AdditiveExpression() 119 * nodeListOptional -> ( ( "<" | ">" | "<=" | ">=" ) AdditiveExpression() )* 120 * </PRE> 121 */ 122 public R visit(RelationalExpression n, A argu) { 123 R _ret=null; 124 n.additiveExpression.accept(this, argu); 125 n.nodeListOptional.accept(this, argu); 126 return _ret; 127 } 128 129 /** 130 * <PRE> 131 * multiplicativeExpression -> MultiplicativeExpression() 132 * nodeListOptional -> ( ( "+" | "-" ) MultiplicativeExpression() )* 133 * </PRE> 134 */ 135 public R visit(AdditiveExpression n, A argu) { 136 R _ret=null; 137 n.multiplicativeExpression.accept(this, argu); 138 n.nodeListOptional.accept(this, argu); 139 return _ret; 140 } 141 142 /** 143 * <PRE> 144 * unaryExpression -> UnaryExpression() 145 * nodeListOptional -> ( ( "*" | "/" | "%" ) UnaryExpression() )* 146 * </PRE> 147 */ 148 public R visit(MultiplicativeExpression n, A argu) { 149 R _ret=null; 150 n.unaryExpression.accept(this, argu); 151 n.nodeListOptional.accept(this, argu); 152 return _ret; 153 } 154 155 /** 156 * <PRE> 157 * nodeChoice -> ( "~" | "!" | "-" ) UnaryExpression() 158 * | PrimaryExpression() 159 * </PRE> 160 */ 161 public R visit(UnaryExpression n, A argu) { 162 R _ret=null; 163 n.nodeChoice.accept(this, argu); 164 return _ret; 165 } 166 167 /** 168 * <PRE> 169 * nodeChoice -> FunctionCall() 170 * | Name() 171 * | Literal() 172 * | "(" Expression() ")" 173 * </PRE> 174 */ 175 public R visit(PrimaryExpression n, A argu) { 176 R _ret=null; 177 n.nodeChoice.accept(this, argu); 178 return _ret; 179 } 180 181 /** 182 * <PRE> 183 * nodeToken -> <IDENTIFIER> 184 * nodeListOptional -> ( "." <IDENTIFIER> )* 185 * </PRE> 186 */ 187 public R visit(Name n, A argu) { 188 R _ret=null; 189 n.nodeToken.accept(this, argu); 190 n.nodeListOptional.accept(this, argu); 191 return _ret; 192 } 193 194 /** 195 * <PRE> 196 * nodeToken -> <IDENTIFIER> 197 * arguments -> Arguments() 198 * </PRE> 199 */ 200 public R visit(FunctionCall n, A argu) { 201 R _ret=null; 202 n.nodeToken.accept(this, argu); 203 n.arguments.accept(this, argu); 204 return _ret; 205 } 206 207 /** 208 * <PRE> 209 * nodeToken -> "(" 210 * nodeOptional -> [ ArgumentList() ] 211 * nodeToken1 -> ")" 212 * </PRE> 213 */ 214 public R visit(Arguments n, A argu) { 215 R _ret=null; 216 n.nodeToken.accept(this, argu); 217 n.nodeOptional.accept(this, argu); 218 n.nodeToken1.accept(this, argu); 219 return _ret; 220 } 221 222 /** 223 * <PRE> 224 * expression -> Expression() 225 * nodeListOptional -> ( "," Expression() )* 226 * </PRE> 227 */ 228 public R visit(ArgumentList n, A argu) { 229 R _ret=null; 230 n.expression.accept(this, argu); 231 n.nodeListOptional.accept(this, argu); 232 return _ret; 233 } 234 235 /** 236 * <PRE> 237 * nodeChoice -> <INTEGER_LITERAL> 238 * | <FLOATING_POINT_LITERAL> 239 * | <CHARACTER_LITERAL> 240 * | <STRING_LITERAL> 241 * | BooleanLiteral() 242 * | NullLiteral() 243 * </PRE> 244 */ 245 public R visit(Literal n, A argu) { 246 R _ret=null; 247 n.nodeChoice.accept(this, argu); 248 return _ret; 249 } 250 251 /** 252 * <PRE> 253 * nodeChoice -> "true" 254 * | "false" 255 * </PRE> 256 */ 257 public R visit(BooleanLiteral n, A argu) { 258 R _ret=null; 259 n.nodeChoice.accept(this, argu); 260 return _ret; 261 } 262 263 /** 264 * <PRE> 265 * nodeToken -> "null" 266 * </PRE> 267 */ 268 public R visit(NullLiteral n, A argu) { 269 R _ret=null; 270 n.nodeToken.accept(this, argu); 271 return _ret; 272 } 273 274}