View Javadoc

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 org.antlr.runtime.CharStream;
20  import org.antlr.runtime.EarlyExitException;
21  import org.antlr.runtime.Lexer;
22  import org.antlr.runtime.MismatchedSetException;
23  import org.antlr.runtime.NoViableAltException;
24  import org.antlr.runtime.RecognitionException;
25  import org.antlr.runtime.RecognizerSharedState;
26  
27  public class BooleanFunctionLexer extends Lexer {
28      public static final int UPPERCASE=9;
29      public static final int LOWERCASE=12;
30      public static final int RP=7;
31      public static final int OR=4;
32      public static final int LP=6;
33      public static final int NUMBER=10;
34      public static final int WHITESPACE=11;
35      public static final int AND=5;
36      public static final int EOF=-1;
37      public static final int ALPHA=8;
38  
39      // delegates
40      // delegators
41  
42      public BooleanFunctionLexer() {;}
43      public BooleanFunctionLexer(CharStream input) {
44          this(input, new RecognizerSharedState());
45      }
46      public BooleanFunctionLexer(CharStream input, RecognizerSharedState state) {
47          super(input,state);
48  
49      }
50      public String getGrammarFileName() { return "BooleanFunction.g"; }
51  
52      // $ANTLR start "OR"
53      public final void mOR() throws RecognitionException {
54          try {
55              int _type = OR;
56              int _channel = DEFAULT_TOKEN_CHANNEL;
57              // BooleanFunction.g:5:4: ( '+' )
58              // BooleanFunction.g:5:6: '+'
59              {
60              match('+');
61  
62              }
63  
64              state.type = _type;
65              state.channel = _channel;
66          } catch (RecognitionException regEx) {
67              throw regEx;
68          }
69      }
70      // $ANTLR end "OR"
71  
72      // $ANTLR start "AND"
73      public final void mAND() throws RecognitionException {
74          try {
75              int _type = AND;
76              int _channel = DEFAULT_TOKEN_CHANNEL;
77              // BooleanFunction.g:6:5: ( '*' )
78              // BooleanFunction.g:6:7: '*'
79              {
80              match('*');
81  
82              }
83  
84              state.type = _type;
85              state.channel = _channel;
86          } catch (RecognitionException regEx) {
87              throw regEx;
88          }
89      }
90      // $ANTLR end "AND"
91  
92      // $ANTLR start "LP"
93      public final void mLP() throws RecognitionException {
94          try {
95              int _type = LP;
96              int _channel = DEFAULT_TOKEN_CHANNEL;
97              // BooleanFunction.g:7:4: ( '(' )
98              // BooleanFunction.g:7:6: '('
99              {
100             match('(');
101 
102             }
103 
104             state.type = _type;
105             state.channel = _channel;
106         } catch (RecognitionException regEx) {
107             throw regEx;
108         }
109     }
110     // $ANTLR end "LP"
111 
112     // $ANTLR start "RP"
113     public final void mRP() throws RecognitionException {
114         try {
115             int _type = RP;
116             int _channel = DEFAULT_TOKEN_CHANNEL;
117             // BooleanFunction.g:8:4: ( ')' )
118             // BooleanFunction.g:8:6: ')'
119             {
120             match(')');
121 
122             }
123 
124             state.type = _type;
125             state.channel = _channel;
126         } catch (RecognitionException regEx) {
127             throw regEx;
128         }
129     }
130     // $ANTLR end "RP"
131 
132     // $ANTLR start "ALPHA"
133     public final void mALPHA() throws RecognitionException {
134         try {
135             int _type = ALPHA;
136             int _channel = DEFAULT_TOKEN_CHANNEL;
137             // BooleanFunction.g:69:9: ( UPPERCASE | ( UPPERCASE NUMBER ) )
138             int alt1=2;
139             int LA1_0 = input.LA(1);
140 
141             if ( ((LA1_0>='A' && LA1_0<='Z')) ) {
142                 int LA1_1 = input.LA(2);
143 
144                 if ( ((LA1_1>='0' && LA1_1<='9')) ) {
145                     alt1=2;
146                 }
147                 else {
148                     alt1=1;}
149             }
150             else {
151                 NoViableAltException nvae =
152                     new NoViableAltException("", 1, 0, input);
153 
154                 throw nvae;
155             }
156             switch (alt1) {
157                 case 1 :
158                     // BooleanFunction.g:69:11: UPPERCASE
159                     {
160                     mUPPERCASE();
161 
162                     }
163                     break;
164                 case 2 :
165                     // BooleanFunction.g:69:23: ( UPPERCASE NUMBER )
166                     {
167                     // BooleanFunction.g:69:23: ( UPPERCASE NUMBER )
168                     // BooleanFunction.g:69:24: UPPERCASE NUMBER
169                     {
170                     mUPPERCASE();
171                     mNUMBER();
172 
173                     }
174 
175 
176                     }
177                     break;
178 
179             }
180             state.type = _type;
181             state.channel = _channel;
182         } catch (RecognitionException regEx) {
183             throw regEx;
184         }
185     }
186     // $ANTLR end "ALPHA"
187 
188     // $ANTLR start "NUMBER"
189     public final void mNUMBER() throws RecognitionException {
190         try {
191             int _type = NUMBER;
192             int _channel = DEFAULT_TOKEN_CHANNEL;
193             // BooleanFunction.g:71:9: ( ( '0' .. '9' )+ )
194             // BooleanFunction.g:71:11: ( '0' .. '9' )+
195             {
196             // BooleanFunction.g:71:11: ( '0' .. '9' )+
197             int cnt2=0;
198             loop2:
199             do {
200                 int alt2=2;
201                 int LA2_0 = input.LA(1);
202 
203                 if ( ((LA2_0>='0' && LA2_0<='9')) ) {
204                     alt2=1;
205                 }
206 
207 
208                 switch (alt2) {
209             	case 1 :
210             	    // BooleanFunction.g:71:12: '0' .. '9'
211             	    {
212             	    matchRange('0','9');
213 
214             	    }
215             	    break;
216 
217             	default :
218             	    if ( cnt2 >= 1 ) break loop2;
219                         EarlyExitException eee =
220                             new EarlyExitException(2, input);
221                         throw eee;
222                 }
223                 cnt2++;
224             } while (true);
225 
226 
227             }
228 
229             state.type = _type;
230             state.channel = _channel;
231         } catch (RecognitionException regEx) {
232             throw regEx;
233         }
234     }
235     // $ANTLR end "NUMBER"
236 
237     // $ANTLR start "WHITESPACE"
238     public final void mWHITESPACE() throws RecognitionException {
239         try {
240             int _type = WHITESPACE;
241             int _channel = DEFAULT_TOKEN_CHANNEL;
242             // BooleanFunction.g:73:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' )+ )
243             // BooleanFunction.g:73:14: ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' )+
244             {
245             // BooleanFunction.g:73:14: ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' )+
246             int cnt3=0;
247             loop3:
248             do {
249                 int alt3=2;
250                 int LA3_0 = input.LA(1);
251 
252                 if ( ((LA3_0>='\t' && LA3_0<='\n')||(LA3_0>='\f' && LA3_0<='\r')||LA3_0==' ') ) {
253                     alt3=1;
254                 }
255 
256 
257                 switch (alt3) {
258             	case 1 :
259             	    // BooleanFunction.g:
260             	    {
261             	    if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||(input.LA(1)>='\f' && input.LA(1)<='\r')||input.LA(1)==' ' ) {
262             	        input.consume();
263 
264             	    }
265             	    else {
266             	        MismatchedSetException mse = new MismatchedSetException(null,input);
267             	        recover(mse);
268             	        throw mse;}
269 
270 
271             	    }
272             	    break;
273 
274             	default :
275             	    if ( cnt3 >= 1 ) break loop3;
276                         EarlyExitException eee =
277                             new EarlyExitException(3, input);
278                         throw eee;
279                 }
280                 cnt3++;
281             } while (true);
282 
283              _channel = HIDDEN;
284 
285             }
286 
287             state.type = _type;
288             state.channel = _channel;
289         } catch (RecognitionException regEx) {
290             throw regEx;
291         }
292     }
293     // $ANTLR end "WHITESPACE"
294 
295     // $ANTLR start "LOWERCASE"
296     public final void mLOWERCASE() throws RecognitionException {
297         try {
298             int _type = LOWERCASE;
299             int _channel = DEFAULT_TOKEN_CHANNEL;
300             // BooleanFunction.g:75:11: ( 'a' .. 'z' )
301             // BooleanFunction.g:75:13: 'a' .. 'z'
302             {
303             matchRange('a','z');
304 
305             }
306 
307             state.type = _type;
308             state.channel = _channel;
309         } catch (RecognitionException regEx) {
310             throw regEx;
311         }
312     }
313     // $ANTLR end "LOWERCASE"
314 
315     // $ANTLR start "UPPERCASE"
316     public final void mUPPERCASE() throws RecognitionException {
317         try {
318             // BooleanFunction.g:77:20: ( 'A' .. 'Z' )
319             // BooleanFunction.g:77:22: 'A' .. 'Z'
320             {
321             matchRange('A','Z');
322 
323             }
324 
325         } catch (RecognitionException regEx) {
326             throw regEx;
327         }
328     }
329     // $ANTLR end "UPPERCASE"
330 
331     public void mTokens() throws RecognitionException {
332         // BooleanFunction.g:1:8: ( OR | AND | LP | RP | ALPHA | NUMBER | WHITESPACE | LOWERCASE )
333         int alt4=8;
334         switch ( input.LA(1) ) {
335         case '+':
336             {
337             alt4=1;
338             }
339             break;
340         case '*':
341             {
342             alt4=2;
343             }
344             break;
345         case '(':
346             {
347             alt4=3;
348             }
349             break;
350         case ')':
351             {
352             alt4=4;
353             }
354             break;
355         case 'A':
356         case 'B':
357         case 'C':
358         case 'D':
359         case 'E':
360         case 'F':
361         case 'G':
362         case 'H':
363         case 'I':
364         case 'J':
365         case 'K':
366         case 'L':
367         case 'M':
368         case 'N':
369         case 'O':
370         case 'P':
371         case 'Q':
372         case 'R':
373         case 'S':
374         case 'T':
375         case 'U':
376         case 'V':
377         case 'W':
378         case 'X':
379         case 'Y':
380         case 'Z':
381             {
382             alt4=5;
383             }
384             break;
385         case '0':
386         case '1':
387         case '2':
388         case '3':
389         case '4':
390         case '5':
391         case '6':
392         case '7':
393         case '8':
394         case '9':
395             {
396             alt4=6;
397             }
398             break;
399         case '\t':
400         case '\n':
401         case '\f':
402         case '\r':
403         case ' ':
404             {
405             alt4=7;
406             }
407             break;
408         case 'a':
409         case 'b':
410         case 'c':
411         case 'd':
412         case 'e':
413         case 'f':
414         case 'g':
415         case 'h':
416         case 'i':
417         case 'j':
418         case 'k':
419         case 'l':
420         case 'm':
421         case 'n':
422         case 'o':
423         case 'p':
424         case 'q':
425         case 'r':
426         case 's':
427         case 't':
428         case 'u':
429         case 'v':
430         case 'w':
431         case 'x':
432         case 'y':
433         case 'z':
434             {
435             alt4=8;
436             }
437             break;
438         default:
439             NoViableAltException nvae =
440                 new NoViableAltException("", 4, 0, input);
441 
442             throw nvae;
443         }
444 
445         switch (alt4) {
446             case 1 :
447                 // BooleanFunction.g:1:10: OR
448                 {
449                 mOR();
450 
451                 }
452                 break;
453             case 2 :
454                 // BooleanFunction.g:1:13: AND
455                 {
456                 mAND();
457 
458                 }
459                 break;
460             case 3 :
461                 // BooleanFunction.g:1:17: LP
462                 {
463                 mLP();
464 
465                 }
466                 break;
467             case 4 :
468                 // BooleanFunction.g:1:20: RP
469                 {
470                 mRP();
471 
472                 }
473                 break;
474             case 5 :
475                 // BooleanFunction.g:1:23: ALPHA
476                 {
477                 mALPHA();
478 
479                 }
480                 break;
481             case 6 :
482                 // BooleanFunction.g:1:29: NUMBER
483                 {
484                 mNUMBER();
485 
486                 }
487                 break;
488             case 7 :
489                 // BooleanFunction.g:1:36: WHITESPACE
490                 {
491                 mWHITESPACE();
492 
493                 }
494                 break;
495             case 8 :
496                 // BooleanFunction.g:1:47: LOWERCASE
497                 {
498                 mLOWERCASE();
499 
500                 }
501                 break;
502 
503         }
504 
505     }
506 
507 
508 
509 
510 }