0001: /*
0002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003: *
0004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005: *
0006: * The contents of this file are subject to the terms of either the GNU
0007: * General Public License Version 2 only ("GPL") or the Common
0008: * Development and Distribution License("CDDL") (collectively, the
0009: * "License"). You may not use this file except in compliance with the
0010: * License. You can obtain a copy of the License at
0011: * http://www.netbeans.org/cddl-gplv2.html
0012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013: * specific language governing permissions and limitations under the
0014: * License. When distributing the software, include this License Header
0015: * Notice in each file and include the License file at
0016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
0017: * particular file as subject to the "Classpath" exception as provided
0018: * by Sun in the GPL Version 2 section of the License file that
0019: * accompanied this code. If applicable, add the following below the
0020: * License Header, with the fields enclosed by brackets [] replaced by
0021: * your own identifying information:
0022: * "Portions Copyrighted [year] [name of copyright owner]"
0023: *
0024: * Contributor(s):
0025: *
0026: * The Original Software is NetBeans. The Initial Developer of the Original
0027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
0028: * Microsystems, Inc. All Rights Reserved.
0029: *
0030: * If you wish your version of this file to be governed by only the CDDL
0031: * or only the GPL Version 2, indicate your decision by adding
0032: * "[Contributor] elects to include this software in this distribution
0033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034: * single choice of license, a recipient has the option to distribute
0035: * your version of this file under either the CDDL, the GPL Version 2 or
0036: * to extend the choice of license to its licensees as provided above.
0037: * However, if you add GPL Version 2 code and therefore, elected the GPL
0038: * Version 2 license, then the option applies only if the new code is
0039: * made subject to such option by the copyright holder.
0040: */
0041:
0042: package org.netbeans.modules.uml.core.reverseengineering.parsers.javaparser;
0043:
0044: import java.util.HashMap;
0045: import org.netbeans.modules.uml.core.reverseengineering.reframework.parsingframework.ParserEventController; // $ANTLR 2.7.2: "EmbarcaderoJava.tree.g" -> "EmbarcaderoJavaTreeParser.java"$
0046:
0047: import antlr.TreeParser;
0048: import antlr.Token;
0049: import antlr.collections.AST;
0050: import antlr.RecognitionException;
0051: import antlr.ANTLRException;
0052: import antlr.NoViableAltException;
0053: import antlr.MismatchedTokenException;
0054: import antlr.SemanticException;
0055: import antlr.collections.impl.BitSet;
0056: import antlr.ASTPair;
0057: import antlr.collections.impl.ASTArray;
0058:
0059: /** Java 1.3 AST Recognizer Grammar
0060: *
0061: * Author: (see java.g preamble)
0062: *
0063: * This grammar is in the PUBLIC DOMAIN
0064: */
0065: public class EmbarcaderoJavaTreeParser extends antlr.TreeParser
0066: implements EmbarcaderoJavaTreeParserTokenTypes {
0067:
0068: public void setEventController(ParserEventController newVal) {
0069: mController = newVal;
0070: }
0071:
0072: /**
0073: * Parser error-reporting function can be overridden in subclass.
0074: * @param ex The exception that occured.
0075: */
0076: public void reportError(RecognitionException ex) {
0077: mController.errorFound(ex.getMessage(), -1, -1, ex
0078: .getFilename());
0079: ex.printStackTrace();
0080: }
0081:
0082: public void initializeStateNameMap() {
0083: mStateNameMap.put("Package", "Package");
0084: mStateNameMap.put("Dependency", "Dependency");
0085: mStateNameMap.put("Class Declaration", "Class Declaration");
0086: mStateNameMap.put("Interface Declaration",
0087: "Interface Declaration");
0088: mStateNameMap.put("Type", "Type");
0089: mStateNameMap.put("Array Declarator", "Array Declarator");
0090: mStateNameMap.put("Modifiers", "Modifiers");
0091: mStateNameMap.put("Generalization", "Generalization");
0092: mStateNameMap.put("Realization", "Realization");
0093: mStateNameMap.put("Body", "Body");
0094: mStateNameMap.put("Static Initializer", "Static Initializer");
0095: mStateNameMap.put("Constructor Definition",
0096: "Constructor Definition");
0097: mStateNameMap.put("Method Declaration", "Method Declaration");
0098: mStateNameMap.put("Method Definition", "Method Definition");
0099: mStateNameMap.put("Method Body", "Method Body");
0100: mStateNameMap.put("Destructor Definition",
0101: "Destructor Definition");
0102: mStateNameMap.put("Variable Definition", "Variable Definition");
0103: mStateNameMap.put("Parameter", "Parameter");
0104: mStateNameMap.put("Initializer", "Initializer");
0105: mStateNameMap.put("Array Initializer", "Array Initializer");
0106: mStateNameMap.put("Parameters", "Parameters");
0107: mStateNameMap.put("Throws Declaration", "Throws Declaration");
0108: mStateNameMap.put("Identifier", "Identifier");
0109: mStateNameMap.put("Constructor Body", "Constructor Body");
0110: mStateNameMap.put("Conditional", "Conditional");
0111: mStateNameMap.put("Test Condition", "Test Condition");
0112: mStateNameMap.put("Body", "Body");
0113: mStateNameMap.put("Else Conditional", "Else Conditional");
0114: mStateNameMap.put("Loop", "Loop");
0115: mStateNameMap.put("Loop Initializer", "Loop Initializer");
0116: mStateNameMap.put("Test Condition", "Test Condition");
0117: mStateNameMap.put("Loop PostProcess", "Loop PostProcess");
0118: mStateNameMap.put("Break", "Break");
0119: mStateNameMap.put("Continue", "Continue");
0120: mStateNameMap.put("Return", "Return");
0121: mStateNameMap.put("Option Conditional", "Option Conditional");
0122: mStateNameMap.put("Test Condition", "Test Condition");
0123: mStateNameMap.put("RaisedException", "RaisedException");
0124: mStateNameMap.put("Exception", "Exception");
0125: mStateNameMap.put("CriticalSection", "CriticalSection");
0126: mStateNameMap.put("Lock Object", "Lock Object");
0127: mStateNameMap.put("Option Group", "Option Group");
0128: mStateNameMap.put("Option", "Option");
0129: mStateNameMap.put("Default Option", "Default Option");
0130: mStateNameMap.put("Exception Processing",
0131: "Exception Processing");
0132: mStateNameMap.put("Default Processing", "Default Processing");
0133: mStateNameMap.put("Exception Handler", "Exception Handler");
0134: mStateNameMap.put("Expression List", "Expression List");
0135: mStateNameMap.put("Conditional Expression",
0136: "Conditional Expression");
0137: mStateNameMap.put("Assignment Expression",
0138: "Assignment Expression");
0139: mStateNameMap.put("Object Destruction", "Object Destruction");
0140: mStateNameMap.put("Assignment Expression",
0141: "Assignment Expression");
0142: mStateNameMap.put("Plus Assignment Expression",
0143: "Plus Assignment Expression");
0144: mStateNameMap.put("Minus Assignment Expression",
0145: "Minus Assignment Expression");
0146: mStateNameMap.put("Multiply Assignment Expression",
0147: "Multiply Assignment Expression");
0148: mStateNameMap.put("Divide Assignment Expression",
0149: "Divide Assignment Expression");
0150: mStateNameMap.put("Mod Assignment Expression",
0151: "Mod Assignment Expression");
0152: mStateNameMap.put("Shift Right Assignment Expression",
0153: "Shift Right Assignment Expression");
0154: mStateNameMap.put("Shift Right Assignment Expression",
0155: "Shift Right Assignment Expression");
0156: mStateNameMap.put("Shift Left Assignment Expression",
0157: "Shift Left Assignment Expression");
0158: mStateNameMap.put("Binary And Assignment Expression",
0159: "Binary And Assignment Expression");
0160: mStateNameMap.put("Binary XOR Assignment Expression",
0161: "Binary XOR Assignment Expression");
0162: mStateNameMap.put("Binary OR Assignment Expression",
0163: "Binary OR Assignment Expression");
0164: mStateNameMap.put("LogicalOR Expression",
0165: "LogicalOR Expression");
0166: mStateNameMap.put("LogicalAND Expression",
0167: "LogicalAND Expression");
0168: mStateNameMap.put("BinaryOR Expression", "BinaryOR Expression");
0169: mStateNameMap.put("ExclusiveOR Expression",
0170: "ExclusiveOR Expression");
0171: mStateNameMap.put("BinaryAND Expression",
0172: "BinaryAND Expression");
0173: mStateNameMap.put("Not Equality Expression",
0174: "Not Equality Expression");
0175: mStateNameMap.put("Equality Expression", "Equality Expression");
0176: mStateNameMap.put("LT Relational Expression",
0177: "LT Relational Expression");
0178: mStateNameMap.put("GT Relational Expression",
0179: "GT Relational Expression");
0180: mStateNameMap.put("LE Relational Expression",
0181: "LE Relational Expression");
0182: mStateNameMap.put("GE Relational Expression",
0183: "GE Relational Expression");
0184: mStateNameMap.put("Shift Left Expression",
0185: "Shift Left Expression");
0186: mStateNameMap.put("Right Shift Expression",
0187: "Right Shift Expression");
0188: mStateNameMap.put("Binary Shift Right Expression",
0189: "Binary Shift Right Expression");
0190: mStateNameMap.put("Plus Expression", "Plus Expression");
0191: mStateNameMap.put("Minus Expression", "Minus Expression");
0192: mStateNameMap.put("Divide Expression", "Divide Expression");
0193: mStateNameMap.put("Mod Expression", "Mod Expression");
0194: mStateNameMap.put("Multiply Expression", "Multiply Expression");
0195: mStateNameMap.put("Increment Unary Expression",
0196: "Increment Unary Expression");
0197: mStateNameMap.put("Decrement Unary Expression",
0198: "Decrement Unary Expression");
0199: mStateNameMap.put("Increment Post Unary Expression",
0200: "Increment Post Unary Expression");
0201: mStateNameMap.put("Decrement Post Unary Expression",
0202: "Decrement Post Unary Expression");
0203: mStateNameMap.put("Binary Not Unary Expression",
0204: "Binary Not Unary Expression");
0205: mStateNameMap.put("Logical Not Unary Expression",
0206: "Logical Not Unary Expression");
0207: mStateNameMap.put("Type Check Expression",
0208: "Type Check Expression");
0209: mStateNameMap.put("Minus Unary Expression",
0210: "Minus Unary Expression");
0211: mStateNameMap.put("Plus Unary Expression",
0212: "Plus Unary Expression");
0213: mStateNameMap.put("Identifier", "Identifier");
0214: mStateNameMap.put("Method Call", "Method Call");
0215: mStateNameMap.put("Type Cast", "Type Cast");
0216: mStateNameMap.put("Array Index", "Array Index");
0217: mStateNameMap.put("Object Creation", "Object Creation");
0218: mStateNameMap.put("Array Declarator", "Array Declarator");
0219: mStateNameMap.put("Constructor Call", "Constructor Call");
0220: mStateNameMap.put("Super Constructor Call",
0221: "Super Constructor Call");
0222: }
0223:
0224: private ParserEventController mController;
0225: private boolean isInElsePart;
0226: private HashMap<String, String> mStateNameMap = new HashMap<String, String>();
0227:
0228: public EmbarcaderoJavaTreeParser() {
0229: tokenNames = _tokenNames;
0230: }
0231:
0232: public final void compilationUnit(AST _t)
0233: throws RecognitionException {
0234:
0235: AST compilationUnit_AST_in = (AST) _t;
0236: isInElsePart = false;
0237:
0238: try { // for error handling
0239: {
0240: if (_t == null)
0241: _t = ASTNULL;
0242: switch (_t.getType()) {
0243: case PACKAGE_DEF: {
0244: packageDefinition(_t);
0245: _t = _retTree;
0246: break;
0247: }
0248: case 3:
0249: case CLASS_DEF:
0250: case INTERFACE_DEF:
0251: case IMPORT: {
0252: break;
0253: }
0254: default: {
0255: throw new NoViableAltException(_t);
0256: }
0257: }
0258: }
0259: {
0260: _loop4: do {
0261: if (_t == null)
0262: _t = ASTNULL;
0263: if ((_t.getType() == IMPORT)) {
0264: importDefinition(_t);
0265: _t = _retTree;
0266: } else {
0267: break _loop4;
0268: }
0269:
0270: } while (true);
0271: }
0272: {
0273: _loop6: do {
0274: if (_t == null)
0275: _t = ASTNULL;
0276: if ((_t.getType() == CLASS_DEF || _t.getType() == INTERFACE_DEF)) {
0277: typeDefinition(_t);
0278: _t = _retTree;
0279: } else {
0280: break _loop6;
0281: }
0282:
0283: } while (true);
0284: }
0285: } catch (RecognitionException ex) {
0286: reportError(ex);
0287: if (_t != null) {
0288: _t = _t.getNextSibling();
0289: }
0290: }
0291: _retTree = _t;
0292: }
0293:
0294: public final void packageDefinition(AST _t)
0295: throws RecognitionException {
0296:
0297: AST packageDefinition_AST_in = (AST) _t;
0298: AST p = null;
0299: AST s = null;
0300:
0301: try { // for error handling
0302:
0303: mController.stateBegin(mStateNameMap.get("Package"));
0304:
0305: AST __t8 = _t;
0306: p = _t == ASTNULL ? null : (AST) _t;
0307: match(_t, PACKAGE_DEF);
0308: _t = _t.getFirstChild();
0309: mController.tokenFound(p, "Keyword");
0310: identifier(_t);
0311: _t = _retTree;
0312: s = (AST) _t;
0313: match(_t, SEMI);
0314: _t = _t.getNextSibling();
0315: mController.tokenFound(s, "Statement Terminator");
0316: _t = __t8;
0317: _t = _t.getNextSibling();
0318:
0319: mController.stateEnd();
0320:
0321: } catch (RecognitionException ex) {
0322: reportError(ex);
0323: if (_t != null) {
0324: _t = _t.getNextSibling();
0325: }
0326: }
0327: _retTree = _t;
0328: }
0329:
0330: public final void importDefinition(AST _t)
0331: throws RecognitionException {
0332:
0333: AST importDefinition_AST_in = (AST) _t;
0334: AST i = null;
0335: AST s = null;
0336:
0337: try { // for error handling
0338:
0339: mController.stateBegin(mStateNameMap.get("Dependency"));
0340:
0341: AST __t10 = _t;
0342: i = _t == ASTNULL ? null : (AST) _t;
0343: match(_t, IMPORT);
0344: _t = _t.getFirstChild();
0345: mController.tokenFound(i, "Keyword");
0346: identifierStar(_t);
0347: _t = _retTree;
0348: s = (AST) _t;
0349: match(_t, SEMI);
0350: _t = _t.getNextSibling();
0351: mController.tokenFound(s, "Statement Terminator");
0352: _t = __t10;
0353: _t = _t.getNextSibling();
0354:
0355: mController.stateEnd();
0356:
0357: } catch (RecognitionException ex) {
0358: reportError(ex);
0359: if (_t != null) {
0360: _t = _t.getNextSibling();
0361: }
0362: }
0363: _retTree = _t;
0364: }
0365:
0366: public final void typeDefinition(AST _t)
0367: throws RecognitionException {
0368:
0369: AST typeDefinition_AST_in = (AST) _t;
0370: AST ck = null;
0371: AST n = null;
0372: AST ik = null;
0373: AST in = null;
0374:
0375: try { // for error handling
0376: if (_t == null)
0377: _t = ASTNULL;
0378: switch (_t.getType()) {
0379: case CLASS_DEF: {
0380: {
0381:
0382: mController.stateBegin(mStateNameMap
0383: .get("Class Declaration"));
0384:
0385: AST __t13 = _t;
0386: AST tmp1_AST_in = (AST) _t;
0387: match(_t, CLASS_DEF);
0388: _t = _t.getFirstChild();
0389: ck = (AST) _t;
0390: match(_t, LITERAL_class);
0391: _t = _t.getNextSibling();
0392: mController.tokenFound(ck, "Keyword");
0393: modifiers(_t);
0394: _t = _retTree;
0395: n = (AST) _t;
0396: match(_t, IDENT);
0397: _t = _t.getNextSibling();
0398: mController.tokenFound(n, "Name");
0399: extendsClause(_t);
0400: _t = _retTree;
0401: implements Clause(_t);
0402: _t = _retTree;
0403: objBlock(_t);
0404: _t = _retTree;
0405: _t = __t13;
0406: _t = _t.getNextSibling();
0407:
0408: mController.stateEnd();
0409:
0410: }
0411: break;
0412: }
0413: case INTERFACE_DEF: {
0414: {
0415:
0416: mController.stateBegin(mStateNameMap
0417: .get("Interface Declaration"));
0418:
0419: AST __t15 = _t;
0420: AST tmp2_AST_in = (AST) _t;
0421: match(_t, INTERFACE_DEF);
0422: _t = _t.getFirstChild();
0423: ik = (AST) _t;
0424: match(_t, LITERAL_interface);
0425: _t = _t.getNextSibling();
0426: mController.tokenFound(ik, "Keyword");
0427: modifiers(_t);
0428: _t = _retTree;
0429: in = (AST) _t;
0430: match(_t, IDENT);
0431: _t = _t.getNextSibling();
0432: mController.tokenFound(in, "Name");
0433: extendsClause(_t);
0434: _t = _retTree;
0435: interfaceBlock(_t);
0436: _t = _retTree;
0437: _t = __t15;
0438: _t = _t.getNextSibling();
0439:
0440: mController.stateEnd();
0441:
0442: }
0443: break;
0444: }
0445: default: {
0446: throw new NoViableAltException(_t);
0447: }
0448: }
0449: } catch (RecognitionException ex) {
0450: reportError(ex);
0451: if (_t != null) {
0452: _t = _t.getNextSibling();
0453: }
0454: }
0455: _retTree = _t;
0456: }
0457:
0458: public final void identifier(AST _t) throws RecognitionException {
0459:
0460: AST identifier_AST_in = (AST) _t;
0461: AST id = null;
0462: AST d = null;
0463: AST id2 = null;
0464:
0465: try { // for error handling
0466:
0467: mController.stateBegin(mStateNameMap.get("Identifier"));
0468:
0469: {
0470: if (_t == null)
0471: _t = ASTNULL;
0472: switch (_t.getType()) {
0473: case IDENT: {
0474: id = (AST) _t;
0475: match(_t, IDENT);
0476: _t = _t.getNextSibling();
0477: mController.tokenFound(id, "Identifier");
0478: break;
0479: }
0480: case DOT: {
0481: AST __t90 = _t;
0482: d = _t == ASTNULL ? null : (AST) _t;
0483: match(_t, DOT);
0484: _t = _t.getFirstChild();
0485: mController.tokenFound(d, "Scope Operator");
0486: identifier(_t);
0487: _t = _retTree;
0488: id2 = (AST) _t;
0489: match(_t, IDENT);
0490: _t = _t.getNextSibling();
0491: mController.tokenFound(id2, "Identifier");
0492: _t = __t90;
0493: _t = _t.getNextSibling();
0494: break;
0495: }
0496: default: {
0497: throw new NoViableAltException(_t);
0498: }
0499: }
0500: }
0501:
0502: mController.stateEnd();
0503:
0504: } catch (RecognitionException ex) {
0505: reportError(ex);
0506: if (_t != null) {
0507: _t = _t.getNextSibling();
0508: }
0509: }
0510: _retTree = _t;
0511: }
0512:
0513: public final void identifierStar(AST _t)
0514: throws RecognitionException {
0515:
0516: AST identifierStar_AST_in = (AST) _t;
0517: AST id = null;
0518: AST d = null;
0519: AST s = null;
0520: AST id2 = null;
0521:
0522: try { // for error handling
0523:
0524: mController.stateBegin(mStateNameMap.get("Identifier"));
0525:
0526: {
0527: if (_t == null)
0528: _t = ASTNULL;
0529: switch (_t.getType()) {
0530: case IDENT: {
0531: id = (AST) _t;
0532: match(_t, IDENT);
0533: _t = _t.getNextSibling();
0534: mController.tokenFound(id, "Identifier");
0535: break;
0536: }
0537: case DOT: {
0538: AST __t93 = _t;
0539: d = _t == ASTNULL ? null : (AST) _t;
0540: match(_t, DOT);
0541: _t = _t.getFirstChild();
0542: mController.tokenFound(d, "Scope Operator");
0543: identifier(_t);
0544: _t = _retTree;
0545: {
0546: if (_t == null)
0547: _t = ASTNULL;
0548: switch (_t.getType()) {
0549: case STAR: {
0550: s = (AST) _t;
0551: match(_t, STAR);
0552: _t = _t.getNextSibling();
0553: mController.tokenFound(s,
0554: "OnDemand Operator");
0555: break;
0556: }
0557: case IDENT: {
0558: id2 = (AST) _t;
0559: match(_t, IDENT);
0560: _t = _t.getNextSibling();
0561: mController.tokenFound(id2, "Identifier");
0562: break;
0563: }
0564: default: {
0565: throw new NoViableAltException(_t);
0566: }
0567: }
0568: }
0569: _t = __t93;
0570: _t = _t.getNextSibling();
0571: break;
0572: }
0573: default: {
0574: throw new NoViableAltException(_t);
0575: }
0576: }
0577: }
0578:
0579: mController.stateEnd();
0580:
0581: } catch (RecognitionException ex) {
0582: reportError(ex);
0583: if (_t != null) {
0584: _t = _t.getNextSibling();
0585: }
0586: }
0587: _retTree = _t;
0588: }
0589:
0590: public final void modifiers(AST _t) throws RecognitionException {
0591:
0592: AST modifiers_AST_in = (AST) _t;
0593: mController.stateBegin(mStateNameMap.get("Modifiers"));
0594:
0595: try { // for error handling
0596: AST __t24 = _t;
0597: AST tmp3_AST_in = (AST) _t;
0598: match(_t, MODIFIERS);
0599: _t = _t.getFirstChild();
0600: {
0601: _loop26: do {
0602: if (_t == null)
0603: _t = ASTNULL;
0604: if ((_tokenSet_0.member(_t.getType()))) {
0605: modifier(_t);
0606: _t = _retTree;
0607: } else {
0608: break _loop26;
0609: }
0610:
0611: } while (true);
0612: }
0613: _t = __t24;
0614: _t = _t.getNextSibling();
0615: mController.stateEnd();
0616: } catch (RecognitionException ex) {
0617: reportError(ex);
0618: if (_t != null) {
0619: _t = _t.getNextSibling();
0620: }
0621: }
0622: _retTree = _t;
0623: }
0624:
0625: public final void extendsClause(AST _t) throws RecognitionException {
0626:
0627: AST extendsClause_AST_in = (AST) _t;
0628: AST e = null;
0629: mController.stateBegin(mStateNameMap.get("Generalization"));
0630:
0631: try { // for error handling
0632: AST __t29 = _t;
0633: AST tmp4_AST_in = (AST) _t;
0634: match(_t, EXTENDS_CLAUSE);
0635: _t = _t.getFirstChild();
0636: {
0637: if (_t == null)
0638: _t = ASTNULL;
0639: switch (_t.getType()) {
0640: case LITERAL_extends: {
0641: e = (AST) _t;
0642: match(_t, LITERAL_extends);
0643: _t = _t.getNextSibling();
0644: mController.tokenFound(e, "Keyword");
0645: {
0646: _loop32: do {
0647: if (_t == null)
0648: _t = ASTNULL;
0649: if ((_t.getType() == IDENT || _t.getType() == DOT)) {
0650: identifier(_t);
0651: _t = _retTree;
0652: } else {
0653: break _loop32;
0654: }
0655:
0656: } while (true);
0657: }
0658: break;
0659: }
0660: case 3: {
0661: break;
0662: }
0663: default: {
0664: throw new NoViableAltException(_t);
0665: }
0666: }
0667: }
0668: _t = __t29;
0669: _t = _t.getNextSibling();
0670: mController.stateEnd();
0671: } catch (RecognitionException ex) {
0672: reportError(ex);
0673: if (_t != null) {
0674: _t = _t.getNextSibling();
0675: }
0676: }
0677: _retTree = _t;
0678: }
0679:
0680: public final void implements Clause(AST _t)
0681: throws RecognitionException {
0682:
0683: AST implements Clause_AST_in = (AST) _t;
0684: AST i = null;
0685: mController.stateBegin(mStateNameMap.get("Realization"));
0686:
0687: try { // for error handling
0688: AST __t34 = _t;
0689: AST tmp5_AST_in = (AST) _t;
0690: match(_t, IMPLEMENTS_CLAUSE);
0691: _t = _t.getFirstChild();
0692: {
0693: if (_t == null)
0694: _t = ASTNULL;
0695: switch (_t.getType()) {
0696: case LITERAL_implements : {
0697: i = (AST) _t;
0698: match(_t, LITERAL_implements );
0699: _t = _t.getNextSibling();
0700: mController.tokenFound(i, "Keyword");
0701: {
0702: _loop37: do {
0703: if (_t == null)
0704: _t = ASTNULL;
0705: if ((_t.getType() == IDENT || _t.getType() == DOT)) {
0706: identifier(_t);
0707: _t = _retTree;
0708: } else {
0709: break _loop37;
0710: }
0711:
0712: } while (true);
0713: }
0714: break;
0715: }
0716: case 3: {
0717: break;
0718: }
0719: default: {
0720: throw new NoViableAltException(_t);
0721: }
0722: }
0723: }
0724: _t = __t34;
0725: _t = _t.getNextSibling();
0726: mController.stateEnd();
0727: } catch (RecognitionException ex) {
0728: reportError(ex);
0729: if (_t != null) {
0730: _t = _t.getNextSibling();
0731: }
0732: }
0733: _retTree = _t;
0734: }
0735:
0736: public final void objBlock(AST _t) throws RecognitionException {
0737:
0738: AST objBlock_AST_in = (AST) _t;
0739: AST s = null;
0740: AST e = null;
0741:
0742: try { // for error handling
0743: AST __t43 = _t;
0744: AST tmp6_AST_in = (AST) _t;
0745: match(_t, OBJBLOCK);
0746: _t = _t.getFirstChild();
0747: s = (AST) _t;
0748: match(_t, START_CLASS_BODY);
0749: _t = _t.getNextSibling();
0750:
0751: mController.stateBegin(mStateNameMap.get("Body"));
0752: mController.tokenFound(s, "Class Body Start");
0753:
0754: {
0755: _loop47: do {
0756: if (_t == null)
0757: _t = ASTNULL;
0758: switch (_t.getType()) {
0759: case CTOR_DEF: {
0760: ctorDef(_t);
0761: _t = _retTree;
0762: break;
0763: }
0764: case METHOD_DEF:
0765: case DESTRUCTOR_DEF: {
0766: methodDef(_t);
0767: _t = _retTree;
0768: break;
0769: }
0770: case VARIABLE_DEF: {
0771: variableDef(_t);
0772: _t = _retTree;
0773: break;
0774: }
0775: case CLASS_DEF:
0776: case INTERFACE_DEF: {
0777: typeDefinition(_t);
0778: _t = _retTree;
0779: break;
0780: }
0781: case STATIC_INIT: {
0782: AST __t45 = _t;
0783: AST tmp7_AST_in = (AST) _t;
0784: match(_t, STATIC_INIT);
0785: _t = _t.getFirstChild();
0786: mController.stateBegin(mStateNameMap
0787: .get("Static Initializer"));
0788: slist(_t, "");
0789: _t = _retTree;
0790: mController.stateEnd();
0791: _t = __t45;
0792: _t = _t.getNextSibling();
0793: break;
0794: }
0795: case INSTANCE_INIT: {
0796: AST __t46 = _t;
0797: AST tmp8_AST_in = (AST) _t;
0798: match(_t, INSTANCE_INIT);
0799: _t = _t.getFirstChild();
0800: slist(_t, "");
0801: _t = _retTree;
0802: _t = __t46;
0803: _t = _t.getNextSibling();
0804: break;
0805: }
0806: default: {
0807: break _loop47;
0808: }
0809: }
0810: } while (true);
0811: }
0812: e = (AST) _t;
0813: match(_t, END_CLASS_BODY);
0814: _t = _t.getNextSibling();
0815:
0816: mController.tokenFound(e, "Class Body End");
0817: mController.stateEnd();
0818:
0819: _t = __t43;
0820: _t = _t.getNextSibling();
0821: } catch (RecognitionException ex) {
0822: reportError(ex);
0823: if (_t != null) {
0824: _t = _t.getNextSibling();
0825: }
0826: }
0827: _retTree = _t;
0828: }
0829:
0830: public final void interfaceBlock(AST _t)
0831: throws RecognitionException {
0832:
0833: AST interfaceBlock_AST_in = (AST) _t;
0834: AST s = null;
0835: AST e = null;
0836:
0837: try { // for error handling
0838: AST __t39 = _t;
0839: AST tmp9_AST_in = (AST) _t;
0840: match(_t, OBJBLOCK);
0841: _t = _t.getFirstChild();
0842: s = (AST) _t;
0843: match(_t, START_CLASS_BODY);
0844: _t = _t.getNextSibling();
0845: mController.tokenFound(s, "Class Body Start");
0846: {
0847: _loop41: do {
0848: if (_t == null)
0849: _t = ASTNULL;
0850: switch (_t.getType()) {
0851: case METHOD_DEF: {
0852: methodDecl(_t);
0853: _t = _retTree;
0854: break;
0855: }
0856: case VARIABLE_DEF: {
0857: variableDef(_t);
0858: _t = _retTree;
0859: break;
0860: }
0861: case CLASS_DEF:
0862: case INTERFACE_DEF: {
0863: typeDefinition(_t);
0864: _t = _retTree;
0865: break;
0866: }
0867: default: {
0868: break _loop41;
0869: }
0870: }
0871: } while (true);
0872: }
0873: e = (AST) _t;
0874: match(_t, END_CLASS_BODY);
0875: _t = _t.getNextSibling();
0876: mController.tokenFound(e, "Class Body End");
0877: _t = __t39;
0878: _t = _t.getNextSibling();
0879: } catch (RecognitionException ex) {
0880: reportError(ex);
0881: if (_t != null) {
0882: _t = _t.getNextSibling();
0883: }
0884: }
0885: _retTree = _t;
0886: }
0887:
0888: public final void typeSpec(AST _t) throws RecognitionException {
0889:
0890: AST typeSpec_AST_in = (AST) _t;
0891: mController.stateBegin(mStateNameMap.get("Type"));
0892:
0893: try { // for error handling
0894: AST __t17 = _t;
0895: AST tmp10_AST_in = (AST) _t;
0896: match(_t, TYPE);
0897: _t = _t.getFirstChild();
0898: typeSpecArray(_t);
0899: _t = _retTree;
0900: _t = __t17;
0901: _t = _t.getNextSibling();
0902: mController.stateEnd();
0903: } catch (RecognitionException ex) {
0904: reportError(ex);
0905: if (_t != null) {
0906: _t = _t.getNextSibling();
0907: }
0908: }
0909: _retTree = _t;
0910: }
0911:
0912: public final void typeSpecArray(AST _t) throws RecognitionException {
0913:
0914: AST typeSpecArray_AST_in = (AST) _t;
0915: AST lb = null;
0916: AST rb = null;
0917:
0918: try { // for error handling
0919: if (_t == null)
0920: _t = ASTNULL;
0921: switch (_t.getType()) {
0922: case ARRAY_DECLARATOR: {
0923: {
0924: mController.stateBegin(mStateNameMap
0925: .get("Array Declarator"));
0926: AST __t20 = _t;
0927: lb = _t == ASTNULL ? null : (AST) _t;
0928: match(_t, ARRAY_DECLARATOR);
0929: _t = _t.getFirstChild();
0930: mController.tokenFound(lb, "Array Start");
0931: typeSpecArray(_t);
0932: _t = _retTree;
0933: rb = (AST) _t;
0934: match(_t, RBRACK);
0935: _t = _t.getNextSibling();
0936: mController.tokenFound(rb, "Array End");
0937: _t = __t20;
0938: _t = _t.getNextSibling();
0939: mController.stateEnd();
0940: }
0941: break;
0942: }
0943: case LITERAL_void:
0944: case LITERAL_boolean:
0945: case LITERAL_byte:
0946: case LITERAL_char:
0947: case LITERAL_short:
0948: case LITERAL_int:
0949: case LITERAL_float:
0950: case LITERAL_long:
0951: case LITERAL_double:
0952: case IDENT:
0953: case DOT: {
0954: type(_t);
0955: _t = _retTree;
0956: break;
0957: }
0958: default: {
0959: throw new NoViableAltException(_t);
0960: }
0961: }
0962: } catch (RecognitionException ex) {
0963: reportError(ex);
0964: if (_t != null) {
0965: _t = _t.getNextSibling();
0966: }
0967: }
0968: _retTree = _t;
0969: }
0970:
0971: public final void type(AST _t) throws RecognitionException {
0972:
0973: AST type_AST_in = (AST) _t;
0974:
0975: try { // for error handling
0976: if (_t == null)
0977: _t = ASTNULL;
0978: switch (_t.getType()) {
0979: case IDENT:
0980: case DOT: {
0981: identifier(_t);
0982: _t = _retTree;
0983: break;
0984: }
0985: case LITERAL_void:
0986: case LITERAL_boolean:
0987: case LITERAL_byte:
0988: case LITERAL_char:
0989: case LITERAL_short:
0990: case LITERAL_int:
0991: case LITERAL_float:
0992: case LITERAL_long:
0993: case LITERAL_double: {
0994: builtInType(_t);
0995: _t = _retTree;
0996: break;
0997: }
0998: default: {
0999: throw new NoViableAltException(_t);
1000: }
1001: }
1002: } catch (RecognitionException ex) {
1003: reportError(ex);
1004: if (_t != null) {
1005: _t = _t.getNextSibling();
1006: }
1007: }
1008: _retTree = _t;
1009: }
1010:
1011: public final void builtInType(AST _t) throws RecognitionException {
1012:
1013: AST builtInType_AST_in = (AST) _t;
1014: AST v = null;
1015: AST b = null;
1016: AST by = null;
1017: AST c = null;
1018: AST s = null;
1019: AST i = null;
1020: AST f = null;
1021: AST l = null;
1022: AST d = null;
1023:
1024: try { // for error handling
1025: if (_t == null)
1026: _t = ASTNULL;
1027: switch (_t.getType()) {
1028: case LITERAL_void: {
1029: v = (AST) _t;
1030: match(_t, LITERAL_void);
1031: _t = _t.getNextSibling();
1032: mController.tokenFound(v, "Primitive Type");
1033: break;
1034: }
1035: case LITERAL_boolean: {
1036: b = (AST) _t;
1037: match(_t, LITERAL_boolean);
1038: _t = _t.getNextSibling();
1039: mController.tokenFound(b, "Primitive Type");
1040: break;
1041: }
1042: case LITERAL_byte: {
1043: by = (AST) _t;
1044: match(_t, LITERAL_byte);
1045: _t = _t.getNextSibling();
1046: mController.tokenFound(by, "Primitive Type");
1047: break;
1048: }
1049: case LITERAL_char: {
1050: c = (AST) _t;
1051: match(_t, LITERAL_char);
1052: _t = _t.getNextSibling();
1053: mController.tokenFound(c, "Primitive Type");
1054: break;
1055: }
1056: case LITERAL_short: {
1057: s = (AST) _t;
1058: match(_t, LITERAL_short);
1059: _t = _t.getNextSibling();
1060: mController.tokenFound(s, "Primitive Type");
1061: break;
1062: }
1063: case LITERAL_int: {
1064: i = (AST) _t;
1065: match(_t, LITERAL_int);
1066: _t = _t.getNextSibling();
1067: mController.tokenFound(i, "Primitive Type");
1068: break;
1069: }
1070: case LITERAL_float: {
1071: f = (AST) _t;
1072: match(_t, LITERAL_float);
1073: _t = _t.getNextSibling();
1074: mController.tokenFound(f, "Primitive Type");
1075: break;
1076: }
1077: case LITERAL_long: {
1078: l = (AST) _t;
1079: match(_t, LITERAL_long);
1080: _t = _t.getNextSibling();
1081: mController.tokenFound(l, "Primitive Type");
1082: break;
1083: }
1084: case LITERAL_double: {
1085: d = (AST) _t;
1086: match(_t, LITERAL_double);
1087: _t = _t.getNextSibling();
1088: mController.tokenFound(d, "Primitive Type");
1089: break;
1090: }
1091: default: {
1092: throw new NoViableAltException(_t);
1093: }
1094: }
1095: } catch (RecognitionException ex) {
1096: reportError(ex);
1097: if (_t != null) {
1098: _t = _t.getNextSibling();
1099: }
1100: }
1101: _retTree = _t;
1102: }
1103:
1104: public final void modifier(AST _t) throws RecognitionException {
1105:
1106: AST modifier_AST_in = (AST) _t;
1107: AST m1 = null;
1108: AST m2 = null;
1109: AST m3 = null;
1110: AST m4 = null;
1111: AST m5 = null;
1112: AST m6 = null;
1113: AST m7 = null;
1114: AST m8 = null;
1115: AST m9 = null;
1116: AST m10 = null;
1117: AST m11 = null;
1118: AST m12 = null;
1119: AST m13 = null;
1120:
1121: try { // for error handling
1122: if (_t == null)
1123: _t = ASTNULL;
1124: switch (_t.getType()) {
1125: case LITERAL_private: {
1126: m1 = (AST) _t;
1127: match(_t, LITERAL_private);
1128: _t = _t.getNextSibling();
1129: mController.tokenFound(m1, "Modifier");
1130: break;
1131: }
1132: case LITERAL_public: {
1133: m2 = (AST) _t;
1134: match(_t, LITERAL_public);
1135: _t = _t.getNextSibling();
1136: mController.tokenFound(m2, "Modifier");
1137: break;
1138: }
1139: case LITERAL_protected: {
1140: m3 = (AST) _t;
1141: match(_t, LITERAL_protected);
1142: _t = _t.getNextSibling();
1143: mController.tokenFound(m3, "Modifier");
1144: break;
1145: }
1146: case LITERAL_static: {
1147: m4 = (AST) _t;
1148: match(_t, LITERAL_static);
1149: _t = _t.getNextSibling();
1150: mController.tokenFound(m4, "Modifier");
1151: break;
1152: }
1153: case LITERAL_transient: {
1154: m5 = (AST) _t;
1155: match(_t, LITERAL_transient);
1156: _t = _t.getNextSibling();
1157: mController.tokenFound(m5, "Modifier");
1158: break;
1159: }
1160: case FINAL: {
1161: m6 = (AST) _t;
1162: match(_t, FINAL);
1163: _t = _t.getNextSibling();
1164: mController.tokenFound(m6, "Modifier");
1165: break;
1166: }
1167: case ABSTRACT: {
1168: m7 = (AST) _t;
1169: match(_t, ABSTRACT);
1170: _t = _t.getNextSibling();
1171: mController.tokenFound(m7, "Modifier");
1172: break;
1173: }
1174: case LITERAL_native: {
1175: m8 = (AST) _t;
1176: match(_t, LITERAL_native);
1177: _t = _t.getNextSibling();
1178: mController.tokenFound(m8, "Modifier");
1179: break;
1180: }
1181: case LITERAL_threadsafe: {
1182: m9 = (AST) _t;
1183: match(_t, LITERAL_threadsafe);
1184: _t = _t.getNextSibling();
1185: mController.tokenFound(m9, "Modifier");
1186: break;
1187: }
1188: case LITERAL_synchronized: {
1189: m10 = (AST) _t;
1190: match(_t, LITERAL_synchronized);
1191: _t = _t.getNextSibling();
1192: mController.tokenFound(m10, "Modifier");
1193: break;
1194: }
1195: case LITERAL_const: {
1196: m11 = (AST) _t;
1197: match(_t, LITERAL_const);
1198: _t = _t.getNextSibling();
1199: mController.tokenFound(m11, "Modifier");
1200: break;
1201: }
1202: case LITERAL_volatile: {
1203: m12 = (AST) _t;
1204: match(_t, LITERAL_volatile);
1205: _t = _t.getNextSibling();
1206: mController.tokenFound(m12, "Modifier");
1207: break;
1208: }
1209: case STRICTFP: {
1210: m13 = (AST) _t;
1211: match(_t, STRICTFP);
1212: _t = _t.getNextSibling();
1213: mController.tokenFound(m13, "Modifier");
1214: break;
1215: }
1216: default: {
1217: throw new NoViableAltException(_t);
1218: }
1219: }
1220: } catch (RecognitionException ex) {
1221: reportError(ex);
1222: if (_t != null) {
1223: _t = _t.getNextSibling();
1224: }
1225: }
1226: _retTree = _t;
1227: }
1228:
1229: public final void methodDecl(AST _t) throws RecognitionException {
1230:
1231: AST methodDecl_AST_in = (AST) _t;
1232: mController.stateBegin(mStateNameMap.get("Method Declaration"));
1233:
1234: try { // for error handling
1235: AST __t56 = _t;
1236: AST tmp11_AST_in = (AST) _t;
1237: match(_t, METHOD_DEF);
1238: _t = _t.getFirstChild();
1239: modifiers(_t);
1240: _t = _retTree;
1241: typeSpec(_t);
1242: _t = _retTree;
1243: methodHead(_t);
1244: _t = _retTree;
1245: _t = __t56;
1246: _t = _t.getNextSibling();
1247: mController.stateEnd();
1248: } catch (RecognitionException ex) {
1249: reportError(ex);
1250: if (_t != null) {
1251: _t = _t.getNextSibling();
1252: }
1253: }
1254: _retTree = _t;
1255: }
1256:
1257: public final void variableDef(AST _t) throws RecognitionException {
1258:
1259: AST variableDef_AST_in = (AST) _t;
1260: AST s = null;
1261: mController
1262: .stateBegin(mStateNameMap.get("Variable Definition"));
1263:
1264: try { // for error handling
1265: AST __t63 = _t;
1266: AST tmp12_AST_in = (AST) _t;
1267: match(_t, VARIABLE_DEF);
1268: _t = _t.getFirstChild();
1269: modifiers(_t);
1270: _t = _retTree;
1271: typeSpec(_t);
1272: _t = _retTree;
1273: variableDeclarator(_t);
1274: _t = _retTree;
1275: varInitializer(_t);
1276: _t = _retTree;
1277: {
1278: if (_t == null)
1279: _t = ASTNULL;
1280: switch (_t.getType()) {
1281: case SEMI: {
1282: s = (AST) _t;
1283: match(_t, SEMI);
1284: _t = _t.getNextSibling();
1285: mController.tokenFound(s, "Statement Terminator");
1286: break;
1287: }
1288: case 3: {
1289: break;
1290: }
1291: default: {
1292: throw new NoViableAltException(_t);
1293: }
1294: }
1295: }
1296: _t = __t63;
1297: _t = _t.getNextSibling();
1298: mController.stateEnd();
1299: } catch (RecognitionException ex) {
1300: reportError(ex);
1301: if (_t != null) {
1302: _t = _t.getNextSibling();
1303: }
1304: }
1305: _retTree = _t;
1306: }
1307:
1308: public final void ctorDef(AST _t) throws RecognitionException {
1309:
1310: AST ctorDef_AST_in = (AST) _t;
1311: mController.stateBegin(mStateNameMap
1312: .get("Constructor Definition"));
1313:
1314: try { // for error handling
1315: AST __t54 = _t;
1316: AST tmp13_AST_in = (AST) _t;
1317: match(_t, CTOR_DEF);
1318: _t = _t.getFirstChild();
1319: modifiers(_t);
1320: _t = _retTree;
1321: methodHead(_t);
1322: _t = _retTree;
1323: ctorSList(_t);
1324: _t = _retTree;
1325: _t = __t54;
1326: _t = _t.getNextSibling();
1327: mController.stateEnd();
1328: } catch (RecognitionException ex) {
1329: reportError(ex);
1330: if (_t != null) {
1331: _t = _t.getNextSibling();
1332: }
1333: }
1334: _retTree = _t;
1335: }
1336:
1337: public final void methodDef(AST _t) throws RecognitionException {
1338:
1339: AST methodDef_AST_in = (AST) _t;
1340:
1341: try { // for error handling
1342: if (_t == null)
1343: _t = ASTNULL;
1344: switch (_t.getType()) {
1345: case METHOD_DEF: {
1346: AST __t58 = _t;
1347: AST tmp14_AST_in = (AST) _t;
1348: match(_t, METHOD_DEF);
1349: _t = _t.getFirstChild();
1350: mController.stateBegin(mStateNameMap
1351: .get("Method Definition"));
1352: modifiers(_t);
1353: _t = _retTree;
1354: typeSpec(_t);
1355: _t = _retTree;
1356: methodHead(_t);
1357: _t = _retTree;
1358: {
1359: if (_t == null)
1360: _t = ASTNULL;
1361: switch (_t.getType()) {
1362: case SLIST: {
1363:
1364: mController.stateBegin(mStateNameMap
1365: .get("Method Body"));
1366:
1367: slist(_t, "Method");
1368: _t = _retTree;
1369:
1370: mController.stateEnd();
1371:
1372: break;
1373: }
1374: case 3: {
1375: break;
1376: }
1377: default: {
1378: throw new NoViableAltException(_t);
1379: }
1380: }
1381: }
1382: mController.stateEnd();
1383: _t = __t58;
1384: _t = _t.getNextSibling();
1385: break;
1386: }
1387: case DESTRUCTOR_DEF: {
1388: AST __t60 = _t;
1389: AST tmp15_AST_in = (AST) _t;
1390: match(_t, DESTRUCTOR_DEF);
1391: _t = _t.getFirstChild();
1392: mController.stateBegin(mStateNameMap
1393: .get("Destructor Definition"));
1394: modifiers(_t);
1395: _t = _retTree;
1396: typeSpec(_t);
1397: _t = _retTree;
1398: methodHead(_t);
1399: _t = _retTree;
1400: {
1401: if (_t == null)
1402: _t = ASTNULL;
1403: switch (_t.getType()) {
1404: case SLIST: {
1405:
1406: mController.stateBegin(mStateNameMap
1407: .get("Method Body"));
1408:
1409: slist(_t, "Method");
1410: _t = _retTree;
1411:
1412: mController.stateEnd();
1413:
1414: break;
1415: }
1416: case 3: {
1417: break;
1418: }
1419: default: {
1420: throw new NoViableAltException(_t);
1421: }
1422: }
1423: }
1424: mController.stateEnd();
1425: _t = __t60;
1426: _t = _t.getNextSibling();
1427: break;
1428: }
1429: default: {
1430: throw new NoViableAltException(_t);
1431: }
1432: }
1433: } catch (RecognitionException ex) {
1434: reportError(ex);
1435: if (_t != null) {
1436: _t = _t.getNextSibling();
1437: }
1438: }
1439: _retTree = _t;
1440: }
1441:
1442: public final void slist(AST _t, String type)
1443: throws RecognitionException {
1444:
1445: AST slist_AST_in = (AST) _t;
1446: AST s = null;
1447: AST e = null;
1448:
1449: try { // for error handling
1450: AST __t101 = _t;
1451: s = _t == ASTNULL ? null : (AST) _t;
1452: match(_t, SLIST);
1453: _t = _t.getFirstChild();
1454:
1455: if (type.equals("Method")) {
1456: mController.tokenFound(s, "Method Body Start");
1457: } else if (type.equals("Option")) {
1458: // mController.tokenFound(#s, "Option Statements");
1459: } else {
1460: mController.tokenFound(s, "Body Start");
1461: }
1462:
1463: {
1464: _loop103: do {
1465: if (_t == null)
1466: _t = ASTNULL;
1467: if ((_tokenSet_1.member(_t.getType()))) {
1468: stat(_t);
1469: _t = _retTree;
1470: } else {
1471: break _loop103;
1472: }
1473:
1474: } while (true);
1475: }
1476: {
1477: if (_t == null)
1478: _t = ASTNULL;
1479: switch (_t.getType()) {
1480: case END_SLIST: {
1481: e = (AST) _t;
1482: match(_t, END_SLIST);
1483: _t = _t.getNextSibling();
1484:
1485: if (type.equals("Method")) {
1486: mController.tokenFound(e, "Method Body End");
1487: } else {
1488: mController.tokenFound(e, "Body End");
1489: }
1490:
1491: break;
1492: }
1493: case 3: {
1494: break;
1495: }
1496: default: {
1497: throw new NoViableAltException(_t);
1498: }
1499: }
1500: }
1501: _t = __t101;
1502: _t = _t.getNextSibling();
1503: } catch (RecognitionException ex) {
1504: reportError(ex);
1505: if (_t != null) {
1506: _t = _t.getNextSibling();
1507: }
1508: }
1509: _retTree = _t;
1510: }
1511:
1512: public final void parseMethodBody(AST _t)
1513: throws RecognitionException {
1514:
1515: AST parseMethodBody_AST_in = (AST) _t;
1516: isInElsePart = false;
1517:
1518: try { // for error handling
1519: {
1520: _loop52: do {
1521: if (_t == null)
1522: _t = ASTNULL;
1523: switch (_t.getType()) {
1524: case CTOR_DEF: {
1525: ctorDef(_t);
1526: _t = _retTree;
1527: break;
1528: }
1529: case METHOD_DEF:
1530: case DESTRUCTOR_DEF: {
1531: methodDef(_t);
1532: _t = _retTree;
1533: break;
1534: }
1535: case VARIABLE_DEF: {
1536: variableDef(_t);
1537: _t = _retTree;
1538: break;
1539: }
1540: case CLASS_DEF:
1541: case INTERFACE_DEF: {
1542: typeDefinition(_t);
1543: _t = _retTree;
1544: break;
1545: }
1546: case STATIC_INIT: {
1547: AST __t50 = _t;
1548: AST tmp16_AST_in = (AST) _t;
1549: match(_t, STATIC_INIT);
1550: _t = _t.getFirstChild();
1551: mController.stateBegin(mStateNameMap
1552: .get("Static Initializer"));
1553: slist(_t, "");
1554: _t = _retTree;
1555: mController.stateEnd();
1556: _t = __t50;
1557: _t = _t.getNextSibling();
1558: break;
1559: }
1560: case INSTANCE_INIT: {
1561: AST __t51 = _t;
1562: AST tmp17_AST_in = (AST) _t;
1563: match(_t, INSTANCE_INIT);
1564: _t = _t.getFirstChild();
1565: slist(_t, "");
1566: _t = _retTree;
1567: _t = __t51;
1568: _t = _t.getNextSibling();
1569: break;
1570: }
1571: case PACKAGE_DEF: {
1572: packageDefinition(_t);
1573: _t = _retTree;
1574: break;
1575: }
1576: case IMPORT: {
1577: importDefinition(_t);
1578: _t = _retTree;
1579: break;
1580: }
1581: default: {
1582: break _loop52;
1583: }
1584: }
1585: } while (true);
1586: }
1587: } catch (RecognitionException ex) {
1588: reportError(ex);
1589: if (_t != null) {
1590: _t = _t.getNextSibling();
1591: }
1592: }
1593: _retTree = _t;
1594: }
1595:
1596: public final void methodHead(AST _t) throws RecognitionException {
1597:
1598: AST methodHead_AST_in = (AST) _t;
1599: AST n = null;
1600: AST lp = null;
1601: AST rp = null;
1602: AST ms = null;
1603:
1604: try { // for error handling
1605: n = (AST) _t;
1606: match(_t, IDENT);
1607: _t = _t.getNextSibling();
1608: mController.tokenFound(n, "Name");
1609: lp = (AST) _t;
1610: match(_t, LPAREN);
1611: _t = _t.getNextSibling();
1612:
1613: mController.stateBegin(mStateNameMap.get("Parameters"));
1614: mController.tokenFound(lp, "Parameter Start");
1615:
1616: AST __t79 = _t;
1617: AST tmp18_AST_in = (AST) _t;
1618: match(_t, PARAMETERS);
1619: _t = _t.getFirstChild();
1620: {
1621: _loop81: do {
1622: if (_t == null)
1623: _t = ASTNULL;
1624: if ((_t.getType() == PARAMETER_DEF)) {
1625: parameterDef(_t);
1626: _t = _retTree;
1627: } else {
1628: break _loop81;
1629: }
1630:
1631: } while (true);
1632: }
1633: _t = __t79;
1634: _t = _t.getNextSibling();
1635: rp = (AST) _t;
1636: match(_t, RPAREN);
1637: _t = _t.getNextSibling();
1638:
1639: mController.tokenFound(rp, "Parameter End");
1640: mController.stateEnd();
1641:
1642: {
1643: if (_t == null)
1644: _t = ASTNULL;
1645: switch (_t.getType()) {
1646: case LITERAL_throws: {
1647: throwsClause(_t);
1648: _t = _retTree;
1649: break;
1650: }
1651: case 3:
1652: case SLIST:
1653: case SEMI: {
1654: break;
1655: }
1656: default: {
1657: throw new NoViableAltException(_t);
1658: }
1659: }
1660: }
1661: {
1662: if (_t == null)
1663: _t = ASTNULL;
1664: switch (_t.getType()) {
1665: case SEMI: {
1666: ms = (AST) _t;
1667: match(_t, SEMI);
1668: _t = _t.getNextSibling();
1669: mController.tokenFound(ms, "Statement Terminator");
1670: break;
1671: }
1672: case 3:
1673: case SLIST: {
1674: break;
1675: }
1676: default: {
1677: throw new NoViableAltException(_t);
1678: }
1679: }
1680: }
1681: } catch (RecognitionException ex) {
1682: reportError(ex);
1683: if (_t != null) {
1684: _t = _t.getNextSibling();
1685: }
1686: }
1687: _retTree = _t;
1688: }
1689:
1690: public final void ctorSList(AST _t) throws RecognitionException {
1691:
1692: AST ctorSList_AST_in = (AST) _t;
1693: AST s = null;
1694: AST e = null;
1695:
1696: try { // for error handling
1697: AST __t96 = _t;
1698: s = _t == ASTNULL ? null : (AST) _t;
1699: match(_t, SLIST);
1700: _t = _t.getFirstChild();
1701:
1702: mController.stateBegin(mStateNameMap
1703: .get("Constructor Body"));
1704: mController.tokenFound(s, "Method Body Start");
1705:
1706: {
1707: if (_t == null)
1708: _t = ASTNULL;
1709: switch (_t.getType()) {
1710: case SUPER_CTOR_CALL:
1711: case CTOR_CALL: {
1712: ctorCall(_t);
1713: _t = _retTree;
1714: break;
1715: }
1716: case SLIST:
1717: case END_SLIST:
1718: case VARIABLE_DEF:
1719: case CLASS_DEF:
1720: case INTERFACE_DEF:
1721: case LABELED_STAT:
1722: case EXPR:
1723: case EMPTY_STAT:
1724: case LITERAL_synchronized:
1725: case LITERAL_if:
1726: case LITERAL_for:
1727: case LITERAL_while:
1728: case LITERAL_do:
1729: case LITERAL_break:
1730: case LITERAL_continue:
1731: case LITERAL_return:
1732: case LITERAL_switch:
1733: case LITERAL_throw:
1734: case LITERAL_try: {
1735: break;
1736: }
1737: default: {
1738: throw new NoViableAltException(_t);
1739: }
1740: }
1741: }
1742: {
1743: _loop99: do {
1744: if (_t == null)
1745: _t = ASTNULL;
1746: if ((_tokenSet_1.member(_t.getType()))) {
1747: stat(_t);
1748: _t = _retTree;
1749: } else {
1750: break _loop99;
1751: }
1752:
1753: } while (true);
1754: }
1755: e = (AST) _t;
1756: match(_t, END_SLIST);
1757: _t = _t.getNextSibling();
1758:
1759: mController.tokenFound(e, "Method Body End");
1760: mController.stateEnd();
1761:
1762: _t = __t96;
1763: _t = _t.getNextSibling();
1764: } catch (RecognitionException ex) {
1765: reportError(ex);
1766: if (_t != null) {
1767: _t = _t.getNextSibling();
1768: }
1769: }
1770: _retTree = _t;
1771: }
1772:
1773: public final void variableDeclarator(AST _t)
1774: throws RecognitionException {
1775:
1776: AST variableDeclarator_AST_in = (AST) _t;
1777: AST i = null;
1778: AST l = null;
1779:
1780: try { // for error handling
1781: if (_t == null)
1782: _t = ASTNULL;
1783: switch (_t.getType()) {
1784: case IDENT: {
1785: i = (AST) _t;
1786: match(_t, IDENT);
1787: _t = _t.getNextSibling();
1788: mController.tokenFound(i, "Name");
1789: break;
1790: }
1791: case LBRACK: {
1792: l = (AST) _t;
1793: match(_t, LBRACK);
1794: _t = _t.getNextSibling();
1795: mController.tokenFound(l, "Array Decl");
1796: variableDeclarator(_t);
1797: _t = _retTree;
1798: break;
1799: }
1800: default: {
1801: throw new NoViableAltException(_t);
1802: }
1803: }
1804: } catch (RecognitionException ex) {
1805: reportError(ex);
1806: if (_t != null) {
1807: _t = _t.getNextSibling();
1808: }
1809: }
1810: _retTree = _t;
1811: }
1812:
1813: public final void varInitializer(AST _t)
1814: throws RecognitionException {
1815:
1816: AST varInitializer_AST_in = (AST) _t;
1817:
1818: try { // for error handling
1819: if (_t == null)
1820: _t = ASTNULL;
1821: switch (_t.getType()) {
1822: case ASSIGN: {
1823: {
1824: mController.stateBegin(mStateNameMap
1825: .get("Initializer"));
1826: AST __t72 = _t;
1827: AST tmp19_AST_in = (AST) _t;
1828: match(_t, ASSIGN);
1829: _t = _t.getFirstChild();
1830: initializer(_t);
1831: _t = _retTree;
1832: _t = __t72;
1833: _t = _t.getNextSibling();
1834: mController.stateEnd();
1835: }
1836: break;
1837: }
1838: case 3:
1839: case SEMI: {
1840: break;
1841: }
1842: default: {
1843: throw new NoViableAltException(_t);
1844: }
1845: }
1846: } catch (RecognitionException ex) {
1847: reportError(ex);
1848: if (_t != null) {
1849: _t = _t.getNextSibling();
1850: }
1851: }
1852: _retTree = _t;
1853: }
1854:
1855: public final void parameterDef(AST _t) throws RecognitionException {
1856:
1857: AST parameterDef_AST_in = (AST) _t;
1858: AST n = null;
1859: mController.stateBegin(mStateNameMap.get("Parameter"));
1860:
1861: try { // for error handling
1862: AST __t66 = _t;
1863: AST tmp20_AST_in = (AST) _t;
1864: match(_t, PARAMETER_DEF);
1865: _t = _t.getFirstChild();
1866: modifiers(_t);
1867: _t = _retTree;
1868: typeSpec(_t);
1869: _t = _retTree;
1870: n = (AST) _t;
1871: match(_t, IDENT);
1872: _t = _t.getNextSibling();
1873: mController.tokenFound(n, "Name");
1874: _t = __t66;
1875: _t = _t.getNextSibling();
1876: mController.stateEnd();
1877: } catch (RecognitionException ex) {
1878: reportError(ex);
1879: if (_t != null) {
1880: _t = _t.getNextSibling();
1881: }
1882: }
1883: _retTree = _t;
1884: }
1885:
1886: public final void objectinitializer(AST _t)
1887: throws RecognitionException {
1888:
1889: AST objectinitializer_AST_in = (AST) _t;
1890:
1891: try { // for error handling
1892: AST __t68 = _t;
1893: AST tmp21_AST_in = (AST) _t;
1894: match(_t, INSTANCE_INIT);
1895: _t = _t.getFirstChild();
1896: slist(_t, "");
1897: _t = _retTree;
1898: _t = __t68;
1899: _t = _t.getNextSibling();
1900: } catch (RecognitionException ex) {
1901: reportError(ex);
1902: if (_t != null) {
1903: _t = _t.getNextSibling();
1904: }
1905: }
1906: _retTree = _t;
1907: }
1908:
1909: public final void initializer(AST _t) throws RecognitionException {
1910:
1911: AST initializer_AST_in = (AST) _t;
1912:
1913: try { // for error handling
1914: if (_t == null)
1915: _t = ASTNULL;
1916: switch (_t.getType()) {
1917: case EXPR: {
1918: expression(_t);
1919: _t = _retTree;
1920: break;
1921: }
1922: case ARRAY_INIT: {
1923: arrayInitializer(_t);
1924: _t = _retTree;
1925: break;
1926: }
1927: default: {
1928: throw new NoViableAltException(_t);
1929: }
1930: }
1931: } catch (RecognitionException ex) {
1932: reportError(ex);
1933: if (_t != null) {
1934: _t = _t.getNextSibling();
1935: }
1936: }
1937: _retTree = _t;
1938: }
1939:
1940: public final void expression(AST _t) throws RecognitionException {
1941:
1942: AST expression_AST_in = (AST) _t;
1943:
1944: try { // for error handling
1945: AST __t147 = _t;
1946: AST tmp22_AST_in = (AST) _t;
1947: match(_t, EXPR);
1948: _t = _t.getFirstChild();
1949: expr(_t);
1950: _t = _retTree;
1951: _t = __t147;
1952: _t = _t.getNextSibling();
1953: } catch (RecognitionException ex) {
1954: reportError(ex);
1955: if (_t != null) {
1956: _t = _t.getNextSibling();
1957: }
1958: }
1959: _retTree = _t;
1960: }
1961:
1962: public final void arrayInitializer(AST _t)
1963: throws RecognitionException {
1964:
1965: AST arrayInitializer_AST_in = (AST) _t;
1966: AST lc = null;
1967: AST rc = null;
1968: mController.stateBegin(mStateNameMap.get("Array Initializer"));
1969:
1970: try { // for error handling
1971: AST __t75 = _t;
1972: lc = _t == ASTNULL ? null : (AST) _t;
1973: match(_t, ARRAY_INIT);
1974: _t = _t.getFirstChild();
1975: mController.tokenFound(lc, "Start Array Init");
1976: {
1977: _loop77: do {
1978: if (_t == null)
1979: _t = ASTNULL;
1980: if ((_t.getType() == EXPR || _t.getType() == ARRAY_INIT)) {
1981: initializer(_t);
1982: _t = _retTree;
1983: } else {
1984: break _loop77;
1985: }
1986:
1987: } while (true);
1988: }
1989: rc = (AST) _t;
1990: match(_t, RCURLY);
1991: _t = _t.getNextSibling();
1992: mController.tokenFound(rc, "End Array Init");
1993: _t = __t75;
1994: _t = _t.getNextSibling();
1995: mController.stateEnd();
1996: } catch (RecognitionException ex) {
1997: reportError(ex);
1998: if (_t != null) {
1999: _t = _t.getNextSibling();
2000: }
2001: }
2002: _retTree = _t;
2003: }
2004:
2005: public final void throwsClause(AST _t) throws RecognitionException {
2006:
2007: AST throwsClause_AST_in = (AST) _t;
2008: AST t = null;
2009: mController.stateBegin(mStateNameMap.get("Throws Declaration"));
2010:
2011: try { // for error handling
2012: AST __t85 = _t;
2013: t = _t == ASTNULL ? null : (AST) _t;
2014: match(_t, LITERAL_throws);
2015: _t = _t.getFirstChild();
2016: mController.tokenFound(t, "Keyword");
2017: {
2018: _loop87: do {
2019: if (_t == null)
2020: _t = ASTNULL;
2021: if ((_t.getType() == IDENT || _t.getType() == DOT)) {
2022: identifier(_t);
2023: _t = _retTree;
2024: } else {
2025: break _loop87;
2026: }
2027:
2028: } while (true);
2029: }
2030: _t = __t85;
2031: _t = _t.getNextSibling();
2032: mController.stateEnd();
2033: } catch (RecognitionException ex) {
2034: reportError(ex);
2035: if (_t != null) {
2036: _t = _t.getNextSibling();
2037: }
2038: }
2039: _retTree = _t;
2040: }
2041:
2042: public final void ctorCall(AST _t) throws RecognitionException {
2043:
2044: AST ctorCall_AST_in = (AST) _t;
2045:
2046: try { // for error handling
2047: if (_t == null)
2048: _t = ASTNULL;
2049: switch (_t.getType()) {
2050: case CTOR_CALL: {
2051: AST __t247 = _t;
2052: AST tmp23_AST_in = (AST) _t;
2053: match(_t, CTOR_CALL);
2054: _t = _t.getFirstChild();
2055: mController.stateBegin(mStateNameMap
2056: .get("Constructor Call"));
2057: elist(_t);
2058: _t = _retTree;
2059: mController.stateEnd();
2060: _t = __t247;
2061: _t = _t.getNextSibling();
2062: break;
2063: }
2064: case SUPER_CTOR_CALL: {
2065: AST __t248 = _t;
2066: AST tmp24_AST_in = (AST) _t;
2067: match(_t, SUPER_CTOR_CALL);
2068: _t = _t.getFirstChild();
2069: mController.stateBegin(mStateNameMap
2070: .get("Super Constructor Call"));
2071: {
2072: if (_t == null)
2073: _t = ASTNULL;
2074: switch (_t.getType()) {
2075: case ELIST: {
2076: elist(_t);
2077: _t = _retTree;
2078: break;
2079: }
2080: case TYPE:
2081: case TYPECAST:
2082: case INDEX_OP:
2083: case METHOD_CALL:
2084: case IDENT:
2085: case DOT:
2086: case LPAREN:
2087: case LITERAL_this :
2088: case LITERAL_super :
2089: case LITERAL_true:
2090: case LITERAL_false:
2091: case LITERAL_null:
2092: case LITERAL_new:
2093: case NUM_INT:
2094: case CHAR_LITERAL:
2095: case STRING_LITERAL:
2096: case NUM_FLOAT:
2097: case NUM_LONG:
2098: case NUM_DOUBLE: {
2099: primaryExpression(_t);
2100: _t = _retTree;
2101: elist(_t);
2102: _t = _retTree;
2103: break;
2104: }
2105: default: {
2106: throw new NoViableAltException(_t);
2107: }
2108: }
2109: }
2110: mController.stateEnd();
2111: _t = __t248;
2112: _t = _t.getNextSibling();
2113: break;
2114: }
2115: default: {
2116: throw new NoViableAltException(_t);
2117: }
2118: }
2119: } catch (RecognitionException ex) {
2120: reportError(ex);
2121: if (_t != null) {
2122: _t = _t.getNextSibling();
2123: }
2124: }
2125: _retTree = _t;
2126: }
2127:
2128: public final void stat(AST _t) throws RecognitionException {
2129:
2130: AST stat_AST_in = (AST) _t;
2131: AST f = null;
2132: AST e = null;
2133: AST fo = null;
2134: AST is = null;
2135: AST cs = null;
2136: AST w = null;
2137: AST d = null;
2138: AST bDest = null;
2139: AST contDest = null;
2140: AST returnKeyword = null;
2141: AST sKey = null;
2142: AST throwKey = null;
2143: AST syncKeyword = null;
2144:
2145: // boolean isInElsePart = false;
2146: boolean isProcessingIf = true;
2147: boolean hasProcessedElse = false;
2148: boolean addConditional = false;
2149:
2150: try { // for error handling
2151: if (_t == null)
2152: _t = ASTNULL;
2153: switch (_t.getType()) {
2154: case CLASS_DEF:
2155: case INTERFACE_DEF: {
2156: typeDefinition(_t);
2157: _t = _retTree;
2158: break;
2159: }
2160: case VARIABLE_DEF: {
2161: variableDef(_t);
2162: _t = _retTree;
2163: break;
2164: }
2165: case EXPR: {
2166: expression(_t);
2167: _t = _retTree;
2168: break;
2169: }
2170: case LABELED_STAT: {
2171: AST __t106 = _t;
2172: AST tmp25_AST_in = (AST) _t;
2173: match(_t, LABELED_STAT);
2174: _t = _t.getFirstChild();
2175: AST tmp26_AST_in = (AST) _t;
2176: match(_t, IDENT);
2177: _t = _t.getNextSibling();
2178: stat(_t);
2179: _t = _retTree;
2180: _t = __t106;
2181: _t = _t.getNextSibling();
2182: break;
2183: }
2184: case LITERAL_if: {
2185: AST __t107 = _t;
2186: f = _t == ASTNULL ? null : (AST) _t;
2187: match(_t, LITERAL_if);
2188: _t = _t.getFirstChild();
2189:
2190: if (isInElsePart == false) {
2191: mController.stateBegin(mStateNameMap
2192: .get("Conditional"));
2193: addConditional = true;
2194: } else {
2195: //isProcessingIf = true;
2196: isInElsePart = false;
2197: }
2198: mController.tokenFound(f, "Keyword");
2199: mController.stateBegin(mStateNameMap
2200: .get("Test Condition"));
2201:
2202: expression(_t);
2203: _t = _retTree;
2204:
2205: mController.stateEnd(); // Test Condition State
2206: mController.stateBegin(mStateNameMap.get("Body"));
2207:
2208: stat(_t);
2209: _t = _retTree;
2210: {
2211: if (_t == null)
2212: _t = ASTNULL;
2213: switch (_t.getType()) {
2214: case LITERAL_else: {
2215: e = (AST) _t;
2216: match(_t, LITERAL_else);
2217: _t = _t.getNextSibling();
2218:
2219: hasProcessedElse = true;
2220: mController.tokenFound(e, "Keyword");
2221:
2222: // Since the Else part is only represented by a statemenet
2223: // This optional statement is the else part
2224: // mController.stateEnd();
2225: // Previous Conditional Statement
2226: //if(_t.getType() != LITERAL_if)
2227: {
2228: mController.stateEnd(); // The Body part.
2229: mController.stateBegin(mStateNameMap
2230: .get("Else Conditional"));
2231:
2232: isProcessingIf = true;
2233: if (_t.getType() != LITERAL_if) {
2234: mController.stateBegin(mStateNameMap
2235: .get("Body"));
2236: isProcessingIf = false;
2237: } else {
2238: isInElsePart = true;
2239: }
2240: }
2241:
2242: stat(_t);
2243: _t = _retTree;
2244:
2245: if (isProcessingIf == false) {
2246: mController.stateEnd(); // The Body part.
2247: }
2248: mController.stateEnd(); // Else Conditional State
2249:
2250: break;
2251: }
2252: case 3: {
2253: break;
2254: }
2255: default: {
2256: throw new NoViableAltException(_t);
2257: }
2258: }
2259: }
2260:
2261: if (hasProcessedElse == false) {
2262: mController.stateEnd(); // Body State
2263: }
2264:
2265: //if(isProcessingIf == false)
2266: if (addConditional == true) {
2267: mController.stateEnd(); // Conditional State
2268: }
2269: isInElsePart = false;
2270:
2271: _t = __t107;
2272: _t = _t.getNextSibling();
2273: break;
2274: }
2275: case LITERAL_for: {
2276: AST __t109 = _t;
2277: fo = _t == ASTNULL ? null : (AST) _t;
2278: match(_t, LITERAL_for);
2279: _t = _t.getFirstChild();
2280:
2281: mController.stateBegin(mStateNameMap.get("Loop"));
2282: mController.tokenFound(fo, "Keyword");
2283: mController.stateBegin(mStateNameMap
2284: .get("Loop Initializer"));
2285:
2286: AST __t110 = _t;
2287: AST tmp27_AST_in = (AST) _t;
2288: match(_t, FOR_INIT);
2289: _t = _t.getFirstChild();
2290: {
2291: if (_t == null)
2292: _t = ASTNULL;
2293: switch (_t.getType()) {
2294: case VARIABLE_DEF: {
2295: variableDef(_t);
2296: _t = _retTree;
2297: break;
2298: }
2299: case ELIST: {
2300: elist(_t);
2301: _t = _retTree;
2302: break;
2303: }
2304: case 3: {
2305: break;
2306: }
2307: default: {
2308: throw new NoViableAltException(_t);
2309: }
2310: }
2311: }
2312: _t = __t110;
2313: _t = _t.getNextSibling();
2314: is = (AST) _t;
2315: match(_t, SEMI);
2316: _t = _t.getNextSibling();
2317:
2318: mController.stateEnd(); // Initializer State
2319: mController.stateBegin(mStateNameMap
2320: .get("Test Condition"));
2321: mController.tokenFound(is, "Conditional Separator");
2322:
2323: AST __t112 = _t;
2324: AST tmp28_AST_in = (AST) _t;
2325: match(_t, FOR_CONDITION);
2326: _t = _t.getFirstChild();
2327: {
2328: if (_t == null)
2329: _t = ASTNULL;
2330: switch (_t.getType()) {
2331: case EXPR: {
2332: expression(_t);
2333: _t = _retTree;
2334: break;
2335: }
2336: case 3: {
2337: break;
2338: }
2339: default: {
2340: throw new NoViableAltException(_t);
2341: }
2342: }
2343: }
2344: _t = __t112;
2345: _t = _t.getNextSibling();
2346: cs = (AST) _t;
2347: match(_t, SEMI);
2348: _t = _t.getNextSibling();
2349:
2350: mController.stateEnd(); // Test Condition State
2351: mController.stateBegin(mStateNameMap
2352: .get("Loop PostProcess"));
2353: mController.tokenFound(cs, "PostProcessor Separator");
2354:
2355: AST __t114 = _t;
2356: AST tmp29_AST_in = (AST) _t;
2357: match(_t, FOR_ITERATOR);
2358: _t = _t.getFirstChild();
2359: {
2360: if (_t == null)
2361: _t = ASTNULL;
2362: switch (_t.getType()) {
2363: case ELIST: {
2364: elist(_t);
2365: _t = _retTree;
2366: break;
2367: }
2368: case 3: {
2369: break;
2370: }
2371: default: {
2372: throw new NoViableAltException(_t);
2373: }
2374: }
2375: }
2376: _t = __t114;
2377: _t = _t.getNextSibling();
2378:
2379: mController.stateEnd(); // PostProcess State
2380: mController.stateBegin(mStateNameMap.get("Body"));
2381:
2382: stat(_t);
2383: _t = _retTree;
2384:
2385: mController.stateEnd(); // Body State
2386: mController.stateEnd(); // Loop State
2387:
2388: _t = __t109;
2389: _t = _t.getNextSibling();
2390: break;
2391: }
2392: case LITERAL_while: {
2393: AST __t116 = _t;
2394: w = _t == ASTNULL ? null : (AST) _t;
2395: match(_t, LITERAL_while);
2396: _t = _t.getFirstChild();
2397:
2398: mController.stateBegin(mStateNameMap.get("Loop"));
2399: mController.tokenFound(w, "Keyword");
2400: mController.stateBegin(mStateNameMap
2401: .get("Test Condition"));
2402:
2403: expression(_t);
2404: _t = _retTree;
2405:
2406: mController.stateEnd(); // Test Condition State
2407: mController.stateBegin(mStateNameMap.get("Body"));
2408:
2409: stat(_t);
2410: _t = _retTree;
2411:
2412: mController.stateEnd(); // Body State
2413: mController.stateEnd(); // Conditional State
2414:
2415: _t = __t116;
2416: _t = _t.getNextSibling();
2417: break;
2418: }
2419: case LITERAL_do: {
2420: AST __t117 = _t;
2421: d = _t == ASTNULL ? null : (AST) _t;
2422: match(_t, LITERAL_do);
2423: _t = _t.getFirstChild();
2424:
2425: mController.stateBegin(mStateNameMap.get("Loop"));
2426: mController.tokenFound(d, "Keyword");
2427: mController.stateBegin(mStateNameMap.get("Body"));
2428:
2429: stat(_t);
2430: _t = _retTree;
2431:
2432: mController.stateEnd(); // Body State
2433: mController.stateBegin(mStateNameMap
2434: .get("Test Condition"));
2435:
2436: expression(_t);
2437: _t = _retTree;
2438:
2439: mController.stateEnd(); // Test Condition State
2440: mController.stateEnd(); // Conditional State
2441:
2442: _t = __t117;
2443: _t = _t.getNextSibling();
2444: break;
2445: }
2446: case LITERAL_break: {
2447: AST __t118 = _t;
2448: AST tmp30_AST_in = (AST) _t;
2449: match(_t, LITERAL_break);
2450: _t = _t.getFirstChild();
2451: mController.stateBegin(mStateNameMap.get("Break"));
2452: {
2453: if (_t == null)
2454: _t = ASTNULL;
2455: switch (_t.getType()) {
2456: case IDENT: {
2457: bDest = (AST) _t;
2458: match(_t, IDENT);
2459: _t = _t.getNextSibling();
2460: mController.tokenFound(bDest, "Destination");
2461: break;
2462: }
2463: case 3: {
2464: break;
2465: }
2466: default: {
2467: throw new NoViableAltException(_t);
2468: }
2469: }
2470: }
2471: mController.stateEnd();
2472: _t = __t118;
2473: _t = _t.getNextSibling();
2474: break;
2475: }
2476: case LITERAL_continue: {
2477: AST __t120 = _t;
2478: AST tmp31_AST_in = (AST) _t;
2479: match(_t, LITERAL_continue);
2480: _t = _t.getFirstChild();
2481: mController.stateBegin(mStateNameMap.get("Continue"));
2482: {
2483: if (_t == null)
2484: _t = ASTNULL;
2485: switch (_t.getType()) {
2486: case IDENT: {
2487: contDest = (AST) _t;
2488: match(_t, IDENT);
2489: _t = _t.getNextSibling();
2490: mController.tokenFound(contDest, "Destination");
2491: break;
2492: }
2493: case 3: {
2494: break;
2495: }
2496: default: {
2497: throw new NoViableAltException(_t);
2498: }
2499: }
2500: }
2501: mController.stateEnd();
2502: _t = __t120;
2503: _t = _t.getNextSibling();
2504: break;
2505: }
2506: case LITERAL_return: {
2507: AST __t122 = _t;
2508: returnKeyword = _t == ASTNULL ? null : (AST) _t;
2509: match(_t, LITERAL_return);
2510: _t = _t.getFirstChild();
2511:
2512: mController.stateBegin(mStateNameMap.get("Return"));
2513: mController.tokenFound(returnKeyword, "Keyword");
2514:
2515: {
2516: if (_t == null)
2517: _t = ASTNULL;
2518: switch (_t.getType()) {
2519: case EXPR: {
2520: expression(_t);
2521: _t = _retTree;
2522: break;
2523: }
2524: case 3: {
2525: break;
2526: }
2527: default: {
2528: throw new NoViableAltException(_t);
2529: }
2530: }
2531: }
2532:
2533: mController.stateEnd();
2534:
2535: _t = __t122;
2536: _t = _t.getNextSibling();
2537: break;
2538: }
2539: case LITERAL_switch: {
2540: AST __t124 = _t;
2541: sKey = _t == ASTNULL ? null : (AST) _t;
2542: match(_t, LITERAL_switch);
2543: _t = _t.getFirstChild();
2544:
2545: mController.stateBegin(mStateNameMap
2546: .get("Option Conditional"));
2547: mController.tokenFound(sKey, "Keyword");
2548: mController.stateBegin(mStateNameMap
2549: .get("Test Condition"));
2550:
2551: expression(_t);
2552: _t = _retTree;
2553:
2554: mController.stateEnd(); // Test Condition
2555:
2556: {
2557: _loop126: do {
2558: if (_t == null)
2559: _t = ASTNULL;
2560: if ((_t.getType() == CASE_GROUP)) {
2561: caseGroup(_t);
2562: _t = _retTree;
2563: } else {
2564: break _loop126;
2565: }
2566:
2567: } while (true);
2568: }
2569:
2570: mController.stateEnd(); // Conditional
2571:
2572: _t = __t124;
2573: _t = _t.getNextSibling();
2574: break;
2575: }
2576: case LITERAL_throw: {
2577: AST __t127 = _t;
2578: throwKey = _t == ASTNULL ? null : (AST) _t;
2579: match(_t, LITERAL_throw);
2580: _t = _t.getFirstChild();
2581:
2582: mController.stateBegin(mStateNameMap
2583: .get("RaisedException"));
2584: mController.tokenFound(throwKey, "Keyword");
2585: mController.stateBegin(mStateNameMap.get("Exception"));
2586:
2587: expression(_t);
2588: _t = _retTree;
2589:
2590: mController.stateEnd(); // Exception
2591: mController.stateEnd(); // RaisedException
2592:
2593: _t = __t127;
2594: _t = _t.getNextSibling();
2595: break;
2596: }
2597: case LITERAL_synchronized: {
2598: AST __t128 = _t;
2599: syncKeyword = _t == ASTNULL ? null : (AST) _t;
2600: match(_t, LITERAL_synchronized);
2601: _t = _t.getFirstChild();
2602:
2603: mController.stateBegin(mStateNameMap
2604: .get("CriticalSection"));
2605: mController.tokenFound(syncKeyword, "Keyword");
2606: mController
2607: .stateBegin(mStateNameMap.get("Lock Object"));
2608:
2609: expression(_t);
2610: _t = _retTree;
2611:
2612: mController.stateEnd(); // Lock Section
2613: mController.stateBegin(mStateNameMap.get("Body"));
2614:
2615: stat(_t);
2616: _t = _retTree;
2617:
2618: mController.stateEnd(); // Body
2619: mController.stateEnd(); // CriticalSection
2620:
2621: _t = __t128;
2622: _t = _t.getNextSibling();
2623: break;
2624: }
2625: case LITERAL_try: {
2626: tryBlock(_t);
2627: _t = _retTree;
2628: break;
2629: }
2630: case SLIST: {
2631: slist(_t, "");
2632: _t = _retTree;
2633: break;
2634: }
2635: case EMPTY_STAT: {
2636: AST tmp32_AST_in = (AST) _t;
2637: match(_t, EMPTY_STAT);
2638: _t = _t.getNextSibling();
2639: break;
2640: }
2641: default: {
2642: throw new NoViableAltException(_t);
2643: }
2644: }
2645: } catch (RecognitionException ex) {
2646: reportError(ex);
2647: if (_t != null) {
2648: _t = _t.getNextSibling();
2649: }
2650: }
2651: _retTree = _t;
2652: }
2653:
2654: public final void elist(AST _t) throws RecognitionException {
2655:
2656: AST elist_AST_in = (AST) _t;
2657: mController.stateBegin(mStateNameMap.get("Expression List"));
2658:
2659: try { // for error handling
2660: AST __t143 = _t;
2661: AST tmp33_AST_in = (AST) _t;
2662: match(_t, ELIST);
2663: _t = _t.getFirstChild();
2664: {
2665: _loop145: do {
2666: if (_t == null)
2667: _t = ASTNULL;
2668: if ((_t.getType() == EXPR)) {
2669: expression(_t);
2670: _t = _retTree;
2671: } else {
2672: break _loop145;
2673: }
2674:
2675: } while (true);
2676: }
2677: _t = __t143;
2678: _t = _t.getNextSibling();
2679: mController.stateEnd();
2680: } catch (RecognitionException ex) {
2681: reportError(ex);
2682: if (_t != null) {
2683: _t = _t.getNextSibling();
2684: }
2685: }
2686: _retTree = _t;
2687: }
2688:
2689: public final void caseGroup(AST _t) throws RecognitionException {
2690:
2691: AST caseGroup_AST_in = (AST) _t;
2692: AST c = null;
2693: AST d = null;
2694:
2695: try { // for error handling
2696: AST __t130 = _t;
2697: AST tmp34_AST_in = (AST) _t;
2698: match(_t, CASE_GROUP);
2699: _t = _t.getFirstChild();
2700: mController.stateBegin(mStateNameMap.get("Option Group"));
2701: {
2702: int _cnt133 = 0;
2703: _loop133: do {
2704: if (_t == null)
2705: _t = ASTNULL;
2706: switch (_t.getType()) {
2707: case LITERAL_case: {
2708: AST __t132 = _t;
2709: c = _t == ASTNULL ? null : (AST) _t;
2710: match(_t, LITERAL_case);
2711: _t = _t.getFirstChild();
2712:
2713: //mController.stateBegin(mStateNameMap.get("Option"));
2714: mController.tokenFound(c, "Keyword");
2715: mController.stateBegin(mStateNameMap
2716: .get("Test Condition"));
2717:
2718: expression(_t);
2719: _t = _retTree;
2720:
2721: mController.stateEnd(); // Test Condition
2722: //mController.stateEnd(); // Option
2723:
2724: _t = __t132;
2725: _t = _t.getNextSibling();
2726: break;
2727: }
2728: case LITERAL_default: {
2729: d = (AST) _t;
2730: match(_t, LITERAL_default);
2731: _t = _t.getNextSibling();
2732:
2733: mController.tokenFound(d, "Keyword");
2734: mController.stateBegin(mStateNameMap
2735: .get("Default Option"));
2736: mController.stateEnd(); // Default Option
2737:
2738: break;
2739: }
2740: default: {
2741: if (_cnt133 >= 1) {
2742: break _loop133;
2743: } else {
2744: throw new NoViableAltException(_t);
2745: }
2746: }
2747: }
2748: _cnt133++;
2749: } while (true);
2750: }
2751:
2752: mController.stateBegin(mStateNameMap.get("Body"));
2753:
2754: slist(_t, "Option");
2755: _t = _retTree;
2756:
2757: mController.stateEnd(); // Body
2758: mController.stateEnd(); // Option Group
2759:
2760: _t = __t130;
2761: _t = _t.getNextSibling();
2762: } catch (RecognitionException ex) {
2763: reportError(ex);
2764: if (_t != null) {
2765: _t = _t.getNextSibling();
2766: }
2767: }
2768: _retTree = _t;
2769: }
2770:
2771: public final void tryBlock(AST _t) throws RecognitionException {
2772:
2773: AST tryBlock_AST_in = (AST) _t;
2774: AST key = null;
2775:
2776: try { // for error handling
2777: AST __t135 = _t;
2778: key = _t == ASTNULL ? null : (AST) _t;
2779: match(_t, LITERAL_try);
2780: _t = _t.getFirstChild();
2781:
2782: mController.stateBegin(mStateNameMap
2783: .get("Exception Processing"));
2784: mController.tokenFound(key, "Keyword");
2785: mController.stateBegin(mStateNameMap.get("Body"));
2786:
2787: slist(_t, "");
2788: _t = _retTree;
2789:
2790: mController.stateEnd(); // Body
2791:
2792: {
2793: _loop137: do {
2794: if (_t == null)
2795: _t = ASTNULL;
2796: if ((_t.getType() == LITERAL_catch)) {
2797: handler(_t);
2798: _t = _retTree;
2799: } else {
2800: break _loop137;
2801: }
2802:
2803: } while (true);
2804: }
2805: {
2806: if (_t == null)
2807: _t = ASTNULL;
2808: switch (_t.getType()) {
2809: case LITERAL_finally: {
2810: AST __t139 = _t;
2811: AST tmp35_AST_in = (AST) _t;
2812: match(_t, LITERAL_finally);
2813: _t = _t.getFirstChild();
2814: mController.stateBegin(mStateNameMap
2815: .get("Default Processing"));
2816: slist(_t, "");
2817: _t = _retTree;
2818: _t = __t139;
2819: _t = _t.getNextSibling();
2820: mController.stateEnd();
2821: break;
2822: }
2823: case 3: {
2824: break;
2825: }
2826: default: {
2827: throw new NoViableAltException(_t);
2828: }
2829: }
2830: }
2831: mController.stateEnd();
2832: _t = __t135;
2833: _t = _t.getNextSibling();
2834: } catch (RecognitionException ex) {
2835: reportError(ex);
2836: if (_t != null) {
2837: _t = _t.getNextSibling();
2838: }
2839: }
2840: _retTree = _t;
2841: }
2842:
2843: public final void handler(AST _t) throws RecognitionException {
2844:
2845: AST handler_AST_in = (AST) _t;
2846:
2847: try { // for error handling
2848: AST __t141 = _t;
2849: AST tmp36_AST_in = (AST) _t;
2850: match(_t, LITERAL_catch);
2851: _t = _t.getFirstChild();
2852: mController.stateBegin(mStateNameMap
2853: .get("Exception Handler"));
2854: parameterDef(_t);
2855: _t = _retTree;
2856: slist(_t, "");
2857: _t = _retTree;
2858: mController.stateEnd();
2859: _t = __t141;
2860: _t = _t.getNextSibling();
2861: } catch (RecognitionException ex) {
2862: reportError(ex);
2863: if (_t != null) {
2864: _t = _t.getNextSibling();
2865: }
2866: }
2867: _retTree = _t;
2868: }
2869:
2870: public final void expr(AST _t) throws RecognitionException {
2871:
2872: AST expr_AST_in = (AST) _t;
2873: AST q = null;
2874: AST qc = null;
2875: AST a = null;
2876: AST pa = null;
2877: AST sa = null;
2878: AST ma = null;
2879: AST da = null;
2880: AST modA = null;
2881: AST sra = null;
2882: AST bsra = null;
2883: AST sla = null;
2884: AST baa = null;
2885: AST bxa = null;
2886: AST boa = null;
2887: AST lor = null;
2888: AST land = null;
2889: AST bor = null;
2890: AST bxor = null;
2891: AST band = null;
2892: AST notEq = null;
2893: AST eq = null;
2894: AST lt = null;
2895: AST gt = null;
2896: AST le = null;
2897: AST ge = null;
2898: AST sl = null;
2899: AST sr = null;
2900: AST bsr = null;
2901: AST p = null;
2902: AST m = null;
2903: AST d = null;
2904: AST mod = null;
2905: AST mul = null;
2906: AST inc = null;
2907: AST dec = null;
2908: AST pinc = null;
2909: AST pdec = null;
2910: AST bnot = null;
2911: AST lnot = null;
2912: AST insOf = null;
2913: AST um = null;
2914: AST up = null;
2915:
2916: try { // for error handling
2917: {
2918: if (_t == null)
2919: _t = ASTNULL;
2920: switch (_t.getType()) {
2921: case QUESTION: {
2922: {
2923: mController.stateBegin(mStateNameMap
2924: .get("Conditional Expression"));
2925: AST __t151 = _t;
2926: q = _t == ASTNULL ? null : (AST) _t;
2927: match(_t, QUESTION);
2928: _t = _t.getFirstChild();
2929: mController.tokenFound(q, "Operator");
2930: expr(_t);
2931: _t = _retTree;
2932: expr(_t);
2933: _t = _retTree;
2934: qc = (AST) _t;
2935: match(_t, COLON);
2936: _t = _t.getNextSibling();
2937: mController.tokenFound(qc, "Operator");
2938: expr(_t);
2939: _t = _retTree;
2940: _t = __t151;
2941: _t = _t.getNextSibling();
2942: mController.stateEnd();
2943: }
2944: break;
2945: }
2946: case ASSIGN: {
2947: {
2948: AST __t153 = _t;
2949: a = _t == ASTNULL ? null : (AST) _t;
2950: match(_t, ASSIGN);
2951: _t = _t.getFirstChild();
2952:
2953: int type2 = 0;
2954: if (_t.getNextSibling() != null) {
2955: type2 = _t.getNextSibling().getType();
2956: }
2957:
2958: if (type2 == LITERAL_null) {
2959: mController.stateBegin(mStateNameMap
2960: .get("Object Destruction"));
2961: } else {
2962: mController.stateBegin(mStateNameMap
2963: .get("Assignment Expression"));
2964: mController.tokenFound(a, "Operator");
2965: }
2966:
2967: expr(_t);
2968: _t = _retTree;
2969: expr(_t);
2970: _t = _retTree;
2971: _t = __t153;
2972: _t = _t.getNextSibling();
2973: mController.stateEnd();
2974: }
2975: break;
2976: }
2977: case PLUS_ASSIGN: {
2978: {
2979: mController.stateBegin(mStateNameMap
2980: .get("Plus Assignment Expression"));
2981: AST __t155 = _t;
2982: pa = _t == ASTNULL ? null : (AST) _t;
2983: match(_t, PLUS_ASSIGN);
2984: _t = _t.getFirstChild();
2985: mController.tokenFound(pa, "Operator");
2986: expr(_t);
2987: _t = _retTree;
2988: expr(_t);
2989: _t = _retTree;
2990: _t = __t155;
2991: _t = _t.getNextSibling();
2992: mController.stateEnd();
2993: }
2994: break;
2995: }
2996: case MINUS_ASSIGN: {
2997: {
2998: mController.stateBegin(mStateNameMap
2999: .get("Minus Assignment Expression"));
3000: AST __t157 = _t;
3001: sa = _t == ASTNULL ? null : (AST) _t;
3002: match(_t, MINUS_ASSIGN);
3003: _t = _t.getFirstChild();
3004: mController.tokenFound(sa, "Operator");
3005: expr(_t);
3006: _t = _retTree;
3007: expr(_t);
3008: _t = _retTree;
3009: _t = __t157;
3010: _t = _t.getNextSibling();
3011: mController.stateEnd();
3012: }
3013: break;
3014: }
3015: case STAR_ASSIGN: {
3016: {
3017: mController.stateBegin(mStateNameMap
3018: .get("Multiply Assignment Expression"));
3019: AST __t159 = _t;
3020: ma = _t == ASTNULL ? null : (AST) _t;
3021: match(_t, STAR_ASSIGN);
3022: _t = _t.getFirstChild();
3023: mController.tokenFound(ma, "Operator");
3024: expr(_t);
3025: _t = _retTree;
3026: expr(_t);
3027: _t = _retTree;
3028: _t = __t159;
3029: _t = _t.getNextSibling();
3030: mController.stateEnd();
3031: }
3032: break;
3033: }
3034: case DIV_ASSIGN: {
3035: {
3036: mController.stateBegin(mStateNameMap
3037: .get("Divide Assignment Expression"));
3038: AST __t161 = _t;
3039: da = _t == ASTNULL ? null : (AST) _t;
3040: match(_t, DIV_ASSIGN);
3041: _t = _t.getFirstChild();
3042: mController.tokenFound(da, "Operator");
3043: expr(_t);
3044: _t = _retTree;
3045: expr(_t);
3046: _t = _retTree;
3047: _t = __t161;
3048: _t = _t.getNextSibling();
3049: mController.stateEnd();
3050: }
3051: break;
3052: }
3053: case MOD_ASSIGN: {
3054: {
3055: mController.stateBegin(mStateNameMap
3056: .get("Mod Assignment Expression"));
3057: AST __t163 = _t;
3058: modA = _t == ASTNULL ? null : (AST) _t;
3059: match(_t, MOD_ASSIGN);
3060: _t = _t.getFirstChild();
3061: mController.tokenFound(modA, "Operator");
3062: expr(_t);
3063: _t = _retTree;
3064: expr(_t);
3065: _t = _retTree;
3066: _t = __t163;
3067: _t = _t.getNextSibling();
3068: mController.stateEnd();
3069: }
3070: break;
3071: }
3072: case SR_ASSIGN: {
3073: {
3074: mController
3075: .stateBegin(mStateNameMap
3076: .get("Shift Right Assignment Expression"));
3077: AST __t165 = _t;
3078: sra = _t == ASTNULL ? null : (AST) _t;
3079: match(_t, SR_ASSIGN);
3080: _t = _t.getFirstChild();
3081: mController.tokenFound(sra, "Operator");
3082: expr(_t);
3083: _t = _retTree;
3084: expr(_t);
3085: _t = _retTree;
3086: _t = __t165;
3087: _t = _t.getNextSibling();
3088: mController.stateEnd();
3089: }
3090: break;
3091: }
3092: case BSR_ASSIGN: {
3093: {
3094: mController
3095: .stateBegin(mStateNameMap
3096: .get("Shift Right Assignment Expression"));
3097: AST __t167 = _t;
3098: bsra = _t == ASTNULL ? null : (AST) _t;
3099: match(_t, BSR_ASSIGN);
3100: _t = _t.getFirstChild();
3101: mController.tokenFound(bsra, "Operator");
3102: expr(_t);
3103: _t = _retTree;
3104: expr(_t);
3105: _t = _retTree;
3106: _t = __t167;
3107: _t = _t.getNextSibling();
3108: mController.stateEnd();
3109: }
3110: break;
3111: }
3112: case SL_ASSIGN: {
3113: {
3114: mController
3115: .stateBegin(mStateNameMap
3116: .get("Shift Left Assignment Expression"));
3117: AST __t169 = _t;
3118: sla = _t == ASTNULL ? null : (AST) _t;
3119: match(_t, SL_ASSIGN);
3120: _t = _t.getFirstChild();
3121: mController.tokenFound(sla, "Operator");
3122: expr(_t);
3123: _t = _retTree;
3124: expr(_t);
3125: _t = _retTree;
3126: _t = __t169;
3127: _t = _t.getNextSibling();
3128: mController.stateEnd();
3129: }
3130: break;
3131: }
3132: case BAND_ASSIGN: {
3133: {
3134: mController
3135: .stateBegin(mStateNameMap
3136: .get("Binary And Assignment Expression"));
3137: AST __t171 = _t;
3138: baa = _t == ASTNULL ? null : (AST) _t;
3139: match(_t, BAND_ASSIGN);
3140: _t = _t.getFirstChild();
3141: mController.tokenFound(baa, "Operator");
3142: expr(_t);
3143: _t = _retTree;
3144: expr(_t);
3145: _t = _retTree;
3146: _t = __t171;
3147: _t = _t.getNextSibling();
3148: mController.stateEnd();
3149: }
3150: break;
3151: }
3152: case BXOR_ASSIGN: {
3153: {
3154: mController
3155: .stateBegin(mStateNameMap
3156: .get("Binary XOR Assignment Expression"));
3157: AST __t173 = _t;
3158: bxa = _t == ASTNULL ? null : (AST) _t;
3159: match(_t, BXOR_ASSIGN);
3160: _t = _t.getFirstChild();
3161: mController.tokenFound(bxa, "Operator");
3162: expr(_t);
3163: _t = _retTree;
3164: expr(_t);
3165: _t = _retTree;
3166: _t = __t173;
3167: _t = _t.getNextSibling();
3168: mController.stateEnd();
3169: }
3170: break;
3171: }
3172: case BOR_ASSIGN: {
3173: {
3174: mController
3175: .stateBegin(mStateNameMap
3176: .get("Binary OR Assignment Expression"));
3177: AST __t175 = _t;
3178: boa = _t == ASTNULL ? null : (AST) _t;
3179: match(_t, BOR_ASSIGN);
3180: _t = _t.getFirstChild();
3181: mController.tokenFound(boa, "Operator");
3182: expr(_t);
3183: _t = _retTree;
3184: expr(_t);
3185: _t = _retTree;
3186: _t = __t175;
3187: _t = _t.getNextSibling();
3188: mController.stateEnd();
3189: }
3190: break;
3191: }
3192: case LOR: {
3193: {
3194: mController.stateBegin(mStateNameMap
3195: .get("LogicalOR Expression"));
3196: AST __t177 = _t;
3197: lor = _t == ASTNULL ? null : (AST) _t;
3198: match(_t, LOR);
3199: _t = _t.getFirstChild();
3200: mController.tokenFound(lor, "Operator");
3201: expr(_t);
3202: _t = _retTree;
3203: expr(_t);
3204: _t = _retTree;
3205: _t = __t177;
3206: _t = _t.getNextSibling();
3207: mController.stateEnd();
3208: }
3209: break;
3210: }
3211: case LAND: {
3212: {
3213: mController.stateBegin(mStateNameMap
3214: .get("LogicalAND Expression"));
3215: AST __t179 = _t;
3216: land = _t == ASTNULL ? null : (AST) _t;
3217: match(_t, LAND);
3218: _t = _t.getFirstChild();
3219: mController.tokenFound(land, "Operator");
3220: expr(_t);
3221: _t = _retTree;
3222: expr(_t);
3223: _t = _retTree;
3224: _t = __t179;
3225: _t = _t.getNextSibling();
3226: mController.stateEnd();
3227: }
3228: break;
3229: }
3230: case BOR: {
3231: {
3232: mController.stateBegin(mStateNameMap
3233: .get("BinaryOR Expression"));
3234: AST __t181 = _t;
3235: bor = _t == ASTNULL ? null : (AST) _t;
3236: match(_t, BOR);
3237: _t = _t.getFirstChild();
3238: mController.tokenFound(bor, "Operator");
3239: expr(_t);
3240: _t = _retTree;
3241: expr(_t);
3242: _t = _retTree;
3243: _t = __t181;
3244: _t = _t.getNextSibling();
3245: mController.stateEnd();
3246: }
3247: break;
3248: }
3249: case BXOR: {
3250: {
3251: mController.stateBegin(mStateNameMap
3252: .get("ExclusiveOR Expression"));
3253: AST __t183 = _t;
3254: bxor = _t == ASTNULL ? null : (AST) _t;
3255: match(_t, BXOR);
3256: _t = _t.getFirstChild();
3257: mController.tokenFound(bxor, "Operator");
3258: expr(_t);
3259: _t = _retTree;
3260: expr(_t);
3261: _t = _retTree;
3262: _t = __t183;
3263: _t = _t.getNextSibling();
3264: mController.stateEnd();
3265: }
3266: break;
3267: }
3268: case BAND: {
3269: {
3270: mController.stateBegin(mStateNameMap
3271: .get("BinaryAND Expression"));
3272: AST __t185 = _t;
3273: band = _t == ASTNULL ? null : (AST) _t;
3274: match(_t, BAND);
3275: _t = _t.getFirstChild();
3276: mController.tokenFound(band, "Operator");
3277: expr(_t);
3278: _t = _retTree;
3279: expr(_t);
3280: _t = _retTree;
3281: _t = __t185;
3282: _t = _t.getNextSibling();
3283: mController.stateEnd();
3284: }
3285: break;
3286: }
3287: case NOT_EQUAL: {
3288: {
3289: mController.stateBegin(mStateNameMap
3290: .get("Not Equality Expression"));
3291: AST __t187 = _t;
3292: notEq = _t == ASTNULL ? null : (AST) _t;
3293: match(_t, NOT_EQUAL);
3294: _t = _t.getFirstChild();
3295: mController.tokenFound(notEq, "Operator");
3296: expr(_t);
3297: _t = _retTree;
3298: expr(_t);
3299: _t = _retTree;
3300: _t = __t187;
3301: _t = _t.getNextSibling();
3302: mController.stateEnd();
3303: }
3304: break;
3305: }
3306: case EQUAL: {
3307: {
3308: mController.stateBegin(mStateNameMap
3309: .get("Equality Expression"));
3310: AST __t189 = _t;
3311: eq = _t == ASTNULL ? null : (AST) _t;
3312: match(_t, EQUAL);
3313: _t = _t.getFirstChild();
3314: mController.tokenFound(eq, "Operator");
3315: expr(_t);
3316: _t = _retTree;
3317: expr(_t);
3318: _t = _retTree;
3319: _t = __t189;
3320: _t = _t.getNextSibling();
3321: mController.stateEnd();
3322: }
3323: break;
3324: }
3325: case LT_: {
3326: {
3327: mController.stateBegin(mStateNameMap
3328: .get("LT Relational Expression"));
3329: AST __t191 = _t;
3330: lt = _t == ASTNULL ? null : (AST) _t;
3331: match(_t, LT_);
3332: _t = _t.getFirstChild();
3333: mController.tokenFound(lt, "Operator");
3334: expr(_t);
3335: _t = _retTree;
3336: expr(_t);
3337: _t = _retTree;
3338: _t = __t191;
3339: _t = _t.getNextSibling();
3340: mController.stateEnd();
3341: }
3342: break;
3343: }
3344: case GT: {
3345: {
3346: mController.stateBegin(mStateNameMap
3347: .get("GT Relational Expression"));
3348: AST __t193 = _t;
3349: gt = _t == ASTNULL ? null : (AST) _t;
3350: match(_t, GT);
3351: _t = _t.getFirstChild();
3352: mController.tokenFound(gt, "Operator");
3353: expr(_t);
3354: _t = _retTree;
3355: expr(_t);
3356: _t = _retTree;
3357: _t = __t193;
3358: _t = _t.getNextSibling();
3359: mController.stateEnd();
3360: }
3361: break;
3362: }
3363: case LE: {
3364: {
3365: mController.stateBegin(mStateNameMap
3366: .get("LE Relational Expression"));
3367: AST __t195 = _t;
3368: le = _t == ASTNULL ? null : (AST) _t;
3369: match(_t, LE);
3370: _t = _t.getFirstChild();
3371: mController.tokenFound(le, "Operator");
3372: expr(_t);
3373: _t = _retTree;
3374: expr(_t);
3375: _t = _retTree;
3376: _t = __t195;
3377: _t = _t.getNextSibling();
3378: mController.stateEnd();
3379: }
3380: break;
3381: }
3382: case GE: {
3383: {
3384: mController.stateBegin(mStateNameMap
3385: .get("GE Relational Expression"));
3386: AST __t197 = _t;
3387: ge = _t == ASTNULL ? null : (AST) _t;
3388: match(_t, GE);
3389: _t = _t.getFirstChild();
3390: mController.tokenFound(ge, "Operator");
3391: expr(_t);
3392: _t = _retTree;
3393: expr(_t);
3394: _t = _retTree;
3395: _t = __t197;
3396: _t = _t.getNextSibling();
3397: mController.stateEnd();
3398: }
3399: break;
3400: }
3401: case SL: {
3402: {
3403: mController.stateBegin(mStateNameMap
3404: .get("Shift Left Expression"));
3405: AST __t199 = _t;
3406: sl = _t == ASTNULL ? null : (AST) _t;
3407: match(_t, SL);
3408: _t = _t.getFirstChild();
3409: mController.tokenFound(sl, "Operator");
3410: expr(_t);
3411: _t = _retTree;
3412: expr(_t);
3413: _t = _retTree;
3414: _t = __t199;
3415: _t = _t.getNextSibling();
3416: mController.stateEnd();
3417: }
3418: break;
3419: }
3420: case SR: {
3421: {
3422: mController.stateBegin(mStateNameMap
3423: .get("Right Shift Expression"));
3424: AST __t201 = _t;
3425: sr = _t == ASTNULL ? null : (AST) _t;
3426: match(_t, SR);
3427: _t = _t.getFirstChild();
3428: mController.tokenFound(sr, "Operator");
3429: expr(_t);
3430: _t = _retTree;
3431: expr(_t);
3432: _t = _retTree;
3433: _t = __t201;
3434: _t = _t.getNextSibling();
3435: mController.stateEnd();
3436: }
3437: break;
3438: }
3439: case BSR: {
3440: {
3441: mController.stateBegin(mStateNameMap
3442: .get("Binary Shift Right Expression"));
3443: AST __t203 = _t;
3444: bsr = _t == ASTNULL ? null : (AST) _t;
3445: match(_t, BSR);
3446: _t = _t.getFirstChild();
3447: mController.tokenFound(bsr, "Operator");
3448: expr(_t);
3449: _t = _retTree;
3450: expr(_t);
3451: _t = _retTree;
3452: _t = __t203;
3453: _t = _t.getNextSibling();
3454: mController.stateEnd();
3455: }
3456: break;
3457: }
3458: case PLUS: {
3459: {
3460: mController.stateBegin(mStateNameMap
3461: .get("Plus Expression"));
3462: AST __t205 = _t;
3463: p = _t == ASTNULL ? null : (AST) _t;
3464: match(_t, PLUS);
3465: _t = _t.getFirstChild();
3466: mController.tokenFound(p, "Operator");
3467: expr(_t);
3468: _t = _retTree;
3469: expr(_t);
3470: _t = _retTree;
3471: _t = __t205;
3472: _t = _t.getNextSibling();
3473: mController.stateEnd();
3474: }
3475: break;
3476: }
3477: case MINUS: {
3478: {
3479: mController.stateBegin(mStateNameMap
3480: .get("Minus Expression"));
3481: AST __t207 = _t;
3482: m = _t == ASTNULL ? null : (AST) _t;
3483: match(_t, MINUS);
3484: _t = _t.getFirstChild();
3485: mController.tokenFound(m, "Operator");
3486: expr(_t);
3487: _t = _retTree;
3488: expr(_t);
3489: _t = _retTree;
3490: _t = __t207;
3491: _t = _t.getNextSibling();
3492: mController.stateEnd();
3493: }
3494: break;
3495: }
3496: case DIV: {
3497: {
3498: mController.stateBegin(mStateNameMap
3499: .get("Divide Expression"));
3500: AST __t209 = _t;
3501: d = _t == ASTNULL ? null : (AST) _t;
3502: match(_t, DIV);
3503: _t = _t.getFirstChild();
3504: mController.tokenFound(d, "Operator");
3505: expr(_t);
3506: _t = _retTree;
3507: expr(_t);
3508: _t = _retTree;
3509: _t = __t209;
3510: _t = _t.getNextSibling();
3511: mController.stateEnd();
3512: }
3513: break;
3514: }
3515: case MOD: {
3516: {
3517: mController.stateBegin(mStateNameMap
3518: .get("Mod Expression"));
3519: AST __t211 = _t;
3520: mod = _t == ASTNULL ? null : (AST) _t;
3521: match(_t, MOD);
3522: _t = _t.getFirstChild();
3523: mController.tokenFound(mod, "Operator");
3524: expr(_t);
3525: _t = _retTree;
3526: expr(_t);
3527: _t = _retTree;
3528: _t = __t211;
3529: _t = _t.getNextSibling();
3530: mController.stateEnd();
3531: }
3532: break;
3533: }
3534: case STAR: {
3535: {
3536: mController.stateBegin(mStateNameMap
3537: .get("Multiply Expression"));
3538: AST __t213 = _t;
3539: mul = _t == ASTNULL ? null : (AST) _t;
3540: match(_t, STAR);
3541: _t = _t.getFirstChild();
3542: mController.tokenFound(mul, "Operator");
3543: expr(_t);
3544: _t = _retTree;
3545: expr(_t);
3546: _t = _retTree;
3547: _t = __t213;
3548: _t = _t.getNextSibling();
3549: mController.stateEnd();
3550: }
3551: break;
3552: }
3553: case INC: {
3554: {
3555: mController.stateBegin(mStateNameMap
3556: .get("Increment Unary Expression"));
3557: AST __t215 = _t;
3558: inc = _t == ASTNULL ? null : (AST) _t;
3559: match(_t, INC);
3560: _t = _t.getFirstChild();
3561: mController.tokenFound(inc, "Operator");
3562: expr(_t);
3563: _t = _retTree;
3564: _t = __t215;
3565: _t = _t.getNextSibling();
3566: mController.stateEnd();
3567: }
3568: break;
3569: }
3570: case DEC: {
3571: {
3572: mController.stateBegin(mStateNameMap
3573: .get("Decrement Unary Expression"));
3574: AST __t217 = _t;
3575: dec = _t == ASTNULL ? null : (AST) _t;
3576: match(_t, DEC);
3577: _t = _t.getFirstChild();
3578: mController.tokenFound(dec, "Operator");
3579: expr(_t);
3580: _t = _retTree;
3581: _t = __t217;
3582: _t = _t.getNextSibling();
3583: mController.stateEnd();
3584: }
3585: break;
3586: }
3587: case POST_INC: {
3588: {
3589: mController
3590: .stateBegin(mStateNameMap
3591: .get("Increment Post Unary Expression"));
3592: AST __t219 = _t;
3593: pinc = _t == ASTNULL ? null : (AST) _t;
3594: match(_t, POST_INC);
3595: _t = _t.getFirstChild();
3596: mController.tokenFound(pinc, "Operator");
3597: expr(_t);
3598: _t = _retTree;
3599: _t = __t219;
3600: _t = _t.getNextSibling();
3601: mController.stateEnd();
3602: }
3603: break;
3604: }
3605: case POST_DEC: {
3606: {
3607: mController
3608: .stateBegin(mStateNameMap
3609: .get("Decrement Post Unary Expression"));
3610: AST __t221 = _t;
3611: pdec = _t == ASTNULL ? null : (AST) _t;
3612: match(_t, POST_DEC);
3613: _t = _t.getFirstChild();
3614: mController.tokenFound(pdec, "Operator");
3615: expr(_t);
3616: _t = _retTree;
3617: _t = __t221;
3618: _t = _t.getNextSibling();
3619: mController.stateEnd();
3620: }
3621: break;
3622: }
3623: case BNOT: {
3624: {
3625: mController.stateBegin(mStateNameMap
3626: .get("Binary Not Unary Expression"));
3627: AST __t223 = _t;
3628: bnot = _t == ASTNULL ? null : (AST) _t;
3629: match(_t, BNOT);
3630: _t = _t.getFirstChild();
3631: mController.tokenFound(bnot, "Operator");
3632: expr(_t);
3633: _t = _retTree;
3634: _t = __t223;
3635: _t = _t.getNextSibling();
3636: mController.stateEnd();
3637: }
3638: break;
3639: }
3640: case LNOT: {
3641: {
3642: mController.stateBegin(mStateNameMap
3643: .get("Logical Not Unary Expression"));
3644: AST __t225 = _t;
3645: lnot = _t == ASTNULL ? null : (AST) _t;
3646: match(_t, LNOT);
3647: _t = _t.getFirstChild();
3648: mController.tokenFound(lnot, "Operator");
3649: expr(_t);
3650: _t = _retTree;
3651: _t = __t225;
3652: _t = _t.getNextSibling();
3653: mController.stateEnd();
3654: }
3655: break;
3656: }
3657: case LITERAL_instanceof : {
3658: {
3659: mController.stateBegin(mStateNameMap
3660: .get("Type Check Expression"));
3661: AST __t227 = _t;
3662: insOf = _t == ASTNULL ? null : (AST) _t;
3663: match(_t, LITERAL_instanceof );
3664: _t = _t.getFirstChild();
3665: mController.tokenFound(insOf, "Operator");
3666: expr(_t);
3667: _t = _retTree;
3668: expr(_t);
3669: _t = _retTree;
3670: _t = __t227;
3671: _t = _t.getNextSibling();
3672: mController.stateEnd();
3673: }
3674: break;
3675: }
3676: case UNARY_MINUS: {
3677: {
3678: mController.stateBegin(mStateNameMap
3679: .get("Minus Unary Expression"));
3680: AST __t229 = _t;
3681: um = _t == ASTNULL ? null : (AST) _t;
3682: match(_t, UNARY_MINUS);
3683: _t = _t.getFirstChild();
3684: mController.tokenFound(um, "Operator");
3685: expr(_t);
3686: _t = _retTree;
3687: _t = __t229;
3688: _t = _t.getNextSibling();
3689: mController.stateEnd();
3690: }
3691: break;
3692: }
3693: case UNARY_PLUS: {
3694: {
3695: mController.stateBegin(mStateNameMap
3696: .get("Plus Unary Expression"));
3697: AST __t231 = _t;
3698: up = _t == ASTNULL ? null : (AST) _t;
3699: match(_t, UNARY_PLUS);
3700: _t = _t.getFirstChild();
3701: mController.tokenFound(up, "Operator");
3702: expr(_t);
3703: _t = _retTree;
3704: _t = __t231;
3705: _t = _t.getNextSibling();
3706: mController.stateEnd();
3707: }
3708: break;
3709: }
3710: case TYPE:
3711: case TYPECAST:
3712: case INDEX_OP:
3713: case METHOD_CALL:
3714: case IDENT:
3715: case DOT:
3716: case LPAREN:
3717: case LITERAL_this :
3718: case LITERAL_super :
3719: case LITERAL_true:
3720: case LITERAL_false:
3721: case LITERAL_null:
3722: case LITERAL_new:
3723: case NUM_INT:
3724: case CHAR_LITERAL:
3725: case STRING_LITERAL:
3726: case NUM_FLOAT:
3727: case NUM_LONG:
3728: case NUM_DOUBLE: {
3729: primaryExpression(_t);
3730: _t = _retTree;
3731: break;
3732: }
3733: default: {
3734: throw new NoViableAltException(_t);
3735: }
3736: }
3737: }
3738: } catch (RecognitionException ex) {
3739: reportError(ex);
3740: if (_t != null) {
3741: _t = _t.getNextSibling();
3742: }
3743: }
3744: _retTree = _t;
3745: }
3746:
3747: public final void primaryExpression(AST _t)
3748: throws RecognitionException {
3749:
3750: AST primaryExpression_AST_in = (AST) _t;
3751: AST id = null;
3752: AST d = null;
3753: AST id2 = null;
3754: AST th1 = null;
3755: AST c = null;
3756: AST nOp = null;
3757: AST nIdent = null;
3758: AST s1 = null;
3759: AST lb = null;
3760: AST rb = null;
3761: AST lp = null;
3762: AST rp = null;
3763: AST tlp = null;
3764: AST trp = null;
3765: AST s = null;
3766: AST t = null;
3767: AST f = null;
3768: AST th = null;
3769: AST n = null;
3770: AST lp2 = null;
3771: AST rp2 = null;
3772:
3773: try { // for error handling
3774: if (_t == null)
3775: _t = ASTNULL;
3776: switch (_t.getType()) {
3777: case IDENT: {
3778: id = (AST) _t;
3779: match(_t, IDENT);
3780: _t = _t.getNextSibling();
3781:
3782: mController.stateBegin(mStateNameMap.get("Identifier"));
3783: mController.tokenFound(id, "Identifier");
3784: mController.stateEnd();
3785:
3786: break;
3787: }
3788: case DOT: {
3789: AST __t233 = _t;
3790: d = _t == ASTNULL ? null : (AST) _t;
3791: match(_t, DOT);
3792: _t = _t.getFirstChild();
3793:
3794: mController.stateBegin(mStateNameMap.get("Identifier"));
3795: mController.tokenFound(d, "Scope Operator");
3796:
3797: {
3798: if (_t == null)
3799: _t = ASTNULL;
3800: switch (_t.getType()) {
3801: case TYPE:
3802: case TYPECAST:
3803: case INDEX_OP:
3804: case POST_INC:
3805: case POST_DEC:
3806: case METHOD_CALL:
3807: case UNARY_MINUS:
3808: case UNARY_PLUS:
3809: case IDENT:
3810: case DOT:
3811: case STAR:
3812: case LPAREN:
3813: case LITERAL_this :
3814: case LITERAL_super :
3815: case ASSIGN:
3816: case PLUS_ASSIGN:
3817: case MINUS_ASSIGN:
3818: case STAR_ASSIGN:
3819: case DIV_ASSIGN:
3820: case MOD_ASSIGN:
3821: case SR_ASSIGN:
3822: case BSR_ASSIGN:
3823: case SL_ASSIGN:
3824: case BAND_ASSIGN:
3825: case BXOR_ASSIGN:
3826: case BOR_ASSIGN:
3827: case QUESTION:
3828: case LOR:
3829: case LAND:
3830: case BOR:
3831: case BXOR:
3832: case BAND:
3833: case NOT_EQUAL:
3834: case EQUAL:
3835: case LT_:
3836: case GT:
3837: case LE:
3838: case GE:
3839: case LITERAL_instanceof :
3840: case SL:
3841: case SR:
3842: case BSR:
3843: case PLUS:
3844: case MINUS:
3845: case DIV:
3846: case MOD:
3847: case INC:
3848: case DEC:
3849: case BNOT:
3850: case LNOT:
3851: case LITERAL_true:
3852: case LITERAL_false:
3853: case LITERAL_null:
3854: case LITERAL_new:
3855: case NUM_INT:
3856: case CHAR_LITERAL:
3857: case STRING_LITERAL:
3858: case NUM_FLOAT:
3859: case NUM_LONG:
3860: case NUM_DOUBLE: {
3861: expr(_t);
3862: _t = _retTree;
3863: {
3864: if (_t == null)
3865: _t = ASTNULL;
3866: switch (_t.getType()) {
3867: case IDENT: {
3868: id2 = (AST) _t;
3869: match(_t, IDENT);
3870: _t = _t.getNextSibling();
3871: mController.tokenFound(id2,
3872: "Identifier");
3873: break;
3874: }
3875: case INDEX_OP: {
3876: arrayIndex(_t);
3877: _t = _retTree;
3878: break;
3879: }
3880: case LITERAL_this : {
3881: th1 = (AST) _t;
3882: match(_t, LITERAL_this );
3883: _t = _t.getNextSibling();
3884: mController.tokenFound(th1,
3885: "This Reference");
3886: break;
3887: }
3888: case LITERAL_class: {
3889: c = (AST) _t;
3890: match(_t, LITERAL_class);
3891: _t = _t.getNextSibling();
3892: mController.tokenFound(c, "Class");
3893: break;
3894: }
3895: case LITERAL_new: {
3896: AST __t236 = _t;
3897: nOp = _t == ASTNULL ? null : (AST) _t;
3898: match(_t, LITERAL_new);
3899: _t = _t.getFirstChild();
3900:
3901: mController.stateBegin(mStateNameMap
3902: .get("Object Creation"));
3903: mController.tokenFound(nOp, "Operator");
3904:
3905: nIdent = (AST) _t;
3906: match(_t, IDENT);
3907: _t = _t.getNextSibling();
3908:
3909: mController.stateBegin(mStateNameMap
3910: .get("Identifier"));
3911: mController.tokenFound(nIdent,
3912: "Identifier");
3913: mController.stateEnd();
3914:
3915: AST tmp37_AST_in = (AST) _t;
3916: match(_t, LPAREN);
3917: _t = _t.getNextSibling();
3918: elist(_t);
3919: _t = _retTree;
3920: AST tmp38_AST_in = (AST) _t;
3921: match(_t, RPAREN);
3922: _t = _t.getNextSibling();
3923:
3924: mController.stateEnd();
3925:
3926: _t = __t236;
3927: _t = _t.getNextSibling();
3928: break;
3929: }
3930: case LITERAL_super : {
3931: s1 = (AST) _t;
3932: match(_t, LITERAL_super );
3933: _t = _t.getNextSibling();
3934: mController.tokenFound(s1,
3935: "Super Class Reference");
3936: break;
3937: }
3938: default: {
3939: throw new NoViableAltException(_t);
3940: }
3941: }
3942: }
3943: break;
3944: }
3945: case ARRAY_DECLARATOR: {
3946: AST __t237 = _t;
3947: lb = _t == ASTNULL ? null : (AST) _t;
3948: match(_t, ARRAY_DECLARATOR);
3949: _t = _t.getFirstChild();
3950: mController.tokenFound(lb, "Array Start");
3951: typeSpecArray(_t);
3952: _t = _retTree;
3953: rb = (AST) _t;
3954: match(_t, RBRACK);
3955: _t = _t.getNextSibling();
3956: mController.tokenFound(rb, "Array End");
3957: _t = __t237;
3958: _t = _t.getNextSibling();
3959: break;
3960: }
3961: case LITERAL_void:
3962: case LITERAL_boolean:
3963: case LITERAL_byte:
3964: case LITERAL_char:
3965: case LITERAL_short:
3966: case LITERAL_int:
3967: case LITERAL_float:
3968: case LITERAL_long:
3969: case LITERAL_double: {
3970: builtInType(_t);
3971: _t = _retTree;
3972: {
3973: if (_t == null)
3974: _t = ASTNULL;
3975: switch (_t.getType()) {
3976: case LITERAL_class: {
3977: AST tmp39_AST_in = (AST) _t;
3978: match(_t, LITERAL_class);
3979: _t = _t.getNextSibling();
3980: break;
3981: }
3982: case 3: {
3983: break;
3984: }
3985: default: {
3986: throw new NoViableAltException(_t);
3987: }
3988: }
3989: }
3990: break;
3991: }
3992: default: {
3993: throw new NoViableAltException(_t);
3994: }
3995: }
3996: }
3997: mController.stateEnd();
3998: _t = __t233;
3999: _t = _t.getNextSibling();
4000: break;
4001: }
4002: case INDEX_OP: {
4003: arrayIndex(_t);
4004: _t = _retTree;
4005: break;
4006: }
4007: case METHOD_CALL: {
4008: {
4009: mController.stateBegin(mStateNameMap
4010: .get("Method Call"));
4011: AST __t240 = _t;
4012: lp = _t == ASTNULL ? null : (AST) _t;
4013: match(_t, METHOD_CALL);
4014: _t = _t.getFirstChild();
4015: primaryExpression(_t);
4016: _t = _retTree;
4017: mController.tokenFound(lp, "Argument Start");
4018: elist(_t);
4019: _t = _retTree;
4020: rp = (AST) _t;
4021: match(_t, RPAREN);
4022: _t = _t.getNextSibling();
4023: mController.tokenFound(rp, "Argument End");
4024: _t = __t240;
4025: _t = _t.getNextSibling();
4026: mController.stateEnd();
4027: }
4028: break;
4029: }
4030: case TYPECAST: {
4031: {
4032: mController.stateBegin(mStateNameMap
4033: .get("Type Cast"));
4034: AST __t242 = _t;
4035: tlp = _t == ASTNULL ? null : (AST) _t;
4036: match(_t, TYPECAST);
4037: _t = _t.getFirstChild();
4038: mController.tokenFound(tlp, "Argument Start");
4039: {
4040: if (_t == null)
4041: _t = ASTNULL;
4042: switch (_t.getType()) {
4043: case LPAREN: {
4044: AST tmp40_AST_in = (AST) _t;
4045: match(_t, LPAREN);
4046: _t = _t.getNextSibling();
4047: break;
4048: }
4049: case TYPE: {
4050: break;
4051: }
4052: default: {
4053: throw new NoViableAltException(_t);
4054: }
4055: }
4056: }
4057: typeSpec(_t);
4058: _t = _retTree;
4059: trp = (AST) _t;
4060: match(_t, RPAREN);
4061: _t = _t.getNextSibling();
4062: mController.tokenFound(trp, "Argument End");
4063: expr(_t);
4064: _t = _retTree;
4065: {
4066: if (_t == null)
4067: _t = ASTNULL;
4068: switch (_t.getType()) {
4069: case RPAREN: {
4070: AST tmp41_AST_in = (AST) _t;
4071: match(_t, RPAREN);
4072: _t = _t.getNextSibling();
4073: break;
4074: }
4075: case 3: {
4076: break;
4077: }
4078: default: {
4079: throw new NoViableAltException(_t);
4080: }
4081: }
4082: }
4083: _t = __t242;
4084: _t = _t.getNextSibling();
4085: mController.stateEnd();
4086: }
4087: break;
4088: }
4089: case LITERAL_new: {
4090: newExpression(_t);
4091: _t = _retTree;
4092: break;
4093: }
4094: case NUM_INT:
4095: case CHAR_LITERAL:
4096: case STRING_LITERAL:
4097: case NUM_FLOAT:
4098: case NUM_LONG:
4099: case NUM_DOUBLE: {
4100: constant(_t);
4101: _t = _retTree;
4102: break;
4103: }
4104: case LITERAL_super : {
4105: s = (AST) _t;
4106: match(_t, LITERAL_super );
4107: _t = _t.getNextSibling();
4108: mController.tokenFound(s, "Super Class Reference");
4109: break;
4110: }
4111: case LITERAL_true: {
4112: t = (AST) _t;
4113: match(_t, LITERAL_true);
4114: _t = _t.getNextSibling();
4115: mController.tokenFound(t, "Boolean");
4116: break;
4117: }
4118: case LITERAL_false: {
4119: f = (AST) _t;
4120: match(_t, LITERAL_false);
4121: _t = _t.getNextSibling();
4122: mController.tokenFound(f, "Boolean");
4123: break;
4124: }
4125: case LITERAL_this : {
4126: th = (AST) _t;
4127: match(_t, LITERAL_this );
4128: _t = _t.getNextSibling();
4129: mController.tokenFound(th, "This Reference");
4130: break;
4131: }
4132: case LITERAL_null: {
4133: n = (AST) _t;
4134: match(_t, LITERAL_null);
4135: _t = _t.getNextSibling();
4136: mController.tokenFound(n, "NULL");
4137: break;
4138: }
4139: case TYPE: {
4140: typeSpec(_t);
4141: _t = _retTree;
4142: break;
4143: }
4144: case LPAREN: {
4145: AST __t245 = _t;
4146: lp2 = _t == ASTNULL ? null : (AST) _t;
4147: match(_t, LPAREN);
4148: _t = _t.getFirstChild();
4149: mController.tokenFound(lp2, "Precedence Start");
4150: expr(_t);
4151: _t = _retTree;
4152: rp2 = (AST) _t;
4153: match(_t, RPAREN);
4154: _t = _t.getNextSibling();
4155: mController.tokenFound(rp2, "Precedence End");
4156: _t = __t245;
4157: _t = _t.getNextSibling();
4158: break;
4159: }
4160: default: {
4161: throw new NoViableAltException(_t);
4162: }
4163: }
4164: } catch (RecognitionException ex) {
4165: reportError(ex);
4166: if (_t != null) {
4167: _t = _t.getNextSibling();
4168: }
4169: }
4170: _retTree = _t;
4171: }
4172:
4173: public final void arrayIndex(AST _t) throws RecognitionException {
4174:
4175: AST arrayIndex_AST_in = (AST) _t;
4176: AST lb = null;
4177: AST rb = null;
4178: mController.stateBegin(mStateNameMap.get("Array Index"));
4179:
4180: try { // for error handling
4181: AST __t251 = _t;
4182: lb = _t == ASTNULL ? null : (AST) _t;
4183: match(_t, INDEX_OP);
4184: _t = _t.getFirstChild();
4185: primaryExpression(_t);
4186: _t = _retTree;
4187: mController.tokenFound(lb, "Array Start");
4188: expression(_t);
4189: _t = _retTree;
4190: rb = (AST) _t;
4191: match(_t, RBRACK);
4192: _t = _t.getNextSibling();
4193: mController.tokenFound(rb, "Array End");
4194: _t = __t251;
4195: _t = _t.getNextSibling();
4196: mController.stateEnd();
4197: } catch (RecognitionException ex) {
4198: reportError(ex);
4199: if (_t != null) {
4200: _t = _t.getNextSibling();
4201: }
4202: }
4203: _retTree = _t;
4204: }
4205:
4206: public final void newExpression(AST _t) throws RecognitionException {
4207:
4208: AST newExpression_AST_in = (AST) _t;
4209: AST n = null;
4210: AST lp = null;
4211: AST rp = null;
4212: mController.stateBegin(mStateNameMap.get("Object Creation"));
4213:
4214: try { // for error handling
4215: AST __t254 = _t;
4216: n = _t == ASTNULL ? null : (AST) _t;
4217: match(_t, LITERAL_new);
4218: _t = _t.getFirstChild();
4219: mController.tokenFound(n, "Operator");
4220: {
4221: if (_t == null)
4222: _t = ASTNULL;
4223: switch (_t.getType()) {
4224: case LPAREN: {
4225: AST tmp42_AST_in = (AST) _t;
4226: match(_t, LPAREN);
4227: _t = _t.getNextSibling();
4228: break;
4229: }
4230: case LITERAL_void:
4231: case LITERAL_boolean:
4232: case LITERAL_byte:
4233: case LITERAL_char:
4234: case LITERAL_short:
4235: case LITERAL_int:
4236: case LITERAL_float:
4237: case LITERAL_long:
4238: case LITERAL_double:
4239: case IDENT:
4240: case DOT: {
4241: break;
4242: }
4243: default: {
4244: throw new NoViableAltException(_t);
4245: }
4246: }
4247: }
4248: type(_t);
4249: _t = _retTree;
4250: {
4251: if (_t == null)
4252: _t = ASTNULL;
4253: switch (_t.getType()) {
4254: case ARRAY_DECLARATOR: {
4255: newArrayDeclarator(_t);
4256: _t = _retTree;
4257: {
4258: if (_t == null)
4259: _t = ASTNULL;
4260: switch (_t.getType()) {
4261: case ARRAY_INIT: {
4262: arrayInitializer(_t);
4263: _t = _retTree;
4264: break;
4265: }
4266: case 3:
4267: case RPAREN: {
4268: break;
4269: }
4270: default: {
4271: throw new NoViableAltException(_t);
4272: }
4273: }
4274: }
4275: break;
4276: }
4277: case LPAREN: {
4278: lp = (AST) _t;
4279: match(_t, LPAREN);
4280: _t = _t.getNextSibling();
4281: mController.tokenFound(lp, "Argument Start");
4282: elist(_t);
4283: _t = _retTree;
4284: rp = (AST) _t;
4285: match(_t, RPAREN);
4286: _t = _t.getNextSibling();
4287: mController.tokenFound(rp, "Argument End");
4288: {
4289: if (_t == null)
4290: _t = ASTNULL;
4291: switch (_t.getType()) {
4292: case OBJBLOCK: {
4293: objBlock(_t);
4294: _t = _retTree;
4295: break;
4296: }
4297: case 3:
4298: case RPAREN: {
4299: break;
4300: }
4301: default: {
4302: throw new NoViableAltException(_t);
4303: }
4304: }
4305: }
4306: break;
4307: }
4308: default: {
4309: throw new NoViableAltException(_t);
4310: }
4311: }
4312: }
4313: {
4314: if (_t == null)
4315: _t = ASTNULL;
4316: switch (_t.getType()) {
4317: case RPAREN: {
4318: AST tmp43_AST_in = (AST) _t;
4319: match(_t, RPAREN);
4320: _t = _t.getNextSibling();
4321: break;
4322: }
4323: case 3: {
4324: break;
4325: }
4326: default: {
4327: throw new NoViableAltException(_t);
4328: }
4329: }
4330: }
4331: _t = __t254;
4332: _t = _t.getNextSibling();
4333: mController.stateEnd();
4334: } catch (RecognitionException ex) {
4335: reportError(ex);
4336: if (_t != null) {
4337: _t = _t.getNextSibling();
4338: }
4339: }
4340: _retTree = _t;
4341: }
4342:
4343: public final void constant(AST _t) throws RecognitionException {
4344:
4345: AST constant_AST_in = (AST) _t;
4346: AST i = null;
4347: AST c = null;
4348: AST s = null;
4349: AST f = null;
4350: AST d = null;
4351: AST l = null;
4352:
4353: try { // for error handling
4354: if (_t == null)
4355: _t = ASTNULL;
4356: switch (_t.getType()) {
4357: case NUM_INT: {
4358: i = (AST) _t;
4359: match(_t, NUM_INT);
4360: _t = _t.getNextSibling();
4361: mController.tokenFound(i, "Integer Constant");
4362: break;
4363: }
4364: case CHAR_LITERAL: {
4365: c = (AST) _t;
4366: match(_t, CHAR_LITERAL);
4367: _t = _t.getNextSibling();
4368: mController.tokenFound(c, "Character Constant");
4369: break;
4370: }
4371: case STRING_LITERAL: {
4372: s = (AST) _t;
4373: match(_t, STRING_LITERAL);
4374: _t = _t.getNextSibling();
4375: mController.tokenFound(s, "String Constant");
4376: break;
4377: }
4378: case NUM_FLOAT: {
4379: f = (AST) _t;
4380: match(_t, NUM_FLOAT);
4381: _t = _t.getNextSibling();
4382: mController.tokenFound(f, "Float Constant");
4383: break;
4384: }
4385: case NUM_DOUBLE: {
4386: d = (AST) _t;
4387: match(_t, NUM_DOUBLE);
4388: _t = _t.getNextSibling();
4389: mController.tokenFound(d, "Double Constant");
4390: break;
4391: }
4392: case NUM_LONG: {
4393: l = (AST) _t;
4394: match(_t, NUM_LONG);
4395: _t = _t.getNextSibling();
4396: mController.tokenFound(l, "Long Constant");
4397: break;
4398: }
4399: default: {
4400: throw new NoViableAltException(_t);
4401: }
4402: }
4403: } catch (RecognitionException ex) {
4404: reportError(ex);
4405: if (_t != null) {
4406: _t = _t.getNextSibling();
4407: }
4408: }
4409: _retTree = _t;
4410: }
4411:
4412: public final void newArrayDeclarator(AST _t)
4413: throws RecognitionException {
4414:
4415: AST newArrayDeclarator_AST_in = (AST) _t;
4416: AST lb = null;
4417: AST rb = null;
4418: mController.stateBegin(mStateNameMap.get("Array Declarator"));
4419:
4420: try { // for error handling
4421: AST __t261 = _t;
4422: lb = _t == ASTNULL ? null : (AST) _t;
4423: match(_t, ARRAY_DECLARATOR);
4424: _t = _t.getFirstChild();
4425: mController.tokenFound(lb, "Array Start");
4426: {
4427: if (_t == null)
4428: _t = ASTNULL;
4429: switch (_t.getType()) {
4430: case ARRAY_DECLARATOR: {
4431: newArrayDeclarator(_t);
4432: _t = _retTree;
4433: break;
4434: }
4435: case EXPR:
4436: case RBRACK: {
4437: break;
4438: }
4439: default: {
4440: throw new NoViableAltException(_t);
4441: }
4442: }
4443: }
4444: {
4445: if (_t == null)
4446: _t = ASTNULL;
4447: switch (_t.getType()) {
4448: case EXPR: {
4449: expression(_t);
4450: _t = _retTree;
4451: break;
4452: }
4453: case RBRACK: {
4454: break;
4455: }
4456: default: {
4457: throw new NoViableAltException(_t);
4458: }
4459: }
4460: }
4461: rb = (AST) _t;
4462: match(_t, RBRACK);
4463: _t = _t.getNextSibling();
4464: mController.tokenFound(rb, "Array End");
4465: _t = __t261;
4466: _t = _t.getNextSibling();
4467: mController.stateEnd();
4468: } catch (RecognitionException ex) {
4469: reportError(ex);
4470: if (_t != null) {
4471: _t = _t.getNextSibling();
4472: }
4473: }
4474: _retTree = _t;
4475: }
4476:
4477: public static final String[] _tokenNames = { "<0>", "EOF", "<2>",
4478: "NULL_TREE_LOOKAHEAD", "BLOCK", "MODIFIERS", "OBJBLOCK",
4479: "SLIST", "END_SLIST", "CTOR_DEF", "METHOD_DEF",
4480: "DESTRUCTOR_DEF", "VARIABLE_DEF", "INSTANCE_INIT",
4481: "STATIC_INIT", "TYPE", "CLASS_DEF", "INTERFACE_DEF",
4482: "PACKAGE_DEF", "ARRAY_DECLARATOR", "EXTENDS_CLAUSE",
4483: "IMPLEMENTS_CLAUSE", "PARAMETERS", "PARAMETER_DEF",
4484: "LABELED_STAT", "TYPECAST", "INDEX_OP", "POST_INC",
4485: "POST_DEC", "METHOD_CALL", "EXPR", "ARRAY_INIT", "IMPORT",
4486: "UNARY_MINUS", "UNARY_PLUS", "CASE_GROUP", "ELIST",
4487: "FOR_INIT", "FOR_CONDITION", "FOR_ITERATOR", "EMPTY_STAT",
4488: "\"final\"", "\"abstract\"", "\"strictfp\"",
4489: "SUPER_CTOR_CALL", "CTOR_CALL", "START_CLASS_BODY",
4490: "END_CLASS_BODY", "\"package\"", "SEMI", "\"import\"",
4491: "LBRACK", "RBRACK", "\"void\"", "\"boolean\"", "\"byte\"",
4492: "\"char\"", "\"short\"", "\"int\"", "\"float\"",
4493: "\"long\"", "\"double\"", "IDENT", "DOT", "STAR",
4494: "\"private\"", "\"public\"", "\"protected\"", "\"static\"",
4495: "\"transient\"", "\"native\"", "\"synchronized\"",
4496: "\"volatile\"", "\"class\"", "\"extends\"",
4497: "\"interface\"", "LCURLY", "RCURLY", "COMMA",
4498: "\"implements\"", "LPAREN", "RPAREN", "\"this\"",
4499: "\"super\"", "ASSIGN", "\"throws\"", "COLON", "\"if\"",
4500: "\"else\"", "\"for\"", "\"while\"", "\"do\"", "\"break\"",
4501: "\"continue\"", "\"return\"", "\"switch\"", "\"throw\"",
4502: "\"case\"", "\"default\"", "\"try\"", "\"catch\"",
4503: "\"finally\"", "PLUS_ASSIGN", "MINUS_ASSIGN",
4504: "STAR_ASSIGN", "DIV_ASSIGN", "MOD_ASSIGN", "SR_ASSIGN",
4505: "BSR_ASSIGN", "SL_ASSIGN", "BAND_ASSIGN", "BXOR_ASSIGN",
4506: "BOR_ASSIGN", "QUESTION", "LOR", "LAND", "BOR", "BXOR",
4507: "BAND", "NOT_EQUAL", "EQUAL", "LT_", "GT", "LE", "GE",
4508: "\"instanceof\"", "SL", "SR", "BSR", "PLUS", "MINUS",
4509: "DIV", "MOD", "INC", "DEC", "BNOT", "LNOT", "\"true\"",
4510: "\"false\"", "\"null\"", "\"new\"", "NUM_INT",
4511: "CHAR_LITERAL", "STRING_LITERAL", "NUM_FLOAT", "NUM_LONG",
4512: "NUM_DOUBLE", "WS", "SL_COMMENT", "ML_COMMENT", "ESC",
4513: "HEX_DIGIT", "VOCAB", "EXPONENT", "FLOAT_SUFFIX",
4514: "\"threadsafe\"", "\"const\"" };
4515:
4516: private static final long[] mk_tokenSet_0() {
4517: long[] data = { 15393162788864L, 510L, 402653184L, 0L, 0L, 0L };
4518: return data;
4519: }
4520:
4521: public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
4522:
4523: private static final long[] mk_tokenSet_1() {
4524: long[] data = { 1100602347648L, 42924507264L, 0L, 0L };
4525: return data;
4526: }
4527:
4528: public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
4529: }
|