0001: /* Generated By:JJTree&JavaCC: Do not edit this line. AnnotationParser.java */
0002: /**************************************************************************************
0003: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
0004: * http://aspectwerkz.codehaus.org *
0005: * ---------------------------------------------------------------------------------- *
0006: * The software in this package is published under the terms of the LGPL license *
0007: * a copy of which has been included with this distribution in the license.txt file. *
0008: **************************************************************************************/package org.codehaus.aspectwerkz.annotation.expression.ast;
0009:
0010: import java.lang.reflect.Modifier;
0011: import java.io.Reader;
0012: import java.io.StringReader;
0013:
0014: /**
0015: * The annotation parser.
0016: *
0017: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr</a>
0018: */
0019: public class AnnotationParser/*@bgen(jjtree)*/implements
0020: AnnotationParserTreeConstants, AnnotationParserConstants {/*@bgen(jjtree)*/
0021: protected static JJTAnnotationParserState jjtree = new JJTAnnotationParserState();
0022:
0023: public ASTRoot parse(String annotation) throws ParseException {
0024: return parse(new StringReader(annotation));
0025: }
0026:
0027: public ASTRoot parse(Reader reader) throws ParseException {
0028: ReInit(reader);
0029: return Root();
0030: }
0031:
0032: /**
0033: * Entry point.
0034: */
0035: static final public ASTRoot Root() throws ParseException {
0036: /*@bgen(jjtree) Root */
0037: ASTRoot jjtn000 = new ASTRoot(JJTROOT);
0038: boolean jjtc000 = true;
0039: jjtree.openNodeScope(jjtn000);
0040: try {
0041: Annotation();
0042: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0043: case 0:
0044: jj_consume_token(0);
0045: break;
0046: case 26:
0047: jj_consume_token(26);
0048: break;
0049: case NEWLINE:
0050: jj_consume_token(NEWLINE);
0051: break;
0052: default:
0053: jj_la1[0] = jj_gen;
0054: jj_consume_token(-1);
0055: throw new ParseException();
0056: }
0057: jjtree.closeNodeScope(jjtn000, true);
0058: jjtc000 = false;
0059: {
0060: if (true)
0061: return jjtn000;
0062: }
0063: } catch (Throwable jjte000) {
0064: if (jjtc000) {
0065: jjtree.clearNodeScope(jjtn000);
0066: jjtc000 = false;
0067: } else {
0068: jjtree.popNode();
0069: }
0070: if (jjte000 instanceof RuntimeException) {
0071: {
0072: if (true)
0073: throw (RuntimeException) jjte000;
0074: }
0075: }
0076: if (jjte000 instanceof ParseException) {
0077: {
0078: if (true)
0079: throw (ParseException) jjte000;
0080: }
0081: }
0082: {
0083: if (true)
0084: throw (Error) jjte000;
0085: }
0086: } finally {
0087: if (jjtc000) {
0088: jjtree.closeNodeScope(jjtn000, true);
0089: }
0090: }
0091: throw new Error("Missing return statement in function");
0092: }
0093:
0094: /**
0095: * Annotation.
0096: */
0097: static final public void Annotation() throws ParseException {
0098: /*@bgen(jjtree) Annotation */
0099: ASTAnnotation jjtn000 = new ASTAnnotation(JJTANNOTATION);
0100: boolean jjtc000 = true;
0101: jjtree.openNodeScope(jjtn000);
0102: try {
0103: if (jj_2_2(3)) {
0104: jj_consume_token(ANNOTATION);
0105: jj_consume_token(LEFT_PARENTHEZIS);
0106: if (jj_2_1(4)) {
0107: KeyValuePairList();
0108: } else {
0109: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0110: case INTEGER:
0111: case HEXNUMBER:
0112: case OCTNUMBER:
0113: case FLOAT:
0114: case BOOLEAN:
0115: case STRING:
0116: case CHAR:
0117: case LEFT_BRACKET:
0118: case ANNOTATION:
0119: case JAVA_TYPE_MAYBEARRAY:
0120: Value();
0121: break;
0122: default:
0123: jj_la1[1] = jj_gen;
0124: jj_consume_token(-1);
0125: throw new ParseException();
0126: }
0127: }
0128: jj_consume_token(RIGHT_PARENTHEZIS);
0129: } else if (jj_2_3(2)) {
0130: jj_consume_token(ANNOTATION);
0131: jj_consume_token(LEFT_PARENTHEZIS);
0132: jj_consume_token(RIGHT_PARENTHEZIS);
0133: } else {
0134: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0135: case ANNOTATION:
0136: jj_consume_token(ANNOTATION);
0137: break;
0138: default:
0139: jj_la1[2] = jj_gen;
0140: jj_consume_token(-1);
0141: throw new ParseException();
0142: }
0143: }
0144: } catch (Throwable jjte000) {
0145: if (jjtc000) {
0146: jjtree.clearNodeScope(jjtn000);
0147: jjtc000 = false;
0148: } else {
0149: jjtree.popNode();
0150: }
0151: if (jjte000 instanceof RuntimeException) {
0152: {
0153: if (true)
0154: throw (RuntimeException) jjte000;
0155: }
0156: }
0157: if (jjte000 instanceof ParseException) {
0158: {
0159: if (true)
0160: throw (ParseException) jjte000;
0161: }
0162: }
0163: {
0164: if (true)
0165: throw (Error) jjte000;
0166: }
0167: } finally {
0168: if (jjtc000) {
0169: jjtree.closeNodeScope(jjtn000, true);
0170: }
0171: }
0172: }
0173:
0174: /**
0175: * KeyValuePairList.
0176: */
0177: static final public void KeyValuePairList() throws ParseException {
0178: KeyValuePair();
0179: label_1: while (true) {
0180: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0181: case COMMA:
0182: ;
0183: break;
0184: default:
0185: jj_la1[3] = jj_gen;
0186: break label_1;
0187: }
0188: jj_consume_token(COMMA);
0189: KeyValuePair();
0190: }
0191: }
0192:
0193: /**
0194: * KeyValuePair.
0195: */
0196: static final public void KeyValuePair() throws ParseException {
0197: /*@bgen(jjtree) KeyValuePair */
0198: ASTKeyValuePair jjtn000 = new ASTKeyValuePair(JJTKEYVALUEPAIR);
0199: boolean jjtc000 = true;
0200: jjtree.openNodeScope(jjtn000);
0201: Token key, value;
0202: try {
0203: key = jj_consume_token(JAVA_NAME);
0204: jjtn000.setKey(key.image);
0205: jj_consume_token(EQUALS);
0206: Value();
0207: } catch (Throwable jjte000) {
0208: if (jjtc000) {
0209: jjtree.clearNodeScope(jjtn000);
0210: jjtc000 = false;
0211: } else {
0212: jjtree.popNode();
0213: }
0214: if (jjte000 instanceof RuntimeException) {
0215: {
0216: if (true)
0217: throw (RuntimeException) jjte000;
0218: }
0219: }
0220: if (jjte000 instanceof ParseException) {
0221: {
0222: if (true)
0223: throw (ParseException) jjte000;
0224: }
0225: }
0226: {
0227: if (true)
0228: throw (Error) jjte000;
0229: }
0230: } finally {
0231: if (jjtc000) {
0232: jjtree.closeNodeScope(jjtn000, true);
0233: }
0234: }
0235: }
0236:
0237: /**
0238: * Value.
0239: *
0240: * @TODO: nested annotations
0241: */
0242: static final public void Value() throws ParseException {
0243: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0244: case ANNOTATION:
0245: Annotation();
0246: break;
0247: case CHAR:
0248: Char();
0249: break;
0250: case STRING:
0251: String();
0252: break;
0253: case LEFT_BRACKET:
0254: Array();
0255: break;
0256: case JAVA_TYPE_MAYBEARRAY:
0257: Identifier();
0258: break;
0259: case BOOLEAN:
0260: Boolean();
0261: break;
0262: case INTEGER:
0263: Integer();
0264: break;
0265: case FLOAT:
0266: Float();
0267: break;
0268: case HEXNUMBER:
0269: Hex();
0270: break;
0271: case OCTNUMBER:
0272: Oct();
0273: break;
0274: default:
0275: jj_la1[4] = jj_gen;
0276: jj_consume_token(-1);
0277: throw new ParseException();
0278: }
0279: }
0280:
0281: /**
0282: * Identifier.
0283: */
0284: static final public void Identifier() throws ParseException {
0285: /*@bgen(jjtree) Identifier */
0286: ASTIdentifier jjtn000 = new ASTIdentifier(JJTIDENTIFIER);
0287: boolean jjtc000 = true;
0288: jjtree.openNodeScope(jjtn000);
0289: Token value;
0290: try {
0291: value = jj_consume_token(JAVA_TYPE_MAYBEARRAY);
0292: jjtree.closeNodeScope(jjtn000, true);
0293: jjtc000 = false;
0294: jjtn000.setValue(value.image);
0295: } finally {
0296: if (jjtc000) {
0297: jjtree.closeNodeScope(jjtn000, true);
0298: }
0299: }
0300: }
0301:
0302: /**
0303: * Boolean.
0304: */
0305: static final public void Boolean() throws ParseException {
0306: /*@bgen(jjtree) Boolean */
0307: ASTBoolean jjtn000 = new ASTBoolean(JJTBOOLEAN);
0308: boolean jjtc000 = true;
0309: jjtree.openNodeScope(jjtn000);
0310: Token value;
0311: try {
0312: value = jj_consume_token(BOOLEAN);
0313: jjtree.closeNodeScope(jjtn000, true);
0314: jjtc000 = false;
0315: jjtn000.setValue(value.image);
0316: } finally {
0317: if (jjtc000) {
0318: jjtree.closeNodeScope(jjtn000, true);
0319: }
0320: }
0321: }
0322:
0323: /**
0324: * Char.
0325: */
0326: static final public void Char() throws ParseException {
0327: /*@bgen(jjtree) Char */
0328: ASTChar jjtn000 = new ASTChar(JJTCHAR);
0329: boolean jjtc000 = true;
0330: jjtree.openNodeScope(jjtn000);
0331: Token value;
0332: try {
0333: value = jj_consume_token(CHAR);
0334: jjtree.closeNodeScope(jjtn000, true);
0335: jjtc000 = false;
0336: jjtn000.setValue(value.image);
0337: } finally {
0338: if (jjtc000) {
0339: jjtree.closeNodeScope(jjtn000, true);
0340: }
0341: }
0342: }
0343:
0344: /**
0345: * String.
0346: */
0347: static final public void String() throws ParseException {
0348: /*@bgen(jjtree) String */
0349: ASTString jjtn000 = new ASTString(JJTSTRING);
0350: boolean jjtc000 = true;
0351: jjtree.openNodeScope(jjtn000);
0352: Token value;
0353: try {
0354: value = jj_consume_token(STRING);
0355: jjtree.closeNodeScope(jjtn000, true);
0356: jjtc000 = false;
0357: jjtn000.setValue(value.image);
0358: } finally {
0359: if (jjtc000) {
0360: jjtree.closeNodeScope(jjtn000, true);
0361: }
0362: }
0363: }
0364:
0365: /**
0366: * Array.
0367: */
0368: static final public void Array() throws ParseException {
0369: /*@bgen(jjtree) Array */
0370: ASTArray jjtn000 = new ASTArray(JJTARRAY);
0371: boolean jjtc000 = true;
0372: jjtree.openNodeScope(jjtn000);
0373: try {
0374: jj_consume_token(LEFT_BRACKET);
0375: switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
0376: case INTEGER:
0377: case HEXNUMBER:
0378: case OCTNUMBER:
0379: case FLOAT:
0380: case BOOLEAN:
0381: case STRING:
0382: case CHAR:
0383: case LEFT_BRACKET:
0384: case ANNOTATION:
0385: case JAVA_TYPE_MAYBEARRAY:
0386: Value();
0387: label_2: while (true) {
0388: if (jj_2_4(2)) {
0389: ;
0390: } else {
0391: break label_2;
0392: }
0393: jj_consume_token(COMMA);
0394: Value();
0395: }
0396: break;
0397: default:
0398: jj_la1[5] = jj_gen;
0399: ;
0400: }
0401: jj_consume_token(RIGHT_BRACKET);
0402: } catch (Throwable jjte000) {
0403: if (jjtc000) {
0404: jjtree.clearNodeScope(jjtn000);
0405: jjtc000 = false;
0406: } else {
0407: jjtree.popNode();
0408: }
0409: if (jjte000 instanceof RuntimeException) {
0410: {
0411: if (true)
0412: throw (RuntimeException) jjte000;
0413: }
0414: }
0415: if (jjte000 instanceof ParseException) {
0416: {
0417: if (true)
0418: throw (ParseException) jjte000;
0419: }
0420: }
0421: {
0422: if (true)
0423: throw (Error) jjte000;
0424: }
0425: } finally {
0426: if (jjtc000) {
0427: jjtree.closeNodeScope(jjtn000, true);
0428: }
0429: }
0430: }
0431:
0432: /**
0433: * Integer.
0434: */
0435: static final public void Integer() throws ParseException {
0436: /*@bgen(jjtree) Integer */
0437: ASTInteger jjtn000 = new ASTInteger(JJTINTEGER);
0438: boolean jjtc000 = true;
0439: jjtree.openNodeScope(jjtn000);
0440: Token value;
0441: try {
0442: value = jj_consume_token(INTEGER);
0443: jjtree.closeNodeScope(jjtn000, true);
0444: jjtc000 = false;
0445: jjtn000.setValue(value.image);
0446: } finally {
0447: if (jjtc000) {
0448: jjtree.closeNodeScope(jjtn000, true);
0449: }
0450: }
0451: }
0452:
0453: /**
0454: * Float.
0455: */
0456: static final public void Float() throws ParseException {
0457: /*@bgen(jjtree) Float */
0458: ASTFloat jjtn000 = new ASTFloat(JJTFLOAT);
0459: boolean jjtc000 = true;
0460: jjtree.openNodeScope(jjtn000);
0461: Token value;
0462: try {
0463: value = jj_consume_token(FLOAT);
0464: jjtree.closeNodeScope(jjtn000, true);
0465: jjtc000 = false;
0466: jjtn000.setValue(value.image);
0467: } finally {
0468: if (jjtc000) {
0469: jjtree.closeNodeScope(jjtn000, true);
0470: }
0471: }
0472: }
0473:
0474: /**
0475: * Hex.
0476: */
0477: static final public void Hex() throws ParseException {
0478: /*@bgen(jjtree) Hex */
0479: ASTHex jjtn000 = new ASTHex(JJTHEX);
0480: boolean jjtc000 = true;
0481: jjtree.openNodeScope(jjtn000);
0482: Token value;
0483: try {
0484: value = jj_consume_token(HEXNUMBER);
0485: jjtree.closeNodeScope(jjtn000, true);
0486: jjtc000 = false;
0487: jjtn000.setValue(value.image);
0488: } finally {
0489: if (jjtc000) {
0490: jjtree.closeNodeScope(jjtn000, true);
0491: }
0492: }
0493: }
0494:
0495: /**
0496: * Oct.
0497: */
0498: static final public void Oct() throws ParseException {
0499: /*@bgen(jjtree) Oct */
0500: ASTOct jjtn000 = new ASTOct(JJTOCT);
0501: boolean jjtc000 = true;
0502: jjtree.openNodeScope(jjtn000);
0503: Token value;
0504: try {
0505: value = jj_consume_token(OCTNUMBER);
0506: jjtree.closeNodeScope(jjtn000, true);
0507: jjtc000 = false;
0508: jjtn000.setValue(value.image);
0509: } finally {
0510: if (jjtc000) {
0511: jjtree.closeNodeScope(jjtn000, true);
0512: }
0513: }
0514: }
0515:
0516: static final private boolean jj_2_1(int xla) {
0517: jj_la = xla;
0518: jj_lastpos = jj_scanpos = token;
0519: try {
0520: return !jj_3_1();
0521: } catch (LookaheadSuccess ls) {
0522: return true;
0523: } finally {
0524: jj_save(0, xla);
0525: }
0526: }
0527:
0528: static final private boolean jj_2_2(int xla) {
0529: jj_la = xla;
0530: jj_lastpos = jj_scanpos = token;
0531: try {
0532: return !jj_3_2();
0533: } catch (LookaheadSuccess ls) {
0534: return true;
0535: } finally {
0536: jj_save(1, xla);
0537: }
0538: }
0539:
0540: static final private boolean jj_2_3(int xla) {
0541: jj_la = xla;
0542: jj_lastpos = jj_scanpos = token;
0543: try {
0544: return !jj_3_3();
0545: } catch (LookaheadSuccess ls) {
0546: return true;
0547: } finally {
0548: jj_save(2, xla);
0549: }
0550: }
0551:
0552: static final private boolean jj_2_4(int xla) {
0553: jj_la = xla;
0554: jj_lastpos = jj_scanpos = token;
0555: try {
0556: return !jj_3_4();
0557: } catch (LookaheadSuccess ls) {
0558: return true;
0559: } finally {
0560: jj_save(3, xla);
0561: }
0562: }
0563:
0564: static final private boolean jj_3R_7() {
0565: if (jj_scan_token(COMMA))
0566: return true;
0567: return false;
0568: }
0569:
0570: static final private boolean jj_3R_22() {
0571: if (jj_scan_token(JAVA_TYPE_MAYBEARRAY))
0572: return true;
0573: return false;
0574: }
0575:
0576: static final private boolean jj_3R_3() {
0577: if (jj_3R_6())
0578: return true;
0579: Token xsp;
0580: while (true) {
0581: xsp = jj_scanpos;
0582: if (jj_3R_7()) {
0583: jj_scanpos = xsp;
0584: break;
0585: }
0586: }
0587: return false;
0588: }
0589:
0590: static final private boolean jj_3R_26() {
0591: if (jj_scan_token(HEXNUMBER))
0592: return true;
0593: return false;
0594: }
0595:
0596: static final private boolean jj_3R_20() {
0597: if (jj_scan_token(STRING))
0598: return true;
0599: return false;
0600: }
0601:
0602: static final private boolean jj_3R_17() {
0603: if (jj_3R_27())
0604: return true;
0605: return false;
0606: }
0607:
0608: static final private boolean jj_3R_16() {
0609: if (jj_3R_26())
0610: return true;
0611: return false;
0612: }
0613:
0614: static final private boolean jj_3R_15() {
0615: if (jj_3R_25())
0616: return true;
0617: return false;
0618: }
0619:
0620: static final private boolean jj_3_3() {
0621: if (jj_scan_token(ANNOTATION))
0622: return true;
0623: if (jj_scan_token(LEFT_PARENTHEZIS))
0624: return true;
0625: return false;
0626: }
0627:
0628: static final private boolean jj_3R_14() {
0629: if (jj_3R_24())
0630: return true;
0631: return false;
0632: }
0633:
0634: static final private boolean jj_3R_13() {
0635: if (jj_3R_23())
0636: return true;
0637: return false;
0638: }
0639:
0640: static final private boolean jj_3R_12() {
0641: if (jj_3R_22())
0642: return true;
0643: return false;
0644: }
0645:
0646: static final private boolean jj_3R_18() {
0647: Token xsp;
0648: xsp = jj_scanpos;
0649: if (jj_3_2()) {
0650: jj_scanpos = xsp;
0651: if (jj_3_3()) {
0652: jj_scanpos = xsp;
0653: if (jj_scan_token(21))
0654: return true;
0655: }
0656: }
0657: return false;
0658: }
0659:
0660: static final private boolean jj_3_2() {
0661: if (jj_scan_token(ANNOTATION))
0662: return true;
0663: if (jj_scan_token(LEFT_PARENTHEZIS))
0664: return true;
0665: Token xsp;
0666: xsp = jj_scanpos;
0667: if (jj_3_1()) {
0668: jj_scanpos = xsp;
0669: if (jj_3R_4())
0670: return true;
0671: }
0672: return false;
0673: }
0674:
0675: static final private boolean jj_3R_11() {
0676: if (jj_3R_21())
0677: return true;
0678: return false;
0679: }
0680:
0681: static final private boolean jj_3R_25() {
0682: if (jj_scan_token(FLOAT))
0683: return true;
0684: return false;
0685: }
0686:
0687: static final private boolean jj_3R_10() {
0688: if (jj_3R_20())
0689: return true;
0690: return false;
0691: }
0692:
0693: static final private boolean jj_3_4() {
0694: if (jj_scan_token(COMMA))
0695: return true;
0696: if (jj_3R_5())
0697: return true;
0698: return false;
0699: }
0700:
0701: static final private boolean jj_3R_9() {
0702: if (jj_3R_19())
0703: return true;
0704: return false;
0705: }
0706:
0707: static final private boolean jj_3R_19() {
0708: if (jj_scan_token(CHAR))
0709: return true;
0710: return false;
0711: }
0712:
0713: static final private boolean jj_3R_5() {
0714: Token xsp;
0715: xsp = jj_scanpos;
0716: if (jj_3R_8()) {
0717: jj_scanpos = xsp;
0718: if (jj_3R_9()) {
0719: jj_scanpos = xsp;
0720: if (jj_3R_10()) {
0721: jj_scanpos = xsp;
0722: if (jj_3R_11()) {
0723: jj_scanpos = xsp;
0724: if (jj_3R_12()) {
0725: jj_scanpos = xsp;
0726: if (jj_3R_13()) {
0727: jj_scanpos = xsp;
0728: if (jj_3R_14()) {
0729: jj_scanpos = xsp;
0730: if (jj_3R_15()) {
0731: jj_scanpos = xsp;
0732: if (jj_3R_16()) {
0733: jj_scanpos = xsp;
0734: if (jj_3R_17())
0735: return true;
0736: }
0737: }
0738: }
0739: }
0740: }
0741: }
0742: }
0743: }
0744: }
0745: return false;
0746: }
0747:
0748: static final private boolean jj_3R_8() {
0749: if (jj_3R_18())
0750: return true;
0751: return false;
0752: }
0753:
0754: static final private boolean jj_3R_28() {
0755: if (jj_3R_5())
0756: return true;
0757: return false;
0758: }
0759:
0760: static final private boolean jj_3_1() {
0761: if (jj_3R_3())
0762: return true;
0763: return false;
0764: }
0765:
0766: static final private boolean jj_3R_24() {
0767: if (jj_scan_token(INTEGER))
0768: return true;
0769: return false;
0770: }
0771:
0772: static final private boolean jj_3R_23() {
0773: if (jj_scan_token(BOOLEAN))
0774: return true;
0775: return false;
0776: }
0777:
0778: static final private boolean jj_3R_27() {
0779: if (jj_scan_token(OCTNUMBER))
0780: return true;
0781: return false;
0782: }
0783:
0784: static final private boolean jj_3R_6() {
0785: if (jj_scan_token(JAVA_NAME))
0786: return true;
0787: if (jj_scan_token(EQUALS))
0788: return true;
0789: if (jj_3R_5())
0790: return true;
0791: return false;
0792: }
0793:
0794: static final private boolean jj_3R_21() {
0795: if (jj_scan_token(LEFT_BRACKET))
0796: return true;
0797: Token xsp;
0798: xsp = jj_scanpos;
0799: if (jj_3R_28())
0800: jj_scanpos = xsp;
0801: if (jj_scan_token(RIGHT_BRACKET))
0802: return true;
0803: return false;
0804: }
0805:
0806: static final private boolean jj_3R_4() {
0807: if (jj_3R_5())
0808: return true;
0809: return false;
0810: }
0811:
0812: static private boolean jj_initialized_once = false;
0813: static public AnnotationParserTokenManager token_source;
0814: static SimpleCharStream jj_input_stream;
0815: static public Token token, jj_nt;
0816: static private int jj_ntk;
0817: static private Token jj_scanpos, jj_lastpos;
0818: static private int jj_la;
0819: static public boolean lookingAhead = false;
0820: static private boolean jj_semLA;
0821: static private int jj_gen;
0822: static final private int[] jj_la1 = new int[6];
0823: static private int[] jj_la1_0;
0824: static {
0825: jj_la1_0();
0826: }
0827:
0828: private static void jj_la1_0() {
0829: jj_la1_0 = new int[] { 0x4002001, 0xa11cf0, 0x200000, 0x40000,
0830: 0xa11cf0, 0xa11cf0, };
0831: }
0832:
0833: static final private JJCalls[] jj_2_rtns = new JJCalls[4];
0834: static private boolean jj_rescan = false;
0835: static private int jj_gc = 0;
0836:
0837: public AnnotationParser(java.io.InputStream stream) {
0838: if (jj_initialized_once) {
0839: System.out
0840: .println("ERROR: Second call to constructor of static parser. You must");
0841: System.out
0842: .println(" either use ReInit() or set the JavaCC option STATIC to false");
0843: System.out.println(" during parser generation.");
0844: throw new Error();
0845: }
0846: jj_initialized_once = true;
0847: jj_input_stream = new SimpleCharStream(stream, 1, 1);
0848: token_source = new AnnotationParserTokenManager(jj_input_stream);
0849: token = new Token();
0850: jj_ntk = -1;
0851: jj_gen = 0;
0852: for (int i = 0; i < 6; i++)
0853: jj_la1[i] = -1;
0854: for (int i = 0; i < jj_2_rtns.length; i++)
0855: jj_2_rtns[i] = new JJCalls();
0856: }
0857:
0858: static public void ReInit(java.io.InputStream stream) {
0859: jj_input_stream.ReInit(stream, 1, 1);
0860: token_source.ReInit(jj_input_stream);
0861: token = new Token();
0862: jj_ntk = -1;
0863: jjtree.reset();
0864: jj_gen = 0;
0865: for (int i = 0; i < 6; i++)
0866: jj_la1[i] = -1;
0867: for (int i = 0; i < jj_2_rtns.length; i++)
0868: jj_2_rtns[i] = new JJCalls();
0869: }
0870:
0871: public AnnotationParser(java.io.Reader stream) {
0872: if (jj_initialized_once) {
0873: System.out
0874: .println("ERROR: Second call to constructor of static parser. You must");
0875: System.out
0876: .println(" either use ReInit() or set the JavaCC option STATIC to false");
0877: System.out.println(" during parser generation.");
0878: throw new Error();
0879: }
0880: jj_initialized_once = true;
0881: jj_input_stream = new SimpleCharStream(stream, 1, 1);
0882: token_source = new AnnotationParserTokenManager(jj_input_stream);
0883: token = new Token();
0884: jj_ntk = -1;
0885: jj_gen = 0;
0886: for (int i = 0; i < 6; i++)
0887: jj_la1[i] = -1;
0888: for (int i = 0; i < jj_2_rtns.length; i++)
0889: jj_2_rtns[i] = new JJCalls();
0890: }
0891:
0892: static public void ReInit(java.io.Reader stream) {
0893: jj_input_stream.ReInit(stream, 1, 1);
0894: token_source.ReInit(jj_input_stream);
0895: token = new Token();
0896: jj_ntk = -1;
0897: jjtree.reset();
0898: jj_gen = 0;
0899: for (int i = 0; i < 6; i++)
0900: jj_la1[i] = -1;
0901: for (int i = 0; i < jj_2_rtns.length; i++)
0902: jj_2_rtns[i] = new JJCalls();
0903: }
0904:
0905: public AnnotationParser(AnnotationParserTokenManager tm) {
0906: if (jj_initialized_once) {
0907: System.out
0908: .println("ERROR: Second call to constructor of static parser. You must");
0909: System.out
0910: .println(" either use ReInit() or set the JavaCC option STATIC to false");
0911: System.out.println(" during parser generation.");
0912: throw new Error();
0913: }
0914: jj_initialized_once = true;
0915: token_source = tm;
0916: token = new Token();
0917: jj_ntk = -1;
0918: jj_gen = 0;
0919: for (int i = 0; i < 6; i++)
0920: jj_la1[i] = -1;
0921: for (int i = 0; i < jj_2_rtns.length; i++)
0922: jj_2_rtns[i] = new JJCalls();
0923: }
0924:
0925: public void ReInit(AnnotationParserTokenManager tm) {
0926: token_source = tm;
0927: token = new Token();
0928: jj_ntk = -1;
0929: jjtree.reset();
0930: jj_gen = 0;
0931: for (int i = 0; i < 6; i++)
0932: jj_la1[i] = -1;
0933: for (int i = 0; i < jj_2_rtns.length; i++)
0934: jj_2_rtns[i] = new JJCalls();
0935: }
0936:
0937: static final private Token jj_consume_token(int kind)
0938: throws ParseException {
0939: Token oldToken;
0940: if ((oldToken = token).next != null)
0941: token = token.next;
0942: else
0943: token = token.next = token_source.getNextToken();
0944: jj_ntk = -1;
0945: if (token.kind == kind) {
0946: jj_gen++;
0947: if (++jj_gc > 100) {
0948: jj_gc = 0;
0949: for (int i = 0; i < jj_2_rtns.length; i++) {
0950: JJCalls c = jj_2_rtns[i];
0951: while (c != null) {
0952: if (c.gen < jj_gen)
0953: c.first = null;
0954: c = c.next;
0955: }
0956: }
0957: }
0958: return token;
0959: }
0960: token = oldToken;
0961: jj_kind = kind;
0962: throw generateParseException();
0963: }
0964:
0965: static private final class LookaheadSuccess extends java.lang.Error {
0966: }
0967:
0968: static final private LookaheadSuccess jj_ls = new LookaheadSuccess();
0969:
0970: static final private boolean jj_scan_token(int kind) {
0971: if (jj_scanpos == jj_lastpos) {
0972: jj_la--;
0973: if (jj_scanpos.next == null) {
0974: jj_lastpos = jj_scanpos = jj_scanpos.next = token_source
0975: .getNextToken();
0976: } else {
0977: jj_lastpos = jj_scanpos = jj_scanpos.next;
0978: }
0979: } else {
0980: jj_scanpos = jj_scanpos.next;
0981: }
0982: if (jj_rescan) {
0983: int i = 0;
0984: Token tok = token;
0985: while (tok != null && tok != jj_scanpos) {
0986: i++;
0987: tok = tok.next;
0988: }
0989: if (tok != null)
0990: jj_add_error_token(kind, i);
0991: }
0992: if (jj_scanpos.kind != kind)
0993: return true;
0994: if (jj_la == 0 && jj_scanpos == jj_lastpos)
0995: throw jj_ls;
0996: return false;
0997: }
0998:
0999: static final public Token getNextToken() {
1000: if (token.next != null)
1001: token = token.next;
1002: else
1003: token = token.next = token_source.getNextToken();
1004: jj_ntk = -1;
1005: jj_gen++;
1006: return token;
1007: }
1008:
1009: static final public Token getToken(int index) {
1010: Token t = lookingAhead ? jj_scanpos : token;
1011: for (int i = 0; i < index; i++) {
1012: if (t.next != null)
1013: t = t.next;
1014: else
1015: t = t.next = token_source.getNextToken();
1016: }
1017: return t;
1018: }
1019:
1020: static final private int jj_ntk() {
1021: if ((jj_nt = token.next) == null)
1022: return (jj_ntk = (token.next = token_source.getNextToken()).kind);
1023: else
1024: return (jj_ntk = jj_nt.kind);
1025: }
1026:
1027: static private java.util.Vector jj_expentries = new java.util.Vector();
1028: static private int[] jj_expentry;
1029: static private int jj_kind = -1;
1030: static private int[] jj_lasttokens = new int[100];
1031: static private int jj_endpos;
1032:
1033: static private void jj_add_error_token(int kind, int pos) {
1034: if (pos >= 100)
1035: return;
1036: if (pos == jj_endpos + 1) {
1037: jj_lasttokens[jj_endpos++] = kind;
1038: } else if (jj_endpos != 0) {
1039: jj_expentry = new int[jj_endpos];
1040: for (int i = 0; i < jj_endpos; i++) {
1041: jj_expentry[i] = jj_lasttokens[i];
1042: }
1043: boolean exists = false;
1044: for (java.util.Enumeration e = jj_expentries.elements(); e
1045: .hasMoreElements();) {
1046: int[] oldentry = (int[]) (e.nextElement());
1047: if (oldentry.length == jj_expentry.length) {
1048: exists = true;
1049: for (int i = 0; i < jj_expentry.length; i++) {
1050: if (oldentry[i] != jj_expentry[i]) {
1051: exists = false;
1052: break;
1053: }
1054: }
1055: if (exists)
1056: break;
1057: }
1058: }
1059: if (!exists)
1060: jj_expentries.addElement(jj_expentry);
1061: if (pos != 0)
1062: jj_lasttokens[(jj_endpos = pos) - 1] = kind;
1063: }
1064: }
1065:
1066: static public ParseException generateParseException() {
1067: jj_expentries.removeAllElements();
1068: boolean[] la1tokens = new boolean[27];
1069: for (int i = 0; i < 27; i++) {
1070: la1tokens[i] = false;
1071: }
1072: if (jj_kind >= 0) {
1073: la1tokens[jj_kind] = true;
1074: jj_kind = -1;
1075: }
1076: for (int i = 0; i < 6; i++) {
1077: if (jj_la1[i] == jj_gen) {
1078: for (int j = 0; j < 32; j++) {
1079: if ((jj_la1_0[i] & (1 << j)) != 0) {
1080: la1tokens[j] = true;
1081: }
1082: }
1083: }
1084: }
1085: for (int i = 0; i < 27; i++) {
1086: if (la1tokens[i]) {
1087: jj_expentry = new int[1];
1088: jj_expentry[0] = i;
1089: jj_expentries.addElement(jj_expentry);
1090: }
1091: }
1092: jj_endpos = 0;
1093: jj_rescan_token();
1094: jj_add_error_token(0, 0);
1095: int[][] exptokseq = new int[jj_expentries.size()][];
1096: for (int i = 0; i < jj_expentries.size(); i++) {
1097: exptokseq[i] = (int[]) jj_expentries.elementAt(i);
1098: }
1099: return new ParseException(token, exptokseq, tokenImage);
1100: }
1101:
1102: static final public void enable_tracing() {
1103: }
1104:
1105: static final public void disable_tracing() {
1106: }
1107:
1108: static final private void jj_rescan_token() {
1109: jj_rescan = true;
1110: for (int i = 0; i < 4; i++) {
1111: JJCalls p = jj_2_rtns[i];
1112: do {
1113: if (p.gen > jj_gen) {
1114: jj_la = p.arg;
1115: jj_lastpos = jj_scanpos = p.first;
1116: switch (i) {
1117: case 0:
1118: jj_3_1();
1119: break;
1120: case 1:
1121: jj_3_2();
1122: break;
1123: case 2:
1124: jj_3_3();
1125: break;
1126: case 3:
1127: jj_3_4();
1128: break;
1129: }
1130: }
1131: p = p.next;
1132: } while (p != null);
1133: }
1134: jj_rescan = false;
1135: }
1136:
1137: static final private void jj_save(int index, int xla) {
1138: JJCalls p = jj_2_rtns[index];
1139: while (p.gen > jj_gen) {
1140: if (p.next == null) {
1141: p = p.next = new JJCalls();
1142: break;
1143: }
1144: p = p.next;
1145: }
1146: p.gen = jj_gen + xla - jj_la;
1147: p.first = token;
1148: p.arg = xla;
1149: }
1150:
1151: static final class JJCalls {
1152: int gen;
1153: Token first;
1154: int arg;
1155: JJCalls next;
1156: }
1157:
1158: }
|