KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > odmg > oql > OQLLexer


1 // $ANTLR 2.7.5 (20050128): "oql-ojb.g" -> "OQLLexer.java"$
2

3 /* Copyright 2003-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.ojb.odmg.oql;
19
20
21 import java.io.InputStream JavaDoc;
22 import java.io.Reader JavaDoc;
23 import java.util.Hashtable JavaDoc;
24
25 import antlr.ANTLRHashString;
26 import antlr.ByteBuffer;
27 import antlr.CharBuffer;
28 import antlr.CharStreamException;
29 import antlr.CharStreamIOException;
30 import antlr.InputBuffer;
31 import antlr.LexerSharedInputState;
32 import antlr.NoViableAltForCharException;
33 import antlr.RecognitionException;
34 import antlr.Token;
35 import antlr.TokenStream;
36 import antlr.TokenStreamException;
37 import antlr.TokenStreamIOException;
38 import antlr.TokenStreamRecognitionException;
39 import antlr.collections.impl.BitSet;
40
41 /**
42  * This OQL grammar has been derived from a OQL sample grammar from the ODMG
43  * WebSite. The original grammar is copyright protected by MicroData Base
44  * Systems: Copyright (c) 1999 Micro Data Base Systems, Inc. All rights
45  * reserved.
46  *
47  * The original grammar has been modified to fit into the OJB
48  * Persistence Managment System.
49  *
50  * Modifications done by Ch. Rath, Th. Mahler, S. Harris and many others.
51  *
52  * This grammar can be used to build an OQL Parser with the ANTLR Parser
53  * construction set.
54  * The grammar defines a Parser that translates valid OQL Strings
55  * into ojb.broker.query.Query Objects. These query objects can be used
56  * to perform database queries by means of the OJB PersistenceBroker.
57  * @see org.apache.ojb.odmg.oql.OQLQueryImpl for implementation details.
58  * @version $Id: OQLLexer.java,v 1.19.2.3 2005/08/17 13:54:35 aclute Exp $
59  */

