0001: // $ANTLR 2.7.5 (20050128): "sjava.g" -> "JavaRecognizer.java"$
0002:
0003: package biz.hammurapi.codegen;
0004:
0005: import antlr.TokenBuffer;
0006: import antlr.TokenStreamException;
0007: import antlr.TokenStreamIOException;
0008: import antlr.ANTLRException;
0009: import antlr.LLkParser;
0010: import antlr.Token;
0011: import antlr.TokenStream;
0012: import antlr.RecognitionException;
0013: import antlr.NoViableAltException;
0014: import antlr.MismatchedTokenException;
0015: import antlr.SemanticException;
0016: import antlr.ParserSharedInputState;
0017: import antlr.collections.impl.BitSet;
0018: import antlr.collections.AST;
0019: import java.util.Hashtable;
0020: import antlr.ASTFactory;
0021: import antlr.ASTPair;
0022: import antlr.collections.impl.ASTArray;
0023:
0024: /** Java 1.3 Recognizer
0025: *
0026: * Run 'java Main [-showtree] directory-full-of-java-files'
0027: *
0028: * [The -showtree option pops up a Swing frame that shows
0029: * the AST constructed from the parser.]
0030: *
0031: * Run 'java Main <directory full of java files>'
0032: *
0033: * Contributing authors:
0034: * John Mitchell johnm@non.net
0035: * Terence Parr parrt@magelang.com
0036: * John Lilley jlilley@empathy.com
0037: * Scott Stanchfield thetick@magelang.com
0038: * Markus Mohnen mohnen@informatik.rwth-aachen.de
0039: * Peter Williams pete.williams@sun.com
0040: * Allan Jacobs Allan.Jacobs@eng.sun.com
0041: * Steve Messick messick@redhills.com
0042: * John Pybus john@pybus.org
0043: *
0044: * Version 1.00 December 9, 1997 -- initial release
0045: * Version 1.01 December 10, 1997
0046: * fixed bug in octal def (0..7 not 0..8)
0047: * Version 1.10 August 1998 (parrt)
0048: * added tree construction
0049: * fixed definition of WS,comments for mac,pc,unix newlines
0050: * added unary plus
0051: * Version 1.11 (Nov 20, 1998)
0052: * Added "shutup" option to turn off last ambig warning.
0053: * Fixed inner class def to allow named class defs as statements
0054: * synchronized requires compound not simple statement
0055: * add [] after builtInType DOT class in primaryExpression
0056: * "const" is reserved but not valid..removed from modifiers
0057: * Version 1.12 (Feb 2, 1999)
0058: * Changed LITERAL_xxx to xxx in tree grammar.
0059: * Updated java.g to use tokens {...} now for 2.6.0 (new feature).
0060: *
0061: * Version 1.13 (Apr 23, 1999)
0062: * Didn't have (stat)? for else clause in tree parser.
0063: * Didn't gen ASTs for interface extends. Updated tree parser too.
0064: * Updated to 2.6.0.
0065: * Version 1.14 (Jun 20, 1999)
0066: * Allowed final/abstract on local classes.
0067: * Removed local interfaces from methods
0068: * Put instanceof precedence where it belongs...in relationalExpr
0069: * It also had expr not type as arg; fixed it.
0070: * Missing ! on SEMI in classBlock
0071: * fixed: (expr) + "string" was parsed incorrectly (+ as unary plus).
0072: * fixed: didn't like Object[].class in parser or tree parser
0073: * Version 1.15 (Jun 26, 1999)
0074: * Screwed up rule with instanceof in it. :( Fixed.
0075: * Tree parser didn't like (expr).something; fixed.
0076: * Allowed multiple inheritance in tree grammar. oops.
0077: * Version 1.16 (August 22, 1999)
0078: * Extending an interface built a wacky tree: had extra EXTENDS.
0079: * Tree grammar didn't allow multiple superinterfaces.
0080: * Tree grammar didn't allow empty var initializer: {}
0081: * Version 1.17 (October 12, 1999)
0082: * ESC lexer rule allowed 399 max not 377 max.
0083: * java.tree.g didn't handle the expression of synchronized
0084: * statements.
0085: * Version 1.18 (August 12, 2001)
0086: * Terence updated to Java 2 Version 1.3 by
0087: * observing/combining work of Allan Jacobs and Steve
0088: * Messick. Handles 1.3 src. Summary:
0089: * o primary didn't include boolean.class kind of thing
0090: * o constructor calls parsed explicitly now:
0091: * see explicitConstructorInvocation
0092: * o add strictfp modifier
0093: * o missing objBlock after new expression in tree grammar
0094: * o merged local class definition alternatives, moved after declaration
0095: * o fixed problem with ClassName.super.field
0096: * o reordered some alternatives to make things more efficient
0097: * o long and double constants were not differentiated from int/float
0098: * o whitespace rule was inefficient: matched only one char
0099: * o add an examples directory with some nasty 1.3 cases
0100: * o made Main.java use buffered IO and a Reader for Unicode support
0101: * o supports UNICODE?
0102: * Using Unicode charVocabulay makes code file big, but only
0103: * in the bitsets at the end. I need to make ANTLR generate
0104: * unicode bitsets more efficiently.
0105: * Version 1.19 (April 25, 2002)
0106: * Terence added in nice fixes by John Pybus concerning floating
0107: * constants and problems with super() calls. John did a nice
0108: * reorg of the primary/postfix expression stuff to read better
0109: * and makes f.g.super() parse properly (it was METHOD_CALL not
0110: * a SUPER_CTOR_CALL). Also:
0111: *
0112: * o "finally" clause was a root...made it a child of "try"
0113: * o Added stuff for asserts too for Java 1.4, but *commented out*
0114: * as it is not backward compatible.
0115: *
0116: * Version 1.20 (October 27, 2002)
0117: *
0118: * Terence ended up reorging John Pybus' stuff to
0119: * remove some nondeterminisms and some syntactic predicates.
0120: * Note that the grammar is stricter now; e.g., this(...) must
0121: * be the first statement.
0122: *
0123: * Trinary ?: operator wasn't working as array name:
0124: * (isBig ? bigDigits : digits)[i];
0125: *
0126: * Checked parser/tree parser on source for
0127: * Resin-2.0.5, jive-2.1.1, jdk 1.3.1, Lucene, antlr 2.7.2a4,
0128: * and the 110k-line jGuru server source.
0129: *
0130: * This grammar is in the PUBLIC DOMAIN
0131: */
0132: public class JavaRecognizer extends antlr.LLkParser implements
0133: JavaTokenTypes {
0134:
0135: protected JavaRecognizer(TokenBuffer tokenBuf, int k) {
0136: super (tokenBuf, k);
0137: tokenNames = _tokenNames;
0138: buildTokenTypeASTClassMap();
0139: astFactory = new ASTFactory(getTokenTypeToASTClassMap());
0140: }
0141:
0142: public JavaRecognizer(TokenBuffer tokenBuf) {
0143: this (tokenBuf, 2);
0144: }
0145:
0146: protected JavaRecognizer(TokenStream lexer, int k) {
0147: super (lexer, k);
0148: tokenNames = _tokenNames;
0149: buildTokenTypeASTClassMap();
0150: astFactory = new ASTFactory(getTokenTypeToASTClassMap());
0151: }
0152:
0153: public JavaRecognizer(TokenStream lexer) {
0154: this (lexer, 2);
0155: }
0156:
0157: public JavaRecognizer(ParserSharedInputState state) {
0158: super (state, 2);
0159: tokenNames = _tokenNames;
0160: buildTokenTypeASTClassMap();
0161: astFactory = new ASTFactory(getTokenTypeToASTClassMap());
0162: }
0163:
0164: public final void typeDefinition() throws RecognitionException,
0165: TokenStreamException {
0166:
0167: returnAST = null;
0168: ASTPair currentAST = new ASTPair();
0169: AST typeDefinition_AST = null;
0170: AST m_AST = null;
0171:
0172: try { // for error handling
0173: modifiers();
0174: m_AST = (AST) returnAST;
0175: {
0176: switch (LA(1)) {
0177: case LITERAL_class: {
0178: classDefinition(m_AST);
0179: astFactory.addASTChild(currentAST, returnAST);
0180: break;
0181: }
0182: case LITERAL_interface: {
0183: interfaceDefinition(m_AST);
0184: astFactory.addASTChild(currentAST, returnAST);
0185: break;
0186: }
0187: default: {
0188: throw new NoViableAltException(LT(1), getFilename());
0189: }
0190: }
0191: }
0192: match(Token.EOF_TYPE);
0193: typeDefinition_AST = (AST) currentAST.root;
0194: } catch (RecognitionException ex) {
0195: reportError(ex);
0196: recover(ex, _tokenSet_0);
0197: }
0198: returnAST = typeDefinition_AST;
0199: }
0200:
0201: public final void modifiers() throws RecognitionException,
0202: TokenStreamException {
0203:
0204: returnAST = null;
0205: ASTPair currentAST = new ASTPair();
0206: AST modifiers_AST = null;
0207:
0208: {
0209: _loop18: do {
0210: if ((_tokenSet_1.member(LA(1)))) {
0211: modifier();
0212: astFactory.addASTChild(currentAST, returnAST);
0213: } else {
0214: break _loop18;
0215: }
0216:
0217: } while (true);
0218: }
0219: modifiers_AST = (AST) currentAST.root;
0220: modifiers_AST = (AST) astFactory.make((new ASTArray(2)).add(
0221: astFactory.create(MODIFIERS, "MODIFIERS")).add(
0222: modifiers_AST));
0223: currentAST.root = modifiers_AST;
0224: currentAST.child = modifiers_AST != null
0225: && modifiers_AST.getFirstChild() != null ? modifiers_AST
0226: .getFirstChild()
0227: : modifiers_AST;
0228: currentAST.advanceChildToEnd();
0229: modifiers_AST = (AST) currentAST.root;
0230: returnAST = modifiers_AST;
0231: }
0232:
0233: public final void classDefinition(AST modifiers)
0234: throws RecognitionException, TokenStreamException {
0235:
0236: returnAST = null;
0237: ASTPair currentAST = new ASTPair();
0238: AST classDefinition_AST = null;
0239: AST name_AST = null;
0240: AST sc_AST = null;
0241: AST ic_AST = null;
0242:
0243: match(LITERAL_class);
0244: identifier();
0245: name_AST = (AST) returnAST;
0246: super ClassClause();
0247: sc_AST = (AST) returnAST;
0248: implements Clause();
0249: ic_AST = (AST) returnAST;
0250: classDefinition_AST = (AST) currentAST.root;
0251: classDefinition_AST = (AST) astFactory.make((new ASTArray(5))
0252: .add(astFactory.create(CLASS_DEF, "CLASS_DEF")).add(
0253: modifiers).add(name_AST).add(sc_AST)
0254: .add(ic_AST));
0255: currentAST.root = classDefinition_AST;
0256: currentAST.child = classDefinition_AST != null
0257: && classDefinition_AST.getFirstChild() != null ? classDefinition_AST
0258: .getFirstChild()
0259: : classDefinition_AST;
0260: currentAST.advanceChildToEnd();
0261: returnAST = classDefinition_AST;
0262: }
0263:
0264: public final void interfaceDefinition(AST modifiers)
0265: throws RecognitionException, TokenStreamException {
0266:
0267: returnAST = null;
0268: ASTPair currentAST = new ASTPair();
0269: AST interfaceDefinition_AST = null;
0270: AST name_AST = null;
0271: AST ie_AST = null;
0272:
0273: match(LITERAL_interface);
0274: identifier();
0275: name_AST = (AST) returnAST;
0276: interfaceExtends();
0277: ie_AST = (AST) returnAST;
0278: interfaceDefinition_AST = (AST) currentAST.root;
0279: interfaceDefinition_AST = (AST) astFactory
0280: .make((new ASTArray(4)).add(
0281: astFactory.create(INTERFACE_DEF,
0282: "INTERFACE_DEF")).add(modifiers).add(
0283: name_AST).add(ie_AST));
0284: currentAST.root = interfaceDefinition_AST;
0285: currentAST.child = interfaceDefinition_AST != null
0286: && interfaceDefinition_AST.getFirstChild() != null ? interfaceDefinition_AST
0287: .getFirstChild()
0288: : interfaceDefinition_AST;
0289: currentAST.advanceChildToEnd();
0290: returnAST = interfaceDefinition_AST;
0291: }
0292:
0293: /** A declaration is the creation of a reference or primitive-type variable
0294: * Create a separate Type/Var tree for each var in the var list.
0295: */
0296: public final void declaration() throws RecognitionException,
0297: TokenStreamException {
0298:
0299: returnAST = null;
0300: ASTPair currentAST = new ASTPair();
0301: AST declaration_AST = null;
0302: AST m_AST = null;
0303: AST t_AST = null;
0304: AST v_AST = null;
0305:
0306: modifiers();
0307: m_AST = (AST) returnAST;
0308: typeSpecification(false);
0309: t_AST = (AST) returnAST;
0310: variableDefinitions(m_AST, t_AST);
0311: v_AST = (AST) returnAST;
0312: declaration_AST = (AST) currentAST.root;
0313: declaration_AST = v_AST;
0314: currentAST.root = declaration_AST;
0315: currentAST.child = declaration_AST != null
0316: && declaration_AST.getFirstChild() != null ? declaration_AST
0317: .getFirstChild()
0318: : declaration_AST;
0319: currentAST.advanceChildToEnd();
0320: returnAST = declaration_AST;
0321: }
0322:
0323: public final void typeSpecification(boolean addImagNode)
0324: throws RecognitionException, TokenStreamException {
0325:
0326: returnAST = null;
0327: ASTPair currentAST = new ASTPair();
0328: AST typeSpecification_AST = null;
0329:
0330: switch (LA(1)) {
0331: case IDENT: {
0332: classTypeSpecification(addImagNode);
0333: astFactory.addASTChild(currentAST, returnAST);
0334: typeSpecification_AST = (AST) currentAST.root;
0335: break;
0336: }
0337: case LITERAL_void:
0338: case LITERAL_boolean:
0339: case LITERAL_byte:
0340: case LITERAL_char:
0341: case LITERAL_short:
0342: case LITERAL_int:
0343: case LITERAL_float:
0344: case LITERAL_long:
0345: case LITERAL_double: {
0346: builtInTypeSpecification(addImagNode);
0347: astFactory.addASTChild(currentAST, returnAST);
0348: typeSpecification_AST = (AST) currentAST.root;
0349: break;
0350: }
0351: default: {
0352: throw new NoViableAltException(LT(1), getFilename());
0353: }
0354: }
0355: returnAST = typeSpecification_AST;
0356: }
0357:
0358: public final void variableDefinitions(AST mods, AST t)
0359: throws RecognitionException, TokenStreamException {
0360:
0361: returnAST = null;
0362: ASTPair currentAST = new ASTPair();
0363: AST variableDefinitions_AST = null;
0364:
0365: variableDeclarator(getASTFactory().dupTree(mods),
0366: getASTFactory().dupTree(t));
0367: astFactory.addASTChild(currentAST, returnAST);
0368: {
0369: _loop39: do {
0370: if ((LA(1) == COMMA)) {
0371: match(COMMA);
0372: variableDeclarator(getASTFactory().dupTree(mods),
0373: getASTFactory().dupTree(t));
0374: astFactory.addASTChild(currentAST, returnAST);
0375: } else {
0376: break _loop39;
0377: }
0378:
0379: } while (true);
0380: }
0381: variableDefinitions_AST = (AST) currentAST.root;
0382: returnAST = variableDefinitions_AST;
0383: }
0384:
0385: public final void classTypeSpecification(boolean addImagNode)
0386: throws RecognitionException, TokenStreamException {
0387:
0388: returnAST = null;
0389: ASTPair currentAST = new ASTPair();
0390: AST classTypeSpecification_AST = null;
0391: Token lb = null;
0392: AST lb_AST = null;
0393:
0394: identifier();
0395: astFactory.addASTChild(currentAST, returnAST);
0396: {
0397: _loop7: do {
0398: if ((LA(1) == LBRACK)) {
0399: lb = LT(1);
0400: lb_AST = astFactory.create(lb);
0401: astFactory.makeASTRoot(currentAST, lb_AST);
0402: match(LBRACK);
0403: lb_AST.setType(ARRAY_DECLARATOR);
0404: match(RBRACK);
0405: } else {
0406: break _loop7;
0407: }
0408:
0409: } while (true);
0410: }
0411: classTypeSpecification_AST = (AST) currentAST.root;
0412:
0413: if (addImagNode) {
0414: classTypeSpecification_AST = (AST) astFactory
0415: .make((new ASTArray(2)).add(
0416: astFactory.create(TYPE, "TYPE")).add(
0417: classTypeSpecification_AST));
0418: }
0419:
0420: currentAST.root = classTypeSpecification_AST;
0421: currentAST.child = classTypeSpecification_AST != null
0422: && classTypeSpecification_AST.getFirstChild() != null ? classTypeSpecification_AST
0423: .getFirstChild()
0424: : classTypeSpecification_AST;
0425: currentAST.advanceChildToEnd();
0426: classTypeSpecification_AST = (AST) currentAST.root;
0427: returnAST = classTypeSpecification_AST;
0428: }
0429:
0430: public final void builtInTypeSpecification(boolean addImagNode)
0431: throws RecognitionException, TokenStreamException {
0432:
0433: returnAST = null;
0434: ASTPair currentAST = new ASTPair();
0435: AST builtInTypeSpecification_AST = null;
0436: Token lb = null;
0437: AST lb_AST = null;
0438:
0439: builtInType();
0440: astFactory.addASTChild(currentAST, returnAST);
0441: {
0442: _loop10: do {
0443: if ((LA(1) == LBRACK)) {
0444: lb = LT(1);
0445: lb_AST = astFactory.create(lb);
0446: astFactory.makeASTRoot(currentAST, lb_AST);
0447: match(LBRACK);
0448: lb_AST.setType(ARRAY_DECLARATOR);
0449: match(RBRACK);
0450: } else {
0451: break _loop10;
0452: }
0453:
0454: } while (true);
0455: }
0456: builtInTypeSpecification_AST = (AST) currentAST.root;
0457:
0458: if (addImagNode) {
0459: builtInTypeSpecification_AST = (AST) astFactory
0460: .make((new ASTArray(2)).add(
0461: astFactory.create(TYPE, "TYPE")).add(
0462: builtInTypeSpecification_AST));
0463: }
0464:
0465: currentAST.root = builtInTypeSpecification_AST;
0466: currentAST.child = builtInTypeSpecification_AST != null
0467: && builtInTypeSpecification_AST.getFirstChild() != null ? builtInTypeSpecification_AST
0468: .getFirstChild()
0469: : builtInTypeSpecification_AST;
0470: currentAST.advanceChildToEnd();
0471: builtInTypeSpecification_AST = (AST) currentAST.root;
0472: returnAST = builtInTypeSpecification_AST;
0473: }
0474:
0475: public final void identifier() throws RecognitionException,
0476: TokenStreamException {
0477:
0478: returnAST = null;
0479: ASTPair currentAST = new ASTPair();
0480: AST identifier_AST = null;
0481:
0482: AST tmp7_AST = null;
0483: tmp7_AST = astFactory.create(LT(1));
0484: astFactory.addASTChild(currentAST, tmp7_AST);
0485: match(IDENT);
0486: {
0487: _loop15: do {
0488: if ((LA(1) == DOT)) {
0489: AST tmp8_AST = null;
0490: tmp8_AST = astFactory.create(LT(1));
0491: astFactory.makeASTRoot(currentAST, tmp8_AST);
0492: match(DOT);
0493: AST tmp9_AST = null;
0494: tmp9_AST = astFactory.create(LT(1));
0495: astFactory.addASTChild(currentAST, tmp9_AST);
0496: match(IDENT);
0497: } else {
0498: break _loop15;
0499: }
0500:
0501: } while (true);
0502: }
0503: identifier_AST = (AST) currentAST.root;
0504: returnAST = identifier_AST;
0505: }
0506:
0507: public final void builtInType() throws RecognitionException,
0508: TokenStreamException {
0509:
0510: returnAST = null;
0511: ASTPair currentAST = new ASTPair();
0512: AST builtInType_AST = null;
0513:
0514: switch (LA(1)) {
0515: case LITERAL_void: {
0516: AST tmp10_AST = null;
0517: tmp10_AST = astFactory.create(LT(1));
0518: astFactory.addASTChild(currentAST, tmp10_AST);
0519: match(LITERAL_void);
0520: builtInType_AST = (AST) currentAST.root;
0521: break;
0522: }
0523: case LITERAL_boolean: {
0524: AST tmp11_AST = null;
0525: tmp11_AST = astFactory.create(LT(1));
0526: astFactory.addASTChild(currentAST, tmp11_AST);
0527: match(LITERAL_boolean);
0528: builtInType_AST = (AST) currentAST.root;
0529: break;
0530: }
0531: case LITERAL_byte: {
0532: AST tmp12_AST = null;
0533: tmp12_AST = astFactory.create(LT(1));
0534: astFactory.addASTChild(currentAST, tmp12_AST);
0535: match(LITERAL_byte);
0536: builtInType_AST = (AST) currentAST.root;
0537: break;
0538: }
0539: case LITERAL_char: {
0540: AST tmp13_AST = null;
0541: tmp13_AST = astFactory.create(LT(1));
0542: astFactory.addASTChild(currentAST, tmp13_AST);
0543: match(LITERAL_char);
0544: builtInType_AST = (AST) currentAST.root;
0545: break;
0546: }
0547: case LITERAL_short: {
0548: AST tmp14_AST = null;
0549: tmp14_AST = astFactory.create(LT(1));
0550: astFactory.addASTChild(currentAST, tmp14_AST);
0551: match(LITERAL_short);
0552: builtInType_AST = (AST) currentAST.root;
0553: break;
0554: }
0555: case LITERAL_int: {
0556: AST tmp15_AST = null;
0557: tmp15_AST = astFactory.create(LT(1));
0558: astFactory.addASTChild(currentAST, tmp15_AST);
0559: match(LITERAL_int);
0560: builtInType_AST = (AST) currentAST.root;
0561: break;
0562: }
0563: case LITERAL_float: {
0564: AST tmp16_AST = null;
0565: tmp16_AST = astFactory.create(LT(1));
0566: astFactory.addASTChild(currentAST, tmp16_AST);
0567: match(LITERAL_float);
0568: builtInType_AST = (AST) currentAST.root;
0569: break;
0570: }
0571: case LITERAL_long: {
0572: AST tmp17_AST = null;
0573: tmp17_AST = astFactory.create(LT(1));
0574: astFactory.addASTChild(currentAST, tmp17_AST);
0575: match(LITERAL_long);
0576: builtInType_AST = (AST) currentAST.root;
0577: break;
0578: }
0579: case LITERAL_double: {
0580: AST tmp18_AST = null;
0581: tmp18_AST = astFactory.create(LT(1));
0582: astFactory.addASTChild(currentAST, tmp18_AST);
0583: match(LITERAL_double);
0584: builtInType_AST = (AST) currentAST.root;
0585: break;
0586: }
0587: default: {
0588: throw new NoViableAltException(LT(1), getFilename());
0589: }
0590: }
0591: returnAST = builtInType_AST;
0592: }
0593:
0594: public final void type() throws RecognitionException,
0595: TokenStreamException {
0596:
0597: returnAST = null;
0598: ASTPair currentAST = new ASTPair();
0599: AST type_AST = null;
0600:
0601: switch (LA(1)) {
0602: case IDENT: {
0603: identifier();
0604: astFactory.addASTChild(currentAST, returnAST);
0605: type_AST = (AST) currentAST.root;
0606: break;
0607: }
0608: case LITERAL_void:
0609: case LITERAL_boolean:
0610: case LITERAL_byte:
0611: case LITERAL_char:
0612: case LITERAL_short:
0613: case LITERAL_int:
0614: case LITERAL_float:
0615: case LITERAL_long:
0616: case LITERAL_double: {
0617: builtInType();
0618: astFactory.addASTChild(currentAST, returnAST);
0619: type_AST = (AST) currentAST.root;
0620: break;
0621: }
0622: default: {
0623: throw new NoViableAltException(LT(1), getFilename());
0624: }
0625: }
0626: returnAST = type_AST;
0627: }
0628:
0629: public final void modifier() throws RecognitionException,
0630: TokenStreamException {
0631:
0632: returnAST = null;
0633: ASTPair currentAST = new ASTPair();
0634: AST modifier_AST = null;
0635:
0636: switch (LA(1)) {
0637: case LITERAL_private: {
0638: AST tmp19_AST = null;
0639: tmp19_AST = astFactory.create(LT(1));
0640: astFactory.addASTChild(currentAST, tmp19_AST);
0641: match(LITERAL_private);
0642: modifier_AST = (AST) currentAST.root;
0643: break;
0644: }
0645: case LITERAL_public: {
0646: AST tmp20_AST = null;
0647: tmp20_AST = astFactory.create(LT(1));
0648: astFactory.addASTChild(currentAST, tmp20_AST);
0649: match(LITERAL_public);
0650: modifier_AST = (AST) currentAST.root;
0651: break;
0652: }
0653: case LITERAL_protected: {
0654: AST tmp21_AST = null;
0655: tmp21_AST = astFactory.create(LT(1));
0656: astFactory.addASTChild(currentAST, tmp21_AST);
0657: match(LITERAL_protected);
0658: modifier_AST = (AST) currentAST.root;
0659: break;
0660: }
0661: case LITERAL_static: {
0662: AST tmp22_AST = null;
0663: tmp22_AST = astFactory.create(LT(1));
0664: astFactory.addASTChild(currentAST, tmp22_AST);
0665: match(LITERAL_static);
0666: modifier_AST = (AST) currentAST.root;
0667: break;
0668: }
0669: case LITERAL_transient: {
0670: AST tmp23_AST = null;
0671: tmp23_AST = astFactory.create(LT(1));
0672: astFactory.addASTChild(currentAST, tmp23_AST);
0673: match(LITERAL_transient);
0674: modifier_AST = (AST) currentAST.root;
0675: break;
0676: }
0677: case FINAL: {
0678: AST tmp24_AST = null;
0679: tmp24_AST = astFactory.create(LT(1));
0680: astFactory.addASTChild(currentAST, tmp24_AST);
0681: match(FINAL);
0682: modifier_AST = (AST) currentAST.root;
0683: break;
0684: }
0685: case ABSTRACT: {
0686: AST tmp25_AST = null;
0687: tmp25_AST = astFactory.create(LT(1));
0688: astFactory.addASTChild(currentAST, tmp25_AST);
0689: match(ABSTRACT);
0690: modifier_AST = (AST) currentAST.root;
0691: break;
0692: }
0693: case LITERAL_native: {
0694: AST tmp26_AST = null;
0695: tmp26_AST = astFactory.create(LT(1));
0696: astFactory.addASTChild(currentAST, tmp26_AST);
0697: match(LITERAL_native);
0698: modifier_AST = (AST) currentAST.root;
0699: break;
0700: }
0701: case LITERAL_threadsafe: {
0702: AST tmp27_AST = null;
0703: tmp27_AST = astFactory.create(LT(1));
0704: astFactory.addASTChild(currentAST, tmp27_AST);
0705: match(LITERAL_threadsafe);
0706: modifier_AST = (AST) currentAST.root;
0707: break;
0708: }
0709: case LITERAL_synchronized: {
0710: AST tmp28_AST = null;
0711: tmp28_AST = astFactory.create(LT(1));
0712: astFactory.addASTChild(currentAST, tmp28_AST);
0713: match(LITERAL_synchronized);
0714: modifier_AST = (AST) currentAST.root;
0715: break;
0716: }
0717: case LITERAL_volatile: {
0718: AST tmp29_AST = null;
0719: tmp29_AST = astFactory.create(LT(1));
0720: astFactory.addASTChild(currentAST, tmp29_AST);
0721: match(LITERAL_volatile);
0722: modifier_AST = (AST) currentAST.root;
0723: break;
0724: }
0725: case STRICTFP: {
0726: AST tmp30_AST = null;
0727: tmp30_AST = astFactory.create(LT(1));
0728: astFactory.addASTChild(currentAST, tmp30_AST);
0729: match(STRICTFP);
0730: modifier_AST = (AST) currentAST.root;
0731: break;
0732: }
0733: default: {
0734: throw new NoViableAltException(LT(1), getFilename());
0735: }
0736: }
0737: returnAST = modifier_AST;
0738: }
0739:
0740: public final void super ClassClause() throws RecognitionException,
0741: TokenStreamException {
0742:
0743: returnAST = null;
0744: ASTPair currentAST = new ASTPair();
0745: AST super ClassClause_AST = null;
0746: AST id_AST = null;
0747:
0748: {
0749: switch (LA(1)) {
0750: case LITERAL_extends: {
0751: match(LITERAL_extends);
0752: identifier();
0753: id_AST = (AST) returnAST;
0754: break;
0755: }
0756: case EOF:
0757: case LITERAL_implements : {
0758: break;
0759: }
0760: default: {
0761: throw new NoViableAltException(LT(1), getFilename());
0762: }
0763: }
0764: }
0765: super ClassClause_AST = (AST) currentAST.root;
0766: super ClassClause_AST = (AST) astFactory.make((new ASTArray(2))
0767: .add(
0768: astFactory.create(EXTENDS_CLAUSE,
0769: "EXTENDS_CLAUSE")).add(id_AST));
0770: currentAST.root = super ClassClause_AST;
0771: currentAST.child = super ClassClause_AST != null
0772: && super ClassClause_AST.getFirstChild() != null ? super ClassClause_AST
0773: .getFirstChild()
0774: : super ClassClause_AST;
0775: currentAST.advanceChildToEnd();
0776: returnAST = super ClassClause_AST;
0777: }
0778:
0779: public final void implements Clause() throws RecognitionException,
0780: TokenStreamException {
0781:
0782: returnAST = null;
0783: ASTPair currentAST = new ASTPair();
0784: AST implements Clause_AST = null;
0785: Token i = null;
0786: AST i_AST = null;
0787:
0788: {
0789: switch (LA(1)) {
0790: case LITERAL_implements : {
0791: i = LT(1);
0792: i_AST = astFactory.create(i);
0793: match(LITERAL_implements );
0794: identifier();
0795: astFactory.addASTChild(currentAST, returnAST);
0796: {
0797: _loop31: do {
0798: if ((LA(1) == COMMA)) {
0799: match(COMMA);
0800: identifier();
0801: astFactory.addASTChild(currentAST,
0802: returnAST);
0803: } else {
0804: break _loop31;
0805: }
0806:
0807: } while (true);
0808: }
0809: break;
0810: }
0811: case EOF: {
0812: break;
0813: }
0814: default: {
0815: throw new NoViableAltException(LT(1), getFilename());
0816: }
0817: }
0818: }
0819: implements Clause_AST = (AST) currentAST.root;
0820: implements Clause_AST = (AST) astFactory.make((new ASTArray(2))
0821: .add(
0822: astFactory.create(IMPLEMENTS_CLAUSE,
0823: "IMPLEMENTS_CLAUSE")).add(
0824: implements Clause_AST));
0825: currentAST.root = implements Clause_AST;
0826: currentAST.child = implements Clause_AST != null
0827: && implements Clause_AST.getFirstChild() != null ? implements Clause_AST
0828: .getFirstChild()
0829: : implements Clause_AST;
0830: currentAST.advanceChildToEnd();
0831: implements Clause_AST = (AST) currentAST.root;
0832: returnAST = implements Clause_AST;
0833: }
0834:
0835: public final void interfaceExtends() throws RecognitionException,
0836: TokenStreamException {
0837:
0838: returnAST = null;
0839: ASTPair currentAST = new ASTPair();
0840: AST interfaceExtends_AST = null;
0841: Token e = null;
0842: AST e_AST = null;
0843:
0844: {
0845: switch (LA(1)) {
0846: case LITERAL_extends: {
0847: e = LT(1);
0848: e_AST = astFactory.create(e);
0849: match(LITERAL_extends);
0850: identifier();
0851: astFactory.addASTChild(currentAST, returnAST);
0852: {
0853: _loop27: do {
0854: if ((LA(1) == COMMA)) {
0855: match(COMMA);
0856: identifier();
0857: astFactory.addASTChild(currentAST,
0858: returnAST);
0859: } else {
0860: break _loop27;
0861: }
0862:
0863: } while (true);
0864: }
0865: break;
0866: }
0867: case EOF: {
0868: break;
0869: }
0870: default: {
0871: throw new NoViableAltException(LT(1), getFilename());
0872: }
0873: }
0874: }
0875: interfaceExtends_AST = (AST) currentAST.root;
0876: interfaceExtends_AST = (AST) astFactory.make((new ASTArray(2))
0877: .add(
0878: astFactory.create(EXTENDS_CLAUSE,
0879: "EXTENDS_CLAUSE")).add(
0880: interfaceExtends_AST));
0881: currentAST.root = interfaceExtends_AST;
0882: currentAST.child = interfaceExtends_AST != null
0883: && interfaceExtends_AST.getFirstChild() != null ? interfaceExtends_AST
0884: .getFirstChild()
0885: : interfaceExtends_AST;
0886: currentAST.advanceChildToEnd();
0887: interfaceExtends_AST = (AST) currentAST.root;
0888: returnAST = interfaceExtends_AST;
0889: }
0890:
0891: public final void methodName() throws RecognitionException,
0892: TokenStreamException {
0893:
0894: returnAST = null;
0895: ASTPair currentAST = new ASTPair();
0896: AST methodName_AST = null;
0897:
0898: switch (LA(1)) {
0899: case IDENT: {
0900: AST tmp34_AST = null;
0901: tmp34_AST = astFactory.create(LT(1));
0902: astFactory.addASTChild(currentAST, tmp34_AST);
0903: match(IDENT);
0904: methodName_AST = (AST) currentAST.root;
0905: break;
0906: }
0907: case INIT: {
0908: AST tmp35_AST = null;
0909: tmp35_AST = astFactory.create(LT(1));
0910: astFactory.addASTChild(currentAST, tmp35_AST);
0911: match(INIT);
0912: methodName_AST = (AST) currentAST.root;
0913: break;
0914: }
0915: default: {
0916: throw new NoViableAltException(LT(1), getFilename());
0917: }
0918: }
0919: returnAST = methodName_AST;
0920: }
0921:
0922: public final void field() throws RecognitionException,
0923: TokenStreamException {
0924:
0925: returnAST = null;
0926: ASTPair currentAST = new ASTPair();
0927: AST field_AST = null;
0928: AST mods_AST = null;
0929: AST t_AST = null;
0930: AST name_AST = null;
0931: AST param_AST = null;
0932: AST rt_AST = null;
0933: AST tc_AST = null;
0934: AST v_AST = null;
0935:
0936: modifiers();
0937: mods_AST = (AST) returnAST;
0938: {
0939: typeSpecification(false);
0940: t_AST = (AST) returnAST;
0941: {
0942: if ((LA(1) == IDENT || LA(1) == INIT)
0943: && (LA(2) == LPAREN)) {
0944: methodName();
0945: name_AST = (AST) returnAST;
0946: match(LPAREN);
0947: parameterDeclarationList();
0948: param_AST = (AST) returnAST;
0949: match(RPAREN);
0950: declaratorBrackets(t_AST);
0951: rt_AST = (AST) returnAST;
0952: {
0953: switch (LA(1)) {
0954: case LITERAL_throws: {
0955: throwsClause();
0956: tc_AST = (AST) returnAST;
0957: break;
0958: }
0959: case EOF: {
0960: break;
0961: }
0962: default: {
0963: throw new NoViableAltException(LT(1),
0964: getFilename());
0965: }
0966: }
0967: }
0968: field_AST = (AST) currentAST.root;
0969: field_AST = (AST) astFactory
0970: .make((new ASTArray(6))
0971: .add(
0972: astFactory.create(
0973: METHOD_DEF,
0974: "METHOD_DEF"))
0975: .add(mods_AST)
0976: .add(
0977: (AST) astFactory
0978: .make((new ASTArray(
0979: 2))
0980: .add(
0981: astFactory
0982: .create(
0983: TYPE,
0984: "TYPE"))
0985: .add(rt_AST)))
0986: .add(name_AST).add(param_AST).add(
0987: tc_AST));
0988: currentAST.root = field_AST;
0989: currentAST.child = field_AST != null
0990: && field_AST.getFirstChild() != null ? field_AST
0991: .getFirstChild()
0992: : field_AST;
0993: currentAST.advanceChildToEnd();
0994: } else if ((LA(1) == IDENT)
0995: && (_tokenSet_2.member(LA(2)))) {
0996: variableDefinitions(mods_AST, t_AST);
0997: v_AST = (AST) returnAST;
0998: field_AST = (AST) currentAST.root;
0999: field_AST = v_AST;
1000: currentAST.root = field_AST;
1001: currentAST.child = field_AST != null
1002: && field_AST.getFirstChild() != null ? field_AST
1003: .getFirstChild()
1004: : field_AST;
1005: currentAST.advanceChildToEnd();
1006: } else {
1007: throw new NoViableAltException(LT(1), getFilename());
1008: }
1009:
1010: }
1011: }
1012: match(Token.EOF_TYPE);
1013: returnAST = field_AST;
1014: }
1015:
1016: public final void parameterDeclarationList()
1017: throws RecognitionException, TokenStreamException {
1018:
1019: returnAST = null;
1020: ASTPair currentAST = new ASTPair();
1021: AST parameterDeclarationList_AST = null;
1022:
1023: {
1024: switch (LA(1)) {
1025: case LITERAL_void:
1026: case LITERAL_boolean:
1027: case LITERAL_byte:
1028: case LITERAL_char:
1029: case LITERAL_short:
1030: case LITERAL_int:
1031: case LITERAL_float:
1032: case LITERAL_long:
1033: case LITERAL_double:
1034: case IDENT: {
1035: parameterDeclaration();
1036: astFactory.addASTChild(currentAST, returnAST);
1037: {
1038: _loop51: do {
1039: if ((LA(1) == COMMA)) {
1040: match(COMMA);
1041: parameterDeclaration();
1042: astFactory.addASTChild(currentAST,
1043: returnAST);
1044: } else {
1045: break _loop51;
1046: }
1047:
1048: } while (true);
1049: }
1050: break;
1051: }
1052: case RPAREN: {
1053: break;
1054: }
1055: default: {
1056: throw new NoViableAltException(LT(1), getFilename());
1057: }
1058: }
1059: }
1060: parameterDeclarationList_AST = (AST) currentAST.root;
1061: parameterDeclarationList_AST = (AST) astFactory
1062: .make((new ASTArray(2)).add(
1063: astFactory.create(PARAMETERS, "PARAMETERS"))
1064: .add(parameterDeclarationList_AST));
1065: currentAST.root = parameterDeclarationList_AST;
1066: currentAST.child = parameterDeclarationList_AST != null
1067: && parameterDeclarationList_AST.getFirstChild() != null ? parameterDeclarationList_AST
1068: .getFirstChild()
1069: : parameterDeclarationList_AST;
1070: currentAST.advanceChildToEnd();
1071: parameterDeclarationList_AST = (AST) currentAST.root;
1072: returnAST = parameterDeclarationList_AST;
1073: }
1074:
1075: public final void declaratorBrackets(AST typ)
1076: throws RecognitionException, TokenStreamException {
1077:
1078: returnAST = null;
1079: ASTPair currentAST = new ASTPair();
1080: AST declaratorBrackets_AST = null;
1081: Token lb = null;
1082: AST lb_AST = null;
1083:
1084: declaratorBrackets_AST = (AST) currentAST.root;
1085: declaratorBrackets_AST = typ;
1086: currentAST.root = declaratorBrackets_AST;
1087: currentAST.child = declaratorBrackets_AST != null
1088: && declaratorBrackets_AST.getFirstChild() != null ? declaratorBrackets_AST
1089: .getFirstChild()
1090: : declaratorBrackets_AST;
1091: currentAST.advanceChildToEnd();
1092: {
1093: _loop43: do {
1094: if ((LA(1) == LBRACK)) {
1095: lb = LT(1);
1096: lb_AST = astFactory.create(lb);
1097: astFactory.makeASTRoot(currentAST, lb_AST);
1098: match(LBRACK);
1099: lb_AST.setType(ARRAY_DECLARATOR);
1100: match(RBRACK);
1101: } else {
1102: break _loop43;
1103: }
1104:
1105: } while (true);
1106: }
1107: declaratorBrackets_AST = (AST) currentAST.root;
1108: returnAST = declaratorBrackets_AST;
1109: }
1110:
1111: public final void throwsClause() throws RecognitionException,
1112: TokenStreamException {
1113:
1114: returnAST = null;
1115: ASTPair currentAST = new ASTPair();
1116: AST throwsClause_AST = null;
1117:
1118: AST tmp41_AST = null;
1119: tmp41_AST = astFactory.create(LT(1));
1120: astFactory.makeASTRoot(currentAST, tmp41_AST);
1121: match(LITERAL_throws);
1122: identifier();
1123: astFactory.addASTChild(currentAST, returnAST);
1124: {
1125: _loop47: do {
1126: if ((LA(1) == COMMA)) {
1127: match(COMMA);
1128: identifier();
1129: astFactory.addASTChild(currentAST, returnAST);
1130: } else {
1131: break _loop47;
1132: }
1133:
1134: } while (true);
1135: }
1136: throwsClause_AST = (AST) currentAST.root;
1137: returnAST = throwsClause_AST;
1138: }
1139:
1140: /** Declaration of a variable. This can be a class/instance variable,
1141: * or a local variable in a method
1142: * It can also include possible initialization.
1143: */
1144: public final void variableDeclarator(AST mods, AST t)
1145: throws RecognitionException, TokenStreamException {
1146:
1147: returnAST = null;
1148: ASTPair currentAST = new ASTPair();
1149: AST variableDeclarator_AST = null;
1150: Token id = null;
1151: AST id_AST = null;
1152: AST d_AST = null;
1153:
1154: id = LT(1);
1155: id_AST = astFactory.create(id);
1156: match(IDENT);
1157: declaratorBrackets(t);
1158: d_AST = (AST) returnAST;
1159: variableDeclarator_AST = (AST) currentAST.root;
1160: variableDeclarator_AST = (AST) astFactory
1161: .make((new ASTArray(4))
1162: .add(
1163: astFactory.create(VARIABLE_DEF,
1164: "VARIABLE_DEF")).add(mods).add(
1165: (AST) astFactory.make((new ASTArray(2))
1166: .add(
1167: astFactory.create(TYPE,
1168: "TYPE")).add(
1169: d_AST))).add(id_AST));
1170: currentAST.root = variableDeclarator_AST;
1171: currentAST.child = variableDeclarator_AST != null
1172: && variableDeclarator_AST.getFirstChild() != null ? variableDeclarator_AST
1173: .getFirstChild()
1174: : variableDeclarator_AST;
1175: currentAST.advanceChildToEnd();
1176: returnAST = variableDeclarator_AST;
1177: }
1178:
1179: public final void invocation() throws RecognitionException,
1180: TokenStreamException {
1181:
1182: returnAST = null;
1183: ASTPair currentAST = new ASTPair();
1184: AST invocation_AST = null;
1185: AST t_AST = null;
1186:
1187: typeSpecification(false);
1188: t_AST = (AST) returnAST;
1189: astFactory.addASTChild(currentAST, returnAST);
1190: methodName();
1191: astFactory.addASTChild(currentAST, returnAST);
1192: match(LPAREN);
1193: typeList();
1194: astFactory.addASTChild(currentAST, returnAST);
1195: match(RPAREN);
1196: match(Token.EOF_TYPE);
1197: invocation_AST = (AST) currentAST.root;
1198: returnAST = invocation_AST;
1199: }
1200:
1201: public final void typeList() throws RecognitionException,
1202: TokenStreamException {
1203:
1204: returnAST = null;
1205: ASTPair currentAST = new ASTPair();
1206: AST typeList_AST = null;
1207:
1208: {
1209: switch (LA(1)) {
1210: case LITERAL_void:
1211: case LITERAL_boolean:
1212: case LITERAL_byte:
1213: case LITERAL_char:
1214: case LITERAL_short:
1215: case LITERAL_int:
1216: case LITERAL_float:
1217: case LITERAL_long:
1218: case LITERAL_double:
1219: case IDENT: {
1220: typeSpecification(false);
1221: astFactory.addASTChild(currentAST, returnAST);
1222: {
1223: _loop56: do {
1224: if ((LA(1) == COMMA)) {
1225: match(COMMA);
1226: typeSpecification(false);
1227: astFactory.addASTChild(currentAST,
1228: returnAST);
1229: } else {
1230: break _loop56;
1231: }
1232:
1233: } while (true);
1234: }
1235: break;
1236: }
1237: case RPAREN: {
1238: break;
1239: }
1240: default: {
1241: throw new NoViableAltException(LT(1), getFilename());
1242: }
1243: }
1244: }
1245: typeList_AST = (AST) currentAST.root;
1246: typeList_AST = (AST) astFactory.make((new ASTArray(2)).add(
1247: astFactory.create(PARAMETERS, "PARAMETERS")).add(
1248: typeList_AST));
1249: currentAST.root = typeList_AST;
1250: currentAST.child = typeList_AST != null
1251: && typeList_AST.getFirstChild() != null ? typeList_AST
1252: .getFirstChild() : typeList_AST;
1253: currentAST.advanceChildToEnd();
1254: typeList_AST = (AST) currentAST.root;
1255: returnAST = typeList_AST;
1256: }
1257:
1258: public final void parameterDeclaration()
1259: throws RecognitionException, TokenStreamException {
1260:
1261: returnAST = null;
1262: ASTPair currentAST = new ASTPair();
1263: AST parameterDeclaration_AST = null;
1264: AST t_AST = null;
1265: Token id = null;
1266: AST id_AST = null;
1267: AST pd_AST = null;
1268:
1269: typeSpecification(false);
1270: t_AST = (AST) returnAST;
1271: id = LT(1);
1272: id_AST = astFactory.create(id);
1273: match(IDENT);
1274: declaratorBrackets(t_AST);
1275: pd_AST = (AST) returnAST;
1276: parameterDeclaration_AST = (AST) currentAST.root;
1277: parameterDeclaration_AST = (AST) astFactory.make((new ASTArray(
1278: 3)).add(
1279: astFactory.create(PARAMETER_DEF, "PARAMETER_DEF")).add(
1280: (AST) astFactory.make((new ASTArray(2)).add(
1281: astFactory.create(TYPE, "TYPE")).add(pd_AST)))
1282: .add(id_AST));
1283: currentAST.root = parameterDeclaration_AST;
1284: currentAST.child = parameterDeclaration_AST != null
1285: && parameterDeclaration_AST.getFirstChild() != null ? parameterDeclaration_AST
1286: .getFirstChild()
1287: : parameterDeclaration_AST;
1288: currentAST.advanceChildToEnd();
1289: returnAST = parameterDeclaration_AST;
1290: }
1291:
1292: public final void signature() throws RecognitionException,
1293: TokenStreamException {
1294:
1295: returnAST = null;
1296: ASTPair currentAST = new ASTPair();
1297: AST signature_AST = null;
1298: AST mods_AST = null;
1299: AST name_AST = null;
1300:
1301: modifiers();
1302: mods_AST = (AST) returnAST;
1303: astFactory.addASTChild(currentAST, returnAST);
1304: typeSpecification(false);
1305: astFactory.addASTChild(currentAST, returnAST);
1306: methodName();
1307: name_AST = (AST) returnAST;
1308: astFactory.addASTChild(currentAST, returnAST);
1309: argumentList();
1310: astFactory.addASTChild(currentAST, returnAST);
1311: {
1312: switch (LA(1)) {
1313: case LITERAL_throws: {
1314: throwsClause();
1315: astFactory.addASTChild(currentAST, returnAST);
1316: break;
1317: }
1318: case EOF: {
1319: break;
1320: }
1321: default: {
1322: throw new NoViableAltException(LT(1), getFilename());
1323: }
1324: }
1325: }
1326: match(Token.EOF_TYPE);
1327: signature_AST = (AST) currentAST.root;
1328: returnAST = signature_AST;
1329: }
1330:
1331: public final void argumentList() throws RecognitionException,
1332: TokenStreamException {
1333:
1334: returnAST = null;
1335: ASTPair currentAST = new ASTPair();
1336: AST argumentList_AST = null;
1337:
1338: match(LPAREN);
1339: {
1340: switch (LA(1)) {
1341: case LITERAL_void:
1342: case LITERAL_boolean:
1343: case LITERAL_byte:
1344: case LITERAL_char:
1345: case LITERAL_short:
1346: case LITERAL_int:
1347: case LITERAL_float:
1348: case LITERAL_long:
1349: case LITERAL_double:
1350: case IDENT: {
1351: argumentDeclaration();
1352: astFactory.addASTChild(currentAST, returnAST);
1353: {
1354: _loop62: do {
1355: if ((LA(1) == COMMA)) {
1356: match(COMMA);
1357: argumentDeclaration();
1358: astFactory.addASTChild(currentAST,
1359: returnAST);
1360: } else {
1361: break _loop62;
1362: }
1363:
1364: } while (true);
1365: }
1366: break;
1367: }
1368: case RPAREN: {
1369: break;
1370: }
1371: default: {
1372: throw new NoViableAltException(LT(1), getFilename());
1373: }
1374: }
1375: }
1376: match(RPAREN);
1377: argumentList_AST = (AST) currentAST.root;
1378: argumentList_AST = (AST) astFactory.make((new ASTArray(2)).add(
1379: astFactory.create(PARAMETERS, "PARAMETERS")).add(
1380: argumentList_AST));
1381: currentAST.root = argumentList_AST;
1382: currentAST.child = argumentList_AST != null
1383: && argumentList_AST.getFirstChild() != null ? argumentList_AST
1384: .getFirstChild()
1385: : argumentList_AST;
1386: currentAST.advanceChildToEnd();
1387: argumentList_AST = (AST) currentAST.root;
1388: returnAST = argumentList_AST;
1389: }
1390:
1391: public final void argumentDeclaration()
1392: throws RecognitionException, TokenStreamException {
1393:
1394: returnAST = null;
1395: ASTPair currentAST = new ASTPair();
1396: AST argumentDeclaration_AST = null;
1397: AST t_AST = null;
1398: Token id = null;
1399: AST id_AST = null;
1400:
1401: typeSpecification(false);
1402: t_AST = (AST) returnAST;
1403: {
1404: switch (LA(1)) {
1405: case IDENT: {
1406: id = LT(1);
1407: id_AST = astFactory.create(id);
1408: match(IDENT);
1409: break;
1410: }
1411: case COMMA:
1412: case RPAREN: {
1413: break;
1414: }
1415: default: {
1416: throw new NoViableAltException(LT(1), getFilename());
1417: }
1418: }
1419: }
1420: argumentDeclaration_AST = (AST) currentAST.root;
1421: argumentDeclaration_AST = (AST) astFactory
1422: .make((new ASTArray(3)).add(
1423: astFactory.create(PARAMETER_DEF,
1424: "PARAMETER_DEF")).add(
1425: (AST) astFactory.make((new ASTArray(2)).add(
1426: astFactory.create(TYPE, "TYPE")).add(
1427: t_AST))).add(id_AST));
1428: currentAST.root = argumentDeclaration_AST;
1429: currentAST.child = argumentDeclaration_AST != null
1430: && argumentDeclaration_AST.getFirstChild() != null ? argumentDeclaration_AST
1431: .getFirstChild()
1432: : argumentDeclaration_AST;
1433: currentAST.advanceChildToEnd();
1434: returnAST = argumentDeclaration_AST;
1435: }
1436:
1437: public static final String[] _tokenNames = { "<0>", "EOF", "<2>",
1438: "NULL_TREE_LOOKAHEAD", "MODIFIERS", "METHOD_DEF",
1439: "VARIABLE_DEF", "TYPE", "CLASS_DEF", "INTERFACE_DEF",
1440: "ARRAY_DECLARATOR", "EXTENDS_CLAUSE", "IMPLEMENTS_CLAUSE",
1441: "PARAMETERS", "PARAMETER_DEF", "SIGNATURE", "\"final\"",
1442: "\"abstract\"", "\"strictfp\"", "LBRACK", "RBRACK",
1443: "\"void\"", "\"boolean\"", "\"byte\"", "\"char\"",
1444: "\"short\"", "\"int\"", "\"float\"", "\"long\"",
1445: "\"double\"", "IDENT", "DOT", "\"private\"", "\"public\"",
1446: "\"protected\"", "\"static\"", "\"transient\"",
1447: "\"native\"", "\"threadsafe\"", "\"synchronized\"",
1448: "\"volatile\"", "\"class\"", "\"extends\"",
1449: "\"interface\"", "COMMA", "\"implements\"", "INIT",
1450: "LPAREN", "RPAREN", "\"throws\"", "COLON", "STAR", "SEMI",
1451: "WS", "CHAR_LITERAL", "STRING_LITERAL", "ESC", "HEX_DIGIT",
1452: "VOCAB" };
1453:
1454: protected void buildTokenTypeASTClassMap() {
1455: tokenTypeToASTClassMap = null;
1456: };
1457:
1458: private static final long[] mk_tokenSet_0() {
1459: long[] data = { 2L, 0L };
1460: return data;
1461: }
1462:
1463: public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
1464:
1465: private static final long[] mk_tokenSet_1() {
1466: long[] data = { 2194728747008L, 0L };
1467: return data;
1468: }
1469:
1470: public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
1471:
1472: private static final long[] mk_tokenSet_2() {
1473: long[] data = { 17592186568706L, 0L };
1474: return data;
1475: }
1476:
1477: public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
1478:
1479: }
|