KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > aspectwerkz > annotation > expression > ast > AnnotationParser


1 /* Generated By:JJTree&JavaCC: Do not edit this line. AnnotationParser.java */
2 /**************************************************************************************
3  * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
4  * http://aspectwerkz.codehaus.org *
5  * ---------------------------------------------------------------------------------- *
6  * The software in this package is published under the terms of the LGPL license *
7  * a copy of which has been included with this distribution in the license.txt file. *
8  **************************************************************************************/

9 package org.codehaus.aspectwerkz.annotation.expression.ast;
10
11 import java.lang.reflect.Modifier JavaDoc;
12 import java.io.Reader JavaDoc;
13 import java.io.StringReader JavaDoc;
14
15 /**
16  * The annotation parser.
17  *
18  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr</a>
19  */

20 public class AnnotationParser/*@bgen(jjtree)*/implements AnnotationParserTreeConstants, AnnotationParserConstants {/*@bgen(jjtree)*/
21   protected static JJTAnnotationParserState jjtree = new JJTAnnotationParserState();
22     public ASTRoot parse(String JavaDoc annotation) throws ParseException {
23         return parse(new StringReader JavaDoc(annotation));
24     }
25
26     public ASTRoot parse(Reader JavaDoc reader) throws ParseException {
27         ReInit(reader);
28         return Root();
29     }
30
31 /**
32  * Entry point.
33  */

34   static final public ASTRoot Root() throws ParseException {
35                         /*@bgen(jjtree) Root */
36   ASTRoot jjtn000 = new ASTRoot(JJTROOT);
37   boolean jjtc000 = true;
38   jjtree.openNodeScope(jjtn000);
39     try {
40       Annotation();
41       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
42       case 0:
43         jj_consume_token(0);
44         break;
45       case 26:
46         jj_consume_token(26);
47         break;
48       case NEWLINE:
49         jj_consume_token(NEWLINE);
50         break;
51       default:
52         jj_la1[0] = jj_gen;
53         jj_consume_token(-1);
54         throw new ParseException();
55       }
56       jjtree.closeNodeScope(jjtn000, true);
57       jjtc000 = false;
58       {if (true) return jjtn000;}
59     } catch (Throwable JavaDoc jjte000) {
60       if (jjtc000) {
61         jjtree.clearNodeScope(jjtn000);
62         jjtc000 = false;
63       } else {
64         jjtree.popNode();
65       }
66       if (jjte000 instanceof RuntimeException JavaDoc) {
67         {if (true) throw (RuntimeException JavaDoc)jjte000;}
68       }
69       if (jjte000 instanceof ParseException) {
70         {if (true) throw (ParseException)jjte000;}
71       }
72       {if (true) throw (Error JavaDoc)jjte000;}
73     } finally {
74       if (jjtc000) {
75         jjtree.closeNodeScope(jjtn000, true);
76       }
77     }
78     throw new Error JavaDoc("Missing return statement in function");
79   }
80
81 /**
82  * Annotation.
83  */