60 public class OQLLexer extends antlr.CharScanner implements OQLLexerTokenTypes, TokenStream
61  {
62 public OQLLexer(InputStream JavaDoc in) {
63     this(new ByteBuffer(in));
64 }
65 public OQLLexer(Reader JavaDoc in) {
66     this(new CharBuffer(in));
67 }
68 public OQLLexer(InputBuffer ib) {
69     this(new LexerSharedInputState(ib));
70 }
71 public OQLLexer(LexerSharedInputState state) {
72     super(state);
73     caseSensitiveLiterals = true;
74     setCaseSensitive(true);
75     literals = new Hashtable JavaDoc();
76     literals.put(new ANTLRHashString("nil", this), new Integer JavaDoc(52));
77     literals.put(new ANTLRHashString("group", this), new Integer JavaDoc(44));
78     literals.put(new ANTLRHashString("between", this), new Integer JavaDoc(55));
79     literals.put(new ANTLRHashString("date", this), new Integer JavaDoc(61));
80     literals.put(new ANTLRHashString("select", this), new Integer JavaDoc(38));
81     literals.put(new ANTLRHashString("timestamp", this), new Integer JavaDoc(63));
82     literals.put(new ANTLRHashString("like", this), new Integer JavaDoc(58));
83     literals.put(new ANTLRHashString("is_undefined", this), new Integer JavaDoc(56));
84     literals.put(new ANTLRHashString("asc", this), new Integer JavaDoc(48));
85     literals.put(new ANTLRHashString("or", this), new Integer JavaDoc(50));
86     literals.put(new ANTLRHashString("in", this), new Integer JavaDoc(47));
87     literals.put(new ANTLRHashString("list", this), new Integer JavaDoc(54));
88     literals.put(new ANTLRHashString("from", this), new Integer JavaDoc(40));
89     literals.put(new ANTLRHashString("desc", this), new Integer JavaDoc(49));
90     literals.put(new ANTLRHashString("true", this), new Integer JavaDoc(59));
91     literals.put(new ANTLRHashString("by", this), new Integer JavaDoc(43));
92     literals.put(new ANTLRHashString("not", this), new Integer JavaDoc(53));
93     literals.put(new ANTLRHashString("and", this), new Integer JavaDoc(51));
94     literals.put(new ANTLRHashString("distinct", this), new Integer JavaDoc(39));
95     literals.put(new ANTLRHashString("prefetch", this), new Integer JavaDoc(45));
96     literals.put(new ANTLRHashString("false", this), new Integer JavaDoc(60));
97     literals.put(new ANTLRHashString("time", this), new Integer JavaDoc(62));
98     literals.put(new ANTLRHashString("order", this), new Integer JavaDoc(42));
99     literals.put(new ANTLRHashString("where", this), new Integer JavaDoc(41));
100     literals.put(new ANTLRHashString("exists", this), new Integer JavaDoc(46));
101     literals.put(new ANTLRHashString("is_defined", this), new Integer JavaDoc(57));
102 }
103
104 public Token nextToken() throws TokenStreamException {
105     Token theRetToken=null;
106 tryAgain:
107     for (;;) {
108         Token _token = null;
109         int _ttype = Token.INVALID_TYPE;
110         resetText();
111         try { // for char stream error handling
112
try { // for lexical error handling
113
switch ( LA(1)) {
114                 case ')':
115                 {
116                     mTOK_RPAREN(true);
117                     theRetToken=_returnToken;
118                     break;
119                 }
120                 case '(':
121                 {
122                     mTOK_LPAREN(true);
123                     theRetToken=_returnToken;
124                     break;
125                 }
126                 case ',':
127                 {
128                     mTOK_COMMA(true);
129                     theRetToken=_returnToken;
130                     break;
131                 }
132                 case ';':
133                 {
134                     mTOK_SEMIC(true);
135                     theRetToken=_returnToken;
136                     break;
137                 }
138                 case ':':
139                 {
140                     mTOK_COLON(true);
141                     theRetToken=_returnToken;
142                     break;
143                 }
144                 case '|':
145                 {
146                     mTOK_CONCAT(true);
147                     theRetToken=_returnToken;
148                     break;
149                 }
150                 case '=':
151                 {
152                     mTOK_EQ(true);
153                     theRetToken=_returnToken;
154                     break;
155                 }
156                 case '+':
157                 {
158                     mTOK_PLUS(true);
159                     theRetToken=_returnToken;
160                     break;
161                 }
162                 case '*':
163                 {
164                     mTOK_STAR(true);
165                     theRetToken=_returnToken;
166                     break;
167                 }
168                 case '!':
169                 {
170                     mTOK_NE2(true);
171                     theRetToken=_returnToken;
172                     break;
173                 }
174                 case '[':
175                 {
176                     mTOK_LBRACK(true);
177                     theRetToken=_returnToken;
178                     break;
179                 }
180                 case ']':
181                 {
182                     mTOK_RBRACK(true);
183                     theRetToken=_returnToken;
184                     break;
185                 }
186                 case '\'':
187                 {
188                     mCharLiteral(true);
189                     theRetToken=_returnToken;
190                     break;
191                 }
192                 case '"':
193                 {
194                     mStringLiteral(true);
195                     theRetToken=_returnToken;
196                     break;
197                 }
198                 case '\t': case '\r': case ' ':
199                 {
200                     mWhiteSpace(true);
201                     theRetToken=_returnToken;
202                     break;
203                 }
204                 case '\n':
205                 {
206                     mNewLine(true);
207                     theRetToken=_returnToken;
208                     break;
209                 }
210                 default:
211                     if ((LA(1)=='-') && (LA(2)=='>')) {
212                         mTOK_INDIRECT(true);
213                         theRetToken=_returnToken;
214                     }
215                     else if ((LA(1)=='<') && (LA(2)=='=')) {
216                         mTOK_LE(true);
217                         theRetToken=_returnToken;
218                     }
219                     else if ((LA(1)=='>') && (LA(2)=='=')) {
220                         mTOK_GE(true);
221                         theRetToken=_returnToken;
222                     }
223                     else if ((LA(1)=='<') && (LA(2)=='>')) {
224                         mTOK_NE(true);
225                         theRetToken=_returnToken;
226                     }
227                     else if ((LA(1)=='/') && (LA(2)=='/')) {
228                         mCommentLine(true);
229                         theRetToken=_returnToken;
230                     }
231                     else if ((LA(1)=='/') && (LA(2)=='*')) {
232                         mMultiLineComment(true);
233                         theRetToken=_returnToken;
234                     }
235                     else if ((LA(1)=='.') && (true)) {
236                         mTOK_DOT(true);
237                         theRetToken=_returnToken;
238                     }
239                     else if ((LA(1)=='-') && (true)) {
240                         mTOK_MINUS(true);
241                         theRetToken=_returnToken;
242                     }
243                     else if ((LA(1)=='/') && (true)) {
244                         mTOK_SLASH(true);
245                         theRetToken=_returnToken;
246                     }
247                     else if ((LA(1)=='<') && (true)) {
248                         mTOK_LT(true);
249                         theRetToken=_returnToken;
250                     }
251                     else if ((LA(1)=='>') && (true)) {
252                         mTOK_GT(true);
253                         theRetToken=_returnToken;
254                     }
255                     else if ((LA(1)=='$') && (true)) {
256                         mTOK_DOLLAR(true);
257                         theRetToken=_returnToken;
258                     }
259                     else if ((_tokenSet_0.member(LA(1))) && (true)) {
260                         mIdentifier(true);
261                         theRetToken=_returnToken;
262                     }
263                     else if ((_tokenSet_1.member(LA(1))) && (true)) {
264                         mTOK_EXACT_NUMERIC_LITERAL(true);
265                         theRetToken=_returnToken;
266                     }
267                 else {
268                     if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
269                 else {throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
270                 }
271                 }
272                 if ( _returnToken==null ) continue tryAgain; // found SKIP token
273
_ttype = _returnToken.getType();
274                 _returnToken.setType(_ttype);
275                 return _returnToken;
276             }
277             catch (RecognitionException e) {
278                 throw new TokenStreamRecognitionException(e);
279             }
280         }
281         catch (CharStreamException cse) {
282             if ( cse instanceof CharStreamIOException ) {
283                 throw new TokenStreamIOException(((CharStreamIOException)cse).io);
284             }
285             else {
286                 throw new TokenStreamException(cse.getMessage());
287             }
288         }
289     }
290 }
291
292     public final void mTOK_RPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
293         int _ttype; Token _token=null; int _begin=text.length();
294         _ttype = TOK_RPAREN;
295         int _saveIndex;
296         
297         match(')');
298         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
299             _token = makeToken(_ttype);
300             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
301         }
302         _returnToken = _token;
303     }
304     
305     public final void mTOK_LPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
306         int _ttype; Token _token=null; int _begin=text.length();
307         _ttype = TOK_LPAREN;
308         int _saveIndex;
309         
310         match('(');
311         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
312             _token = makeToken(_ttype);
313             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
314         }
315         _returnToken = _token;
316     }
317     
318     public final void mTOK_COMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
319         int _ttype; Token _token=null; int _begin=text.length();
320         _ttype = TOK_COMMA;
321         int _saveIndex;
322         
323         match(',');
324         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
325             _token = makeToken(_ttype);
326             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
327         }
328         _returnToken = _token;
329     }
330     
331     public final void mTOK_SEMIC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
332         int _ttype; Token _token=null; int _begin=text.length();
333         _ttype = TOK_SEMIC;
334         int _saveIndex;
335         
336         match(';');
337         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
338             _token = makeToken(_ttype);
339             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
340         }
341         _returnToken = _token;
342     }
343     
344     public final void mTOK_COLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
345         int _ttype; Token _token=null; int _begin=text.length();
346         _ttype = TOK_COLON;
347         int _saveIndex;
348         
349         match(':');
350         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
351             _token = makeToken(_ttype);
352             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
353         }
354         _returnToken = _token;
355     }
356     
357     public final void mTOK_DOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
358         int _ttype; Token _token=null; int _begin=text.length();
359         _ttype = TOK_DOT;
360         int _saveIndex;
361         
362         match('.');
363         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
364             _token = makeToken(_ttype);
365             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
366         }
367         _returnToken = _token;
368     }
369     
370     public final void mTOK_INDIRECT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
371         int _ttype; Token _token=null; int _begin=text.length();
372         _ttype = TOK_INDIRECT;
373         int _saveIndex;
374         
375         match('-');
376         match('>');
377         _ttype = TOK_DOT;
378         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
379             _token = makeToken(_ttype);
380             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
381         }
382         _returnToken = _token;
383     }
384     
385     public final void mTOK_CONCAT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
386         int _ttype; Token _token=null; int _begin=text.length();
387         _ttype = TOK_CONCAT;
388         int _saveIndex;
389         
390         match('|');
391         match('|');
392         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
393             _token = makeToken(_ttype);
394             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
395         }
396         _returnToken = _token;
397     }
398     
399     public final void mTOK_EQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
400         int _ttype; Token _token=null; int _begin=text.length();
401         _ttype = TOK_EQ;
402         int _saveIndex;
403         
404         match('=');
405         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
406             _token = makeToken(_ttype);
407             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
408         }
409         _returnToken = _token;
410     }
411     
412     public final void mTOK_PLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
413         int _ttype; Token _token=null; int _begin=text.length();
414         _ttype = TOK_PLUS;
415         int _saveIndex;
416         
417         match('+');
418         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
419             _token = makeToken(_ttype);
420             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
421         }
422         _returnToken = _token;
423     }
424     
425     public final void mTOK_MINUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
426         int _ttype; Token _token=null; int _begin=text.length();
427         _ttype = TOK_MINUS;
428         int _saveIndex;
429         
430         match('-');
431         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
432             _token = makeToken(_ttype);
433             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
434         }
435         _returnToken = _token;
436     }
437     
438     public final void mTOK_SLASH(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
439         int _ttype; Token _token=null; int _begin=text.length();
440         _ttype = TOK_SLASH;
441         int _saveIndex;
442         
443         match('/');
444         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
445             _token = makeToken(_ttype);
446             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
447         }
448         _returnToken = _token;
449     }
450     
451     public final void mTOK_STAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
452         int _ttype; Token _token=null; int _begin=text.length();
453         _ttype = TOK_STAR;
454         int _saveIndex;
455         
456         match('*');
457         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
458             _token = makeToken(_ttype);
459             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
460         }
461         _returnToken = _token;
462     }
463     
464     public final void mTOK_LE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
465         int _ttype; Token _token=null; int _begin=text.length();
466         _ttype = TOK_LE;
467         int _saveIndex;
468         
469         match('<');
470         match('=');
471         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
472             _token = makeToken(_ttype);
473             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
474         }
475         _returnToken = _token;
476     }
477     
478     public final void mTOK_GE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
479         int _ttype; Token _token=null; int _begin=text.length();
480         _ttype = TOK_GE;
481         int _saveIndex;
482         
483         match('>');
484         match('=');
485         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
486             _token = makeToken(_ttype);
487             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
488         }
489         _returnToken = _token;
490     }
491     
492     public final void mTOK_NE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
493         int _ttype; Token _token=null; int _begin=text.length();
494         _ttype = TOK_NE;
495         int _saveIndex;
496         
497         match('<');
498         match('>');
499         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
500             _token = makeToken(_ttype);
501             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
502         }
503         _returnToken = _token;
504     }
505     
506     public final void mTOK_NE2(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
507         int _ttype; Token _token=null; int _begin=text.length();
508         _ttype = TOK_NE2;
509         int _saveIndex;
510         
511         match('!');
512         match('=');
513         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
514             _token = makeToken(_ttype);
515             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
516         }
517         _returnToken = _token;
518     }
519     
520     public final void mTOK_LT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
521         int _ttype; Token _token=null; int _begin=text.length();
522         _ttype = TOK_LT;
523         int _saveIndex;
524         
525         match('<');
526         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
527             _token = makeToken(_ttype);
528             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
529         }
530         _returnToken = _token;
531     }
532     
533     public final void mTOK_GT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
534         int _ttype; Token _token=null; int _begin=text.length();
535         _ttype = TOK_GT;
536         int _saveIndex;
537         
538         match('>');
539         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
540             _token = makeToken(_ttype);
541             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
542         }
543         _returnToken = _token;
544     }
545     
546     public final void mTOK_LBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
547         int _ttype; Token _token=null; int _begin=text.length();
548         _ttype = TOK_LBRACK;
549         int _saveIndex;
550         
551         match('[');
552         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
553             _token = makeToken(_ttype);
554             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
555         }
556         _returnToken = _token;
557     }
558     
559     public final void mTOK_RBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
560         int _ttype; Token _token=null; int _begin=text.length();
561         _ttype = TOK_RBRACK;
562         int _saveIndex;
563         
564         match(']');
565         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
566             _token = makeToken(_ttype);
567             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
568         }
569         _returnToken = _token;
570     }
571     
572     public final void mTOK_DOLLAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
573         int _ttype; Token _token=null; int _begin=text.length();
574         _ttype = TOK_DOLLAR;
575         int _saveIndex;
576         
577         match('$');
578         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
579             _token = makeToken(_ttype);
580             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
581         }
582         _returnToken = _token;
583     }
584     
585     protected final void mNameFirstCharacter(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
586         int _ttype; Token _token=null; int _begin=text.length();
587         _ttype = NameFirstCharacter;
588         int _saveIndex;
589         
590         {
591         switch ( LA(1)) {
592         case 'A': case 'B': case 'C': case 'D':
593         case 'E': case 'F': case 'G': case 'H':
594         case 'I': case 'J': case 'K': case 'L':
595         case 'M': case 'N': case 'O': case 'P':
596         case 'Q': case 'R': case 'S': case 'T':
597         case 'U': case 'V': case 'W': case 'X':
598         case 'Y': case 'Z':
599         {
600             matchRange('A','Z');
601             break;
602         }
603         case 'a': case 'b': case 'c': case 'd':
604         case 'e': case 'f': case 'g': case 'h':
605         case 'i': case 'j': case 'k': case 'l':
606         case 'm': case 'n': case 'o': case 'p':
607         case 'q': case 'r': case 's': case 't':
608         case 'u': case 'v': case 'w': case 'x':
609         case 'y': case 'z':
610         {
611             matchRange('a','z');
612             break;
613         }
614         case '_':
615         {
616             match('_');
617             break;
618         }
619         case '.':
620         {
621             mTOK_DOT(false);
622             break;
623         }
624         case '-':
625         {
626             mTOK_INDIRECT(false);
627             break;
628         }
629         case '$':
630         {
631             mTOK_DOLLAR(false);
632             break;
633         }
634         default:
635         {
636             throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
637         }
638         }
639         }
640         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
641             _token = makeToken(_ttype);
642             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
643         }
644         _returnToken = _token;
645     }
646     
647     protected final void mNameCharacter(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
648         int _ttype; Token _token=null; int _begin=text.length();
649         _ttype = NameCharacter;
650         int _saveIndex;
651         
652         {
653         switch ( LA(1)) {
654         case '$': case '-': case '.': case 'A':
655         case 'B': case 'C': case 'D': case 'E':
656         case 'F': case 'G': case 'H': case 'I':
657         case 'J': case 'K': case 'L': case 'M':
658         case 'N': case 'O': case 'P': case 'Q':
659         case 'R': case 'S': case 'T': case 'U':
660         case 'V': case 'W': case 'X': case 'Y':
661         case 'Z': case '_': case 'a': case 'b':
662         case 'c': case 'd': case 'e': case 'f':
663         case 'g': case 'h': case 'i': case 'j':
664         case 'k': case 'l': case 'm': case 'n':
665         case 'o': case 'p': case 'q': case 'r':
666         case 's': case 't': case 'u': case 'v':
667         case 'w': case 'x': case 'y': case 'z':
668         {
669             mNameFirstCharacter(false);
670             break;
671         }
672         case '0': case '1': case '2': case '3':
673         case '4': case '5': case '6': case '7':
674         case '8': case '9':
675         {
676             matchRange('0','9');
677             break;
678         }
679         default:
680         {
681             throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
682         }
683         }
684         }
685         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
686             _token = makeToken(_ttype);
687             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
688         }
689         _returnToken = _token;
690     }
691     
692     public final void mIdentifier(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
693         int _ttype; Token _token=null; int _begin=text.length();
694         _ttype = Identifier;
695         int _saveIndex;
696         
697         mNameFirstCharacter(false);
698         {
699         _loop29:
700         do {
701             if ((_tokenSet_2.member(LA(1)))) {
702                 mNameCharacter(false);
703             }
704             else {
705                 break _loop29;
706             }
707             
708         } while (true);
709         }
710         _ttype = testLiteralsTable(_ttype);
711         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
712             _token = makeToken(_ttype);
713             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
714         }
715         _returnToken = _token;
716     }
717     
718     protected final void mTOK_UNSIGNED_INTEGER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
719         int _ttype; Token _token=null; int _begin=text.length();
720         _ttype = TOK_UNSIGNED_INTEGER;
721         int _saveIndex;
722         
723         matchRange('0','9');
724         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
725             _token = makeToken(_ttype);
726             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
727         }
728         _returnToken = _token;
729     }
730     
731     protected final void mTOK_APPROXIMATE_NUMERIC_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
732         int _ttype; Token _token=null; int _begin=text.length();
733         _ttype = TOK_APPROXIMATE_NUMERIC_LITERAL;
734         int _saveIndex;
735         
736         match('e');
737         {
738         switch ( LA(1)) {
739         case '+':
740         {
741             match('+');
742             break;
743         }
744         case '-':
745         {
746             match('-');
747             break;
748         }
749         case '0': case '1': case '2': case '3':
750         case '4': case '5': case '6': case '7':
751         case '8': case '9':
752         {
753             break;
754         }
755         default:
756         {
757             throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
758         }
759         }
760         }
761         {
762         int _cnt34=0;
763         _loop34:
764         do {
765             if (((LA(1) >= '0' && LA(1) <= '9'))) {
766                 matchRange('0','9');
767             }
768             else {
769                 if ( _cnt34>=1 ) { break _loop34; } else {throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
770             }
771             
772             _cnt34++;
773         } while (true);
774         }
775         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
776             _token = makeToken(_ttype);
777             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
778         }
779         _returnToken = _token;
780     }
781     
782     public final void mTOK_EXACT_NUMERIC_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
783         int _ttype; Token _token=null; int _begin=text.length();
784         _ttype = TOK_EXACT_NUMERIC_LITERAL;
785         int _saveIndex;
786         
787         switch ( LA(1)) {
788         case '.':
789         {
790             match('.');
791             {
792             int _cnt37=0;
793             _loop37:
794             do {
795                 if (((LA(1) >= '0' && LA(1) <= '9'))) {
796                     mTOK_UNSIGNED_INTEGER(false);
797                 }
798                 else {
799                     if ( _cnt37>=1 ) { break _loop37; } else {throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
800                 }
801                 
802                 _cnt37++;
803             } while (true);
804             }
805             _ttype = TOK_EXACT_NUMERIC_LITERAL;
806             {
807             if ((LA(1)=='e')) {
808                 mTOK_APPROXIMATE_NUMERIC_LITERAL(false);
809                 _ttype = TOK_APPROXIMATE_NUMERIC_LITERAL;
810             }
811             else {
812             }
813             
814             }
815             break;
816         }
817         case '0': case '1': case '2': case '3':
818         case '4': case '5': case '6': case '7':
819         case '8': case '9':
820         {
821             {
822             int _cnt40=0;
823             _loop40:
824             do {
825                 if (((LA(1) >= '0' && LA(1) <= '9'))) {
826                     mTOK_UNSIGNED_INTEGER(false);
827                 }
828                 else {
829                     if ( _cnt40>=1 ) { break _loop40; } else {throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
830                 }
831                 
832                 _cnt40++;
833             } while (true);
834             }
835             _ttype = TOK_UNSIGNED_INTEGER;
836             {
837             switch ( LA(1)) {
838             case '.':
839             {
840                 match('.');
841                 {
842                 _loop43:
843                 do {
844                     if (((LA(1) >= '0' && LA(1) <= '9'))) {
845                         mTOK_UNSIGNED_INTEGER(false);
846                     }
847                     else {
848                         break _loop43;
849                     }
850                     
851                 } while (true);
852                 }
853                 _ttype = TOK_EXACT_NUMERIC_LITERAL;
854                 {
855                 if ((LA(1)=='e')) {
856                     mTOK_APPROXIMATE_NUMERIC_LITERAL(false);
857                     _ttype = TOK_APPROXIMATE_NUMERIC_LITERAL;
858                 }
859                 else {
860                 }
861                 
862                 }
863                 break;
864             }
865             case 'e':
866             {
867                 mTOK_APPROXIMATE_NUMERIC_LITERAL(false);
868                 _ttype = TOK_APPROXIMATE_NUMERIC_LITERAL;
869                 break;
870             }
871             default:
872                 {
873                 }
874             }
875             }
876             break;
877         }
878         default:
879         {
880             throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
881         }
882         }
883         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
884             _token = makeToken(_ttype);
885             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
886         }
887         _returnToken = _token;
888     }
889     
890     public final void mCharLiteral(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
891         int _ttype; Token _token=null; int _begin=text.length();
892         _ttype = CharLiteral;
893         int _saveIndex;
894         
895         _saveIndex=text.length();
896         match('\'');
897         text.setLength(_saveIndex);
898         {
899         _loop48:
900         do {
901             if ((LA(1)=='\'') && (LA(2)=='\'')) {
902                 match('\'');
903                 match('\'');
904                 text.setLength(_begin); text.append("'");
905             }
906             else if ((LA(1)=='\n')) {
907                 match('\n');
908                 newline();
909             }
910             else if ((_tokenSet_3.member(LA(1)))) {
911                 {
912                 match(_tokenSet_3);
913                 }
914             }
915             else {
916                 break _loop48;
917             }
918             
919         } while (true);
920         }
921         _saveIndex=text.length();
922         match('\'');
923         text.setLength(_saveIndex);
924         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
925             _token = makeToken(_ttype);
926             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
927         }
928         _returnToken = _token;
929     }
930     
931     public final void mStringLiteral(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
932         int _ttype; Token _token=null; int _begin=text.length();
933         _ttype = StringLiteral;
934         int _saveIndex;
935         
936         _saveIndex=text.length();
937         match('"');
938         text.setLength(_saveIndex);
939         {
940         _loop52:
941         do {
942             if ((LA(1)=='\\') && (LA(2)=='"')) {
943                 match('\\');
944                 match('"');
945                 text.setLength(_begin); text.append("\"");
946             }
947             else if ((_tokenSet_4.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe'))) {
948                 {
949                 match(_tokenSet_4);
950                 }
951             }
952             else if ((LA(1)=='\n')) {
953                 match('\n');
954                 newline();
955             }
956             else {
957                 break _loop52;
958             }
959             
960         } while (true);
961         }
962         _saveIndex=text.length();
963         match('"');
964         text.setLength(_saveIndex);
965         if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
966             _token = makeToken(_ttype);
967             _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
968         }
969         _returnToken = _token;
970     }
971     
972     public final void mWhiteSpace(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
973         int _ttype; Token _token=null; int _begin=text.length();
974         _ttype = WhiteSpace;
975         int _saveIndex;
976         
977         {
978         switch ( LA(1)) {
979         case ' ':
980         {
981             match(' ');
982             break;
983         }
984         case '\t':
985         {
986             match('\t');
987             break;
988         }
989         case '\r':
990         {
991             match('\r');
992             break;
993         }
994         default:
995         {
996             throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
997         }
998         }
999         }
1000        _ttype = Token.SKIP;
1001        if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1002            _token = makeToken(_ttype);
1003            _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
1004        }
1005        _returnToken = _token;
1006    }
1007    
1008    public final void mNewLine(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1009        int _ttype; Token _token=null; int _begin=text.length();
1010        _ttype = NewLine;
1011        int _saveIndex;
1012        
1013        match('\n');
1014        newline(); _ttype = Token.SKIP;
1015        if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1016            _token = makeToken(_ttype);
1017            _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
1018        }
1019        _returnToken = _token;
1020    }
1021    
1022    public final void mCommentLine(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1023        int _ttype; Token _token=null; int _begin=text.length();
1024        _ttype = CommentLine;
1025        int _saveIndex;
1026        
1027        _saveIndex=text.length();
1028        match('/');
1029        text.setLength(_saveIndex);
1030        _saveIndex=text.length();
1031        match('/');
1032        text.setLength(_saveIndex);
1033        {
1034        _loop58:
1035        do {
1036            if ((_tokenSet_5.member(LA(1)))) {
1037                _saveIndex=text.length();
1038                matchNot('\n');
1039                text.setLength(_saveIndex);
1040            }
1041            else {
1042                break _loop58;
1043            }
1044            
1045        } while (true);
1046        }
1047        _saveIndex=text.length();
1048        match('\n');
1049        text.setLength(_saveIndex);
1050        newline(); _ttype = Token.SKIP;
1051        if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1052            _token = makeToken(_ttype);
1053            _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
1054        }
1055        _returnToken = _token;
1056    }
1057    
1058    public final void mMultiLineComment(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1059        int _ttype; Token _token=null; int _begin=text.length();
1060        _ttype = MultiLineComment;
1061        int _saveIndex;
1062        
1063        match("/*");
1064        {
1065        _loop62:
1066        do {
1067            if (((LA(1)=='*') && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe')))&&( LA(2)!='/' )) {
1068                match('*');
1069            }
1070            else if ((LA(1)=='\n')) {
1071                match('\n');
1072                newline();
1073            }
1074            else if ((_tokenSet_6.member(LA(1)))) {
1075                {
1076                match(_tokenSet_6);
1077                }
1078            }
1079            else {
1080                break _loop62;
1081            }
1082            
1083        } while (true);
1084        }
1085        match("*/");
1086        _ttype = Token.SKIP;
1087        if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1088            _token = makeToken(_ttype);
1089            _token.setText(new String JavaDoc(text.getBuffer(), _begin, text.length()-_begin));
1090        }
1091        _returnToken = _token;
1092    }
1093    
1094    
1095    private static final long[] mk_tokenSet_0() {
1096        long[] data = new long[1025];
1097        data[0]=105621835743232L;
1098        data[1]=576460745995190270L;
1099        return data;
1100    }
1101    public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
1102    private static final long[] mk_tokenSet_1() {
1103        long[] data = new long[1025];
1104        data[0]=288019269919178752L;
1105        return data;
1106    }
1107    public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
1108    private static final long[] mk_tokenSet_2() {
1109        long[] data = new long[1025];
1110        data[0]=288054523010744320L;
1111        data[1]=576460745995190270L;
1112        return data;
1113    }
1114    public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
1115    private static final long[] mk_tokenSet_3() {
1116        long[] data = new long[2048];
1117        data[0]=-549755814920L;
1118        for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1119        data[1023]=9223372036854775807L;
1120        return data;
1121    }
1122    public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
1123    private static final long[] mk_tokenSet_4() {
1124        long[] data = new long[2048];
1125        data[0]=-17179870216L;
1126        for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1127        data[1023]=9223372036854775807L;
1128        return data;
1129    }
1130    public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
1131    private static final long[] mk_tokenSet_5() {
1132        long[] data = new long[2048];
1133        data[0]=-1032L;
1134        for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1135        data[1023]=9223372036854775807L;
1136        return data;
1137    }
1138    public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
1139    private static final long[] mk_tokenSet_6() {
1140        long[] data = new long[2048];
1141        data[0]=-4398046512136L;
1142        for (int i = 1; i<=1022; i++) { data[i]=-1L; }
1143        data[1023]=9223372036854775807L;
1144        return data;
1145    }
1146    public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
1147    
1148    }
1149
Popular Tags