View Javadoc
1   //
2   // Generated by JTB 1.3.2
3   //
4   
5   package com.randomnoun.common.jexl.visitor;
6   import com.randomnoun.common.jexl.ast.*;
7   import java.util.*;
8   
9   /**
10   * Provides default methods which visit each node in the tree in depth-first
11   * order.  Your visitors may extend this class.
12   */
13  public class GJDepthFirst<R,A> implements GJVisitor<R,A> {
14     //
15     // Auto class visitors--probably don't need to be overridden.
16     //
17     public R visit(NodeList n, A argu) {
18        R _ret=null;
19        int _count=0;
20        for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
21           e.nextElement().accept(this,argu);
22           _count++;
23        }
24        return _ret;
25     }
26  
27     public R visit(NodeListOptional n, A argu) {
28        if ( n.present() ) {
29           R _ret=null;
30           int _count=0;
31           for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
32              e.nextElement().accept(this,argu);
33              _count++;
34           }
35           return _ret;
36        }
37        else
38           return null;
39     }
40  
41     public R visit(NodeOptional n, A argu) {
42        if ( n.present() )
43           return n.node.accept(this,argu);
44        else
45           return null;
46     }
47  
48     public R visit(NodeSequence n, A argu) {
49        R _ret=null;
50        int _count=0;
51        for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
52           e.nextElement().accept(this,argu);
53           _count++;
54        }
55        return _ret;
56     }
57  
58     public R visit(NodeToken n, A argu) { return null; }
59  
60     //
61     // User-generated visitor methods below
62     //
63  
64     /**
65      * <PRE>
66      * expression -> Expression()
67      * nodeToken -> &lt;EOF&gt;
68      * </PRE>
69      */
70     public R visit(TopLevelExpression n, A argu) {
71        R _ret=null;
72        n.expression.accept(this, argu);
73        n.nodeToken.accept(this, argu);
74        return _ret;
75     }
76  
77     /**
78      * <PRE>
79      * conditionalAndExpression -> ConditionalAndExpression()
80      * nodeListOptional -> ( "||" ConditionalAndExpression() )*
81      * </PRE>
82      */
83     public R visit(Expression n, A argu) {
84        R _ret=null;
85        n.conditionalAndExpression.accept(this, argu);
86        n.nodeListOptional.accept(this, argu);
87        return _ret;
88     }
89  
90     /**
91      * <PRE>
92      * equalityExpression -> EqualityExpression()
93      * nodeListOptional -> ( "&&" EqualityExpression() )*
94      * </PRE>
95      */
96     public R visit(ConditionalAndExpression n, A argu) {
97        R _ret=null;
98        n.equalityExpression.accept(this, argu);
99        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 -> ( ( "&lt;" | "&gt;" | "&lt;=" | "&gt;=" ) 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 -> &lt;IDENTIFIER&gt;
184     * nodeListOptional -> ( "." &lt;IDENTIFIER&gt; )*
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 -> &lt;IDENTIFIER&gt;
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 -> &lt;INTEGER_LITERAL&gt;
238     *       | &lt;FLOATING_POINT_LITERAL&gt;
239     *       | &lt;CHARACTER_LITERAL&gt;
240     *       | &lt;STRING_LITERAL&gt;
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 }