84   static final public void Annotation() throws ParseException {
85                                  /*@bgen(jjtree) Annotation */
86   ASTAnnotation jjtn000 = new ASTAnnotation(JJTANNOTATION);
87   boolean jjtc000 = true;
88   jjtree.openNodeScope(jjtn000);
89     try {
90       if (jj_2_2(3)) {
91         jj_consume_token(ANNOTATION);
92         jj_consume_token(LEFT_PARENTHEZIS);
93         if (jj_2_1(4)) {
94           KeyValuePairList();
95         } else {
96           switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
97           case INTEGER:
98           case HEXNUMBER:
99           case OCTNUMBER:
100           case FLOAT:
101           case BOOLEAN:
102           case STRING:
103           case CHAR:
104           case LEFT_BRACKET:
105           case ANNOTATION:
106           case JAVA_TYPE_MAYBEARRAY:
107             Value();
108             break;
109           default:
110             jj_la1[1] = jj_gen;
111             jj_consume_token(-1);
112             throw new ParseException();
113           }
114         }
115         jj_consume_token(RIGHT_PARENTHEZIS);
116       } else if (jj_2_3(2)) {
117         jj_consume_token(ANNOTATION);
118         jj_consume_token(LEFT_PARENTHEZIS);
119         jj_consume_token(RIGHT_PARENTHEZIS);
120       } else {
121         switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
122         case ANNOTATION:
123           jj_consume_token(ANNOTATION);
124           break;
125         default:
126           jj_la1[2] = jj_gen;
127           jj_consume_token(-1);
128           throw new ParseException();
129         }
130       }
131     } catch (Throwable JavaDoc jjte000) {
132       if (jjtc000) {
133         jjtree.clearNodeScope(jjtn000);
134         jjtc000 = false;
135       } else {
136         jjtree.popNode();
137       }
138       if (jjte000 instanceof RuntimeException JavaDoc) {
139         {if (true) throw (RuntimeException JavaDoc)jjte000;}
140       }
141       if (jjte000 instanceof ParseException) {
142         {if (true) throw (ParseException)jjte000;}
143       }
144       {if (true) throw (Error JavaDoc)jjte000;}
145     } finally {
146       if (jjtc000) {
147         jjtree.closeNodeScope(jjtn000, true);
148       }
149     }
150   }
151
152 /**
153  * KeyValuePairList.
154  */

155   static final public void KeyValuePairList() throws ParseException {
156     KeyValuePair();
157     label_1:
158     while (true) {
159       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
160       case COMMA:
161         ;
162         break;
163       default:
164         jj_la1[3] = jj_gen;
165         break label_1;
166       }
167       jj_consume_token(COMMA);
168       KeyValuePair();
169     }
170   }
171
172 /**
173  * KeyValuePair.
174  */

175   static final public void KeyValuePair() throws ParseException {
176  /*@bgen(jjtree) KeyValuePair */
177     ASTKeyValuePair jjtn000 = new ASTKeyValuePair(JJTKEYVALUEPAIR);
178     boolean jjtc000 = true;
179     jjtree.openNodeScope(jjtn000);Token key, value;
180     try {
181       key = jj_consume_token(JAVA_NAME);
182         jjtn000.setKey(key.image);
183       jj_consume_token(EQUALS);
184       Value();
185     } catch (Throwable JavaDoc jjte000) {
186       if (jjtc000) {
187         jjtree.clearNodeScope(jjtn000);
188         jjtc000 = false;
189       } else {
190         jjtree.popNode();
191       }
192       if (jjte000 instanceof RuntimeException JavaDoc) {
193         {if (true) throw (RuntimeException JavaDoc)jjte000;}
194       }
195       if (jjte000 instanceof ParseException) {
196         {if (true) throw (ParseException)jjte000;}
197       }
198       {if (true) throw (Error JavaDoc)jjte000;}
199     } finally {
200       if (jjtc000) {
201         jjtree.closeNodeScope(jjtn000, true);
202       }
203     }
204   }
205
206 /**
207  * Value.
208  *
209  * @TODO: nested annotations
210  */

211   static final public void Value() throws ParseException {
212     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
213     case ANNOTATION:
214       Annotation();
215       break;
216     case CHAR:
217       Char();
218       break;
219     case STRING:
220       String();
221       break;
222     case LEFT_BRACKET:
223       Array();
224       break;
225     case JAVA_TYPE_MAYBEARRAY:
226       Identifier();
227       break;
228     case BOOLEAN:
229       Boolean();
230       break;
231     case INTEGER:
232       Integer();
233       break;
234     case FLOAT:
235       Float();
236       break;
237     case HEXNUMBER:
238       Hex();
239       break;
240     case OCTNUMBER:
241       Oct();
242       break;
243     default:
244       jj_la1[4] = jj_gen;
245       jj_consume_token(-1);
246       throw new ParseException();
247     }
248   }
249
250 /**
251  * Identifier.
252  */

