Clover Coverage Report - Kuali Student 1.1.1-SNAPSHOT (Aggregated)
Coverage timestamp: Wed Apr 20 2011 04:04:00 EST
../../../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
149   434   34   8.76
16   279   0.23   3.4
17     2  
5    
 
  BooleanFunctionParser       Line # 32 145 0% 30 15 91.4% 0.9137931
  BooleanFunctionParser.booleanExpression_return       Line # 103 1 0% 1 0 100% 1.0
  BooleanFunctionParser.orTerm_return       Line # 152 1 0% 1 0 100% 1.0
  BooleanFunctionParser.andTerm_return       Line # 238 1 0% 1 0 100% 1.0
  BooleanFunctionParser.atom_return       Line # 324 1 0% 1 0 100% 1.0
 
  (44)
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10    * software distributed under the License is distributed on an "AS IS"
11    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12    * or implied. See the License for the specific language governing
13    * permissions and limitations under the License.
14    */
15   
16    // $ANTLR 3.1.1 BooleanFunction.g 2009-06-03 01:05:39
17    package org.kuali.student.common.messagebuilder.booleanmessage.ast.parsers;
18   
19    import java.util.List;
20   
21    import org.antlr.runtime.BitSet;
22    import org.antlr.runtime.NoViableAltException;
23    import org.antlr.runtime.Parser;
24    import org.antlr.runtime.ParserRuleReturnScope;
25    import org.antlr.runtime.RecognitionException;
26    import org.antlr.runtime.RecognizerSharedState;
27    import org.antlr.runtime.Token;
28    import org.antlr.runtime.TokenStream;
29    import org.antlr.runtime.tree.CommonTreeAdaptor;
30    import org.antlr.runtime.tree.TreeAdaptor;
31   
 