253   static final public void Identifier() throws ParseException {
254  /*@bgen(jjtree) Identifier */
255     ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER);
256     boolean jjtc000 = true;
257     jjtree.openNodeScope(jjtn000);Token value;
258     try {
259       value = jj_consume_token(JAVA_TYPE_MAYBEARRAY);
260       jjtree.closeNodeScope(jjtn000, true);
261       jjtc000 = false;
262         jjtn000.setValue(value.image);
263     } finally {
264       if (jjtc000) {
265         jjtree.closeNodeScope(jjtn000, true);
266       }
267     }
268   }
269
270 /**
271  * Boolean.
272  */

273   static final public void Boolean() throws ParseException {
274  /*@bgen(jjtree) Boolean */
275     ASTBoolean jjtn000 = new ASTBoolean(JJTBOOLEAN);
276     boolean jjtc000 = true;
277     jjtree.openNodeScope(jjtn000);Token value;
278     try {
279       value = jj_consume_token(BOOLEAN);
280       jjtree.closeNodeScope(jjtn000, true);
281       jjtc000 = false;
282         jjtn000.setValue(value.image);
283     } finally {
284       if (jjtc000) {
285         jjtree.closeNodeScope(jjtn000, true);
286       }
287     }
288   }
289
290 /**
291  * Char.
292  */

293   static final public void Char() throws ParseException {
294  /*@bgen(jjtree) Char */
295     ASTChar jjtn000 = new ASTChar(JJTCHAR);
296     boolean jjtc000 = true;
297     jjtree.openNodeScope(jjtn000);Token value;
298     try {
299       value = jj_consume_token(CHAR);
300       jjtree.closeNodeScope(jjtn000, true);
301       jjtc000 = false;
302         jjtn000.setValue(value.image);
303     } finally {
304       if (jjtc000) {
305         jjtree.closeNodeScope(jjtn000, true);
306       }
307     }
308   }
309
310 /**
311  * String.
312  */

313   static final public void String() throws ParseException {
314  /*@bgen(jjtree) String */
315     ASTString jjtn000 = new ASTString(JJTSTRING);
316     boolean jjtc000 = true;
317     jjtree.openNodeScope(jjtn000);Token value;
318     try {
319       value = jj_consume_token(STRING);
320       jjtree.closeNodeScope(jjtn000, true);
321       jjtc000 = false;
322         jjtn000.setValue(value.image);
323     } finally {
324       if (jjtc000) {
325         jjtree.closeNodeScope(jjtn000, true);
326       }
327     }
328   }
329
330 /**
331  * Array.
332  */

333   static final public void Array() throws ParseException {
334                        /*@bgen(jjtree) Array */
335   ASTArray jjtn000 = new ASTArray(JJTARRAY);
336   boolean jjtc000 = true;
337   jjtree.openNodeScope(jjtn000);
338     try {
339       jj_consume_token(LEFT_BRACKET);
340       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
341       case INTEGER:
342       case HEXNUMBER:
343       case OCTNUMBER:
344       case FLOAT:
345       case BOOLEAN:
346       case STRING:
347       case CHAR:
348       case LEFT_BRACKET:
349       case ANNOTATION:
350       case JAVA_TYPE_MAYBEARRAY:
351         Value();
352         label_2:
353         while (true) {
354           if (jj_2_4(2)) {
355             ;
356           } else {
357             break label_2;
358           }
359           jj_consume_token(COMMA);
360           Value();
361         }
362         break;
363       default:
364         jj_la1[5] = jj_gen;
365         ;
366       }
367       jj_consume_token(RIGHT_BRACKET);
368     } catch (Throwable JavaDoc jjte000) {
369       if (jjtc000) {
370         jjtree.clearNodeScope(jjtn000);
371         jjtc000 = false;
372       } else {
373         jjtree.popNode();
374       }
375       if (jjte000 instanceof RuntimeException JavaDoc) {
376         {if (true) throw (RuntimeException JavaDoc)jjte000;}
377       }
378       if (jjte000 instanceof ParseException) {
379         {if (true) throw (ParseException)jjte000;}
380       }
381       {if (true) throw (Error JavaDoc)jjte000;}
382     } finally {
383       if (jjtc000) {
384         jjtree.closeNodeScope(jjtn000, true);
385       }
386     }
387   }
388
389 /**
390  * Integer.
391  */

392   static final public void Integer() throws ParseException {
393  /*@bgen(jjtree) Integer */
394     ASTInteger jjtn000 = new ASTInteger(JJTINTEGER);
395     boolean jjtc000 = true;
396     jjtree.openNodeScope(jjtn000);Token value;
397     try {
398       value = jj_consume_token(INTEGER);
399       jjtree.closeNodeScope(jjtn000, true);
400       jjtc000 = false;
401         jjtn000.setValue(value.image);
402     } finally {
403       if (jjtc000) {
404         jjtree.closeNodeScope(jjtn000, true);
405       }
406     }
407   }
408
409 /**
410  * Float.
411  */

412   static final public void Float() throws ParseException {
413  /*@bgen(jjtree) Float */
414     ASTFloat jjtn000 = new ASTFloat(JJTFLOAT);
415     boolean jjtc000 = true;
416     jjtree.openNodeScope(jjtn000);Token value;
417     try {
418       value = jj_consume_token(FLOAT);
419       jjtree.closeNodeScope(jjtn000, true);
420       jjtc000 = false;
421         jjtn000.setValue(value.image);
422     } finally {
423       if (jjtc000) {
424         jjtree.closeNodeScope(jjtn000, true);
425       }
426     }
427   }
428
429 /**
430  * Hex.
431  */

432   static final public void Hex() throws ParseException {
433  /*@bgen(jjtree) Hex */
434     ASTHex jjtn000 = new ASTHex(JJTHEX);
435     boolean jjtc000 = true;
436     jjtree.openNodeScope(jjtn000);Token value;
437     try {
438       value = jj_consume_token(HEXNUMBER);
439       jjtree.closeNodeScope(jjtn000, true);
440       jjtc000 = false;
441         jjtn000.setValue(value.image);
442     } finally {
443       if (jjtc000) {
444         jjtree.closeNodeScope(jjtn000, true);
445       }
446     }
447   }
448
449 /**
450  * Oct.
451  */