32    public class BooleanFunctionParser extends Parser {
33    public static final String[] tokenNames = new String[] {
34    "<invalid>", "<EOR>", "<DOWN>", "<UP>", "OR", "AND", "LP", "RP", "ALPHA", "UPPERCASE", "NUMBER", "WHITESPACE", "LOWERCASE"
35    };
36    public static final int UPPERCASE=9;
37    public static final int LOWERCASE=12;
38    public static final int RP=7;
39    public static final int OR=4;
40    public static final int NUMBER=10;
41    public static final int LP=6;
42    public static final int WHITESPACE=11;
43    public static final int AND=5;
44    public static final int EOF=-1;
45    public static final int ALPHA=8;
46   
47    // delegates
48    // delegators
49   
50   
 
51  92 toggle public BooleanFunctionParser(TokenStream input) {
52  92 this(input, new RecognizerSharedState());
53    }
 
54  92 toggle public BooleanFunctionParser(TokenStream input, RecognizerSharedState state) {
55  92 super(input, state);
56   
57    }
58   
59    protected TreeAdaptor adaptor = new CommonTreeAdaptor();
60   
 
61  92 toggle public void setTreeAdaptor(TreeAdaptor adaptor) {
62  92 this.adaptor = adaptor;
63    }
 
64  0 toggle public TreeAdaptor getTreeAdaptor() {
65  0 return adaptor;
66    }
67   
 
68  1 toggle public String[] getTokenNames() { return BooleanFunctionParser.tokenNames; }
 
69  0 toggle public String getGrammarFileName() { return "BooleanFunction.g"; }
70   
71   
 
72  1 toggle @Override
73    public String getErrorMessage(RecognitionException e, String[] tokenNames) {
74  1 List<?> stack = getRuleInvocationStack(e, this.getClass().getName());
75  1 String msg = null;
76  1 if ( e instanceof NoViableAltException ) {
77  1 NoViableAltException nvae = (NoViableAltException)e;
78  1 msg = " No viable alternatives; token=" + e.token
79    + " (decision=" + nvae.decisionNumber
80    + " state " + nvae.stateNumber+")"
81    + " decision=<<" + nvae.grammarDecisionDescription + ">>";
82    }
83    else {
84  0 msg = super.getErrorMessage(e, tokenNames);
85    }
86  1 return stack + " " + msg;
87    }
88   
 
89  0 toggle @Override
90    public String getTokenErrorDisplay(Token t) {
91  0 return t.toString();
92    }
93   
 
94  91 toggle private boolean isTokenParenthesis(String paren){
95  91 if (paren != null) {
96  0 if ( paren.equals("(") || paren.equals(")") )
97  0 return true;
98    }
99  91 return false;
100    }
101   
102   
 
103    public static class booleanExpression_return extends ParserRuleReturnScope {
104    Object tree;
 
105  91 toggle public Object getTree() { return tree; }
106    };
107   
108    // $ANTLR start "booleanExpression"
109    // BooleanFunction.g:60:1: booleanExpression : orTerm ;
 
110  92 toggle public final BooleanFunctionParser.booleanExpression_return booleanExpression() throws RecognitionException {
111  92 BooleanFunctionParser.booleanExpression_return retval = new BooleanFunctionParser.booleanExpression_return();
112  92 retval.start = input.LT(1);
113   
114  92 Object root_0 = null;
115   
116  92 BooleanFunctionParser.orTerm_return orTerm1 = null;
117   
118   
119   
120  92 try {
121    // BooleanFunction.g:60:18: ( orTerm )
122    // BooleanFunction.g:60:22: orTerm
123    {
124  92 root_0 = (Object)adaptor.nil();
125   
126  92 pushFollow(FOLLOW_orTerm_in_booleanExpression111);
127  92 orTerm1=orTerm();
128   
129  91 state._fsp--;
130   
131  91 adaptor.addChild(root_0, orTerm1.getTree());
132  91 if ( isTokenParenthesis(input.LT(1).getText()) ) throw new RecognitionException();
133   
134    }
135   
136  91 retval.stop = input.LT(-1);
137   
138  91 retval.tree = (Object)adaptor.rulePostProcessing(root_0);
139  91 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
140   
141    }
142   
143    catch (RecognitionException e) {
144  1 throw e;
145    }
146    finally {
147    }
148  91 return retval;
149    }
150    // $ANTLR end "booleanExpression"
151   
 
152    public static class orTerm_return extends ParserRuleReturnScope {
153    Object tree;
 
154  145 toggle public Object getTree() { return tree; }
155    };
156   
157    // $ANTLR start "orTerm"
158    // BooleanFunction.g:61:1: orTerm : andTerm ( OR andTerm )* ;
 
159  146 toggle public final BooleanFunctionParser.orTerm_return orTerm() throws RecognitionException {
160  146 BooleanFunctionParser.orTerm_return retval = new BooleanFunctionParser.orTerm_return();
161  146 retval.start = input.LT(1);
162   
163  146 Object root_0 = null;
164   
165  146 Token OR3=null;
166  146 BooleanFunctionParser.andTerm_return andTerm2 = null;
167   
168  146 BooleanFunctionParser.andTerm_return andTerm4 = null;
169   
170   
171  146 Object OR3_tree=null;
172   
173  146 try {
174    // BooleanFunction.g:61:9: ( andTerm ( OR andTerm )* )
175    // BooleanFunction.g:61:13: andTerm ( OR andTerm )*
176    {
177  146 root_0 = (Object)adaptor.nil();
178   
179  146 pushFollow(FOLLOW_andTerm_in_orTerm123);
180  146 andTerm2=andTerm();
181   
182  145 state._fsp--;
183   
184  145 adaptor.addChild(root_0, andTerm2.getTree());
185    // BooleanFunction.g:61:21: ( OR andTerm )*
186  145 loop1:
187    do {
188  213 int alt1=2;
189  213 int LA1_0 = input.LA(1);
190   
191  213 if ( (LA1_0==OR) ) {
192  68 alt1=1;
193    }
194   
195   
196  213 switch (alt1) {
197  68 case 1 :
198    // BooleanFunction.g:61:22: OR andTerm
199    {
200  68 OR3=(Token)match(input,OR,FOLLOW_OR_in_orTerm126);
201  68 OR3_tree = (Object)adaptor.create(OR3);
202  68 root_0 = (Object)adaptor.becomeRoot(OR3_tree, root_0);
203   
204  68 pushFollow(FOLLOW_andTerm_in_orTerm129);
205  68 andTerm4=andTerm();
206   
207  68 state._fsp--;
208   
209  68 adaptor.addChild(root_0, andTerm4.getTree());
210   
211    }
212  68 break;
213   
214  145 default :
215  145 break loop1;
216    }
217    } while (true);
218   
219   
220    }
221   
222  145 retval.stop = input.LT(-1);
223   
224  145 retval.tree = (Object)adaptor.rulePostProcessing(root_0);
225  145 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
226   
227    }
228   
229    catch (RecognitionException e) {
230  1 throw e;
231    }
232    finally {
233    }
234  145 return retval;
235    }
236    // $ANTLR end "orTerm"
237   
 
238    public static class andTerm_return extends ParserRuleReturnScope {
239    Object tree;
 
240  213 toggle public Object getTree() { return tree; }
241    };
242   
243    // $ANTLR start "andTerm"
244    // BooleanFunction.g:62:1: andTerm : atom ( AND atom )* ;
 
245  214 toggle public final BooleanFunctionParser.andTerm_return andTerm() throws RecognitionException {
246  214 BooleanFunctionParser.andTerm_return retval = new BooleanFunctionParser.andTerm_return();
247  214 retval.start = input.LT(1);
248   
249  214 Object root_0 = null;
250   
251  214 Token AND6=null;
252  214 BooleanFunctionParser.atom_return atom5 = null;
253   
254  214 BooleanFunctionParser.atom_return atom7 = null;
255   
256   
257  214 Object AND6_tree=null;
258   
259  214 try {
260    // BooleanFunction.g:62:9: ( atom ( AND atom )* )
261    // BooleanFunction.g:62:13: atom ( AND atom )*
262    {
263  214 root_0 = (Object)adaptor.nil();
264   
265  214 pushFollow(FOLLOW_atom_in_andTerm140);
266  214 atom5=atom();
267   
268  214 state._fsp--;
269   
270  214 adaptor.addChild(root_0, atom5.getTree());
271    // BooleanFunction.g:62:18: ( AND atom )*
272  214 loop2:
273    do {
274  297 int alt2=2;
275  297 int LA2_0 = input.LA(1);
276   
277  297 if ( (LA2_0==AND) ) {
278  84 alt2=1;
279    }
280   
281   
282  297 switch (alt2) {
283  84 case 1 :
284    // BooleanFunction.g:62:19: AND atom
285    {
286  84 AND6=(Token)match(input,AND,FOLLOW_AND_in_andTerm143);
287  84 AND6_tree = (Object)adaptor.create(AND6);
288  84 root_0 = (Object)adaptor.becomeRoot(AND6_tree, root_0);
289   
290  84 pushFollow(FOLLOW_atom_in_andTerm146);
291  84 atom7=atom();
292   
293  83 state._fsp--;
294   
295  83 adaptor.addChild(root_0, atom7.getTree());
296   
297    }
298  83 break;
299   
300  213 default :
301  213 break loop2;
302    }
303    } while (true);
304   
305   
306    }
307   
308  213 retval.stop = input.LT(-1);
309   
310  213 retval.tree = (Object)adaptor.rulePostProcessing(root_0);
311  213 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
312   
313    }
314   
315    catch (RecognitionException e) {
316  1 throw e;
317    }
318    finally {
319    }
320  213 return retval;
321    }
322    // $ANTLR end "andTerm"
323   
 
324    public static class atom_return extends ParserRuleReturnScope {
325    Object tree;
 
326  297 toggle public Object getTree() { return tree; }
327    };
328   
329    // $ANTLR start "atom"
330    // BooleanFunction.g:63:1: atom : ( ALPHA | ( LP orTerm RP ) );
 
331  298 toggle public final BooleanFunctionParser.atom_return atom() throws RecognitionException {
332  298 BooleanFunctionParser.atom_return retval = new BooleanFunctionParser.atom_return();
333  298 retval.start = input.LT(1);
334   
335  298 Object root_0 = null;
336   
337  298 Token ALPHA8=null;
338  298 Token LP9=null;
339  298 Token RP11=null;
340  298 BooleanFunctionParser.orTerm_return orTerm10 = null;
341   
342   
343  298 Object ALPHA8_tree=null;
344  298 Object LP9_tree=null;
345  298 Object RP11_tree=null;
346   
347  298 try {
348    // BooleanFunction.g:63:9: ( ALPHA | ( LP orTerm RP ) )
349  298 int alt3=2;
350  298 int LA3_0 = input.LA(1);
351   
352  298 if ( (LA3_0==ALPHA) ) {
353  243 alt3=1;
354    }
355  55 else if ( (LA3_0==LP) ) {
356  54 alt3=2;
357    }
358    else {
359  1 NoViableAltException nvae =
360    new NoViableAltException("", 3, 0, input);
361   
362  1 throw nvae;
363    }
364  297 switch (alt3) {
365  243 case 1 :
366    // BooleanFunction.g:63:13: ALPHA
367    {
368  243 root_0 = (Object)adaptor.nil();
369   
370  243 ALPHA8=(Token)match(input,ALPHA,FOLLOW_ALPHA_in_atom160);
371  243 ALPHA8_tree = (Object)adaptor.create(ALPHA8);
372  243 adaptor.addChild(root_0, ALPHA8_tree);
373   
374   
375    }
376  243 break;
377  54 case 2 :
378    // BooleanFunction.g:63:21: ( LP orTerm RP )
379    {
380  54 root_0 = (Object)adaptor.nil();
381   
382    // BooleanFunction.g:63:21: ( LP orTerm RP )
383    // BooleanFunction.g:63:22: LP orTerm RP
384    {
385  54 LP9=(Token)match(input,LP,FOLLOW_LP_in_atom165);
386  54 pushFollow(FOLLOW_orTerm_in_atom168);
387  54 orTerm10=orTerm();
388   
389  54 state._fsp--;
390   
391  54 adaptor.addChild(root_0, orTerm10.getTree());
392  54 RP11=(Token)match(input,RP,FOLLOW_RP_in_atom170);
393   
394    }
395   
396   
397    }
398  54 break;
399   
400    }
401  297 retval.stop = input.LT(-1);
402   
403  297 retval.tree = (Object)adaptor.rulePostProcessing(root_0);
404  297 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
405   
406    }
407   
408    catch (RecognitionException e) {
409  1 throw e;
410    }
411    finally {
412    }
413  297 return retval;
414    }
415    // $ANTLR end "atom"
416   
417    // Delegated rules
418   
419   
420   
421   
422    public static final BitSet FOLLOW_orTerm_in_booleanExpression111 = new BitSet(new long[]{0x0000000000000002L});
423    public static final BitSet FOLLOW_andTerm_in_orTerm123 = new BitSet(new long[]{0x0000000000000012L});
424    public static final BitSet FOLLOW_OR_in_orTerm126 = new BitSet(new long[]{0x0000000000000140L});
425    public static final BitSet FOLLOW_andTerm_in_orTerm129 = new BitSet(new long[]{0x0000000000000012L});
426    public static final BitSet FOLLOW_atom_in_andTerm140 = new BitSet(new long[]{0x0000000000000022L});
427    public static final BitSet FOLLOW_AND_in_andTerm143 = new BitSet(new long[]{0x0000000000000140L});
428    public static final BitSet FOLLOW_atom_in_andTerm146 = new BitSet(new long[]{0x0000000000000022L});
429    public static final BitSet FOLLOW_ALPHA_in_atom160 = new BitSet(new long[]{0x0000000000000002L});
430    public static final BitSet FOLLOW_LP_in_atom165 = new BitSet(new long[]{0x0000000000000140L});
431    public static final BitSet FOLLOW_orTerm_in_atom168 = new BitSet(new long[]{0x0000000000000080L});
432    public static final BitSet FOLLOW_RP_in_atom170 = new BitSet(new long[]{0x0000000000000002L});
433   
434    }