452   static final public void Oct() throws ParseException {
453  /*@bgen(jjtree) Oct */
454     ASTOct jjtn000 = new ASTOct(JJTOCT);
455     boolean jjtc000 = true;
456     jjtree.openNodeScope(jjtn000);Token value;
457     try {
458       value = jj_consume_token(OCTNUMBER);
459       jjtree.closeNodeScope(jjtn000, true);
460       jjtc000 = false;
461         jjtn000.setValue(value.image);
462     } finally {
463       if (jjtc000) {
464         jjtree.closeNodeScope(jjtn000, true);
465       }
466     }
467   }
468
469   static final private boolean jj_2_1(int xla) {
470     jj_la = xla; jj_lastpos = jj_scanpos = token;
471     try { return !jj_3_1(); }
472     catch(LookaheadSuccess ls) { return true; }
473     finally { jj_save(0, xla); }
474   }
475
476   static final private boolean jj_2_2(int xla) {
477     jj_la = xla; jj_lastpos = jj_scanpos = token;
478     try { return !jj_3_2(); }
479     catch(LookaheadSuccess ls) { return true; }
480     finally { jj_save(1, xla); }
481   }
482
483   static final private boolean jj_2_3(int xla) {
484     jj_la = xla; jj_lastpos = jj_scanpos = token;
485     try { return !jj_3_3(); }
486     catch(LookaheadSuccess ls) { return true; }
487     finally { jj_save(2, xla); }
488   }
489
490   static final private boolean jj_2_4(int xla) {
491     jj_la = xla; jj_lastpos = jj_scanpos = token;
492     try { return !jj_3_4(); }
493     catch(LookaheadSuccess ls) { return true; }
494     finally { jj_save(3, xla); }
495   }
496
497   static final private boolean jj_3R_7() {
498     if (jj_scan_token(COMMA)) return true;
499     return false;
500   }
501
502   static final private boolean jj_3R_22() {
503     if (jj_scan_token(JAVA_TYPE_MAYBEARRAY)) return true;
504     return false;
505   }
506
507   static final private boolean jj_3R_3() {
508     if (jj_3R_6()) return true;
509     Token xsp;
510     while (true) {
511       xsp = jj_scanpos;
512       if (jj_3R_7()) { jj_scanpos = xsp; break; }
513     }
514     return false;
515   }
516
517   static final private boolean jj_3R_26() {
518     if (jj_scan_token(HEXNUMBER)) return true;
519     return false;
520   }
521
522   static final private boolean jj_3R_20() {
523     if (jj_scan_token(STRING)) return true;
524     return false;
525   }
526
527   static final private boolean jj_3R_17() {
528     if (jj_3R_27()) return true;
529     return false;
530   }
531
532   static final private boolean jj_3R_16() {
533     if (jj_3R_26()) return true;
534     return false;
535   }
536
537   static final private boolean jj_3R_15() {
538     if (jj_3R_25()) return true;
539     return false;
540   }
541
542   static final private boolean jj_3_3() {
543     if (jj_scan_token(ANNOTATION)) return true;
544     if (jj_scan_token(LEFT_PARENTHEZIS)) return true;
545     return false;
546   }
547
548   static final private boolean jj_3R_14() {
549     if (jj_3R_24()) return true;
550     return false;
551   }
552
553   static final private boolean jj_3R_13() {
554     if (jj_3R_23()) return true;
555     return false;
556   }
557
558   static final private boolean jj_3R_12() {
559     if (jj_3R_22()) return true;
560     return false;
561   }
562
563   static final private boolean jj_3R_18() {
564     Token xsp;
565     xsp = jj_scanpos;
566     if (jj_3_2()) {
567     jj_scanpos = xsp;
568     if (jj_3_3()) {
569     jj_scanpos = xsp;
570     if (jj_scan_token(21)) return true;
571     }
572     }
573     return false;
574   }
575
576   static final private boolean jj_3_2() {
577     if (jj_scan_token(ANNOTATION)) return true;
578     if (jj_scan_token(LEFT_PARENTHEZIS)) return true;
579     Token xsp;
580     xsp = jj_scanpos;
581     if (jj_3_1()) {
582     jj_scanpos = xsp;
583     if (jj_3R_4()) return true;
584     }
585     return false;
586   }
587
588   static final private boolean jj_3R_11() {
589     if (jj_3R_21()) return true;
590     return false;
591   }
592
593   static final private boolean jj_3R_25() {
594     if (jj_scan_token(FLOAT)) return true;
595     return false;
596   }
597
598   static final private boolean jj_3R_10() {
599     if (jj_3R_20()) return true;
600     return false;
601   }
602
603   static final private boolean jj_3_4() {
604     if (jj_scan_token(COMMA)) return true;
605     if (jj_3R_5()) return true;
606     return false;
607   }
608
609   static final private boolean jj_3R_9() {
610     if (jj_3R_19()) return true;
611     return false;
612   }
613
614   static final private boolean jj_3R_19() {
615     if (jj_scan_token(CHAR)) return true;
616     return false;
617   }
618
619   static final private boolean jj_3R_5() {
620     Token xsp;
621     xsp = jj_scanpos;
622     if (jj_3R_8()) {
623     jj_scanpos = xsp;
624     if (jj_3R_9()) {
625     jj_scanpos = xsp;
626     if (jj_3R_10()) {
627     jj_scanpos = xsp;
628     if (jj_3R_11()) {
629     jj_scanpos = xsp;
630     if (jj_3R_12()) {
631     jj_scanpos = xsp;
632     if (jj_3R_13()) {
633     jj_scanpos = xsp;
634     if (jj_3R_14()) {
635     jj_scanpos = xsp;
636     if (jj_3R_15()) {
637     jj_scanpos = xsp;
638     if (jj_3R_16()) {
639     jj_scanpos = xsp;
640     if (jj_3R_17()) return true;
641     }
642     }
643     }
644     }
645     }
646     }
647     }
648     }
649     }
650     return false;
651   }
652
653   static final private boolean jj_3R_8() {
654     if (jj_3R_18()) return true;
655     return false;
656   }
657
658   static final private boolean jj_3R_28() {
659     if (jj_3R_5()) return true;
660     return false;
661   }
662
663   static final private boolean jj_3_1() {
664     if (jj_3R_3()) return true;
665     return false;
666   }
667
668   static final private boolean jj_3R_24() {
669     if (jj_scan_token(INTEGER)) return true;
670     return false;
671   }
672
673   static final private boolean jj_3R_23() {
674     if (jj_scan_token(BOOLEAN)) return true;
675     return false;
676   }
677
678   static final private boolean jj_3R_27() {
679     if (jj_scan_token(OCTNUMBER)) return true;
680     return false;
681   }
682
683   static final private boolean jj_3R_6() {
684     if (jj_scan_token(JAVA_NAME)) return true;
685     if (jj_scan_token(EQUALS)) return true;
686     if (jj_3R_5()) return true;
687     return false;
688   }
689
690   static final private boolean jj_3R_21() {
691     if (jj_scan_token(LEFT_BRACKET)) return true;
692     Token xsp;
693     xsp = jj_scanpos;
694     if (jj_3R_28()) jj_scanpos = xsp;
695     if (jj_scan_token(RIGHT_BRACKET)) return true;
696     return false;
697   }
698
699   static final private boolean jj_3R_4() {
700     if (jj_3R_5()) return true;
701     return false;
702   }
703
704   static private boolean jj_initialized_once = false;
705   static public AnnotationParserTokenManager token_source;
706   static SimpleCharStream jj_input_stream;
707   static public Token token, jj_nt;
708   static private int jj_ntk;
709   static private Token jj_scanpos, jj_lastpos;
710   static private int jj_la;
711   static public boolean lookingAhead = false;
712   static private boolean jj_semLA;
713   static private int jj_gen;
714   static final private int[] jj_la1 = new int[6];
715   static private int[] jj_la1_0;
716   static {
717       jj_la1_0();
718    }
719    private static void jj_la1_0() {
720       jj_la1_0 = new int[] {0x4002001,0xa11cf0,0x200000,0x40000,0xa11cf0,0xa11cf0,};
721    }
722   static final private JJCalls[] jj_2_rtns = new JJCalls[4];
723   static private boolean jj_rescan = false;
724   static private int jj_gc = 0;
725
726   public AnnotationParser(java.io.InputStream JavaDoc stream) {
727     if (jj_initialized_once) {
728       System.out.println("ERROR: Second call to constructor of static parser. You must");
729       System.out.println(" either use ReInit() or set the JavaCC option STATIC to false");
730       System.out.println(" during parser generation.");
731       throw new Error JavaDoc();
732     }
733     jj_initialized_once = true;
734     jj_input_stream = new SimpleCharStream(stream, 1, 1);
735     token_source = new AnnotationParserTokenManager(jj_input_stream);
736     token = new Token();
737     jj_ntk = -1;
738     jj_gen = 0;
739     for (int i = 0; i < 6; i++) jj_la1[i] = -1;
740     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
741   }
742
743   static public void ReInit(java.io.InputStream JavaDoc stream) {
744     jj_input_stream.ReInit(stream, 1, 1);
745     token_source.ReInit(jj_input_stream);
746     token = new Token();
747     jj_ntk = -1;
748     jjtree.reset();
749     jj_gen = 0;
750     for (int i = 0; i < 6; i++) jj_la1[i] = -1;
751     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
752   }
753
754   public AnnotationParser(java.io.Reader JavaDoc stream) {
755     if (jj_initialized_once) {
756       System.out.println("ERROR: Second call to constructor of static parser. You must");
757       System.out.println(" either use ReInit() or set the JavaCC option STATIC to false");
758       System.out.println(" during parser generation.");
759       throw new Error JavaDoc();
760     }
761     jj_initialized_once = true;
762     jj_input_stream = new SimpleCharStream(stream, 1, 1);
763     token_source = new AnnotationParserTokenManager(jj_input_stream);
764     token = new Token();
765     jj_ntk = -1;
766     jj_gen = 0;
767     for (int i = 0; i < 6; i++) jj_la1[i] = -1;
768     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
769   }
770
771   static public void ReInit(java.io.Reader JavaDoc stream) {
772     jj_input_stream.ReInit(stream, 1, 1);
773     token_source.ReInit(jj_input_stream);
774     token = new Token();
775     jj_ntk = -1;
776     jjtree.reset();
777     jj_gen = 0;
778     for (int i = 0; i < 6; i++) jj_la1[i] = -1;
779     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
780   }
781
782   public AnnotationParser(AnnotationParserTokenManager tm) {
783     if (jj_initialized_once) {
784       System.out.println("ERROR: Second call to constructor of static parser. You must");
785       System.out.println(" either use ReInit() or set the JavaCC option STATIC to false");
786       System.out.println(" during parser generation.");
787       throw new Error JavaDoc();
788     }
789     jj_initialized_once = true;
790     token_source = tm;
791     token = new Token();
792     jj_ntk = -1;
793     jj_gen = 0;
794     for (int i = 0; i < 6; i++) jj_la1[i] = -1;
795     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
796   }
797
798   public void ReInit(AnnotationParserTokenManager tm) {
799     token_source = tm;
800     token = new Token();
801     jj_ntk = -1;
802     jjtree.reset();
803     jj_gen = 0;
804     for (int i = 0; i < 6; i++) jj_la1[i] = -1;
805     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
806   }
807
808   static final private Token jj_consume_token(int kind) throws ParseException {
809     Token oldToken;
810     if ((oldToken = token).next != null) token = token.next;
811     else token = token.next = token_source.getNextToken();
812     jj_ntk = -1;
813     if (token.kind == kind) {
814       jj_gen++;
815       if (++jj_gc > 100) {
816         jj_gc = 0;
817         for (int i = 0; i < jj_2_rtns.length; i++) {
818           JJCalls c = jj_2_rtns[i];
819           while (c != null) {
820             if (c.gen < jj_gen) c.first = null;
821             c = c.next;
822           }
823         }
824       }
825       return token;
826     }
827     token = oldToken;
828     jj_kind = kind;
829     throw generateParseException();
830   }
831
832   static private final class LookaheadSuccess extends java.lang.Error JavaDoc { }
833   static final private LookaheadSuccess jj_ls = new LookaheadSuccess();
834   static final private boolean jj_scan_token(int kind) {
835     if (jj_scanpos == jj_lastpos) {
836       jj_la--;
837       if (jj_scanpos.next == null) {
838         jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
839       } else {
840         jj_lastpos = jj_scanpos = jj_scanpos.next;
841       }
842     } else {
843       jj_scanpos = jj_scanpos.next;
844     }
845     if (jj_rescan) {
846       int i = 0; Token tok = token;
847       while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
848       if (tok != null) jj_add_error_token(kind, i);
849     }
850     if (jj_scanpos.kind != kind) return true;
851     if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
852     return false;
853   }
854
855   static final public Token getNextToken() {
856     if (token.next != null) token = token.next;
857     else token = token.next = token_source.getNextToken();
858     jj_ntk = -1;
859     jj_gen++;
860     return token;
861   }
862
863   static final public Token getToken(int index) {
864     Token t = lookingAhead ? jj_scanpos : token;
865     for (int i = 0; i < index; i++) {
866       if (t.next != null) t = t.next;
867       else t = t.next = token_source.getNextToken();
868     }
869     return t;
870   }
871
872   static final private int jj_ntk() {
873     if ((jj_nt=token.next) == null)
874       return (jj_ntk = (token.next=token_source.getNextToken()).kind);
875     else
876       return (jj_ntk = jj_nt.kind);
877   }
878
879   static private java.util.Vector JavaDoc jj_expentries = new java.util.Vector JavaDoc();
880   static private int[] jj_expentry;
881   static private int jj_kind = -1;
882   static private int[] jj_lasttokens = new int[100];
883   static private int jj_endpos;
884
885   static private void jj_add_error_token(int kind, int pos) {
886     if (pos >= 100) return;
887     if (pos == jj_endpos + 1) {
888       jj_lasttokens[jj_endpos++] = kind;
889     } else if (jj_endpos != 0) {
890       jj_expentry = new int[jj_endpos];
891       for (int i = 0; i < jj_endpos; i++) {
892         jj_expentry[i] = jj_lasttokens[i];
893       }
894       boolean exists = false;
895       for (java.util.Enumeration JavaDoc e = jj_expentries.elements(); e.hasMoreElements();) {
896         int[] oldentry = (int[])(e.nextElement());
897         if (oldentry.length == jj_expentry.length) {
898           exists = true;
899           for (int i = 0; i < jj_expentry.length; i++) {
900             if (oldentry[i] != jj_expentry[i]) {
901               exists = false;
902               break;
903             }
904           }
905           if (exists) break;
906         }
907       }
908       if (!exists) jj_expentries.addElement(jj_expentry);
909       if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
910     }
911   }
912
913   static public ParseException generateParseException() {
914     jj_expentries.removeAllElements();
915     boolean[] la1tokens = new boolean[27];
916     for (int i = 0; i < 27; i++) {
917       la1tokens[i] = false;
918     }
919     if (jj_kind >= 0) {
920       la1tokens[jj_kind] = true;
921       jj_kind = -1;
922     }
923     for (int i = 0; i < 6; i++) {
924       if (jj_la1[i] == jj_gen) {
925         for (int j = 0; j < 32; j++) {
926           if ((jj_la1_0[i] & (1<<j)) != 0) {
927             la1tokens[j] = true;
928           }
929         }
930       }
931     }
932     for (int i = 0; i < 27; i++) {
933       if (la1tokens[i]) {
934         jj_expentry = new int[1];
935         jj_expentry[0] = i;
936         jj_expentries.addElement(jj_expentry);
937       }
938     }
939     jj_endpos = 0;
940     jj_rescan_token();
941     jj_add_error_token(0, 0);
942     int[][] exptokseq = new int[jj_expentries.size()][];
943     for (int i = 0; i < jj_expentries.size(); i++) {
944       exptokseq[i] = (int[])jj_expentries.elementAt(i);
945     }
946     return new ParseException(token, exptokseq, tokenImage);
947   }
948
949   static final public void enable_tracing() {
950   }
951
952   static final public void disable_tracing() {
953   }
954
955   static final private void jj_rescan_token() {
956     jj_rescan = true;
957     for (int i = 0; i < 4; i++) {
958       JJCalls p = jj_2_rtns[i];
959       do {
960         if (p.gen > jj_gen) {
961           jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
962           switch (i) {
963             case 0: jj_3_1(); break;
964             case 1: jj_3_2(); break;
965             case 2: jj_3_3(); break;
966             case 3: jj_3_4(); break;
967           }
968         }
969         p = p.next;
970       } while (p != null);
971     }
972     jj_rescan = false;
973   }
974
975   static final private void jj_save(int index, int xla) {
976     JJCalls p = jj_2_rtns[index];
977     while (p.gen > jj_gen) {
978       if (p.next == null) { p = p.next = new JJCalls(); break; }
979       p = p.next;
980     }
981     p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
982   }
983
984   static final class JJCalls {
985     int gen;
986     Token first;
987     int arg;
988     JJCalls next;
989   }
990
991 }
992
Popular Tags