00001: // ===========================================================================
00002: // This file has been generated by
00003: // Rats! Parser Generator, version 1.13.2,
00004: // (C) 2004-2007 Robert Grimm,
00005: // on Sunday, November 4, 2007 at 12:19:19 PM.
00006: // Edit at your own risk.
00007: // ===========================================================================
00008:
00009: package xtc.lang.c4;
00010:
00011: import java.io.Reader;
00012: import java.io.BufferedReader;
00013: import java.io.BufferedWriter;
00014: import java.io.File;
00015: import java.io.FileReader;
00016: import java.io.OutputStreamWriter;
00017: import java.io.IOException;
00018:
00019: import java.util.HashSet;
00020: import java.util.Set;
00021:
00022: import xtc.util.Action;
00023: import xtc.util.Pair;
00024:
00025: import xtc.tree.Node;
00026: import xtc.tree.GNode;
00027: import xtc.tree.Printer;
00028:
00029: import xtc.parser.ParserBase;
00030: import xtc.parser.Column;
00031: import xtc.parser.Result;
00032: import xtc.parser.SemanticValue;
00033: import xtc.parser.ParseError;
00034:
00035: /**
00036: * Packrat parser for grammar <code>xtc.lang.c4.C4</code>.
00037: *
00038: * <p />This class has been generated by the <i>Rats!</i> parser
00039: * generator, version 1.13.2, (C) 2004-2007 Robert Grimm.
00040: */
00041: public final class C4Parser extends ParserBase {
00042:
00043: /** The GCC flag. */
00044: public static final boolean GCC = true;
00045:
00046: /** The C_KEYWORDS set. */
00047: public static final Set<String> C_KEYWORDS = new HashSet<String>();
00048:
00049: /** The RELOCATE flag. */
00050: public static final boolean RELOCATE = true;
00051:
00052: /** The ASPECT flag. */
00053: public static final boolean ASPECT = true;
00054:
00055: /** The C99 flag. */
00056: public static final boolean C99 = true;
00057:
00058: // =========================================================================
00059:
00060: /** Chunk 1 of memoized results. */
00061: static final class Chunk1 {
00062: Result fFunctionDefinition;
00063: Result fDeclarationList;
00064: Result fDeclarationList$$Plus1;
00065: Result fDeclarationSpecifiers;
00066: Result fSpecifierQualifierList;
00067: Result fAttributedDeclarator;
00068: Result fDeclarator;
00069: Result fPointer;
00070: Result fVariableLength;
00071: Result fParameterTypeList;
00072: }
00073:
00074: /** Chunk 2 of memoized results. */
00075: static final class Chunk2 {
00076: Result fAbstractDeclarator;
00077: Result fTypeName;
00078: Result fAttributeSpecifierList;
00079: Result fAttributeSpecifier;
00080: Result fStatement;
00081: Result fCompoundStatement;
00082: Result fCompoundStatement$$Star1;
00083: Result fCompoundStatement$$Star2;
00084: Result fLocalLabelDeclaration;
00085: Result fLocalLabelDeclaration$$Star1;
00086: }
00087:
00088: /** Chunk 3 of memoized results. */
00089: static final class Chunk3 {
00090: Result fDeclarationOrStatement;
00091: Result fCommaExpression;
00092: Result fAssignmentExpression;
00093: Result fConditionalExpression;
00094: Result fLogicalOrExpression;
00095: Result fCastExpression;
00096: Result fUnaryExpression;
00097: Result fExpressionList;
00098: Result fExpressionList$$Star1;
00099: Result fSimpleAssemblyExpression;
00100: }
00101:
00102: /** Chunk 4 of memoized results. */
00103: static final class Chunk4 {
00104: Result fAssemblyOperands;
00105: Result fAssemblyOperands$$Star1;
00106: Result fAssemblyOperand;
00107: Result fAsmKeyword;
00108: Result fExponent;
00109: Result f$$Shared2;
00110: Result fBinaryExponent;
00111: Result fCharacterLiteral;
00112: Result fCharacterLiteral$$Plus1;
00113: Result fStringConstant;
00114: }
00115:
00116: /** Chunk 5 of memoized results. */
00117: static final class Chunk5 {
00118: Result fStringConstant$$Plus1;
00119: Result fStringLiteral;
00120: Result fStringLiteral$$Star1;
00121: Result fIdentifier;
00122: Result fKeyword;
00123: Result fWord;
00124: Result fSymbol;
00125: }
00126:
00127: // =========================================================================
00128:
00129: /** Memoization table column. */
00130: static final class C4ParserColumn extends Column {
00131: Chunk1 chunk1;
00132: Chunk2 chunk2;
00133: Chunk3 chunk3;
00134: Chunk4 chunk4;
00135: Chunk5 chunk5;
00136: }
00137:
00138: // =========================================================================
00139:
00140: /** The global state object. */
00141: protected final C4ParserState yyState;
00142:
00143: // =========================================================================
00144:
00145: /**
00146: * Create a new packrat parser.
00147: *
00148: * @param reader The reader.
00149: * @param file The file name.
00150: */
00151: public C4Parser(final Reader reader, final String file) {
00152: super (reader, file);
00153: yyState = new C4ParserState();
00154: }
00155:
00156: /**
00157: * Create a new packrat parser.
00158: *
00159: * @param reader The file reader.
00160: * @param file The file name.
00161: * @param size The file size.
00162: */
00163: public C4Parser(final Reader reader, final String file,
00164: final int size) {
00165: super (reader, file, size);
00166: yyState = new C4ParserState();
00167: }
00168:
00169: // =========================================================================
00170:
00171: protected Column newColumn() {
00172: return new C4ParserColumn();
00173: }
00174:
00175: // =========================================================================
00176:
00177: /**
00178: * Parse nonterminal xtc.lang.c4.C4.TranslationUnit.
00179: *
00180: * @param yyStart The index.
00181: * @return The result.
00182: * @throws IOException Signals an I/O error.
00183: */
00184: public Result pTranslationUnit(final int yyStart)
00185: throws IOException {
00186: Result yyResult;
00187: int yyRepetition1;
00188: Pair<Node> yyRepValue1;
00189: Node yyValue;
00190: ParseError yyError = ParseError.DUMMY;
00191:
00192: // Alternative <Unit>.
00193:
00194: yyResult = pPrelude(yyStart);
00195: yyError = yyResult.select(yyError);
00196: if (yyResult.hasValue()) {
00197:
00198: yyRepetition1 = yyResult.index;
00199: yyRepValue1 = Pair.empty();
00200: while (true) {
00201:
00202: yyResult = pExternalDeclaration(yyRepetition1);
00203: yyError = yyResult.select(yyError);
00204: if (yyResult.hasValue()) {
00205: final Node v$el$1 = yyResult.semanticValue();
00206:
00207: yyRepetition1 = yyResult.index;
00208: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
00209: continue;
00210: }
00211: break;
00212: }
00213: { // Start scope for v$g$1.
00214: final Pair<Node> v$g$1 = yyRepValue1.reverse();
00215:
00216: yyResult = pAnnotations(yyRepetition1);
00217: yyError = yyResult.select(yyError);
00218: if (yyResult.hasValue()) {
00219: final Node v$g$2 = yyResult.semanticValue();
00220:
00221: yyResult = pEndOfFile(yyResult.index);
00222: yyError = yyResult.select(yyError);
00223: if (yyResult.hasValue()) {
00224:
00225: yyValue = GNode.create("TranslationUnit",
00226: v$g$1.size() + 1).addAll(v$g$1).add(
00227: v$g$2);
00228: yyValue.setLocation(location(yyStart));
00229:
00230: return yyResult.createValue(yyValue, yyError);
00231: }
00232: }
00233: } // End scope for v$g$1.
00234: }
00235:
00236: // Done.
00237: return yyError;
00238: }
00239:
00240: // =========================================================================
00241:
00242: /**
00243: * Parse nonterminal xtc.lang.c4.C4.Prelude.
00244: *
00245: * @param yyStart The index.
00246: * @return The result.
00247: * @throws IOException Signals an I/O error.
00248: */
00249: public Result pPrelude(final int yyStart) throws IOException {
00250: Result yyResult;
00251: Void yyValue;
00252: ParseError yyError = ParseError.DUMMY;
00253:
00254: // Reset the global state object.
00255: yyState.reset(column(yyStart).file);
00256:
00257: // Alternative 1.
00258:
00259: yyResult = pDirective(yyStart);
00260: yyError = yyResult.select(yyError);
00261: if (yyResult.hasValue()) {
00262:
00263: yyResult = pSpacing(yyResult.index);
00264: yyError = yyResult.select(yyError);
00265: if (yyResult.hasValue()) {
00266:
00267: yyValue = null;
00268:
00269: return yyResult.createValue(yyValue, yyError);
00270: }
00271: }
00272:
00273: // Done.
00274: return yyError;
00275: }
00276:
00277: // =========================================================================
00278:
00279: /**
00280: * Parse nonterminal xtc.lang.c4.C4.ExternalDeclaration.
00281: *
00282: * @param yyStart The index.
00283: * @return The result.
00284: * @throws IOException Signals an I/O error.
00285: */
00286: public Result pExternalDeclaration(final int yyStart)
00287: throws IOException {
00288: Result yyResult;
00289: Node yyValue;
00290: ParseError yyError = ParseError.DUMMY;
00291:
00292: // Start a state modification.
00293: yyState.start();
00294:
00295: // Alternative <Declaration>.
00296:
00297: yyState.mark();
00298:
00299: yyResult = pDeclaration(yyStart);
00300: yyError = yyResult.select(yyError);
00301: if (yyResult.hasValue()) {
00302: final Node d = yyResult.semanticValue();
00303:
00304: yyValue = yyState.annotate(d);
00305:
00306: // Commit the state modification.
00307: yyState.commit();
00308:
00309: setLocation(yyValue, yyStart);
00310: return yyResult.createValue(yyValue, yyError);
00311: }
00312:
00313: // Alternative <AspectDef>.
00314:
00315: yyResult = pAspectDefinition(yyStart);
00316: yyError = yyResult.select(yyError);
00317: if (yyResult.hasValue()) {
00318: final Node ag = yyResult.semanticValue();
00319:
00320: yyValue = yyState.annotate(ag);
00321:
00322: // Commit the state modification.
00323: yyState.commit();
00324:
00325: setLocation(yyValue, yyStart);
00326: return yyResult.createValue(yyValue, yyError);
00327: }
00328:
00329: // Alternative <Function>.
00330:
00331: yyResult = pFunctionDefinition(yyStart);
00332: yyError = yyResult.select(yyError);
00333: if (yyResult.hasValue()) {
00334: final Node fd = yyResult.semanticValue();
00335:
00336: yyValue = yyState.annotate(fd);
00337:
00338: // Commit the state modification.
00339: yyState.commit();
00340:
00341: setLocation(yyValue, yyStart);
00342: return yyResult.createValue(yyValue, yyError);
00343: }
00344:
00345: // Alternative <AspectFunction>.
00346:
00347: yyResult = pAspectFunctionDefinition(yyStart);
00348: yyError = yyResult.select(yyError);
00349: if (yyResult.hasValue()) {
00350: yyValue = yyResult.semanticValue();
00351:
00352: // Commit the state modification.
00353: yyState.commit();
00354:
00355: return yyResult.createValue(yyValue, yyError);
00356: }
00357:
00358: // Alternative <Assembly>.
00359:
00360: yyResult = pAssemblyDefinition(yyStart);
00361: yyError = yyResult.select(yyError);
00362: if (yyResult.hasValue()) {
00363: final Node a = yyResult.semanticValue();
00364:
00365: yyValue = yyState.annotate(a);
00366:
00367: // Commit the state modification.
00368: yyState.commit();
00369:
00370: setLocation(yyValue, yyStart);
00371: return yyResult.createValue(yyValue, yyError);
00372: }
00373:
00374: // Alternative <Empty>.
00375:
00376: yyResult = pEmptyDefinition(yyStart);
00377: yyError = yyResult.select(yyError);
00378: if (yyResult.hasValue()) {
00379: final Node e = yyResult.semanticValue();
00380:
00381: yyValue = yyState.annotate(e);
00382:
00383: // Commit the state modification.
00384: yyState.commit();
00385:
00386: setLocation(yyValue, yyStart);
00387: return yyResult.createValue(yyValue, yyError);
00388: }
00389:
00390: // Abort the state modification.
00391: yyState.abort();
00392:
00393: // Done.
00394: return yyError;
00395: }
00396:
00397: // =========================================================================
00398:
00399: /**
00400: * Parse nonterminal xtc.lang.c4.C4.FunctionDefinition.
00401: *
00402: * @param yyStart The index.
00403: * @return The result.
00404: * @throws IOException Signals an I/O error.
00405: */
00406: private Result pFunctionDefinition(final int yyStart)
00407: throws IOException {
00408: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
00409: if (null == yyColumn.chunk1)
00410: yyColumn.chunk1 = new Chunk1();
00411: if (null == yyColumn.chunk1.fFunctionDefinition)
00412: yyColumn.chunk1.fFunctionDefinition = pFunctionDefinition$1(yyStart);
00413: return yyColumn.chunk1.fFunctionDefinition;
00414: }
00415:
00416: /** Actually parse xtc.lang.c4.C4.FunctionDefinition. */
00417: private Result pFunctionDefinition$1(final int yyStart)
00418: throws IOException {
00419: Result yyResult;
00420: int yyBase;
00421: int yyOption1;
00422: Object yyOpValue1;
00423: Node yyValue;
00424: ParseError yyError = ParseError.DUMMY;
00425:
00426: // Alternative <Definition>.
00427:
00428: yyOption1 = yyStart;
00429: yyOpValue1 = null;
00430:
00431: yyBase = yyOption1;
00432: yyResult = pKeyword(yyBase);
00433: yyError = yyResult.select(yyError);
00434: if (yyResult.hasValue("__extension__")) {
00435: final String v$el$1 = "__extension__";
00436:
00437: yyOption1 = yyResult.index;
00438: yyOpValue1 = v$el$1;
00439: } else {
00440: yyError = yyError.select("\"__extension__\" expected",
00441: yyBase);
00442: }
00443: { // Start scope for v$g$1.
00444: final String v$g$1 = cast(yyOpValue1);
00445:
00446: yyOpValue1 = null;
00447:
00448: yyResult = pDeclarationSpecifiers(yyOption1);
00449: yyError = yyResult.select(yyError);
00450: if (yyResult.hasValue()) {
00451: final Node v$el$2 = yyResult.semanticValue();
00452:
00453: yyOption1 = yyResult.index;
00454: yyOpValue1 = v$el$2;
00455: }
00456: { // Start scope for v$g$2.
00457: final Node v$g$2 = cast(yyOpValue1);
00458:
00459: yyResult = pDeclarator(yyOption1);
00460: yyError = yyResult.select(yyError);
00461: if (yyResult.hasValue()) {
00462: final Node v$g$3 = yyResult.semanticValue();
00463:
00464: yyResult = pFunctionDeclaratorContext(yyResult.index);
00465: yyError = yyResult.select(yyError);
00466: if (yyResult.hasValue()) {
00467:
00468: yyOption1 = yyResult.index;
00469: yyOpValue1 = null;
00470:
00471: yyResult = pDeclarationList(yyOption1);
00472: yyError = yyResult.select(yyError);
00473: if (yyResult.hasValue()) {
00474: final Node v$el$3 = yyResult
00475: .semanticValue();
00476:
00477: yyOption1 = yyResult.index;
00478: yyOpValue1 = v$el$3;
00479: }
00480: { // Start scope for v$g$4.
00481: final Node v$g$4 = cast(yyOpValue1);
00482:
00483: yyResult = pCompoundStatement(yyOption1);
00484: yyError = yyResult.select(yyError);
00485: if (yyResult.hasValue()) {
00486: final Node v$g$5 = yyResult
00487: .semanticValue();
00488:
00489: yyValue = GNode.create(
00490: "FunctionDefinition", v$g$1,
00491: v$g$2, v$g$3, v$g$4, v$g$5);
00492: yyValue.setLocation(location(yyStart));
00493:
00494: return yyResult.createValue(yyValue,
00495: yyError);
00496: }
00497: } // End scope for v$g$4.
00498: }
00499: }
00500: } // End scope for v$g$2.
00501: } // End scope for v$g$1.
00502:
00503: // Done.
00504: return yyError;
00505: }
00506:
00507: // =========================================================================
00508:
00509: /**
00510: * Parse nonterminal xtc.lang.c4.C4.DeclarationList.
00511: *
00512: * @param yyStart The index.
00513: * @return The result.
00514: * @throws IOException Signals an I/O error.
00515: */
00516: private Result pDeclarationList(final int yyStart)
00517: throws IOException {
00518: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
00519: if (null == yyColumn.chunk1)
00520: yyColumn.chunk1 = new Chunk1();
00521: if (null == yyColumn.chunk1.fDeclarationList)
00522: yyColumn.chunk1.fDeclarationList = pDeclarationList$1(yyStart);
00523: return yyColumn.chunk1.fDeclarationList;
00524: }
00525:
00526: /** Actually parse xtc.lang.c4.C4.DeclarationList. */
00527: private Result pDeclarationList$1(final int yyStart)
00528: throws IOException {
00529: Result yyResult;
00530: Node yyValue;
00531: ParseError yyError = ParseError.DUMMY;
00532:
00533: // Alternative <List>.
00534:
00535: yyResult = pDeclarationList$$Plus1(yyStart);
00536: yyError = yyResult.select(yyError);
00537: if (yyResult.hasValue()) {
00538: final Pair<Node> v$g$1 = yyResult.semanticValue();
00539:
00540: yyValue = GNode.createFromPair("DeclarationList", v$g$1);
00541: yyValue.setLocation(location(yyStart));
00542:
00543: return yyResult.createValue(yyValue, yyError);
00544: }
00545:
00546: // Done.
00547: return yyError;
00548: }
00549:
00550: // =========================================================================
00551:
00552: /**
00553: * Parse synthetic nonterminal xtc.lang.c4.C4.DeclarationList$$Plus1.
00554: *
00555: * @param yyStart The index.
00556: * @return The result.
00557: * @throws IOException Signals an I/O error.
00558: */
00559: private Result pDeclarationList$$Plus1(final int yyStart)
00560: throws IOException {
00561:
00562: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
00563: if (null == yyColumn.chunk1)
00564: yyColumn.chunk1 = new Chunk1();
00565: if (null == yyColumn.chunk1.fDeclarationList$$Plus1)
00566: yyColumn.chunk1.fDeclarationList$$Plus1 = pDeclarationList$$Plus1$1(yyStart);
00567: return yyColumn.chunk1.fDeclarationList$$Plus1;
00568: }
00569:
00570: /** Actually parse xtc.lang.c4.C4.DeclarationList$$Plus1. */
00571: private Result pDeclarationList$$Plus1$1(final int yyStart)
00572: throws IOException {
00573:
00574: Result yyResult;
00575: Pair<Node> yyValue;
00576: ParseError yyError = ParseError.DUMMY;
00577:
00578: // Alternative 1.
00579:
00580: yyResult = pDeclarationListEntry(yyStart);
00581: yyError = yyResult.select(yyError);
00582: if (yyResult.hasValue()) {
00583: final Node v$el$1 = yyResult.semanticValue();
00584:
00585: final int yyChoice1 = yyResult.index;
00586:
00587: // Nested alternative 1.
00588:
00589: yyResult = pDeclarationList$$Plus1(yyChoice1);
00590: yyError = yyResult.select(yyError);
00591: if (yyResult.hasValue()) {
00592: final Pair<Node> v$2 = yyResult.semanticValue();
00593:
00594: yyValue = new Pair<Node>(v$el$1, v$2);
00595:
00596: return yyResult.createValue(yyValue, yyError);
00597: }
00598:
00599: // Nested alternative 2.
00600:
00601: yyValue = new Pair<Node>(v$el$1);
00602:
00603: return new SemanticValue(yyValue, yyChoice1, yyError);
00604: }
00605:
00606: // Done.
00607: return yyError;
00608: }
00609:
00610: // =========================================================================
00611:
00612: /**
00613: * Parse nonterminal xtc.lang.c4.C4.DeclarationListEntry.
00614: *
00615: * @param yyStart The index.
00616: * @return The result.
00617: * @throws IOException Signals an I/O error.
00618: */
00619: private Result pDeclarationListEntry(final int yyStart)
00620: throws IOException {
00621: Result yyResult;
00622: Node yyValue;
00623: ParseError yyError = ParseError.DUMMY;
00624:
00625: // Start a state modification.
00626: yyState.start();
00627:
00628: // Alternative <Entry>.
00629:
00630: yyResult = pDeclaration(yyStart);
00631: yyError = yyResult.select(yyError);
00632: if (yyResult.hasValue()) {
00633: yyValue = yyResult.semanticValue();
00634:
00635: // Commit the state modification.
00636: yyState.commit();
00637:
00638: return yyResult.createValue(yyValue, yyError);
00639: }
00640:
00641: // Abort the state modification.
00642: yyState.abort();
00643:
00644: // Done.
00645: return yyError;
00646: }
00647:
00648: // =========================================================================
00649:
00650: /**
00651: * Parse nonterminal xtc.lang.c4.C4.EmptyDefinition.
00652: *
00653: * @param yyStart The index.
00654: * @return The result.
00655: * @throws IOException Signals an I/O error.
00656: */
00657: private Result pEmptyDefinition(final int yyStart)
00658: throws IOException {
00659: Result yyResult;
00660: Node yyValue;
00661: ParseError yyError = ParseError.DUMMY;
00662:
00663: // Alternative 1.
00664:
00665: yyResult = pSymbol(yyStart);
00666: yyError = yyResult.select(yyError);
00667: if (yyResult.hasValue(";")) {
00668:
00669: yyValue = GNode.create("EmptyDefinition", false);
00670: yyValue.setLocation(location(yyStart));
00671:
00672: return yyResult.createValue(yyValue, yyError);
00673: }
00674:
00675: // Done.
00676: yyError = yyError.select("empty definition expected", yyStart);
00677: return yyError;
00678: }
00679:
00680: // =========================================================================
00681:
00682: /**
00683: * Parse nonterminal xtc.lang.c4.C4.Annotations.
00684: *
00685: * @param yyStart The index.
00686: * @return The result.
00687: * @throws IOException Signals an I/O error.
00688: */
00689: public Result pAnnotations(final int yyStart) throws IOException {
00690: Node yyValue;
00691: ParseError yyError = ParseError.DUMMY;
00692:
00693: // Start a state modification.
00694: yyState.start();
00695:
00696: // Alternative 1.
00697:
00698: yyState.mark();
00699: yyValue = yyState.annotate(null);
00700:
00701: // Commit the state modification.
00702: yyState.commit();
00703:
00704: setLocation(yyValue, yyStart);
00705: return new SemanticValue(yyValue, yyStart, yyError);
00706: }
00707:
00708: // =========================================================================
00709:
00710: /**
00711: * Parse nonterminal xtc.lang.c4.C4.Declaration.
00712: *
00713: * @param yyStart The index.
00714: * @return The result.
00715: * @throws IOException Signals an I/O error.
00716: */
00717: private Result pDeclaration(final int yyStart) throws IOException {
00718: Result yyResult;
00719: int yyBase;
00720: int yyOption1;
00721: Object yyOpValue1;
00722: Node yyValue;
00723: ParseError yyError = ParseError.DUMMY;
00724:
00725: // Alternative 1.
00726:
00727: yyOption1 = yyStart;
00728: yyOpValue1 = null;
00729:
00730: yyBase = yyOption1;
00731: yyResult = pKeyword(yyBase);
00732: yyError = yyResult.select(yyError);
00733: if (yyResult.hasValue("__extension__")) {
00734: final String v$el$1 = "__extension__";
00735:
00736: yyOption1 = yyResult.index;
00737: yyOpValue1 = v$el$1;
00738: } else {
00739: yyError = yyError.select("\"__extension__\" expected",
00740: yyBase);
00741: }
00742: { // Start scope for v$g$1.
00743: final String v$g$1 = cast(yyOpValue1);
00744:
00745: yyResult = pDeclarationSpecifiers(yyOption1);
00746: yyError = yyResult.select(yyError);
00747: if (yyResult.hasValue()) {
00748: final Node v$g$2 = yyResult.semanticValue();
00749:
00750: yyOption1 = yyResult.index;
00751: yyOpValue1 = null;
00752:
00753: yyResult = pInitializedDeclaratorList(yyOption1);
00754: yyError = yyResult.select(yyError);
00755: if (yyResult.hasValue()) {
00756: final Node v$el$2 = yyResult.semanticValue();
00757:
00758: yyOption1 = yyResult.index;
00759: yyOpValue1 = v$el$2;
00760: }
00761: { // Start scope for l.
00762: final Node l = cast(yyOpValue1);
00763:
00764: if (yyState.isValid(l)) {
00765:
00766: yyBase = yyOption1;
00767: yyResult = pSymbol(yyBase);
00768: yyError = yyResult.select(yyError);
00769: if (yyResult.hasValue(";")) {
00770:
00771: yyValue = GNode.create("Declaration",
00772: v$g$1, v$g$2, l);
00773: yyValue.setLocation(location(yyStart));
00774:
00775: return yyResult.createValue(yyValue,
00776: yyError);
00777: } else {
00778: yyError = yyError.select("\";\" expected",
00779: yyBase);
00780: }
00781: }
00782: } // End scope for l.
00783: }
00784: } // End scope for v$g$1.
00785:
00786: // Done.
00787: yyError = yyError.select("declaration expected", yyStart);
00788: return yyError;
00789: }
00790:
00791: // =========================================================================
00792:
00793: /**
00794: * Parse nonterminal xtc.lang.c4.C4.DeclarationSpecifiers.
00795: *
00796: * @param yyStart The index.
00797: * @return The result.
00798: * @throws IOException Signals an I/O error.
00799: */
00800: private Result pDeclarationSpecifiers(final int yyStart)
00801: throws IOException {
00802:
00803: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
00804: if (null == yyColumn.chunk1)
00805: yyColumn.chunk1 = new Chunk1();
00806: if (null == yyColumn.chunk1.fDeclarationSpecifiers)
00807: yyColumn.chunk1.fDeclarationSpecifiers = pDeclarationSpecifiers$1(yyStart);
00808: return yyColumn.chunk1.fDeclarationSpecifiers;
00809: }
00810:
00811: /** Actually parse xtc.lang.c4.C4.DeclarationSpecifiers. */
00812: private Result pDeclarationSpecifiers$1(final int yyStart)
00813: throws IOException {
00814:
00815: Result yyResult;
00816: Node yyValue;
00817: ParseError yyError = ParseError.DUMMY;
00818:
00819: // Alternative 1.
00820:
00821: yyResult = pDeclarationSpecifierPlus(yyStart);
00822: yyError = yyResult.select(yyError);
00823: if (yyResult.hasValue()) {
00824: final Pair<Node> v$g$1 = yyResult.semanticValue();
00825:
00826: yyValue = GNode.createFromPair("DeclarationSpecifiers",
00827: v$g$1);
00828: yyValue.setLocation(location(yyStart));
00829:
00830: return yyResult.createValue(yyValue, yyError);
00831: }
00832:
00833: // Done.
00834: return yyError;
00835: }
00836:
00837: // =========================================================================
00838:
00839: /**
00840: * Parse nonterminal xtc.lang.c4.C4.DeclarationSpecifierPlus.
00841: *
00842: * @param yyStart The index.
00843: * @return The result.
00844: * @throws IOException Signals an I/O error.
00845: */
00846: private Result pDeclarationSpecifierPlus(final int yyStart)
00847: throws IOException {
00848:
00849: Result yyResult;
00850: int yyRepetition1;
00851: boolean yyRepeated1;
00852: Pair<Node> yyRepValue1;
00853: Pair<Node> yyValue;
00854: ParseError yyError = ParseError.DUMMY;
00855:
00856: // Alternative 1.
00857:
00858: yyRepetition1 = yyStart;
00859: yyRepeated1 = false;
00860: yyRepValue1 = Pair.empty();
00861: while (true) {
00862:
00863: yyResult = pDeclarationSpecifier(yyRepetition1);
00864: yyError = yyResult.select(yyError);
00865: if (yyResult.hasValue()) {
00866: final Node v$el$1 = yyResult.semanticValue();
00867:
00868: yyRepetition1 = yyResult.index;
00869: yyRepeated1 = true;
00870: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
00871: continue;
00872: }
00873: break;
00874: }
00875:
00876: if (yyRepeated1) {
00877: yyValue = yyRepValue1.reverse();
00878:
00879: return new SemanticValue(yyValue, yyRepetition1, yyError);
00880: }
00881:
00882: // Done.
00883: return yyError;
00884: }
00885:
00886: // =========================================================================
00887:
00888: /**
00889: * Parse nonterminal xtc.lang.c4.C4.DeclarationSpecifier.
00890: *
00891: * @param yyStart The index.
00892: * @return The result.
00893: * @throws IOException Signals an I/O error.
00894: */
00895: private Result pDeclarationSpecifier(final int yyStart)
00896: throws IOException {
00897: Result yyResult;
00898: Node yyValue;
00899: ParseError yyError = ParseError.DUMMY;
00900:
00901: // Alternative <StorageClass>.
00902:
00903: yyResult = pStorageClassSpecifier(yyStart);
00904: yyError = yyResult.select(yyError);
00905: if (yyResult.hasValue()) {
00906: yyValue = yyResult.semanticValue();
00907:
00908: return yyResult.createValue(yyValue, yyError);
00909: }
00910:
00911: // Alternative <TypeSpecifier>.
00912:
00913: yyResult = pTypeSpecifier(yyStart);
00914: yyError = yyResult.select(yyError);
00915: if (yyResult.hasValue()) {
00916: yyValue = yyResult.semanticValue();
00917:
00918: yyResult = pTypeSpecContext(yyResult.index);
00919: yyError = yyResult.select(yyError);
00920: if (yyResult.hasValue()) {
00921:
00922: return yyResult.createValue(yyValue, yyError);
00923: }
00924: }
00925:
00926: // Alternative <TypeQualifier>.
00927:
00928: yyResult = pTypeQualifier(yyStart);
00929: yyError = yyResult.select(yyError);
00930: if (yyResult.hasValue()) {
00931: yyValue = yyResult.semanticValue();
00932:
00933: return yyResult.createValue(yyValue, yyError);
00934: }
00935:
00936: // Alternative 4.
00937:
00938: yyResult = pKeyword(yyStart);
00939: yyError = yyResult.select(yyError);
00940: if (yyResult.hasValue("inline")) {
00941: final String v$g$1 = "inline";
00942:
00943: yyValue = GNode.create("FunctionSpecifier", v$g$1);
00944: yyValue.setLocation(location(yyStart));
00945:
00946: return yyResult.createValue(yyValue, yyError);
00947: }
00948:
00949: // Alternative 5.
00950:
00951: yyResult = pKeyword(yyStart);
00952: yyError = yyResult.select(yyError);
00953: if (yyResult.hasValue("__inline")) {
00954: final String v$g$2 = "__inline";
00955:
00956: yyValue = GNode.create("FunctionSpecifier", v$g$2);
00957: yyValue.setLocation(location(yyStart));
00958:
00959: return yyResult.createValue(yyValue, yyError);
00960: }
00961:
00962: // Alternative 6.
00963:
00964: yyResult = pKeyword(yyStart);
00965: yyError = yyResult.select(yyError);
00966: if (yyResult.hasValue("__inline__")) {
00967: final String v$g$3 = "__inline__";
00968:
00969: yyValue = GNode.create("FunctionSpecifier", v$g$3);
00970: yyValue.setLocation(location(yyStart));
00971:
00972: return yyResult.createValue(yyValue, yyError);
00973: }
00974:
00975: // Alternative <Attribute>.
00976:
00977: yyResult = pAttributeSpecifier(yyStart);
00978: yyError = yyResult.select(yyError);
00979: if (yyResult.hasValue()) {
00980: yyValue = yyResult.semanticValue();
00981:
00982: return yyResult.createValue(yyValue, yyError);
00983: }
00984:
00985: // Done.
00986: yyError = yyError.select("declaration specifier expected",
00987: yyStart);
00988: return yyError;
00989: }
00990:
00991: // =========================================================================
00992:
00993: /**
00994: * Parse nonterminal xtc.lang.c4.C4.InitializedDeclaratorList.
00995: *
00996: * @param yyStart The index.
00997: * @return The result.
00998: * @throws IOException Signals an I/O error.
00999: */
01000: private Result pInitializedDeclaratorList(final int yyStart)
01001: throws IOException {
01002:
01003: Result yyResult;
01004: int yyBase;
01005: int yyRepetition1;
01006: Pair<Node> yyRepValue1;
01007: Node yyValue;
01008: ParseError yyError = ParseError.DUMMY;
01009:
01010: // Alternative <List>.
01011:
01012: yyResult = pInitializedDeclarator(yyStart);
01013: yyError = yyResult.select(yyError);
01014: if (yyResult.hasValue()) {
01015: final Node v$g$1 = yyResult.semanticValue();
01016:
01017: yyRepetition1 = yyResult.index;
01018: yyRepValue1 = Pair.empty();
01019: while (true) {
01020:
01021: yyBase = yyRepetition1;
01022: yyResult = pSymbol(yyBase);
01023: yyError = yyResult.select(yyError);
01024: if (yyResult.hasValue(",")) {
01025:
01026: yyResult = pInitializedDeclarator(yyResult.index);
01027: yyError = yyResult.select(yyError);
01028: if (yyResult.hasValue()) {
01029: final Node v$el$1 = yyResult.semanticValue();
01030:
01031: yyRepetition1 = yyResult.index;
01032: yyRepValue1 = new Pair<Node>(v$el$1,
01033: yyRepValue1);
01034: continue;
01035: }
01036: } else {
01037: yyError = yyError.select("\",\" expected", yyBase);
01038: }
01039: break;
01040: }
01041: { // Start scope for v$g$2.
01042: final Pair<Node> v$g$2 = yyRepValue1.reverse();
01043:
01044: yyValue = GNode.createFromPair(
01045: "InitializedDeclaratorList", v$g$1, v$g$2);
01046: yyValue.setLocation(location(yyStart));
01047:
01048: return new SemanticValue(yyValue, yyRepetition1,
01049: yyError);
01050: } // End scope for v$g$2.
01051: }
01052:
01053: // Done.
01054: return yyError;
01055: }
01056:
01057: // =========================================================================
01058:
01059: /**
01060: * Parse nonterminal xtc.lang.c4.C4.InitializedDeclarator.
01061: *
01062: * @param yyStart The index.
01063: * @return The result.
01064: * @throws IOException Signals an I/O error.
01065: */
01066: private Result pInitializedDeclarator(final int yyStart)
01067: throws IOException {
01068:
01069: Result yyResult;
01070: int yyBase;
01071: int yyOption1;
01072: Node yyOpValue1;
01073: Node yyValue;
01074: ParseError yyError = ParseError.DUMMY;
01075:
01076: // Alternative 1.
01077:
01078: yyOption1 = yyStart;
01079: yyOpValue1 = null;
01080:
01081: yyResult = pAttributeSpecifierList(yyOption1);
01082: yyError = yyResult.select(yyError);
01083: if (yyResult.hasValue()) {
01084: final Node v$el$1 = yyResult.semanticValue();
01085:
01086: yyOption1 = yyResult.index;
01087: yyOpValue1 = v$el$1;
01088: }
01089: { // Start scope for v$g$1.
01090: final Node v$g$1 = yyOpValue1;
01091:
01092: yyResult = pDeclarator(yyOption1);
01093: yyError = yyResult.select(yyError);
01094: if (yyResult.hasValue()) {
01095: final Node v$g$2 = yyResult.semanticValue();
01096:
01097: yyOption1 = yyResult.index;
01098: yyOpValue1 = null;
01099:
01100: yyResult = pSimpleAssemblyExpression(yyOption1);
01101: yyError = yyResult.select(yyError);
01102: if (yyResult.hasValue()) {
01103: final Node v$el$2 = yyResult.semanticValue();
01104:
01105: yyOption1 = yyResult.index;
01106: yyOpValue1 = v$el$2;
01107: }
01108: { // Start scope for v$g$3.
01109: final Node v$g$3 = yyOpValue1;
01110:
01111: yyOpValue1 = null;
01112:
01113: yyResult = pAttributeSpecifierList(yyOption1);
01114: yyError = yyResult.select(yyError);
01115: if (yyResult.hasValue()) {
01116: final Node v$el$3 = yyResult.semanticValue();
01117:
01118: yyOption1 = yyResult.index;
01119: yyOpValue1 = v$el$3;
01120: }
01121: { // Start scope for v$g$4.
01122: final Node v$g$4 = yyOpValue1;
01123:
01124: yyOpValue1 = null;
01125:
01126: yyBase = yyOption1;
01127: yyResult = pSymbol(yyBase);
01128: yyError = yyResult.select(yyError);
01129: if (yyResult.hasValue("=")) {
01130:
01131: yyResult = pInitializer(yyResult.index);
01132: yyError = yyResult.select(yyError);
01133: if (yyResult.hasValue()) {
01134: final Node v$el$4 = yyResult
01135: .semanticValue();
01136:
01137: yyOption1 = yyResult.index;
01138: yyOpValue1 = v$el$4;
01139: }
01140: } else {
01141: yyError = yyError.select("\"=\" expected",
01142: yyBase);
01143: }
01144: { // Start scope for v$g$5.
01145: final Node v$g$5 = yyOpValue1;
01146:
01147: yyValue = GNode.create(
01148: "InitializedDeclarator", v$g$1,
01149: v$g$2, v$g$3, v$g$4, v$g$5);
01150: yyValue.setLocation(location(yyStart));
01151:
01152: return new SemanticValue(yyValue,
01153: yyOption1, yyError);
01154: } // End scope for v$g$5.
01155: } // End scope for v$g$4.
01156: } // End scope for v$g$3.
01157: }
01158: } // End scope for v$g$1.
01159:
01160: // Done.
01161: return yyError;
01162: }
01163:
01164: // =========================================================================
01165:
01166: /**
01167: * Parse nonterminal xtc.lang.c4.C4.StorageClassSpecifier.
01168: *
01169: * @param yyStart The index.
01170: * @return The result.
01171: * @throws IOException Signals an I/O error.
01172: */
01173: private Result pStorageClassSpecifier(final int yyStart)
01174: throws IOException {
01175:
01176: Result yyResult;
01177: Node yyValue;
01178: ParseError yyError = ParseError.DUMMY;
01179:
01180: // Alternative 1.
01181:
01182: yyResult = pKeyword(yyStart);
01183: yyError = yyResult.select(yyError);
01184: if (yyResult.hasValue("auto")) {
01185:
01186: yyValue = GNode.create("AutoSpecifier", false);
01187: yyValue.setLocation(location(yyStart));
01188:
01189: return yyResult.createValue(yyValue, yyError);
01190: }
01191:
01192: // Alternative 2.
01193:
01194: yyResult = pKeyword(yyStart);
01195: yyError = yyResult.select(yyError);
01196: if (yyResult.hasValue("extern")) {
01197:
01198: yyValue = GNode.create("ExternSpecifier", false);
01199: yyValue.setLocation(location(yyStart));
01200:
01201: return yyResult.createValue(yyValue, yyError);
01202: }
01203:
01204: // Alternative 3.
01205:
01206: yyResult = pKeyword(yyStart);
01207: yyError = yyResult.select(yyError);
01208: if (yyResult.hasValue("register")) {
01209:
01210: yyValue = GNode.create("RegisterSpecifier", false);
01211: yyValue.setLocation(location(yyStart));
01212:
01213: return yyResult.createValue(yyValue, yyError);
01214: }
01215:
01216: // Alternative 4.
01217:
01218: yyResult = pKeyword(yyStart);
01219: yyError = yyResult.select(yyError);
01220: if (yyResult.hasValue("static")) {
01221:
01222: yyValue = GNode.create("StaticSpecifier", false);
01223: yyValue.setLocation(location(yyStart));
01224:
01225: return yyResult.createValue(yyValue, yyError);
01226: }
01227:
01228: // Alternative 5.
01229:
01230: yyResult = pKeyword(yyStart);
01231: yyError = yyResult.select(yyError);
01232: if (yyResult.hasValue("typedef")) {
01233:
01234: yyResult = pTypedefContext(yyResult.index);
01235: yyError = yyResult.select(yyError);
01236: if (yyResult.hasValue()) {
01237:
01238: yyValue = GNode.create("TypedefSpecifier", false);
01239: yyValue.setLocation(location(yyStart));
01240:
01241: return yyResult.createValue(yyValue, yyError);
01242: }
01243: }
01244:
01245: // Done.
01246: yyError = yyError.select("storage class specifier expected",
01247: yyStart);
01248: return yyError;
01249: }
01250:
01251: // =========================================================================
01252:
01253: /**
01254: * Parse nonterminal xtc.lang.c4.C4.TypeQualifier.
01255: *
01256: * @param yyStart The index.
01257: * @return The result.
01258: * @throws IOException Signals an I/O error.
01259: */
01260: private Result pTypeQualifier(final int yyStart) throws IOException {
01261: Result yyResult;
01262: Node yyValue;
01263: ParseError yyError = ParseError.DUMMY;
01264:
01265: // Alternative 1.
01266:
01267: yyResult = pKeyword(yyStart);
01268: yyError = yyResult.select(yyError);
01269: if (yyResult.hasValue("volatile")) {
01270: final String v$g$1 = "volatile";
01271:
01272: yyValue = GNode.create("VolatileQualifier", v$g$1);
01273: yyValue.setLocation(location(yyStart));
01274:
01275: return yyResult.createValue(yyValue, yyError);
01276: }
01277:
01278: // Alternative 2.
01279:
01280: yyResult = pKeyword(yyStart);
01281: yyError = yyResult.select(yyError);
01282: if (yyResult.hasValue("__volatile")) {
01283: final String v$g$2 = "__volatile";
01284:
01285: yyValue = GNode.create("VolatileQualifier", v$g$2);
01286: yyValue.setLocation(location(yyStart));
01287:
01288: return yyResult.createValue(yyValue, yyError);
01289: }
01290:
01291: // Alternative 3.
01292:
01293: yyResult = pKeyword(yyStart);
01294: yyError = yyResult.select(yyError);
01295: if (yyResult.hasValue("__volatile__")) {
01296: final String v$g$3 = "__volatile__";
01297:
01298: yyValue = GNode.create("VolatileQualifier", v$g$3);
01299: yyValue.setLocation(location(yyStart));
01300:
01301: return yyResult.createValue(yyValue, yyError);
01302: }
01303:
01304: // Alternative 4.
01305:
01306: yyResult = pKeyword(yyStart);
01307: yyError = yyResult.select(yyError);
01308: if (yyResult.hasValue("const")) {
01309: final String v$g$1 = "const";
01310:
01311: yyValue = GNode.create("ConstantQualifier", v$g$1);
01312: yyValue.setLocation(location(yyStart));
01313:
01314: return yyResult.createValue(yyValue, yyError);
01315: }
01316:
01317: // Alternative 5.
01318:
01319: yyResult = pKeyword(yyStart);
01320: yyError = yyResult.select(yyError);
01321: if (yyResult.hasValue("__const")) {
01322: final String v$g$2 = "__const";
01323:
01324: yyValue = GNode.create("ConstantQualifier", v$g$2);
01325: yyValue.setLocation(location(yyStart));
01326:
01327: return yyResult.createValue(yyValue, yyError);
01328: }
01329:
01330: // Alternative 6.
01331:
01332: yyResult = pKeyword(yyStart);
01333: yyError = yyResult.select(yyError);
01334: if (yyResult.hasValue("__const__")) {
01335: final String v$g$3 = "__const__";
01336:
01337: yyValue = GNode.create("ConstantQualifier", v$g$3);
01338: yyValue.setLocation(location(yyStart));
01339:
01340: return yyResult.createValue(yyValue, yyError);
01341: }
01342:
01343: // Alternative 7.
01344:
01345: yyResult = pKeyword(yyStart);
01346: yyError = yyResult.select(yyError);
01347: if (yyResult.hasValue("restrict")) {
01348: final String v$g$1 = "restrict";
01349:
01350: yyValue = GNode.create("RestrictQualifier", v$g$1);
01351: yyValue.setLocation(location(yyStart));
01352:
01353: return yyResult.createValue(yyValue, yyError);
01354: }
01355:
01356: // Alternative 8.
01357:
01358: yyResult = pKeyword(yyStart);
01359: yyError = yyResult.select(yyError);
01360: if (yyResult.hasValue("__restrict")) {
01361: final String v$g$2 = "__restrict";
01362:
01363: yyValue = GNode.create("RestrictQualifier", v$g$2);
01364: yyValue.setLocation(location(yyStart));
01365:
01366: return yyResult.createValue(yyValue, yyError);
01367: }
01368:
01369: // Alternative 9.
01370:
01371: yyResult = pKeyword(yyStart);
01372: yyError = yyResult.select(yyError);
01373: if (yyResult.hasValue("__restrict__")) {
01374: final String v$g$3 = "__restrict__";
01375:
01376: yyValue = GNode.create("RestrictQualifier", v$g$3);
01377: yyValue.setLocation(location(yyStart));
01378:
01379: return yyResult.createValue(yyValue, yyError);
01380: }
01381:
01382: // Done.
01383: yyError = yyError.select("type qualifier expected", yyStart);
01384: return yyError;
01385: }
01386:
01387: // =========================================================================
01388:
01389: /**
01390: * Parse nonterminal xtc.lang.c4.C4.TypeSpecifier.
01391: *
01392: * @param yyStart The index.
01393: * @return The result.
01394: * @throws IOException Signals an I/O error.
01395: */
01396: private Result pTypeSpecifier(final int yyStart) throws IOException {
01397: Result yyResult;
01398: int yyBase;
01399: Node yyValue;
01400: ParseError yyError = ParseError.DUMMY;
01401:
01402: // Alternative <Enumeration>.
01403:
01404: yyResult = pEnumerationTypeSpecifier(yyStart);
01405: yyError = yyResult.select(yyError);
01406: if (yyResult.hasValue()) {
01407: yyValue = yyResult.semanticValue();
01408:
01409: return yyResult.createValue(yyValue, yyError);
01410: }
01411:
01412: // Alternative <Structure>.
01413:
01414: yyResult = pStructureTypeSpecifier(yyStart);
01415: yyError = yyResult.select(yyError);
01416: if (yyResult.hasValue()) {
01417: yyValue = yyResult.semanticValue();
01418:
01419: return yyResult.createValue(yyValue, yyError);
01420: }
01421:
01422: // Alternative <Union>.
01423:
01424: yyResult = pUnionTypeSpecifier(yyStart);
01425: yyError = yyResult.select(yyError);
01426: if (yyResult.hasValue()) {
01427: yyValue = yyResult.semanticValue();
01428:
01429: return yyResult.createValue(yyValue, yyError);
01430: }
01431:
01432: // Alternative <Floating>.
01433:
01434: yyResult = pFloatingPointTypeSpecifier(yyStart);
01435: yyError = yyResult.select(yyError);
01436: if (yyResult.hasValue()) {
01437: yyValue = yyResult.semanticValue();
01438:
01439: return yyResult.createValue(yyValue, yyError);
01440: }
01441:
01442: // Alternative <Integer>.
01443:
01444: yyResult = pIntegerTypeSpecifier(yyStart);
01445: yyError = yyResult.select(yyError);
01446: if (yyResult.hasValue()) {
01447: yyValue = yyResult.semanticValue();
01448:
01449: return yyResult.createValue(yyValue, yyError);
01450: }
01451:
01452: // Alternative 6.
01453:
01454: yyResult = pIdentifier(yyStart);
01455: yyError = yyResult.select(yyError);
01456: if (yyResult.hasValue()) {
01457: final String id = yyResult.semanticValue();
01458:
01459: if (yyState.isType(toText(id))) {
01460:
01461: yyValue = GNode.create("TypedefName", id);
01462: yyValue.setLocation(location(yyStart));
01463:
01464: return yyResult.createValue(yyValue, yyError);
01465: }
01466: }
01467:
01468: // Alternative 7.
01469:
01470: yyResult = pTypeofKeyword(yyStart);
01471: yyError = yyResult.select(yyError);
01472: if (yyResult.hasValue()) {
01473:
01474: yyBase = yyResult.index;
01475: yyResult = pSymbol(yyBase);
01476: yyError = yyResult.select(yyError);
01477: if (yyResult.hasValue("(")) {
01478:
01479: final int yyChoice1 = yyResult.index;
01480:
01481: // Nested alternative 1.
01482:
01483: yyResult = pTypeName(yyChoice1);
01484: yyError = yyResult.select(yyError);
01485: if (yyResult.hasValue()) {
01486: final Node v$g$1 = yyResult.semanticValue();
01487:
01488: yyBase = yyResult.index;
01489: yyResult = pSymbol(yyBase);
01490: yyError = yyResult.select(yyError);
01491: if (yyResult.hasValue(")")) {
01492:
01493: yyValue = GNode
01494: .create("TypeofSpecifier", v$g$1);
01495: yyValue.setLocation(location(yyStart));
01496:
01497: return yyResult.createValue(yyValue, yyError);
01498: } else {
01499: yyError = yyError.select("\")\" expected",
01500: yyBase);
01501: }
01502: }
01503:
01504: // Nested alternative 2.
01505:
01506: yyResult = pCommaExpression(yyChoice1);
01507: yyError = yyResult.select(yyError);
01508: if (yyResult.hasValue()) {
01509: final Node v$g$2 = yyResult.semanticValue();
01510:
01511: yyBase = yyResult.index;
01512: yyResult = pSymbol(yyBase);
01513: yyError = yyResult.select(yyError);
01514: if (yyResult.hasValue(")")) {
01515:
01516: yyValue = GNode
01517: .create("TypeofSpecifier", v$g$2);
01518: yyValue.setLocation(location(yyStart));
01519:
01520: return yyResult.createValue(yyValue, yyError);
01521: } else {
01522: yyError = yyError.select("\")\" expected",
01523: yyBase);
01524: }
01525: }
01526: } else {
01527: yyError = yyError.select("\"(\" expected", yyBase);
01528: }
01529: }
01530:
01531: // Alternative 8.
01532:
01533: yyResult = pKeyword(yyStart);
01534: yyError = yyResult.select(yyError);
01535: if (yyResult.hasValue("void")) {
01536:
01537: yyValue = GNode.create("VoidTypeSpecifier", false);
01538: yyValue.setLocation(location(yyStart));
01539:
01540: return yyResult.createValue(yyValue, yyError);
01541: }
01542:
01543: // Alternative 9.
01544:
01545: yyResult = pKeyword(yyStart);
01546: yyError = yyResult.select(yyError);
01547: if (yyResult.hasValue("__builtin_va_list")) {
01548:
01549: yyValue = GNode.create("VarArgListSpecifier", false);
01550: yyValue.setLocation(location(yyStart));
01551:
01552: return yyResult.createValue(yyValue, yyError);
01553: }
01554:
01555: // Done.
01556: yyError = yyError.select("type specifier expected", yyStart);
01557: return yyError;
01558: }
01559:
01560: // =========================================================================
01561:
01562: /**
01563: * Parse nonterminal xtc.lang.c4.C4.EnumerationTypeSpecifier.
01564: *
01565: * @param yyStart The index.
01566: * @return The result.
01567: * @throws IOException Signals an I/O error.
01568: */
01569: private Result pEnumerationTypeSpecifier(final int yyStart)
01570: throws IOException {
01571:
01572: Result yyResult;
01573: int yyBase;
01574: int yyOption1;
01575: Object yyOpValue1;
01576: Node yyValue;
01577: ParseError yyError = ParseError.DUMMY;
01578:
01579: // Alternative 1.
01580:
01581: yyResult = pKeyword(yyStart);
01582: yyError = yyResult.select(yyError);
01583: if (yyResult.hasValue("enum")) {
01584:
01585: yyOption1 = yyResult.index;
01586: yyOpValue1 = null;
01587:
01588: yyResult = pAttributeSpecifierList(yyOption1);
01589: yyError = yyResult.select(yyError);
01590: if (yyResult.hasValue()) {
01591: final Node v$el$1 = yyResult.semanticValue();
01592:
01593: yyOption1 = yyResult.index;
01594: yyOpValue1 = v$el$1;
01595: }
01596: { // Start scope for v$g$1.
01597: final Node v$g$1 = cast(yyOpValue1);
01598:
01599: final int yyChoice1 = yyOption1;
01600:
01601: // Nested alternative 1.
01602:
01603: yyOption1 = yyChoice1;
01604: yyOpValue1 = null;
01605:
01606: yyResult = pIdentifier(yyOption1);
01607: yyError = yyResult.select(yyError);
01608: if (yyResult.hasValue()) {
01609: final String v$el$2 = yyResult.semanticValue();
01610:
01611: yyOption1 = yyResult.index;
01612: yyOpValue1 = v$el$2;
01613: }
01614: { // Start scope for v$g$2.
01615: final String v$g$2 = cast(yyOpValue1);
01616:
01617: yyBase = yyOption1;
01618: yyResult = pSymbol(yyBase);
01619: yyError = yyResult.select(yyError);
01620: if (yyResult.hasValue("{")) {
01621:
01622: yyResult = pEnumeratorList(yyResult.index);
01623: yyError = yyResult.select(yyError);
01624: if (yyResult.hasValue()) {
01625: final Node v$g$3 = yyResult.semanticValue();
01626:
01627: yyOption1 = yyResult.index;
01628:
01629: yyBase = yyOption1;
01630: yyResult = pSymbol(yyBase);
01631: yyError = yyResult.select(yyError);
01632: if (yyResult.hasValue(",")) {
01633:
01634: yyOption1 = yyResult.index;
01635: } else {
01636: yyError = yyError.select(
01637: "\",\" expected", yyBase);
01638: }
01639:
01640: yyBase = yyOption1;
01641: yyResult = pSymbol(yyBase);
01642: yyError = yyResult.select(yyError);
01643: if (yyResult.hasValue("}")) {
01644:
01645: yyOption1 = yyResult.index;
01646: yyOpValue1 = null;
01647:
01648: yyResult = pAttributeSpecifierList(yyOption1);
01649: yyError = yyResult.select(yyError);
01650: if (yyResult.hasValue()) {
01651: final Node v$el$3 = yyResult
01652: .semanticValue();
01653:
01654: yyOption1 = yyResult.index;
01655: yyOpValue1 = v$el$3;
01656: }
01657: { // Start scope for v$g$4.
01658: final Node v$g$4 = cast(yyOpValue1);
01659:
01660: yyValue = GNode
01661: .create(
01662: "EnumerationTypeDefinition",
01663: v$g$1, v$g$2,
01664: v$g$3, v$g$4);
01665: yyValue
01666: .setLocation(location(yyStart));
01667:
01668: return new SemanticValue(yyValue,
01669: yyOption1, yyError);
01670: } // End scope for v$g$4.
01671: } else {
01672: yyError = yyError.select(
01673: "\"}\" expected", yyBase);
01674: }
01675: }
01676: } else {
01677: yyError = yyError.select("\"{\" expected",
01678: yyBase);
01679: }
01680: } // End scope for v$g$2.
01681:
01682: // Nested alternative 2.
01683:
01684: yyResult = pIdentifier(yyChoice1);
01685: yyError = yyResult.select(yyError);
01686: if (yyResult.hasValue()) {
01687: final String v$g$2 = yyResult.semanticValue();
01688:
01689: yyValue = GNode.create("EnumerationTypeReference",
01690: v$g$1, v$g$2);
01691: yyValue.setLocation(location(yyStart));
01692:
01693: return yyResult.createValue(yyValue, yyError);
01694: }
01695: } // End scope for v$g$1.
01696: }
01697:
01698: // Done.
01699: yyError = yyError.select("enumeration type specifier expected",
01700: yyStart);
01701: return yyError;
01702: }
01703:
01704: // =========================================================================
01705:
01706: /**
01707: * Parse nonterminal xtc.lang.c4.C4.EnumeratorList.
01708: *
01709: * @param yyStart The index.
01710: * @return The result.
01711: * @throws IOException Signals an I/O error.
01712: */
01713: private Result pEnumeratorList(final int yyStart)
01714: throws IOException {
01715: Result yyResult;
01716: int yyBase;
01717: int yyRepetition1;
01718: Pair<Node> yyRepValue1;
01719: Node yyValue;
01720: ParseError yyError = ParseError.DUMMY;
01721:
01722: // Alternative <List>.
01723:
01724: yyResult = pEnumerator(yyStart);
01725: yyError = yyResult.select(yyError);
01726: if (yyResult.hasValue()) {
01727: final Node v$g$1 = yyResult.semanticValue();
01728:
01729: yyRepetition1 = yyResult.index;
01730: yyRepValue1 = Pair.empty();
01731: while (true) {
01732:
01733: yyBase = yyRepetition1;
01734: yyResult = pSymbol(yyBase);
01735: yyError = yyResult.select(yyError);
01736: if (yyResult.hasValue(",")) {
01737:
01738: yyResult = pEnumerator(yyResult.index);
01739: yyError = yyResult.select(yyError);
01740: if (yyResult.hasValue()) {
01741: final Node v$el$1 = yyResult.semanticValue();
01742:
01743: yyRepetition1 = yyResult.index;
01744: yyRepValue1 = new Pair<Node>(v$el$1,
01745: yyRepValue1);
01746: continue;
01747: }
01748: } else {
01749: yyError = yyError.select("\",\" expected", yyBase);
01750: }
01751: break;
01752: }
01753: { // Start scope for v$g$2.
01754: final Pair<Node> v$g$2 = yyRepValue1.reverse();
01755:
01756: yyValue = GNode.createFromPair("EnumeratorList", v$g$1,
01757: v$g$2);
01758: yyValue.setLocation(location(yyStart));
01759:
01760: return new SemanticValue(yyValue, yyRepetition1,
01761: yyError);
01762: } // End scope for v$g$2.
01763: }
01764:
01765: // Done.
01766: return yyError;
01767: }
01768:
01769: // =========================================================================
01770:
01771: /**
01772: * Parse nonterminal xtc.lang.c4.C4.Enumerator.
01773: *
01774: * @param yyStart The index.
01775: * @return The result.
01776: * @throws IOException Signals an I/O error.
01777: */
01778: private Result pEnumerator(final int yyStart) throws IOException {
01779: Result yyResult;
01780: int yyBase;
01781: int yyOption1;
01782: Node yyOpValue1;
01783: Node yyValue;
01784: ParseError yyError = ParseError.DUMMY;
01785:
01786: // Alternative <Enumerator>.
01787:
01788: yyResult = pIdentifier(yyStart);
01789: yyError = yyResult.select(yyError);
01790: if (yyResult.hasValue()) {
01791: final String id = yyResult.semanticValue();
01792:
01793: yyState.bind(toText(id), false);
01794:
01795: yyOption1 = yyResult.index;
01796: yyOpValue1 = null;
01797:
01798: yyBase = yyOption1;
01799: yyResult = pSymbol(yyBase);
01800: yyError = yyResult.select(yyError);
01801: if (yyResult.hasValue("=")) {
01802:
01803: yyResult = pConditionalExpression(yyResult.index);
01804: yyError = yyResult.select(yyError);
01805: if (yyResult.hasValue()) {
01806: final Node v$el$1 = yyResult.semanticValue();
01807:
01808: yyOption1 = yyResult.index;
01809: yyOpValue1 = v$el$1;
01810: }
01811: } else {
01812: yyError = yyError.select("\"=\" expected", yyBase);
01813: }
01814: { // Start scope for v$g$1.
01815: final Node v$g$1 = yyOpValue1;
01816:
01817: yyValue = GNode.create("Enumerator", id, v$g$1);
01818: yyValue.setLocation(location(yyStart));
01819:
01820: return new SemanticValue(yyValue, yyOption1, yyError);
01821: } // End scope for v$g$1.
01822: }
01823:
01824: // Done.
01825: return yyError;
01826: }
01827:
01828: // =========================================================================
01829:
01830: /**
01831: * Parse nonterminal xtc.lang.c4.C4.StructureTypeSpecifier.
01832: *
01833: * @param yyStart The index.
01834: * @return The result.
01835: * @throws IOException Signals an I/O error.
01836: */
01837: private Result pStructureTypeSpecifier(final int yyStart)
01838: throws IOException {
01839:
01840: Result yyResult;
01841: int yyBase;
01842: int yyOption1;
01843: Object yyOpValue1;
01844: Node yyValue;
01845: ParseError yyError = ParseError.DUMMY;
01846:
01847: // Alternative 1.
01848:
01849: yyResult = pKeyword(yyStart);
01850: yyError = yyResult.select(yyError);
01851: if (yyResult.hasValue("struct")) {
01852:
01853: yyOption1 = yyResult.index;
01854: yyOpValue1 = null;
01855:
01856: yyResult = pAttributeSpecifierList(yyOption1);
01857: yyError = yyResult.select(yyError);
01858: if (yyResult.hasValue()) {
01859: final Node v$el$1 = yyResult.semanticValue();
01860:
01861: yyOption1 = yyResult.index;
01862: yyOpValue1 = v$el$1;
01863: }
01864: { // Start scope for v$g$1.
01865: final Node v$g$1 = cast(yyOpValue1);
01866:
01867: final int yyChoice1 = yyOption1;
01868:
01869: // Nested alternative 1.
01870:
01871: yyOption1 = yyChoice1;
01872: yyOpValue1 = null;
01873:
01874: yyResult = pIdentifier(yyOption1);
01875: yyError = yyResult.select(yyError);
01876: if (yyResult.hasValue()) {
01877: final String v$el$2 = yyResult.semanticValue();
01878:
01879: yyOption1 = yyResult.index;
01880: yyOpValue1 = v$el$2;
01881: }
01882: { // Start scope for v$g$2.
01883: final String v$g$2 = cast(yyOpValue1);
01884:
01885: yyBase = yyOption1;
01886: yyResult = pSymbol(yyBase);
01887: yyError = yyResult.select(yyError);
01888: if (yyResult.hasValue("{")) {
01889:
01890: yyResult = pPushScope(yyResult.index);
01891: yyError = yyResult.select(yyError);
01892: if (yyResult.hasValue()) {
01893:
01894: yyResult = pEnterStructure(yyResult.index);
01895: yyError = yyResult.select(yyError);
01896: if (yyResult.hasValue()) {
01897:
01898: yyResult = pStructureDeclarationList(yyResult.index);
01899: yyError = yyResult.select(yyError);
01900: if (yyResult.hasValue()) {
01901: final Node v$g$3 = yyResult
01902: .semanticValue();
01903:
01904: yyBase = yyResult.index;
01905: yyResult = pSymbol(yyBase);
01906: yyError = yyResult.select(yyError);
01907: if (yyResult.hasValue("}")) {
01908:
01909: yyResult = pExitStructure(yyResult.index);
01910: yyError = yyResult
01911: .select(yyError);
01912: if (yyResult.hasValue()) {
01913:
01914: yyResult = pPopScope(yyResult.index);
01915: yyError = yyResult
01916: .select(yyError);
01917: if (yyResult.hasValue()) {
01918:
01919: yyOption1 = yyResult.index;
01920: yyOpValue1 = null;
01921:
01922: yyResult = pAttributeSpecifierList(yyOption1);
01923: yyError = yyResult
01924: .select(yyError);
01925: if (yyResult.hasValue()) {
01926: final Node v$el$3 = yyResult
01927: .semanticValue();
01928:
01929: yyOption1 = yyResult.index;
01930: yyOpValue1 = v$el$3;
01931: }
01932: { // Start scope for v$g$4.
01933: final Node v$g$4 = cast(yyOpValue1);
01934:
01935: yyValue = GNode
01936: .create(
01937: "StructureTypeDefinition",
01938: v$g$1,
01939: v$g$2,
01940: v$g$3,
01941: v$g$4);
01942: yyValue
01943: .setLocation(location(yyStart));
01944:
01945: return new SemanticValue(
01946: yyValue,
01947: yyOption1,
01948: yyError);
01949: } // End scope for v$g$4.
01950: }
01951: }
01952: } else {
01953: yyError = yyError.select(
01954: "\"}\" expected",
01955: yyBase);
01956: }
01957: }
01958: }
01959: }
01960: } else {
01961: yyError = yyError.select("\"{\" expected",
01962: yyBase);
01963: }
01964: } // End scope for v$g$2.
01965:
01966: // Nested alternative 2.
01967:
01968: yyResult = pIdentifier(yyChoice1);
01969: yyError = yyResult.select(yyError);
01970: if (yyResult.hasValue()) {
01971: final String v$g$2 = yyResult.semanticValue();
01972:
01973: yyValue = GNode.create("StructureTypeReference",
01974: v$g$1, v$g$2);
01975: yyValue.setLocation(location(yyStart));
01976:
01977: return yyResult.createValue(yyValue, yyError);
01978: }
01979: } // End scope for v$g$1.
01980: }
01981:
01982: // Done.
01983: yyError = yyError.select("structure type specifier expected",
01984: yyStart);
01985: return yyError;
01986: }
01987:
01988: // =========================================================================
01989:
01990: /**
01991: * Parse nonterminal xtc.lang.c4.C4.UnionTypeSpecifier.
01992: *
01993: * @param yyStart The index.
01994: * @return The result.
01995: * @throws IOException Signals an I/O error.
01996: */
01997: private Result pUnionTypeSpecifier(final int yyStart)
01998: throws IOException {
01999: Result yyResult;
02000: int yyBase;
02001: int yyOption1;
02002: Object yyOpValue1;
02003: Node yyValue;
02004: ParseError yyError = ParseError.DUMMY;
02005:
02006: // Alternative 1.
02007:
02008: yyResult = pKeyword(yyStart);
02009: yyError = yyResult.select(yyError);
02010: if (yyResult.hasValue("union")) {
02011:
02012: yyOption1 = yyResult.index;
02013: yyOpValue1 = null;
02014:
02015: yyResult = pAttributeSpecifierList(yyOption1);
02016: yyError = yyResult.select(yyError);
02017: if (yyResult.hasValue()) {
02018: final Node v$el$1 = yyResult.semanticValue();
02019:
02020: yyOption1 = yyResult.index;
02021: yyOpValue1 = v$el$1;
02022: }
02023: { // Start scope for v$g$1.
02024: final Node v$g$1 = cast(yyOpValue1);
02025:
02026: final int yyChoice1 = yyOption1;
02027:
02028: // Nested alternative 1.
02029:
02030: yyOption1 = yyChoice1;
02031: yyOpValue1 = null;
02032:
02033: yyResult = pIdentifier(yyOption1);
02034: yyError = yyResult.select(yyError);
02035: if (yyResult.hasValue()) {
02036: final String v$el$2 = yyResult.semanticValue();
02037:
02038: yyOption1 = yyResult.index;
02039: yyOpValue1 = v$el$2;
02040: }
02041: { // Start scope for v$g$2.
02042: final String v$g$2 = cast(yyOpValue1);
02043:
02044: yyBase = yyOption1;
02045: yyResult = pSymbol(yyBase);
02046: yyError = yyResult.select(yyError);
02047: if (yyResult.hasValue("{")) {
02048:
02049: yyResult = pPushScope(yyResult.index);
02050: yyError = yyResult.select(yyError);
02051: if (yyResult.hasValue()) {
02052:
02053: yyResult = pEnterStructure(yyResult.index);
02054: yyError = yyResult.select(yyError);
02055: if (yyResult.hasValue()) {
02056:
02057: yyResult = pStructureDeclarationList(yyResult.index);
02058: yyError = yyResult.select(yyError);
02059: if (yyResult.hasValue()) {
02060: final Node v$g$3 = yyResult
02061: .semanticValue();
02062:
02063: yyBase = yyResult.index;
02064: yyResult = pSymbol(yyBase);
02065: yyError = yyResult.select(yyError);
02066: if (yyResult.hasValue("}")) {
02067:
02068: yyResult = pExitStructure(yyResult.index);
02069: yyError = yyResult
02070: .select(yyError);
02071: if (yyResult.hasValue()) {
02072:
02073: yyResult = pPopScope(yyResult.index);
02074: yyError = yyResult
02075: .select(yyError);
02076: if (yyResult.hasValue()) {
02077:
02078: yyOption1 = yyResult.index;
02079: yyOpValue1 = null;
02080:
02081: yyResult = pAttributeSpecifierList(yyOption1);
02082: yyError = yyResult
02083: .select(yyError);
02084: if (yyResult.hasValue()) {
02085: final Node v$el$3 = yyResult
02086: .semanticValue();
02087:
02088: yyOption1 = yyResult.index;
02089: yyOpValue1 = v$el$3;
02090: }
02091: { // Start scope for v$g$4.
02092: final Node v$g$4 = cast(yyOpValue1);
02093:
02094: yyValue = GNode
02095: .create(
02096: "UnionTypeDefinition",
02097: v$g$1,
02098: v$g$2,
02099: v$g$3,
02100: v$g$4);
02101: yyValue
02102: .setLocation(location(yyStart));
02103:
02104: return new SemanticValue(
02105: yyValue,
02106: yyOption1,
02107: yyError);
02108: } // End scope for v$g$4.
02109: }
02110: }
02111: } else {
02112: yyError = yyError.select(
02113: "\"}\" expected",
02114: yyBase);
02115: }
02116: }
02117: }
02118: }
02119: } else {
02120: yyError = yyError.select("\"{\" expected",
02121: yyBase);
02122: }
02123: } // End scope for v$g$2.
02124:
02125: // Nested alternative 2.
02126:
02127: yyResult = pIdentifier(yyChoice1);
02128: yyError = yyResult.select(yyError);
02129: if (yyResult.hasValue()) {
02130: final String v$g$2 = yyResult.semanticValue();
02131:
02132: yyValue = GNode.create("UnionTypeReference", v$g$1,
02133: v$g$2);
02134: yyValue.setLocation(location(yyStart));
02135:
02136: return yyResult.createValue(yyValue, yyError);
02137: }
02138: } // End scope for v$g$1.
02139: }
02140:
02141: // Done.
02142: yyError = yyError.select("union type specifier expected",
02143: yyStart);
02144: return yyError;
02145: }
02146:
02147: // =========================================================================
02148:
02149: /**
02150: * Parse nonterminal xtc.lang.c4.C4.StructureDeclarationList.
02151: *
02152: * @param yyStart The index.
02153: * @return The result.
02154: * @throws IOException Signals an I/O error.
02155: */
02156: private Result pStructureDeclarationList(final int yyStart)
02157: throws IOException {
02158:
02159: Result yyResult;
02160: int yyRepetition1;
02161: boolean yyRepeated1;
02162: Pair<Node> yyRepValue1;
02163: Node yyValue;
02164: ParseError yyError = ParseError.DUMMY;
02165:
02166: // Alternative <Regular>.
02167:
02168: yyRepetition1 = yyStart;
02169: yyRepeated1 = false;
02170: yyRepValue1 = Pair.empty();
02171: while (true) {
02172:
02173: yyResult = pAnnotatedStructureDeclaration(yyRepetition1);
02174: yyError = yyResult.select(yyError);
02175: if (yyResult.hasValue()) {
02176: final Node v$el$1 = yyResult.semanticValue();
02177:
02178: yyRepetition1 = yyResult.index;
02179: yyRepeated1 = true;
02180: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
02181: continue;
02182: }
02183: break;
02184: }
02185:
02186: if (yyRepeated1) {
02187: final Pair<Node> v$g$1 = yyRepValue1.reverse();
02188:
02189: yyResult = pAnnotations(yyRepetition1);
02190: yyError = yyResult.select(yyError);
02191: if (yyResult.hasValue()) {
02192: final Node v$g$2 = yyResult.semanticValue();
02193:
02194: yyValue = GNode.create("StructureDeclarationList",
02195: v$g$1.size() + 1).addAll(v$g$1).add(v$g$2);
02196: yyValue.setLocation(location(yyStart));
02197:
02198: return yyResult.createValue(yyValue, yyError);
02199: }
02200: }
02201:
02202: // Alternative <Empty>.
02203:
02204: if (GCC) {
02205:
02206: yyResult = pAnnotations(yyStart);
02207: yyError = yyResult.select(yyError);
02208: if (yyResult.hasValue()) {
02209: final Node v$g$3 = yyResult.semanticValue();
02210:
02211: yyValue = GNode.create("StructureDeclarationList",
02212: v$g$3);
02213: yyValue.setLocation(location(yyStart));
02214:
02215: return yyResult.createValue(yyValue, yyError);
02216: }
02217: }
02218:
02219: // Done.
02220: yyError = yyError.select("structure declaration list expected",
02221: yyStart);
02222: return yyError;
02223: }
02224:
02225: // =========================================================================
02226:
02227: /**
02228: * Parse nonterminal xtc.lang.c4.C4.AnnotatedStructureDeclaration.
02229: *
02230: * @param yyStart The index.
02231: * @return The result.
02232: * @throws IOException Signals an I/O error.
02233: */
02234: private Result pAnnotatedStructureDeclaration(final int yyStart)
02235: throws IOException {
02236:
02237: Result yyResult;
02238: Node yyValue;
02239: ParseError yyError = ParseError.DUMMY;
02240:
02241: // Start a state modification.
02242: yyState.start();
02243:
02244: // Alternative 1.
02245:
02246: yyState.mark();
02247:
02248: yyResult = pStructureDeclaration(yyStart);
02249: yyError = yyResult.select(yyError);
02250: if (yyResult.hasValue()) {
02251: final Node d = yyResult.semanticValue();
02252:
02253: yyValue = yyState.annotate(d);
02254:
02255: // Commit the state modification.
02256: yyState.commit();
02257:
02258: setLocation(yyValue, yyStart);
02259: return yyResult.createValue(yyValue, yyError);
02260: }
02261:
02262: // Abort the state modification.
02263: yyState.abort();
02264:
02265: // Done.
02266: return yyError;
02267: }
02268:
02269: // =========================================================================
02270:
02271: /**
02272: * Parse nonterminal xtc.lang.c4.C4.StructureDeclaration.
02273: *
02274: * @param yyStart The index.
02275: * @return The result.
02276: * @throws IOException Signals an I/O error.
02277: */
02278: private Result pStructureDeclaration(final int yyStart)
02279: throws IOException {
02280: Result yyResult;
02281: int yyBase;
02282: int yyRepetition1;
02283: boolean yyRepeated1;
02284: int yyOption1;
02285: String yyOpValue1;
02286: Node yyValue;
02287: ParseError yyError = ParseError.DUMMY;
02288:
02289: // Alternative 1.
02290:
02291: yyOption1 = yyStart;
02292: yyOpValue1 = null;
02293:
02294: yyBase = yyOption1;
02295: yyResult = pKeyword(yyBase);
02296: yyError = yyResult.select(yyError);
02297: if (yyResult.hasValue("__extension__")) {
02298: final String v$el$1 = "__extension__";
02299:
02300: yyOption1 = yyResult.index;
02301: yyOpValue1 = v$el$1;
02302: } else {
02303: yyError = yyError.select("\"__extension__\" expected",
02304: yyBase);
02305: }
02306: { // Start scope for v$g$1.
02307: final String v$g$1 = yyOpValue1;
02308:
02309: final int yyChoice1 = yyOption1;
02310:
02311: // Nested alternative 1.
02312:
02313: yyResult = pSpecifierQualifierList(yyChoice1);
02314: yyError = yyResult.select(yyError);
02315: if (yyResult.hasValue()) {
02316: final Node v$g$2 = yyResult.semanticValue();
02317:
02318: yyResult = pOptionalStructureDeclaratorList(yyResult.index);
02319: yyError = yyResult.select(yyError);
02320: if (yyResult.hasValue()) {
02321: final Node v$g$3 = yyResult.semanticValue();
02322:
02323: yyBase = yyResult.index;
02324: yyResult = pSymbol(yyBase);
02325: yyError = yyResult.select(yyError);
02326: if (yyResult.hasValue(";")) {
02327:
02328: yyOption1 = yyResult.index;
02329:
02330: if (GCC) {
02331:
02332: yyRepetition1 = yyOption1;
02333: yyRepeated1 = false;
02334: while (true) {
02335:
02336: yyBase = yyRepetition1;
02337: yyResult = pSymbol(yyBase);
02338: yyError = yyResult.select(yyError);
02339: if (yyResult.hasValue(";")) {
02340:
02341: yyRepetition1 = yyResult.index;
02342: yyRepeated1 = true;
02343: continue;
02344: } else {
02345: yyError = yyError.select(
02346: "\";\" expected", yyBase);
02347: }
02348: break;
02349: }
02350:
02351: if (yyRepeated1) {
02352:
02353: yyOption1 = yyRepetition1;
02354: }
02355: }
02356:
02357: yyValue = GNode.create("StructureDeclaration",
02358: v$g$1, v$g$2, v$g$3);
02359: yyValue.setLocation(location(yyStart));
02360:
02361: return new SemanticValue(yyValue, yyOption1,
02362: yyError);
02363: } else {
02364: yyError = yyError.select("\";\" expected",
02365: yyBase);
02366: }
02367: }
02368: }
02369:
02370: // Nested alternative 2.
02371:
02372: yyResult = pAspectStructureDeclaration(yyChoice1);
02373: yyError = yyResult.select(yyError);
02374: if (yyResult.hasValue()) {
02375: final Node v$g$4 = yyResult.semanticValue();
02376:
02377: yyBase = yyResult.index;
02378: yyResult = pSymbol(yyBase);
02379: yyError = yyResult.select(yyError);
02380: if (yyResult.hasValue(";")) {
02381:
02382: yyValue = GNode.create("StructureDeclaration",
02383: v$g$1, v$g$4);
02384: yyValue.setLocation(location(yyStart));
02385:
02386: return yyResult.createValue(yyValue, yyError);
02387: } else {
02388: yyError = yyError.select("\";\" expected", yyBase);
02389: }
02390: }
02391: } // End scope for v$g$1.
02392:
02393: // Done.
02394: yyError = yyError.select("structure declaration expected",
02395: yyStart);
02396: return yyError;
02397: }
02398:
02399: // =========================================================================
02400:
02401: /**
02402: * Parse nonterminal xtc.lang.c4.C4.SpecifierQualifierList.
02403: *
02404: * @param yyStart The index.
02405: * @return The result.
02406: * @throws IOException Signals an I/O error.
02407: */
02408: private Result pSpecifierQualifierList(final int yyStart)
02409: throws IOException {
02410:
02411: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
02412: if (null == yyColumn.chunk1)
02413: yyColumn.chunk1 = new Chunk1();
02414: if (null == yyColumn.chunk1.fSpecifierQualifierList)
02415: yyColumn.chunk1.fSpecifierQualifierList = pSpecifierQualifierList$1(yyStart);
02416: return yyColumn.chunk1.fSpecifierQualifierList;
02417: }
02418:
02419: /** Actually parse xtc.lang.c4.C4.SpecifierQualifierList. */
02420: private Result pSpecifierQualifierList$1(final int yyStart)
02421: throws IOException {
02422:
02423: Result yyResult;
02424: Node yyValue;
02425: ParseError yyError = ParseError.DUMMY;
02426:
02427: // Alternative 1.
02428:
02429: yyResult = pSpecifierQualifierPlus(yyStart);
02430: yyError = yyResult.select(yyError);
02431: if (yyResult.hasValue()) {
02432: final Pair<Node> v$g$1 = yyResult.semanticValue();
02433:
02434: yyValue = GNode.createFromPair("SpecifierQualifierList",
02435: v$g$1);
02436: yyValue.setLocation(location(yyStart));
02437:
02438: return yyResult.createValue(yyValue, yyError);
02439: }
02440:
02441: // Done.
02442: return yyError;
02443: }
02444:
02445: // =========================================================================
02446:
02447: /**
02448: * Parse nonterminal xtc.lang.c4.C4.SpecifierQualifierPlus.
02449: *
02450: * @param yyStart The index.
02451: * @return The result.
02452: * @throws IOException Signals an I/O error.
02453: */
02454: private Result pSpecifierQualifierPlus(final int yyStart)
02455: throws IOException {
02456:
02457: Result yyResult;
02458: int yyRepetition1;
02459: boolean yyRepeated1;
02460: Pair<Node> yyRepValue1;
02461: Pair<Node> yyValue;
02462: ParseError yyError = ParseError.DUMMY;
02463:
02464: // Alternative 1.
02465:
02466: yyRepetition1 = yyStart;
02467: yyRepeated1 = false;
02468: yyRepValue1 = Pair.empty();
02469: while (true) {
02470:
02471: yyResult = pSpecifierQualifier(yyRepetition1);
02472: yyError = yyResult.select(yyError);
02473: if (yyResult.hasValue()) {
02474: final Node v$el$1 = yyResult.semanticValue();
02475:
02476: yyRepetition1 = yyResult.index;
02477: yyRepeated1 = true;
02478: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
02479: continue;
02480: }
02481: break;
02482: }
02483:
02484: if (yyRepeated1) {
02485: yyValue = yyRepValue1.reverse();
02486:
02487: return new SemanticValue(yyValue, yyRepetition1, yyError);
02488: }
02489:
02490: // Done.
02491: return yyError;
02492: }
02493:
02494: // =========================================================================
02495:
02496: /**
02497: * Parse nonterminal xtc.lang.c4.C4.SpecifierQualifier.
02498: *
02499: * @param yyStart The index.
02500: * @return The result.
02501: * @throws IOException Signals an I/O error.
02502: */
02503: private Result pSpecifierQualifier(final int yyStart)
02504: throws IOException {
02505: Result yyResult;
02506: Node yyValue;
02507: ParseError yyError = ParseError.DUMMY;
02508:
02509: // Alternative <TypeSpecifier>.
02510:
02511: yyResult = pTypeSpecifier(yyStart);
02512: yyError = yyResult.select(yyError);
02513: if (yyResult.hasValue()) {
02514: yyValue = yyResult.semanticValue();
02515:
02516: yyResult = pTypeSpecContext(yyResult.index);
02517: yyError = yyResult.select(yyError);
02518: if (yyResult.hasValue()) {
02519:
02520: return yyResult.createValue(yyValue, yyError);
02521: }
02522: }
02523:
02524: // Alternative <TypeQualifier>.
02525:
02526: yyResult = pTypeQualifier(yyStart);
02527: yyError = yyResult.select(yyError);
02528: if (yyResult.hasValue()) {
02529: yyValue = yyResult.semanticValue();
02530:
02531: return yyResult.createValue(yyValue, yyError);
02532: }
02533:
02534: // Alternative <Attribute>.
02535:
02536: yyResult = pAttributeSpecifier(yyStart);
02537: yyError = yyResult.select(yyError);
02538: if (yyResult.hasValue()) {
02539: yyValue = yyResult.semanticValue();
02540:
02541: return yyResult.createValue(yyValue, yyError);
02542: }
02543:
02544: // Done.
02545: return yyError;
02546: }
02547:
02548: // =========================================================================
02549:
02550: /**
02551: * Parse nonterminal xtc.lang.c4.C4.OptionalStructureDeclaratorList.
02552: *
02553: * @param yyStart The index.
02554: * @return The result.
02555: * @throws IOException Signals an I/O error.
02556: */
02557: private Result pOptionalStructureDeclaratorList(final int yyStart)
02558: throws IOException {
02559:
02560: Result yyResult;
02561: Node yyValue;
02562: ParseError yyError = ParseError.DUMMY;
02563:
02564: // Alternative <List>.
02565:
02566: yyResult = pStructureDeclaratorList(yyStart);
02567: yyError = yyResult.select(yyError);
02568: if (yyResult.hasValue()) {
02569: yyValue = yyResult.semanticValue();
02570:
02571: return yyResult.createValue(yyValue, yyError);
02572: }
02573:
02574: // Alternative <Null>.
02575:
02576: if (GCC) {
02577: { // Start scope for yyValue.
02578: yyValue = null;
02579:
02580: return new SemanticValue(yyValue, yyStart, yyError);
02581: } // End scope for yyValue.
02582: }
02583:
02584: // Done.
02585: yyError = yyError.select(
02586: "optional structure declarator list expected", yyStart);
02587: return yyError;
02588: }
02589:
02590: // =========================================================================
02591:
02592: /**
02593: * Parse nonterminal xtc.lang.c4.C4.StructureDeclaratorList.
02594: *
02595: * @param yyStart The index.
02596: * @return The result.
02597: * @throws IOException Signals an I/O error.
02598: */
02599: private Result pStructureDeclaratorList(final int yyStart)
02600: throws IOException {
02601:
02602: Result yyResult;
02603: int yyBase;
02604: int yyRepetition1;
02605: Pair<Node> yyRepValue1;
02606: Node yyValue;
02607: ParseError yyError = ParseError.DUMMY;
02608:
02609: // Alternative <List>.
02610:
02611: yyResult = pStructureDeclarator(yyStart);
02612: yyError = yyResult.select(yyError);
02613: if (yyResult.hasValue()) {
02614: final Node v$g$1 = yyResult.semanticValue();
02615:
02616: yyRepetition1 = yyResult.index;
02617: yyRepValue1 = Pair.empty();
02618: while (true) {
02619:
02620: yyBase = yyRepetition1;
02621: yyResult = pSymbol(yyBase);
02622: yyError = yyResult.select(yyError);
02623: if (yyResult.hasValue(",")) {
02624:
02625: yyResult = pStructureDeclarator(yyResult.index);
02626: yyError = yyResult.select(yyError);
02627: if (yyResult.hasValue()) {
02628: final Node v$el$1 = yyResult.semanticValue();
02629:
02630: yyRepetition1 = yyResult.index;
02631: yyRepValue1 = new Pair<Node>(v$el$1,
02632: yyRepValue1);
02633: continue;
02634: }
02635: } else {
02636: yyError = yyError.select("\",\" expected", yyBase);
02637: }
02638: break;
02639: }
02640: { // Start scope for v$g$2.
02641: final Pair<Node> v$g$2 = yyRepValue1.reverse();
02642:
02643: yyValue = GNode.createFromPair(
02644: "StructureDeclaratorList", v$g$1, v$g$2);
02645: yyValue.setLocation(location(yyStart));
02646:
02647: return new SemanticValue(yyValue, yyRepetition1,
02648: yyError);
02649: } // End scope for v$g$2.
02650: }
02651:
02652: // Done.
02653: return yyError;
02654: }
02655:
02656: // =========================================================================
02657:
02658: /**
02659: * Parse nonterminal xtc.lang.c4.C4.StructureDeclarator.
02660: *
02661: * @param yyStart The index.
02662: * @return The result.
02663: * @throws IOException Signals an I/O error.
02664: */
02665: private Result pStructureDeclarator(final int yyStart)
02666: throws IOException {
02667: Result yyResult;
02668: int yyBase;
02669: int yyOption1;
02670: Node yyOpValue1;
02671: Node yyValue;
02672: ParseError yyError = ParseError.DUMMY;
02673:
02674: // Alternative 1.
02675:
02676: yyOption1 = yyStart;
02677: yyOpValue1 = null;
02678:
02679: yyResult = pAttributeSpecifierList(yyOption1);
02680: yyError = yyResult.select(yyError);
02681: if (yyResult.hasValue()) {
02682: final Node v$el$1 = yyResult.semanticValue();
02683:
02684: yyOption1 = yyResult.index;
02685: yyOpValue1 = v$el$1;
02686: }
02687: { // Start scope for v$g$1.
02688: final Node v$g$1 = yyOpValue1;
02689:
02690: yyOpValue1 = null;
02691:
02692: yyResult = pDeclarator(yyOption1);
02693: yyError = yyResult.select(yyError);
02694: if (yyResult.hasValue()) {
02695: final Node v$el$2 = yyResult.semanticValue();
02696:
02697: yyOption1 = yyResult.index;
02698: yyOpValue1 = v$el$2;
02699: }
02700: { // Start scope for v$g$2.
02701: final Node v$g$2 = yyOpValue1;
02702:
02703: yyBase = yyOption1;
02704: yyResult = pSymbol(yyBase);
02705: yyError = yyResult.select(yyError);
02706: if (yyResult.hasValue(":")) {
02707:
02708: yyResult = pConditionalExpression(yyResult.index);
02709: yyError = yyResult.select(yyError);
02710: if (yyResult.hasValue()) {
02711: final Node v$g$3 = yyResult.semanticValue();
02712:
02713: yyOption1 = yyResult.index;
02714: yyOpValue1 = null;
02715:
02716: yyResult = pAttributeSpecifierList(yyOption1);
02717: yyError = yyResult.select(yyError);
02718: if (yyResult.hasValue()) {
02719: final Node v$el$3 = yyResult
02720: .semanticValue();
02721:
02722: yyOption1 = yyResult.index;
02723: yyOpValue1 = v$el$3;
02724: }
02725: { // Start scope for v$g$4.
02726: final Node v$g$4 = yyOpValue1;
02727:
02728: yyValue = GNode.create("BitField", v$g$1,
02729: v$g$2, v$g$3, v$g$4);
02730: yyValue.setLocation(location(yyStart));
02731:
02732: return new SemanticValue(yyValue,
02733: yyOption1, yyError);
02734: } // End scope for v$g$4.
02735: }
02736: } else {
02737: yyError = yyError.select("\":\" expected", yyBase);
02738: }
02739: } // End scope for v$g$2.
02740: } // End scope for v$g$1.
02741:
02742: // Alternative <Simple>.
02743:
02744: yyResult = pAttributedDeclarator(yyStart);
02745: yyError = yyResult.select(yyError);
02746: if (yyResult.hasValue()) {
02747: yyValue = yyResult.semanticValue();
02748:
02749: return yyResult.createValue(yyValue, yyError);
02750: }
02751:
02752: // Done.
02753: return yyError;
02754: }
02755:
02756: // =========================================================================
02757:
02758: /**
02759: * Parse nonterminal xtc.lang.c4.C4.AttributedDeclarator.
02760: *
02761: * @param yyStart The index.
02762: * @return The result.
02763: * @throws IOException Signals an I/O error.
02764: */
02765: private Result pAttributedDeclarator(final int yyStart)
02766: throws IOException {
02767: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
02768: if (null == yyColumn.chunk1)
02769: yyColumn.chunk1 = new Chunk1();
02770: if (null == yyColumn.chunk1.fAttributedDeclarator)
02771: yyColumn.chunk1.fAttributedDeclarator = pAttributedDeclarator$1(yyStart);
02772: return yyColumn.chunk1.fAttributedDeclarator;
02773: }
02774:
02775: /** Actually parse xtc.lang.c4.C4.AttributedDeclarator. */
02776: private Result pAttributedDeclarator$1(final int yyStart)
02777: throws IOException {
02778:
02779: Result yyResult;
02780: int yyOption1;
02781: Node yyOpValue1;
02782: Node yyValue;
02783: ParseError yyError = ParseError.DUMMY;
02784:
02785: // Alternative 1.
02786:
02787: yyOption1 = yyStart;
02788: yyOpValue1 = null;
02789:
02790: yyResult = pAttributeSpecifierList(yyOption1);
02791: yyError = yyResult.select(yyError);
02792: if (yyResult.hasValue()) {
02793: final Node v$el$1 = yyResult.semanticValue();
02794:
02795: yyOption1 = yyResult.index;
02796: yyOpValue1 = v$el$1;
02797: }
02798: { // Start scope for v$g$1.
02799: final Node v$g$1 = yyOpValue1;
02800:
02801: yyResult = pDeclarator(yyOption1);
02802: yyError = yyResult.select(yyError);
02803: if (yyResult.hasValue()) {
02804: final Node v$g$2 = yyResult.semanticValue();
02805:
02806: yyOption1 = yyResult.index;
02807: yyOpValue1 = null;
02808:
02809: yyResult = pAttributeSpecifierList(yyOption1);
02810: yyError = yyResult.select(yyError);
02811: if (yyResult.hasValue()) {
02812: final Node v$el$2 = yyResult.semanticValue();
02813:
02814: yyOption1 = yyResult.index;
02815: yyOpValue1 = v$el$2;
02816: }
02817: { // Start scope for v$g$3.
02818: final Node v$g$3 = yyOpValue1;
02819:
02820: yyValue = GNode.create("AttributedDeclarator",
02821: v$g$1, v$g$2, v$g$3);
02822: yyValue.setLocation(location(yyStart));
02823:
02824: return new SemanticValue(yyValue, yyOption1,
02825: yyError);
02826: } // End scope for v$g$3.
02827: }
02828: } // End scope for v$g$1.
02829:
02830: // Done.
02831: return yyError;
02832: }
02833:
02834: // =========================================================================
02835:
02836: /**
02837: * Parse nonterminal xtc.lang.c4.C4.Declarator.
02838: *
02839: * @param yyStart The index.
02840: * @return The result.
02841: * @throws IOException Signals an I/O error.
02842: */
02843: private Result pDeclarator(final int yyStart) throws IOException {
02844: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
02845: if (null == yyColumn.chunk1)
02846: yyColumn.chunk1 = new Chunk1();
02847: if (null == yyColumn.chunk1.fDeclarator)
02848: yyColumn.chunk1.fDeclarator = pDeclarator$1(yyStart);
02849: return yyColumn.chunk1.fDeclarator;
02850: }
02851:
02852: /** Actually parse xtc.lang.c4.C4.Declarator. */
02853: private Result pDeclarator$1(final int yyStart) throws IOException {
02854: Result yyResult;
02855: Node yyValue;
02856: ParseError yyError = ParseError.DUMMY;
02857:
02858: // Alternative <Pointer>.
02859:
02860: yyResult = pPointerDeclarator(yyStart);
02861: yyError = yyResult.select(yyError);
02862: if (yyResult.hasValue()) {
02863: yyValue = yyResult.semanticValue();
02864:
02865: return yyResult.createValue(yyValue, yyError);
02866: }
02867:
02868: // Alternative <Direct>.
02869:
02870: yyResult = pDirectDeclarator(yyStart);
02871: yyError = yyResult.select(yyError);
02872: if (yyResult.hasValue()) {
02873: yyValue = yyResult.semanticValue();
02874:
02875: return yyResult.createValue(yyValue, yyError);
02876: }
02877:
02878: // Done.
02879: return yyError;
02880: }
02881:
02882: // =========================================================================
02883:
02884: /**
02885: * Parse nonterminal xtc.lang.c4.C4.PointerDeclarator.
02886: *
02887: * @param yyStart The index.
02888: * @return The result.
02889: * @throws IOException Signals an I/O error.
02890: */
02891: private Result pPointerDeclarator(final int yyStart)
02892: throws IOException {
02893: Result yyResult;
02894: Node yyValue;
02895: ParseError yyError = ParseError.DUMMY;
02896:
02897: // Alternative 1.
02898:
02899: yyResult = pPointer(yyStart);
02900: yyError = yyResult.select(yyError);
02901: if (yyResult.hasValue()) {
02902: final Node v$g$1 = yyResult.semanticValue();
02903:
02904: yyResult = pDirectDeclarator(yyResult.index);
02905: yyError = yyResult.select(yyError);
02906: if (yyResult.hasValue()) {
02907: final Node v$g$2 = yyResult.semanticValue();
02908:
02909: yyValue = GNode.create("PointerDeclarator", v$g$1,
02910: v$g$2);
02911: yyValue.setLocation(location(yyStart));
02912:
02913: return yyResult.createValue(yyValue, yyError);
02914: }
02915: }
02916:
02917: // Done.
02918: return yyError;
02919: }
02920:
02921: // =========================================================================
02922:
02923: /**
02924: * Parse nonterminal xtc.lang.c4.C4.Pointer.
02925: *
02926: * @param yyStart The index.
02927: * @return The result.
02928: * @throws IOException Signals an I/O error.
02929: */
02930: private Result pPointer(final int yyStart) throws IOException {
02931: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
02932: if (null == yyColumn.chunk1)
02933: yyColumn.chunk1 = new Chunk1();
02934: if (null == yyColumn.chunk1.fPointer)
02935: yyColumn.chunk1.fPointer = pPointer$1(yyStart);
02936: return yyColumn.chunk1.fPointer;
02937: }
02938:
02939: /** Actually parse xtc.lang.c4.C4.Pointer. */
02940: private Result pPointer$1(final int yyStart) throws IOException {
02941: Result yyResult;
02942: int yyOption1;
02943: Node yyOpValue1;
02944: Node yyValue;
02945: ParseError yyError = ParseError.DUMMY;
02946:
02947: // Alternative 1.
02948:
02949: yyResult = pSymbol(yyStart);
02950: yyError = yyResult.select(yyError);
02951: if (yyResult.hasValue("*")) {
02952:
02953: yyResult = pTypeQualifierList(yyResult.index);
02954: yyError = yyResult.select(yyError);
02955: if (yyResult.hasValue()) {
02956: final Node v$g$1 = yyResult.semanticValue();
02957:
02958: yyOption1 = yyResult.index;
02959: yyOpValue1 = null;
02960:
02961: yyResult = pPointer(yyOption1);
02962: yyError = yyResult.select(yyError);
02963: if (yyResult.hasValue()) {
02964: final Node v$el$1 = yyResult.semanticValue();
02965:
02966: yyOption1 = yyResult.index;
02967: yyOpValue1 = v$el$1;
02968: }
02969: { // Start scope for v$g$2.
02970: final Node v$g$2 = yyOpValue1;
02971:
02972: yyValue = GNode.create("Pointer", v$g$1, v$g$2);
02973: yyValue.setLocation(location(yyStart));
02974:
02975: return new SemanticValue(yyValue, yyOption1,
02976: yyError);
02977: } // End scope for v$g$2.
02978: }
02979: }
02980:
02981: // Done.
02982: yyError = yyError.select("pointer expected", yyStart);
02983: return yyError;
02984: }
02985:
02986: // =========================================================================
02987:
02988: /**
02989: * Parse nonterminal xtc.lang.c4.C4.TypeQualifierList.
02990: *
02991: * @param yyStart The index.
02992: * @return The result.
02993: * @throws IOException Signals an I/O error.
02994: */
02995: private Result pTypeQualifierList(final int yyStart)
02996: throws IOException {
02997: Result yyResult;
02998: int yyRepetition1;
02999: Pair<Node> yyRepValue1;
03000: Node yyValue;
03001: ParseError yyError = ParseError.DUMMY;
03002:
03003: // Alternative 1.
03004:
03005: yyRepetition1 = yyStart;
03006: yyRepValue1 = Pair.empty();
03007: while (true) {
03008:
03009: yyResult = pTypeQualifierList$$Choice1(yyRepetition1);
03010: yyError = yyResult.select(yyError);
03011: if (yyResult.hasValue()) {
03012: final Node v$el$1 = yyResult.semanticValue();
03013:
03014: yyRepetition1 = yyResult.index;
03015: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
03016: continue;
03017: }
03018: break;
03019: }
03020: { // Start scope for v$g$1.
03021: final Pair<Node> v$g$1 = yyRepValue1.reverse();
03022:
03023: yyValue = GNode.createFromPair("TypeQualifierList", v$g$1);
03024: yyValue.setLocation(location(yyStart));
03025:
03026: return new SemanticValue(yyValue, yyRepetition1, yyError);
03027: } // End scope for v$g$1.
03028: }
03029:
03030: // =========================================================================
03031:
03032: /**
03033: * Parse synthetic nonterminal xtc.lang.c4.C4.TypeQualifierList$$Choice1.
03034: *
03035: * @param yyStart The index.
03036: * @return The result.
03037: * @throws IOException Signals an I/O error.
03038: */
03039: private Result pTypeQualifierList$$Choice1(final int yyStart)
03040: throws IOException {
03041:
03042: Result yyResult;
03043: Node yyValue;
03044: ParseError yyError = ParseError.DUMMY;
03045:
03046: // Alternative 1.
03047:
03048: yyResult = pTypeQualifier(yyStart);
03049: yyError = yyResult.select(yyError);
03050: if (yyResult.hasValue()) {
03051: yyValue = yyResult.semanticValue();
03052:
03053: return yyResult.createValue(yyValue, yyError);
03054: }
03055:
03056: // Alternative 2.
03057:
03058: yyResult = pAttributeSpecifier(yyStart);
03059: yyError = yyResult.select(yyError);
03060: if (yyResult.hasValue()) {
03061: yyValue = yyResult.semanticValue();
03062:
03063: return yyResult.createValue(yyValue, yyError);
03064: }
03065:
03066: // Done.
03067: return yyError;
03068: }
03069:
03070: // =========================================================================
03071:
03072: /**
03073: * Parse nonterminal xtc.lang.c4.C4.DirectDeclarator.
03074: *
03075: * @param yyStart The index.
03076: * @return The result.
03077: * @throws IOException Signals an I/O error.
03078: */
03079: private Result pDirectDeclarator(final int yyStart)
03080: throws IOException {
03081: Result yyResult;
03082: int yyBase;
03083: int yyRepetition1;
03084: Pair<Action<Node>> yyRepValue1;
03085: Node yyValue;
03086: ParseError yyError = ParseError.DUMMY;
03087:
03088: // Alternative <FullBase>.
03089:
03090: yyResult = pSymbol(yyStart);
03091: yyError = yyResult.select(yyError);
03092: if (yyResult.hasValue("(")) {
03093:
03094: yyResult = pAttributedDeclarator(yyResult.index);
03095: yyError = yyResult.select(yyError);
03096: if (yyResult.hasValue()) {
03097: final Node v$g$7 = yyResult.semanticValue();
03098:
03099: yyBase = yyResult.index;
03100: yyResult = pSymbol(yyBase);
03101: yyError = yyResult.select(yyError);
03102: if (yyResult.hasValue(")")) {
03103:
03104: yyRepetition1 = yyResult.index;
03105: yyRepValue1 = Pair.empty();
03106: while (true) {
03107:
03108: yyResult = pDirectDeclarator$$Tail1(yyRepetition1);
03109: yyError = yyResult.select(yyError);
03110: if (yyResult.hasValue()) {
03111: final Action<Node> v$8 = yyResult
03112: .semanticValue();
03113:
03114: yyRepetition1 = yyResult.index;
03115: yyRepValue1 = new Pair<Action<Node>>(v$8,
03116: yyRepValue1);
03117: continue;
03118: }
03119: break;
03120: }
03121: { // Start scope for v$9.
03122: final Pair<Action<Node>> v$9 = yyRepValue1
03123: .reverse();
03124:
03125: yyValue = apply(v$9, v$g$7, yyStart);
03126:
03127: return new SemanticValue(yyValue,
03128: yyRepetition1, yyError);
03129: } // End scope for v$9.
03130: } else {
03131: yyError = yyError.select("\")\" expected", yyBase);
03132: }
03133: }
03134: }
03135:
03136: // Alternative <SimpleBase>.
03137:
03138: yyResult = pSimpleDeclarator(yyStart);
03139: yyError = yyResult.select(yyError);
03140: if (yyResult.hasValue()) {
03141: final Node v$g$10 = yyResult.semanticValue();
03142:
03143: yyRepetition1 = yyResult.index;
03144: yyRepValue1 = Pair.empty();
03145: while (true) {
03146:
03147: yyResult = pDirectDeclarator$$Tail1(yyRepetition1);
03148: yyError = yyResult.select(yyError);
03149: if (yyResult.hasValue()) {
03150: final Action<Node> v$11 = yyResult.semanticValue();
03151:
03152: yyRepetition1 = yyResult.index;
03153: yyRepValue1 = new Pair<Action<Node>>(v$11,
03154: yyRepValue1);
03155: continue;
03156: }
03157: break;
03158: }
03159: { // Start scope for v$12.
03160: final Pair<Action<Node>> v$12 = yyRepValue1.reverse();
03161:
03162: yyValue = apply(v$12, v$g$10, yyStart);
03163:
03164: return new SemanticValue(yyValue, yyRepetition1,
03165: yyError);
03166: } // End scope for v$12.
03167: }
03168:
03169: // Done.
03170: yyError = yyError.select("direct declarator expected", yyStart);
03171: return yyError;
03172: }
03173:
03174: // =========================================================================
03175:
03176: /**
03177: * Parse synthetic nonterminal xtc.lang.c4.C4.DirectDeclarator$$Tail1.
03178: *
03179: * @param yyStart The index.
03180: * @return The result.
03181: * @throws IOException Signals an I/O error.
03182: */
03183: private Result pDirectDeclarator$$Tail1(final int yyStart)
03184: throws IOException {
03185:
03186: Result yyResult;
03187: int yyBase;
03188: int yyOption1;
03189: Node yyOpValue1;
03190: Action<Node> yyValue;
03191: ParseError yyError = ParseError.DUMMY;
03192:
03193: // Alternative 1.
03194:
03195: yyResult = pSymbol(yyStart);
03196: yyError = yyResult.select(yyError);
03197: if (yyResult.hasValue("(")) {
03198:
03199: yyResult = pPushScope(yyResult.index);
03200: yyError = yyResult.select(yyError);
03201: if (yyResult.hasValue()) {
03202:
03203: final int yyChoice1 = yyResult.index;
03204:
03205: // Nested alternative 1.
03206:
03207: yyResult = pParameterTypeList(yyChoice1);
03208: yyError = yyResult.select(yyError);
03209: if (yyResult.hasValue()) {
03210: final Node v$g$2 = yyResult.semanticValue();
03211:
03212: yyBase = yyResult.index;
03213: yyResult = pSymbol(yyBase);
03214: yyError = yyResult.select(yyError);
03215: if (yyResult.hasValue(")")) {
03216:
03217: yyResult = pParameterContext(yyResult.index);
03218: yyError = yyResult.select(yyError);
03219: if (yyResult.hasValue()) {
03220:
03221: yyValue = new Action<Node>() {
03222: public Node run(Node v$1) {
03223: return GNode.create(
03224: "FunctionDeclarator", v$1,
03225: v$g$2);
03226: }
03227: };
03228:
03229: return yyResult.createValue(yyValue,
03230: yyError);
03231: }
03232: } else {
03233: yyError = yyError.select("\")\" expected",
03234: yyBase);
03235: }
03236: }
03237:
03238: // Nested alternative 2.
03239:
03240: yyOption1 = yyChoice1;
03241: yyOpValue1 = null;
03242:
03243: yyResult = pIdentifierList(yyOption1);
03244: yyError = yyResult.select(yyError);
03245: if (yyResult.hasValue()) {
03246: final Node v$el$1 = yyResult.semanticValue();
03247:
03248: yyOption1 = yyResult.index;
03249: yyOpValue1 = v$el$1;
03250: }
03251: { // Start scope for v$g$3.
03252: final Node v$g$3 = yyOpValue1;
03253:
03254: yyBase = yyOption1;
03255: yyResult = pSymbol(yyBase);
03256: yyError = yyResult.select(yyError);
03257: if (yyResult.hasValue(")")) {
03258:
03259: yyResult = pParameterContext(yyResult.index);
03260: yyError = yyResult.select(yyError);
03261: if (yyResult.hasValue()) {
03262:
03263: yyValue = new Action<Node>() {
03264: public Node run(Node v$1) {
03265: return GNode.create(
03266: "FunctionDeclarator", v$1,
03267: v$g$3);
03268: }
03269: };
03270:
03271: return yyResult.createValue(yyValue,
03272: yyError);
03273: }
03274: } else {
03275: yyError = yyError.select("\")\" expected",
03276: yyBase);
03277: }
03278: } // End scope for v$g$3.
03279: }
03280: }
03281:
03282: // Alternative 2.
03283:
03284: yyResult = pSymbol(yyStart);
03285: yyError = yyResult.select(yyError);
03286: if (yyResult.hasValue("[")) {
03287:
03288: yyResult = pArrayQualifierList(yyResult.index);
03289: yyError = yyResult.select(yyError);
03290: if (yyResult.hasValue()) {
03291: final Node v$g$4 = yyResult.semanticValue();
03292:
03293: final int yyChoice1 = yyResult.index;
03294:
03295: // Nested alternative 1.
03296:
03297: yyOption1 = yyChoice1;
03298: yyOpValue1 = null;
03299:
03300: yyResult = pAssignmentExpression(yyOption1);
03301: yyError = yyResult.select(yyError);
03302: if (yyResult.hasValue()) {
03303: final Node v$el$2 = yyResult.semanticValue();
03304:
03305: yyOption1 = yyResult.index;
03306: yyOpValue1 = v$el$2;
03307: }
03308: { // Start scope for v$g$5.
03309: final Node v$g$5 = yyOpValue1;
03310:
03311: yyBase = yyOption1;
03312: yyResult = pSymbol(yyBase);
03313: yyError = yyResult.select(yyError);
03314: if (yyResult.hasValue("]")) {
03315:
03316: yyValue = new Action<Node>() {
03317: public Node run(Node v$1) {
03318: return GNode.create("ArrayDeclarator",
03319: v$1, v$g$4, v$g$5);
03320: }
03321: };
03322:
03323: return yyResult.createValue(yyValue, yyError);
03324: } else {
03325: yyError = yyError.select("\"]\" expected",
03326: yyBase);
03327: }
03328: } // End scope for v$g$5.
03329:
03330: // Nested alternative 2.
03331:
03332: yyResult = pVariableLength(yyChoice1);
03333: yyError = yyResult.select(yyError);
03334: if (yyResult.hasValue()) {
03335: final Node v$g$6 = yyResult.semanticValue();
03336:
03337: yyBase = yyResult.index;
03338: yyResult = pSymbol(yyBase);
03339: yyError = yyResult.select(yyError);
03340: if (yyResult.hasValue("]")) {
03341:
03342: yyValue = new Action<Node>() {
03343: public Node run(Node v$1) {
03344: return GNode.create("ArrayDeclarator",
03345: v$1, v$g$4, v$g$6);
03346: }
03347: };
03348:
03349: return yyResult.createValue(yyValue, yyError);
03350: } else {
03351: yyError = yyError.select("\"]\" expected",
03352: yyBase);
03353: }
03354: }
03355: }
03356: }
03357:
03358: // Done.
03359: yyError = yyError.select("direct declarator expected", yyStart);
03360: return yyError;
03361: }
03362:
03363: // =========================================================================
03364:
03365: /**
03366: * Parse nonterminal xtc.lang.c4.C4.VariableLength.
03367: *
03368: * @param yyStart The index.
03369: * @return The result.
03370: * @throws IOException Signals an I/O error.
03371: */
03372: private Result pVariableLength(final int yyStart)
03373: throws IOException {
03374: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
03375: if (null == yyColumn.chunk1)
03376: yyColumn.chunk1 = new Chunk1();
03377: if (null == yyColumn.chunk1.fVariableLength)
03378: yyColumn.chunk1.fVariableLength = pVariableLength$1(yyStart);
03379: return yyColumn.chunk1.fVariableLength;
03380: }
03381:
03382: /** Actually parse xtc.lang.c4.C4.VariableLength. */
03383: private Result pVariableLength$1(final int yyStart)
03384: throws IOException {
03385: Result yyResult;
03386: Node yyValue;
03387: ParseError yyError = ParseError.DUMMY;
03388:
03389: // Alternative 1.
03390:
03391: yyResult = pSymbol(yyStart);
03392: yyError = yyResult.select(yyError);
03393: if (yyResult.hasValue("*")) {
03394:
03395: yyValue = GNode.create("VariableLength", false);
03396: yyValue.setLocation(location(yyStart));
03397:
03398: return yyResult.createValue(yyValue, yyError);
03399: }
03400:
03401: // Done.
03402: yyError = yyError.select("variable length expected", yyStart);
03403: return yyError;
03404: }
03405:
03406: // =========================================================================
03407:
03408: /**
03409: * Parse nonterminal xtc.lang.c4.C4.SimpleDeclarator.
03410: *
03411: * @param yyStart The index.
03412: * @return The result.
03413: * @throws IOException Signals an I/O error.
03414: */
03415: private Result pSimpleDeclarator(final int yyStart)
03416: throws IOException {
03417: Result yyResult;
03418: Node yyValue;
03419: ParseError yyError = ParseError.DUMMY;
03420:
03421: // Alternative <Declarator>.
03422:
03423: yyResult = pIdentifier(yyStart);
03424: yyError = yyResult.select(yyError);
03425: if (yyResult.hasValue()) {
03426: final String id = yyResult.semanticValue();
03427:
03428: yyState.bind(toText(id));
03429:
03430: yyValue = GNode.create("SimpleDeclarator", id);
03431: yyValue.setLocation(location(yyStart));
03432:
03433: return yyResult.createValue(yyValue, yyError);
03434: }
03435:
03436: // Done.
03437: return yyError;
03438: }
03439:
03440: // =========================================================================
03441:
03442: /**
03443: * Parse nonterminal xtc.lang.c4.C4.ParameterTypeList.
03444: *
03445: * @param yyStart The index.
03446: * @return The result.
03447: * @throws IOException Signals an I/O error.
03448: */
03449: private Result pParameterTypeList(final int yyStart)
03450: throws IOException {
03451: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
03452: if (null == yyColumn.chunk1)
03453: yyColumn.chunk1 = new Chunk1();
03454: if (null == yyColumn.chunk1.fParameterTypeList)
03455: yyColumn.chunk1.fParameterTypeList = pParameterTypeList$1(yyStart);
03456: return yyColumn.chunk1.fParameterTypeList;
03457: }
03458:
03459: /** Actually parse xtc.lang.c4.C4.ParameterTypeList. */
03460: private Result pParameterTypeList$1(final int yyStart)
03461: throws IOException {
03462: Result yyResult;
03463: int yyBase;
03464: int yyOption1;
03465: String yyOpValue1;
03466: Node yyValue;
03467: ParseError yyError = ParseError.DUMMY;
03468:
03469: // Alternative 1.
03470:
03471: yyResult = pParameterList(yyStart);
03472: yyError = yyResult.select(yyError);
03473: if (yyResult.hasValue()) {
03474: final Node v$g$1 = yyResult.semanticValue();
03475:
03476: yyOption1 = yyResult.index;
03477: yyOpValue1 = null;
03478:
03479: yyBase = yyOption1;
03480: yyResult = pSymbol(yyBase);
03481: yyError = yyResult.select(yyError);
03482: if (yyResult.hasValue(",")) {
03483:
03484: yyBase = yyResult.index;
03485: yyResult = pSymbol(yyBase);
03486: yyError = yyResult.select(yyError);
03487: if (yyResult.hasValue("...")) {
03488: final String v$el$1 = "...";
03489:
03490: yyOption1 = yyResult.index;
03491: yyOpValue1 = v$el$1;
03492: } else {
03493: yyError = yyError
03494: .select("\"...\" expected", yyBase);
03495: }
03496: } else {
03497: yyError = yyError.select("\",\" expected", yyBase);
03498: }
03499: { // Start scope for v$g$2.
03500: final String v$g$2 = yyOpValue1;
03501:
03502: yyValue = GNode.create("ParameterTypeList", v$g$1,
03503: v$g$2);
03504: yyValue.setLocation(location(yyStart));
03505:
03506: return new SemanticValue(yyValue, yyOption1, yyError);
03507: } // End scope for v$g$2.
03508: }
03509:
03510: // Done.
03511: return yyError;
03512: }
03513:
03514: // =========================================================================
03515:
03516: /**
03517: * Parse nonterminal xtc.lang.c4.C4.ParameterList.
03518: *
03519: * @param yyStart The index.
03520: * @return The result.
03521: * @throws IOException Signals an I/O error.
03522: */
03523: private Result pParameterList(final int yyStart) throws IOException {
03524: Result yyResult;
03525: int yyBase;
03526: int yyRepetition1;
03527: Pair<Node> yyRepValue1;
03528: Node yyValue;
03529: ParseError yyError = ParseError.DUMMY;
03530:
03531: // Alternative 1.
03532:
03533: yyResult = pParameterDeclaration(yyStart);
03534: yyError = yyResult.select(yyError);
03535: if (yyResult.hasValue()) {
03536: final Node v$g$1 = yyResult.semanticValue();
03537:
03538: yyRepetition1 = yyResult.index;
03539: yyRepValue1 = Pair.empty();
03540: while (true) {
03541:
03542: yyBase = yyRepetition1;
03543: yyResult = pSymbol(yyBase);
03544: yyError = yyResult.select(yyError);
03545: if (yyResult.hasValue(",")) {
03546:
03547: yyResult = pParameterDeclaration(yyResult.index);
03548: yyError = yyResult.select(yyError);
03549: if (yyResult.hasValue()) {
03550: final Node v$el$1 = yyResult.semanticValue();
03551:
03552: yyRepetition1 = yyResult.index;
03553: yyRepValue1 = new Pair<Node>(v$el$1,
03554: yyRepValue1);
03555: continue;
03556: }
03557: } else {
03558: yyError = yyError.select("\",\" expected", yyBase);
03559: }
03560: break;
03561: }
03562: { // Start scope for v$g$2.
03563: final Pair<Node> v$g$2 = yyRepValue1.reverse();
03564:
03565: yyValue = GNode.createFromPair("ParameterList", v$g$1,
03566: v$g$2);
03567: yyValue.setLocation(location(yyStart));
03568:
03569: return new SemanticValue(yyValue, yyRepetition1,
03570: yyError);
03571: } // End scope for v$g$2.
03572: }
03573:
03574: // Done.
03575: return yyError;
03576: }
03577:
03578: // =========================================================================
03579:
03580: /**
03581: * Parse nonterminal xtc.lang.c4.C4.ParameterDeclaration.
03582: *
03583: * @param yyStart The index.
03584: * @return The result.
03585: * @throws IOException Signals an I/O error.
03586: */
03587: private Result pParameterDeclaration(final int yyStart)
03588: throws IOException {
03589: Result yyResult;
03590: int yyOption1;
03591: Node yyOpValue1;
03592: Node yyValue;
03593: ParseError yyError = ParseError.DUMMY;
03594:
03595: // Start a state modification.
03596: yyState.start();
03597:
03598: // Alternative 1.
03599:
03600: yyResult = pDeclarationSpecifiers(yyStart);
03601: yyError = yyResult.select(yyError);
03602: if (yyResult.hasValue()) {
03603: final Node v$g$1 = yyResult.semanticValue();
03604:
03605: final int yyChoice1 = yyResult.index;
03606:
03607: // Nested alternative 1.
03608:
03609: yyResult = pDeclarator(yyChoice1);
03610: yyError = yyResult.select(yyError);
03611: if (yyResult.hasValue()) {
03612: final Node v$g$2 = yyResult.semanticValue();
03613:
03614: yyOption1 = yyResult.index;
03615: yyOpValue1 = null;
03616:
03617: yyResult = pAttributeSpecifierList(yyOption1);
03618: yyError = yyResult.select(yyError);
03619: if (yyResult.hasValue()) {
03620: final Node v$el$1 = yyResult.semanticValue();
03621:
03622: yyOption1 = yyResult.index;
03623: yyOpValue1 = v$el$1;
03624: }
03625: { // Start scope for v$g$3.
03626: final Node v$g$3 = yyOpValue1;
03627:
03628: yyValue = GNode.create("ParameterDeclaration",
03629: v$g$1, v$g$2, v$g$3);
03630: yyValue.setLocation(location(yyStart));
03631:
03632: // Commit the state modification.
03633: yyState.commit();
03634:
03635: return new SemanticValue(yyValue, yyOption1,
03636: yyError);
03637: } // End scope for v$g$3.
03638: }
03639:
03640: // Nested alternative 2.
03641:
03642: yyOption1 = yyChoice1;
03643: yyOpValue1 = null;
03644:
03645: yyResult = pAbstractDeclarator(yyOption1);
03646: yyError = yyResult.select(yyError);
03647: if (yyResult.hasValue()) {
03648: final Node v$el$2 = yyResult.semanticValue();
03649:
03650: yyOption1 = yyResult.index;
03651: yyOpValue1 = v$el$2;
03652: }
03653: { // Start scope for v$g$4.
03654: final Node v$g$4 = yyOpValue1;
03655:
03656: yyOpValue1 = null;
03657:
03658: yyResult = pAttributeSpecifierList(yyOption1);
03659: yyError = yyResult.select(yyError);
03660: if (yyResult.hasValue()) {
03661: final Node v$el$3 = yyResult.semanticValue();
03662:
03663: yyOption1 = yyResult.index;
03664: yyOpValue1 = v$el$3;
03665: }
03666: { // Start scope for v$g$5.
03667: final Node v$g$5 = yyOpValue1;
03668:
03669: yyValue = GNode.create("ParameterDeclaration",
03670: v$g$1, v$g$4, v$g$5);
03671: yyValue.setLocation(location(yyStart));
03672:
03673: // Commit the state modification.
03674: yyState.commit();
03675:
03676: return new SemanticValue(yyValue, yyOption1,
03677: yyError);
03678: } // End scope for v$g$5.
03679: } // End scope for v$g$4.
03680: }
03681:
03682: // Abort the state modification.
03683: yyState.abort();
03684:
03685: // Done.
03686: return yyError;
03687: }
03688:
03689: // =========================================================================
03690:
03691: /**
03692: * Parse nonterminal xtc.lang.c4.C4.AttributedAbstractDeclarator.
03693: *
03694: * @param yyStart The index.
03695: * @return The result.
03696: * @throws IOException Signals an I/O error.
03697: */
03698: private Result pAttributedAbstractDeclarator(final int yyStart)
03699: throws IOException {
03700:
03701: Result yyResult;
03702: int yyOption1;
03703: Node yyOpValue1;
03704: Node yyValue;
03705: ParseError yyError = ParseError.DUMMY;
03706:
03707: // Alternative 1.
03708:
03709: yyOption1 = yyStart;
03710: yyOpValue1 = null;
03711:
03712: yyResult = pAttributeSpecifierList(yyOption1);
03713: yyError = yyResult.select(yyError);
03714: if (yyResult.hasValue()) {
03715: final Node v$el$1 = yyResult.semanticValue();
03716:
03717: yyOption1 = yyResult.index;
03718: yyOpValue1 = v$el$1;
03719: }
03720: { // Start scope for v$g$1.
03721: final Node v$g$1 = yyOpValue1;
03722:
03723: yyResult = pAbstractDeclarator(yyOption1);
03724: yyError = yyResult.select(yyError);
03725: if (yyResult.hasValue()) {
03726: final Node v$g$2 = yyResult.semanticValue();
03727:
03728: yyValue = GNode.create("AttributedAbstractDeclarator",
03729: v$g$1, v$g$2);
03730: yyValue.setLocation(location(yyStart));
03731:
03732: return yyResult.createValue(yyValue, yyError);
03733: }
03734: } // End scope for v$g$1.
03735:
03736: // Done.
03737: return yyError;
03738: }
03739:
03740: // =========================================================================
03741:
03742: /**
03743: * Parse nonterminal xtc.lang.c4.C4.AbstractDeclarator.
03744: *
03745: * @param yyStart The index.
03746: * @return The result.
03747: * @throws IOException Signals an I/O error.
03748: */
03749: private Result pAbstractDeclarator(final int yyStart)
03750: throws IOException {
03751: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
03752: if (null == yyColumn.chunk2)
03753: yyColumn.chunk2 = new Chunk2();
03754: if (null == yyColumn.chunk2.fAbstractDeclarator)
03755: yyColumn.chunk2.fAbstractDeclarator = pAbstractDeclarator$1(yyStart);
03756: return yyColumn.chunk2.fAbstractDeclarator;
03757: }
03758:
03759: /** Actually parse xtc.lang.c4.C4.AbstractDeclarator. */
03760: private Result pAbstractDeclarator$1(final int yyStart)
03761: throws IOException {
03762: Result yyResult;
03763: int yyOption1;
03764: Node yyOpValue1;
03765: Node yyValue;
03766: ParseError yyError = ParseError.DUMMY;
03767:
03768: // Alternative 1.
03769:
03770: yyOption1 = yyStart;
03771: yyOpValue1 = null;
03772:
03773: yyResult = pPointer(yyOption1);
03774: yyError = yyResult.select(yyError);
03775: if (yyResult.hasValue()) {
03776: final Node v$el$1 = yyResult.semanticValue();
03777:
03778: yyOption1 = yyResult.index;
03779: yyOpValue1 = v$el$1;
03780: }
03781: { // Start scope for p.
03782: final Node p = yyOpValue1;
03783:
03784: yyResult = pDirectAbstractDeclarator(yyOption1);
03785: yyError = yyResult.select(yyError);
03786: if (yyResult.hasValue()) {
03787: final Node d = yyResult.semanticValue();
03788:
03789: if ((null != p) || (null != d)) {
03790:
03791: yyValue = GNode.create("AbstractDeclarator", p, d);
03792: yyValue.setLocation(location(yyStart));
03793:
03794: return yyResult.createValue(yyValue, yyError);
03795: }
03796: }
03797: } // End scope for p.
03798:
03799: // Done.
03800: yyError = yyError.select("abstract declarator expected",
03801: yyStart);
03802: return yyError;
03803: }
03804:
03805: // =========================================================================
03806:
03807: /**
03808: * Parse nonterminal xtc.lang.c4.C4.DirectAbstractDeclarator.
03809: *
03810: * @param yyStart The index.
03811: * @return The result.
03812: * @throws IOException Signals an I/O error.
03813: */
03814: private Result pDirectAbstractDeclarator(final int yyStart)
03815: throws IOException {
03816:
03817: Result yyResult;
03818: int yyBase;
03819: int yyRepetition1;
03820: Pair<Action<Node>> yyRepValue1;
03821: Node yyValue;
03822: ParseError yyError = ParseError.DUMMY;
03823:
03824: // Alternative <Parenthesized>.
03825:
03826: yyResult = pSymbol(yyStart);
03827: yyError = yyResult.select(yyError);
03828: if (yyResult.hasValue("(")) {
03829:
03830: yyResult = pAttributedAbstractDeclarator(yyResult.index);
03831: yyError = yyResult.select(yyError);
03832: if (yyResult.hasValue()) {
03833: final Node v$g$7 = yyResult.semanticValue();
03834:
03835: yyBase = yyResult.index;
03836: yyResult = pSymbol(yyBase);
03837: yyError = yyResult.select(yyError);
03838: if (yyResult.hasValue(")")) {
03839:
03840: yyRepetition1 = yyResult.index;
03841: yyRepValue1 = Pair.empty();
03842: while (true) {
03843:
03844: yyResult = pDirectAbstractDeclarator$$Tail1(yyRepetition1);
03845: yyError = yyResult.select(yyError);
03846: if (yyResult.hasValue()) {
03847: final Action<Node> v$8 = yyResult
03848: .semanticValue();
03849:
03850: yyRepetition1 = yyResult.index;
03851: yyRepValue1 = new Pair<Action<Node>>(v$8,
03852: yyRepValue1);
03853: continue;
03854: }
03855: break;
03856: }
03857: { // Start scope for v$9.
03858: final Pair<Action<Node>> v$9 = yyRepValue1
03859: .reverse();
03860:
03861: yyValue = apply(v$9, v$g$7, yyStart);
03862:
03863: return new SemanticValue(yyValue,
03864: yyRepetition1, yyError);
03865: } // End scope for v$9.
03866: } else {
03867: yyError = yyError.select("\")\" expected", yyBase);
03868: }
03869: }
03870: }
03871:
03872: // Alternative <Empty>.
03873:
03874: yyRepetition1 = yyStart;
03875: yyRepValue1 = Pair.empty();
03876: while (true) {
03877:
03878: yyResult = pDirectAbstractDeclarator$$Tail1(yyRepetition1);
03879: yyError = yyResult.select(yyError);
03880: if (yyResult.hasValue()) {
03881: final Action<Node> v$11 = yyResult.semanticValue();
03882:
03883: yyRepetition1 = yyResult.index;
03884: yyRepValue1 = new Pair<Action<Node>>(v$11, yyRepValue1);
03885: continue;
03886: }
03887: break;
03888: }
03889: { // Start scope for v$12.
03890: final Pair<Action<Node>> v$12 = yyRepValue1.reverse();
03891:
03892: yyValue = apply(v$12, null, yyStart);
03893:
03894: return new SemanticValue(yyValue, yyRepetition1, yyError);
03895: } // End scope for v$12.
03896: }
03897:
03898: // =========================================================================
03899:
03900: /**
03901: * Parse synthetic nonterminal
03902: * xtc.lang.c4.C4.DirectAbstractDeclarator$$Tail1.
03903: *
03904: * @param yyStart The index.
03905: * @return The result.
03906: * @throws IOException Signals an I/O error.
03907: */
03908: private Result pDirectAbstractDeclarator$$Tail1(final int yyStart)
03909: throws IOException {
03910:
03911: Result yyResult;
03912: int yyBase;
03913: int yyOption1;
03914: Node yyOpValue1;
03915: Action<Node> yyValue;
03916: ParseError yyError = ParseError.DUMMY;
03917:
03918: // Alternative 1.
03919:
03920: yyResult = pSymbol(yyStart);
03921: yyError = yyResult.select(yyError);
03922: if (yyResult.hasValue("[")) {
03923: final String v$g$2 = "[";
03924:
03925: final int yyChoice1 = yyResult.index;
03926:
03927: // Nested alternative 1.
03928:
03929: yyOption1 = yyChoice1;
03930: yyOpValue1 = null;
03931:
03932: yyResult = pAssignmentExpression(yyOption1);
03933: yyError = yyResult.select(yyError);
03934: if (yyResult.hasValue()) {
03935: final Node v$el$1 = yyResult.semanticValue();
03936:
03937: yyOption1 = yyResult.index;
03938: yyOpValue1 = v$el$1;
03939: }
03940: { // Start scope for v$g$3.
03941: final Node v$g$3 = yyOpValue1;
03942:
03943: yyBase = yyOption1;
03944: yyResult = pSymbol(yyBase);
03945: yyError = yyResult.select(yyError);
03946: if (yyResult.hasValue("]")) {
03947:
03948: yyValue = new Action<Node>() {
03949: public Node run(Node v$1) {
03950: return GNode.create(
03951: "DirectAbstractDeclarator", v$1,
03952: v$g$2, v$g$3);
03953: }
03954: };
03955:
03956: return yyResult.createValue(yyValue, yyError);
03957: } else {
03958: yyError = yyError.select("\"]\" expected", yyBase);
03959: }
03960: } // End scope for v$g$3.
03961:
03962: // Nested alternative 2.
03963:
03964: yyResult = pVariableLength(yyChoice1);
03965: yyError = yyResult.select(yyError);
03966: if (yyResult.hasValue()) {
03967: final Node v$g$4 = yyResult.semanticValue();
03968:
03969: yyBase = yyResult.index;
03970: yyResult = pSymbol(yyBase);
03971: yyError = yyResult.select(yyError);
03972: if (yyResult.hasValue("]")) {
03973:
03974: yyValue = new Action<Node>() {
03975: public Node run(Node v$1) {
03976: return GNode.create(
03977: "DirectAbstractDeclarator", v$1,
03978: v$g$2, v$g$4);
03979: }
03980: };
03981:
03982: return yyResult.createValue(yyValue, yyError);
03983: } else {
03984: yyError = yyError.select("\"]\" expected", yyBase);
03985: }
03986: }
03987: }
03988:
03989: // Alternative 2.
03990:
03991: yyResult = pSymbol(yyStart);
03992: yyError = yyResult.select(yyError);
03993: if (yyResult.hasValue("(")) {
03994: final String v$g$5 = "(";
03995:
03996: yyOption1 = yyResult.index;
03997: yyOpValue1 = null;
03998:
03999: yyResult = pParameterTypeList(yyOption1);
04000: yyError = yyResult.select(yyError);
04001: if (yyResult.hasValue()) {
04002: final Node v$el$2 = yyResult.semanticValue();
04003:
04004: yyOption1 = yyResult.index;
04005: yyOpValue1 = v$el$2;
04006: }
04007: { // Start scope for v$g$6.
04008: final Node v$g$6 = yyOpValue1;
04009:
04010: yyBase = yyOption1;
04011: yyResult = pSymbol(yyBase);
04012: yyError = yyResult.select(yyError);
04013: if (yyResult.hasValue(")")) {
04014:
04015: yyValue = new Action<Node>() {
04016: public Node run(Node v$1) {
04017: return GNode.create(
04018: "DirectAbstractDeclarator", v$1,
04019: v$g$5, v$g$6);
04020: }
04021: };
04022:
04023: return yyResult.createValue(yyValue, yyError);
04024: } else {
04025: yyError = yyError.select("\")\" expected", yyBase);
04026: }
04027: } // End scope for v$g$6.
04028: }
04029:
04030: // Done.
04031: yyError = yyError.select("direct abstract declarator expected",
04032: yyStart);
04033: return yyError;
04034: }
04035:
04036: // =========================================================================
04037:
04038: /**
04039: * Parse nonterminal xtc.lang.c4.C4.IdentifierList.
04040: *
04041: * @param yyStart The index.
04042: * @return The result.
04043: * @throws IOException Signals an I/O error.
04044: */
04045: private Result pIdentifierList(final int yyStart)
04046: throws IOException {
04047: Result yyResult;
04048: int yyBase;
04049: int yyRepetition1;
04050: Pair<String> yyRepValue1;
04051: Node yyValue;
04052: ParseError yyError = ParseError.DUMMY;
04053:
04054: // Alternative 1.
04055:
04056: yyResult = pIdentifier(yyStart);
04057: yyError = yyResult.select(yyError);
04058: if (yyResult.hasValue()) {
04059: final String id1 = yyResult.semanticValue();
04060:
04061: yyState.bind(toText(id1));
04062:
04063: yyRepetition1 = yyResult.index;
04064: yyRepValue1 = Pair.empty();
04065: while (true) {
04066:
04067: yyBase = yyRepetition1;
04068: yyResult = pSymbol(yyBase);
04069: yyError = yyResult.select(yyError);
04070: if (yyResult.hasValue(",")) {
04071:
04072: yyResult = pIdentifier(yyResult.index);
04073: yyError = yyResult.select(yyError);
04074: if (yyResult.hasValue()) {
04075: final String id2 = yyResult.semanticValue();
04076:
04077: yyState.bind(toText(id2));
04078:
04079: yyRepetition1 = yyResult.index;
04080: yyRepValue1 = new Pair<String>(id2, yyRepValue1);
04081: continue;
04082: }
04083: } else {
04084: yyError = yyError.select("\",\" expected", yyBase);
04085: }
04086: break;
04087: }
04088: { // Start scope for v$g$1.
04089: final Pair<String> v$g$1 = yyRepValue1.reverse();
04090:
04091: yyValue = GNode.createFromPair("IdentifierList", id1,
04092: v$g$1);
04093: yyValue.setLocation(location(yyStart));
04094:
04095: return new SemanticValue(yyValue, yyRepetition1,
04096: yyError);
04097: } // End scope for v$g$1.
04098: }
04099:
04100: // Done.
04101: return yyError;
04102: }
04103:
04104: // =========================================================================
04105:
04106: /**
04107: * Parse nonterminal xtc.lang.c4.C4.ArrayQualifierList.
04108: *
04109: * @param yyStart The index.
04110: * @return The result.
04111: * @throws IOException Signals an I/O error.
04112: */
04113: private Result pArrayQualifierList(final int yyStart)
04114: throws IOException {
04115: Result yyResult;
04116: int yyRepetition1;
04117: Pair<Node> yyRepValue1;
04118: Node yyValue;
04119: ParseError yyError = ParseError.DUMMY;
04120:
04121: // Alternative 1.
04122:
04123: yyRepetition1 = yyStart;
04124: yyRepValue1 = Pair.empty();
04125: while (true) {
04126:
04127: yyResult = pArrayQualifierList$$Choice1(yyRepetition1);
04128: yyError = yyResult.select(yyError);
04129: if (yyResult.hasValue()) {
04130: final Node v$el$1 = yyResult.semanticValue();
04131:
04132: yyRepetition1 = yyResult.index;
04133: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
04134: continue;
04135: }
04136: break;
04137: }
04138: { // Start scope for v$g$1.
04139: final Pair<Node> v$g$1 = yyRepValue1.reverse();
04140:
04141: yyValue = GNode.createFromPair("ArrayQualifierList", v$g$1);
04142: yyValue.setLocation(location(yyStart));
04143:
04144: return new SemanticValue(yyValue, yyRepetition1, yyError);
04145: } // End scope for v$g$1.
04146: }
04147:
04148: // =========================================================================
04149:
04150: /**
04151: * Parse synthetic nonterminal xtc.lang.c4.C4.ArrayQualifierList$$Choice1.
04152: *
04153: * @param yyStart The index.
04154: * @return The result.
04155: * @throws IOException Signals an I/O error.
04156: */
04157: private Result pArrayQualifierList$$Choice1(final int yyStart)
04158: throws IOException {
04159:
04160: Result yyResult;
04161: Node yyValue;
04162: ParseError yyError = ParseError.DUMMY;
04163:
04164: // Alternative 1.
04165:
04166: yyResult = pKeyword(yyStart);
04167: yyError = yyResult.select(yyError);
04168: if (yyResult.hasValue("static")) {
04169:
04170: yyValue = GNode.create("StaticSpecifier", false);
04171: yyValue.setLocation(location(yyStart));
04172:
04173: return yyResult.createValue(yyValue, yyError);
04174: }
04175:
04176: // Alternative 2.
04177:
04178: yyResult = pKeyword(yyStart);
04179: yyError = yyResult.select(yyError);
04180: if (yyResult.hasValue("volatile")) {
04181: final String v$g$1 = "volatile";
04182:
04183: yyValue = GNode.create("VolatileQualifier", v$g$1);
04184: yyValue.setLocation(location(yyStart));
04185:
04186: return yyResult.createValue(yyValue, yyError);
04187: }
04188:
04189: // Alternative 3.
04190:
04191: yyResult = pKeyword(yyStart);
04192: yyError = yyResult.select(yyError);
04193: if (yyResult.hasValue("__volatile")) {
04194: final String v$g$2 = "__volatile";
04195:
04196: yyValue = GNode.create("VolatileQualifier", v$g$2);
04197: yyValue.setLocation(location(yyStart));
04198:
04199: return yyResult.createValue(yyValue, yyError);
04200: }
04201:
04202: // Alternative 4.
04203:
04204: yyResult = pKeyword(yyStart);
04205: yyError = yyResult.select(yyError);
04206: if (yyResult.hasValue("__volatile__")) {
04207: final String v$g$3 = "__volatile__";
04208:
04209: yyValue = GNode.create("VolatileQualifier", v$g$3);
04210: yyValue.setLocation(location(yyStart));
04211:
04212: return yyResult.createValue(yyValue, yyError);
04213: }
04214:
04215: // Alternative 5.
04216:
04217: yyResult = pKeyword(yyStart);
04218: yyError = yyResult.select(yyError);
04219: if (yyResult.hasValue("restrict")) {
04220: final String v$g$1 = "restrict";
04221:
04222: yyValue = GNode.create("RestrictQualifier", v$g$1);
04223: yyValue.setLocation(location(yyStart));
04224:
04225: return yyResult.createValue(yyValue, yyError);
04226: }
04227:
04228: // Alternative 6.
04229:
04230: yyResult = pKeyword(yyStart);
04231: yyError = yyResult.select(yyError);
04232: if (yyResult.hasValue("__restrict")) {
04233: final String v$g$2 = "__restrict";
04234:
04235: yyValue = GNode.create("RestrictQualifier", v$g$2);
04236: yyValue.setLocation(location(yyStart));
04237:
04238: return yyResult.createValue(yyValue, yyError);
04239: }
04240:
04241: // Alternative 7.
04242:
04243: yyResult = pKeyword(yyStart);
04244: yyError = yyResult.select(yyError);
04245: if (yyResult.hasValue("__restrict__")) {
04246: final String v$g$3 = "__restrict__";
04247:
04248: yyValue = GNode.create("RestrictQualifier", v$g$3);
04249: yyValue.setLocation(location(yyStart));
04250:
04251: return yyResult.createValue(yyValue, yyError);
04252: }
04253:
04254: // Alternative 8.
04255:
04256: yyResult = pKeyword(yyStart);
04257: yyError = yyResult.select(yyError);
04258: if (yyResult.hasValue("const")) {
04259: final String v$g$1 = "const";
04260:
04261: yyValue = GNode.create("ConstantQualifier", v$g$1);
04262: yyValue.setLocation(location(yyStart));
04263:
04264: return yyResult.createValue(yyValue, yyError);
04265: }
04266:
04267: // Alternative 9.
04268:
04269: yyResult = pKeyword(yyStart);
04270: yyError = yyResult.select(yyError);
04271: if (yyResult.hasValue("__const")) {
04272: final String v$g$2 = "__const";
04273:
04274: yyValue = GNode.create("ConstantQualifier", v$g$2);
04275: yyValue.setLocation(location(yyStart));
04276:
04277: return yyResult.createValue(yyValue, yyError);
04278: }
04279:
04280: // Alternative 10.
04281:
04282: yyResult = pKeyword(yyStart);
04283: yyError = yyResult.select(yyError);
04284: if (yyResult.hasValue("__const__")) {
04285: final String v$g$3 = "__const__";
04286:
04287: yyValue = GNode.create("ConstantQualifier", v$g$3);
04288: yyValue.setLocation(location(yyStart));
04289:
04290: return yyResult.createValue(yyValue, yyError);
04291: }
04292:
04293: // Alternative 11.
04294:
04295: yyResult = pAttributeSpecifier(yyStart);
04296: yyError = yyResult.select(yyError);
04297: if (yyResult.hasValue()) {
04298: yyValue = yyResult.semanticValue();
04299:
04300: return yyResult.createValue(yyValue, yyError);
04301: }
04302:
04303: // Done.
04304: yyError = yyError.select("array qualifier list expected",
04305: yyStart);
04306: return yyError;
04307: }
04308:
04309: // =========================================================================
04310:
04311: /**
04312: * Parse nonterminal xtc.lang.c4.C4.FloatingPointTypeSpecifier.
04313: *
04314: * @param yyStart The index.
04315: * @return The result.
04316: * @throws IOException Signals an I/O error.
04317: */
04318: private Result pFloatingPointTypeSpecifier(final int yyStart)
04319: throws IOException {
04320:
04321: Result yyResult;
04322: Node yyValue;
04323: ParseError yyError = ParseError.DUMMY;
04324:
04325: // Alternative 1.
04326:
04327: yyResult = pKeyword(yyStart);
04328: yyError = yyResult.select(yyError);
04329: if (yyResult.hasValue("_Complex")) {
04330: final String v$g$1 = "_Complex";
04331:
04332: yyValue = GNode.create("Complex", v$g$1);
04333: yyValue.setLocation(location(yyStart));
04334:
04335: return yyResult.createValue(yyValue, yyError);
04336: }
04337:
04338: // Alternative 2.
04339:
04340: yyResult = pKeyword(yyStart);
04341: yyError = yyResult.select(yyError);
04342: if (yyResult.hasValue("__complex__")) {
04343: final String v$g$2 = "__complex__";
04344:
04345: yyValue = GNode.create("Complex", v$g$2);
04346: yyValue.setLocation(location(yyStart));
04347:
04348: return yyResult.createValue(yyValue, yyError);
04349: }
04350:
04351: // Alternative 3.
04352:
04353: yyResult = pKeyword(yyStart);
04354: yyError = yyResult.select(yyError);
04355: if (yyResult.hasValue("double")) {
04356:
04357: yyValue = GNode.create("Double", false);
04358: yyValue.setLocation(location(yyStart));
04359:
04360: return yyResult.createValue(yyValue, yyError);
04361: }
04362:
04363: // Alternative 4.
04364:
04365: yyResult = pKeyword(yyStart);
04366: yyError = yyResult.select(yyError);
04367: if (yyResult.hasValue("float")) {
04368:
04369: yyValue = GNode.create("Float", false);
04370: yyValue.setLocation(location(yyStart));
04371:
04372: return yyResult.createValue(yyValue, yyError);
04373: }
04374:
04375: // Done.
04376: yyError = yyError.select(
04377: "floating point type specifier expected", yyStart);
04378: return yyError;
04379: }
04380:
04381: // =========================================================================
04382:
04383: /**
04384: * Parse nonterminal xtc.lang.c4.C4.IntegerTypeSpecifier.
04385: *
04386: * @param yyStart The index.
04387: * @return The result.
04388: * @throws IOException Signals an I/O error.
04389: */
04390: private Result pIntegerTypeSpecifier(final int yyStart)
04391: throws IOException {
04392: Result yyResult;
04393: Node yyValue;
04394: ParseError yyError = ParseError.DUMMY;
04395:
04396: // Alternative 1.
04397:
04398: yyResult = pKeyword(yyStart);
04399: yyError = yyResult.select(yyError);
04400: if (yyResult.hasValue("long")) {
04401:
04402: yyValue = GNode.create("Long", false);
04403: yyValue.setLocation(location(yyStart));
04404:
04405: return yyResult.createValue(yyValue, yyError);
04406: }
04407:
04408: // Alternative 2.
04409:
04410: yyResult = pKeyword(yyStart);
04411: yyError = yyResult.select(yyError);
04412: if (yyResult.hasValue("int")) {
04413:
04414: yyValue = GNode.create("Int", false);
04415: yyValue.setLocation(location(yyStart));
04416:
04417: return yyResult.createValue(yyValue, yyError);
04418: }
04419:
04420: // Alternative 3.
04421:
04422: yyResult = pKeyword(yyStart);
04423: yyError = yyResult.select(yyError);
04424: if (yyResult.hasValue("short")) {
04425:
04426: yyValue = GNode.create("Short", false);
04427: yyValue.setLocation(location(yyStart));
04428:
04429: return yyResult.createValue(yyValue, yyError);
04430: }
04431:
04432: // Alternative 4.
04433:
04434: yyResult = pKeyword(yyStart);
04435: yyError = yyResult.select(yyError);
04436: if (yyResult.hasValue("char")) {
04437:
04438: yyValue = GNode.create("Char", false);
04439: yyValue.setLocation(location(yyStart));
04440:
04441: return yyResult.createValue(yyValue, yyError);
04442: }
04443:
04444: // Alternative 5.
04445:
04446: yyResult = pKeyword(yyStart);
04447: yyError = yyResult.select(yyError);
04448: if (yyResult.hasValue("_Bool")) {
04449:
04450: yyValue = GNode.create("Bool", false);
04451: yyValue.setLocation(location(yyStart));
04452:
04453: return yyResult.createValue(yyValue, yyError);
04454: }
04455:
04456: // Alternative 6.
04457:
04458: yyResult = pKeyword(yyStart);
04459: yyError = yyResult.select(yyError);
04460: if (yyResult.hasValue("unsigned")) {
04461:
04462: yyValue = GNode.create("Unsigned", false);
04463: yyValue.setLocation(location(yyStart));
04464:
04465: return yyResult.createValue(yyValue, yyError);
04466: }
04467:
04468: // Alternative 7.
04469:
04470: yyResult = pKeyword(yyStart);
04471: yyError = yyResult.select(yyError);
04472: if (yyResult.hasValue("signed")) {
04473: final String v$g$1 = "signed";
04474:
04475: yyValue = GNode.create("Signed", v$g$1);
04476: yyValue.setLocation(location(yyStart));
04477:
04478: return yyResult.createValue(yyValue, yyError);
04479: }
04480:
04481: // Alternative 8.
04482:
04483: yyResult = pKeyword(yyStart);
04484: yyError = yyResult.select(yyError);
04485: if (yyResult.hasValue("__signed")) {
04486: final String v$g$2 = "__signed";
04487:
04488: yyValue = GNode.create("Signed", v$g$2);
04489: yyValue.setLocation(location(yyStart));
04490:
04491: return yyResult.createValue(yyValue, yyError);
04492: }
04493:
04494: // Alternative 9.
04495:
04496: yyResult = pKeyword(yyStart);
04497: yyError = yyResult.select(yyError);
04498: if (yyResult.hasValue("__signed__")) {
04499: final String v$g$3 = "__signed__";
04500:
04501: yyValue = GNode.create("Signed", v$g$3);
04502: yyValue.setLocation(location(yyStart));
04503:
04504: return yyResult.createValue(yyValue, yyError);
04505: }
04506:
04507: // Done.
04508: yyError = yyError.select("integer type specifier expected",
04509: yyStart);
04510: return yyError;
04511: }
04512:
04513: // =========================================================================
04514:
04515: /**
04516: * Parse nonterminal xtc.lang.c4.C4.TypeofKeyword.
04517: *
04518: * @param yyStart The index.
04519: * @return The result.
04520: * @throws IOException Signals an I/O error.
04521: */
04522: private Result pTypeofKeyword(final int yyStart) throws IOException {
04523: Result yyResult;
04524: Void yyValue;
04525: ParseError yyError = ParseError.DUMMY;
04526:
04527: // Alternative 1.
04528:
04529: yyResult = pKeyword(yyStart);
04530: yyError = yyResult.select(yyError);
04531: if (yyResult.hasValue("typeof")) {
04532:
04533: yyValue = null;
04534:
04535: return yyResult.createValue(yyValue, yyError);
04536: }
04537:
04538: // Alternative 2.
04539:
04540: yyResult = pKeyword(yyStart);
04541: yyError = yyResult.select(yyError);
04542: if (yyResult.hasValue("__typeof")) {
04543:
04544: yyValue = null;
04545:
04546: return yyResult.createValue(yyValue, yyError);
04547: }
04548:
04549: // Alternative 3.
04550:
04551: yyResult = pKeyword(yyStart);
04552: yyError = yyResult.select(yyError);
04553: if (yyResult.hasValue("__typeof__")) {
04554:
04555: yyValue = null;
04556:
04557: return yyResult.createValue(yyValue, yyError);
04558: }
04559:
04560: // Done.
04561: yyError = yyError.select("typeof keyword expected", yyStart);
04562: return yyError;
04563: }
04564:
04565: // =========================================================================
04566:
04567: /**
04568: * Parse nonterminal xtc.lang.c4.C4.Initializer.
04569: *
04570: * @param yyStart The index.
04571: * @return The result.
04572: * @throws IOException Signals an I/O error.
04573: */
04574: private Result pInitializer(final int yyStart) throws IOException {
04575: Result yyResult;
04576: int yyBase;
04577: int yyOption1;
04578: Node yyValue;
04579: ParseError yyError = ParseError.DUMMY;
04580:
04581: // Alternative <Complex>.
04582:
04583: yyResult = pSymbol(yyStart);
04584: yyError = yyResult.select(yyError);
04585: if (yyResult.hasValue("{")) {
04586:
04587: yyResult = pInitializerList(yyResult.index);
04588: yyError = yyResult.select(yyError);
04589: if (yyResult.hasValue()) {
04590: yyValue = yyResult.semanticValue();
04591:
04592: yyOption1 = yyResult.index;
04593:
04594: yyBase = yyOption1;
04595: yyResult = pSymbol(yyBase);
04596: yyError = yyResult.select(yyError);
04597: if (yyResult.hasValue(",")) {
04598:
04599: yyOption1 = yyResult.index;
04600: } else {
04601: yyError = yyError.select("\",\" expected", yyBase);
04602: }
04603:
04604: yyBase = yyOption1;
04605: yyResult = pSymbol(yyBase);
04606: yyError = yyResult.select(yyError);
04607: if (yyResult.hasValue("}")) {
04608:
04609: return yyResult.createValue(yyValue, yyError);
04610: } else {
04611: yyError = yyError.select("\"}\" expected", yyBase);
04612: }
04613: }
04614: }
04615:
04616: // Alternative <Simple>.
04617:
04618: yyResult = pAssignmentExpression(yyStart);
04619: yyError = yyResult.select(yyError);
04620: if (yyResult.hasValue()) {
04621: yyValue = yyResult.semanticValue();
04622:
04623: return yyResult.createValue(yyValue, yyError);
04624: }
04625:
04626: // Done.
04627: yyError = yyError.select("initializer expected", yyStart);
04628: return yyError;
04629: }
04630:
04631: // =========================================================================
04632:
04633: /**
04634: * Parse nonterminal xtc.lang.c4.C4.InitializerList.
04635: *
04636: * @param yyStart The index.
04637: * @return The result.
04638: * @throws IOException Signals an I/O error.
04639: */
04640: private Result pInitializerList(final int yyStart)
04641: throws IOException {
04642: Result yyResult;
04643: int yyBase;
04644: int yyRepetition1;
04645: Pair<Node> yyRepValue1;
04646: Node yyValue;
04647: ParseError yyError = ParseError.DUMMY;
04648:
04649: // Alternative 1.
04650:
04651: yyResult = pInitializerListEntry(yyStart);
04652: yyError = yyResult.select(yyError);
04653: if (yyResult.hasValue()) {
04654: final Node v$g$1 = yyResult.semanticValue();
04655:
04656: yyRepetition1 = yyResult.index;
04657: yyRepValue1 = Pair.empty();
04658: while (true) {
04659:
04660: yyBase = yyRepetition1;
04661: yyResult = pSymbol(yyBase);
04662: yyError = yyResult.select(yyError);
04663: if (yyResult.hasValue(",")) {
04664:
04665: yyResult = pInitializerListEntry(yyResult.index);
04666: yyError = yyResult.select(yyError);
04667: if (yyResult.hasValue()) {
04668: final Node v$el$1 = yyResult.semanticValue();
04669:
04670: yyRepetition1 = yyResult.index;
04671: yyRepValue1 = new Pair<Node>(v$el$1,
04672: yyRepValue1);
04673: continue;
04674: }
04675: } else {
04676: yyError = yyError.select("\",\" expected", yyBase);
04677: }
04678: break;
04679: }
04680: { // Start scope for v$g$2.
04681: final Pair<Node> v$g$2 = yyRepValue1.reverse();
04682:
04683: yyValue = GNode.createFromPair("InitializerList",
04684: v$g$1, v$g$2);
04685: yyValue.setLocation(location(yyStart));
04686:
04687: return new SemanticValue(yyValue, yyRepetition1,
04688: yyError);
04689: } // End scope for v$g$2.
04690: }
04691:
04692: // Alternative 2.
04693:
04694: if (GCC) {
04695:
04696: yyValue = GNode.create("InitializerList", false);
04697: yyValue.setLocation(location(yyStart));
04698:
04699: return new SemanticValue(yyValue, yyStart, yyError);
04700: }
04701:
04702: // Done.
04703: yyError = yyError.select("initializer list expected", yyStart);
04704: return yyError;
04705: }
04706:
04707: // =========================================================================
04708:
04709: /**
04710: * Parse nonterminal xtc.lang.c4.C4.InitializerListEntry.
04711: *
04712: * @param yyStart The index.
04713: * @return The result.
04714: * @throws IOException Signals an I/O error.
04715: */
04716: private Result pInitializerListEntry(final int yyStart)
04717: throws IOException {
04718: Result yyResult;
04719: int yyOption1;
04720: Node yyOpValue1;
04721: Node yyValue;
04722: ParseError yyError = ParseError.DUMMY;
04723:
04724: // Alternative 1.
04725:
04726: yyOption1 = yyStart;
04727: yyOpValue1 = null;
04728:
04729: yyResult = pDesignation(yyOption1);
04730: yyError = yyResult.select(yyError);
04731: if (yyResult.hasValue()) {
04732: final Node v$el$1 = yyResult.semanticValue();
04733:
04734: yyOption1 = yyResult.index;
04735: yyOpValue1 = v$el$1;
04736: }
04737: { // Start scope for v$g$1.
04738: final Node v$g$1 = yyOpValue1;
04739:
04740: yyResult = pInitializer(yyOption1);
04741: yyError = yyResult.select(yyError);
04742: if (yyResult.hasValue()) {
04743: final Node v$g$2 = yyResult.semanticValue();
04744:
04745: yyValue = GNode.create("InitializerListEntry", v$g$1,
04746: v$g$2);
04747: yyValue.setLocation(location(yyStart));
04748:
04749: return yyResult.createValue(yyValue, yyError);
04750: }
04751: } // End scope for v$g$1.
04752:
04753: // Done.
04754: return yyError;
04755: }
04756:
04757: // =========================================================================
04758:
04759: /**
04760: * Parse nonterminal xtc.lang.c4.C4.Designation.
04761: *
04762: * @param yyStart The index.
04763: * @return The result.
04764: * @throws IOException Signals an I/O error.
04765: */
04766: private Result pDesignation(final int yyStart) throws IOException {
04767: Result yyResult;
04768: int yyBase;
04769: int yyRepetition1;
04770: boolean yyRepeated1;
04771: Pair<Node> yyRepValue1;
04772: Node yyValue;
04773: ParseError yyError = ParseError.DUMMY;
04774:
04775: // Alternative <Standard>.
04776:
04777: yyRepetition1 = yyStart;
04778: yyRepeated1 = false;
04779: yyRepValue1 = Pair.empty();
04780: while (true) {
04781:
04782: yyResult = pDesignator(yyRepetition1);
04783: yyError = yyResult.select(yyError);
04784: if (yyResult.hasValue()) {
04785: final Node v$el$1 = yyResult.semanticValue();
04786:
04787: yyRepetition1 = yyResult.index;
04788: yyRepeated1 = true;
04789: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
04790: continue;
04791: }
04792: break;
04793: }
04794:
04795: if (yyRepeated1) {
04796: final Pair<Node> v$g$1 = yyRepValue1.reverse();
04797:
04798: yyBase = yyRepetition1;
04799: yyResult = pSymbol(yyBase);
04800: yyError = yyResult.select(yyError);
04801: if (yyResult.hasValue("=")) {
04802:
04803: yyValue = GNode.createFromPair("Designation", v$g$1);
04804: yyValue.setLocation(location(yyStart));
04805:
04806: return yyResult.createValue(yyValue, yyError);
04807: } else {
04808: yyError = yyError.select("\"=\" expected", yyBase);
04809: }
04810: }
04811:
04812: // Alternative 2.
04813:
04814: if (GCC) {
04815:
04816: final int yyChoice1 = yyStart;
04817:
04818: // Nested alternative 1.
04819:
04820: yyResult = pObsoleteArrayDesignation(yyChoice1);
04821: yyError = yyResult.select(yyError);
04822: if (yyResult.hasValue()) {
04823: yyValue = yyResult.semanticValue();
04824:
04825: return yyResult.createValue(yyValue, yyError);
04826: }
04827:
04828: // Nested alternative 2.
04829:
04830: yyResult = pObsoleteFieldDesignation(yyChoice1);
04831: yyError = yyResult.select(yyError);
04832: if (yyResult.hasValue()) {
04833: yyValue = yyResult.semanticValue();
04834:
04835: return yyResult.createValue(yyValue, yyError);
04836: }
04837: }
04838:
04839: // Done.
04840: yyError = yyError.select("designation expected", yyStart);
04841: return yyError;
04842: }
04843:
04844: // =========================================================================
04845:
04846: /**
04847: * Parse nonterminal xtc.lang.c4.C4.Designator.
04848: *
04849: * @param yyStart The index.
04850: * @return The result.
04851: * @throws IOException Signals an I/O error.
04852: */
04853: private Result pDesignator(final int yyStart) throws IOException {
04854: Result yyResult;
04855: int yyBase;
04856: Node yyValue;
04857: ParseError yyError = ParseError.DUMMY;
04858:
04859: // Alternative <Array>.
04860:
04861: yyResult = pSymbol(yyStart);
04862: yyError = yyResult.select(yyError);
04863: if (yyResult.hasValue("[")) {
04864: final String v$g$1 = "[";
04865:
04866: yyResult = pConditionalExpression(yyResult.index);
04867: yyError = yyResult.select(yyError);
04868: if (yyResult.hasValue()) {
04869: final Node v$g$2 = yyResult.semanticValue();
04870:
04871: yyBase = yyResult.index;
04872: yyResult = pSymbol(yyBase);
04873: yyError = yyResult.select(yyError);
04874: if (yyResult.hasValue("]")) {
04875:
04876: yyValue = GNode.create("Designator", v$g$1, v$g$2);
04877: yyValue.setLocation(location(yyStart));
04878:
04879: return yyResult.createValue(yyValue, yyError);
04880: } else {
04881: yyError = yyError.select("\"]\" expected", yyBase);
04882: }
04883: }
04884: }
04885:
04886: // Alternative <ArrayRange>.
04887:
04888: if (GCC) {
04889:
04890: yyResult = pSymbol(yyStart);
04891: yyError = yyResult.select(yyError);
04892: if (yyResult.hasValue("[")) {
04893: final String v$g$3 = "[";
04894:
04895: yyResult = pConditionalExpression(yyResult.index);
04896: yyError = yyResult.select(yyError);
04897: if (yyResult.hasValue()) {
04898: final Node v$g$4 = yyResult.semanticValue();
04899:
04900: yyBase = yyResult.index;
04901: yyResult = pSymbol(yyBase);
04902: yyError = yyResult.select(yyError);
04903: if (yyResult.hasValue("...")) {
04904:
04905: yyResult = pConditionalExpression(yyResult.index);
04906: yyError = yyResult.select(yyError);
04907: if (yyResult.hasValue()) {
04908: final Node v$g$5 = yyResult.semanticValue();
04909:
04910: yyBase = yyResult.index;
04911: yyResult = pSymbol(yyBase);
04912: yyError = yyResult.select(yyError);
04913: if (yyResult.hasValue("]")) {
04914:
04915: yyValue = GNode.create("Designator",
04916: v$g$3, v$g$4, v$g$5);
04917: yyValue.setLocation(location(yyStart));
04918:
04919: return yyResult.createValue(yyValue,
04920: yyError);
04921: } else {
04922: yyError = yyError.select(
04923: "\"]\" expected", yyBase);
04924: }
04925: }
04926: } else {
04927: yyError = yyError.select("\"...\" expected",
04928: yyBase);
04929: }
04930: }
04931: }
04932: }
04933:
04934: // Alternative <Structure>.
04935:
04936: yyResult = pSymbol(yyStart);
04937: yyError = yyResult.select(yyError);
04938: if (yyResult.hasValue(".")) {
04939: final String v$g$6 = ".";
04940:
04941: yyResult = pPrimaryIdentifier(yyResult.index);
04942: yyError = yyResult.select(yyError);
04943: if (yyResult.hasValue()) {
04944: final Node v$g$7 = yyResult.semanticValue();
04945:
04946: yyValue = GNode.create("Designator", v$g$6, v$g$7);
04947: yyValue.setLocation(location(yyStart));
04948:
04949: return yyResult.createValue(yyValue, yyError);
04950: }
04951: }
04952:
04953: // Done.
04954: yyError = yyError.select("designator expected", yyStart);
04955: return yyError;
04956: }
04957:
04958: // =========================================================================
04959:
04960: /**
04961: * Parse nonterminal xtc.lang.c4.C4.ObsoleteArrayDesignation.
04962: *
04963: * @param yyStart The index.
04964: * @return The result.
04965: * @throws IOException Signals an I/O error.
04966: */
04967: private Result pObsoleteArrayDesignation(final int yyStart)
04968: throws IOException {
04969:
04970: Result yyResult;
04971: int yyBase;
04972: Node yyValue;
04973: ParseError yyError = ParseError.DUMMY;
04974:
04975: // Alternative 1.
04976:
04977: yyResult = pSymbol(yyStart);
04978: yyError = yyResult.select(yyError);
04979: if (yyResult.hasValue("[")) {
04980: final String v$g$1 = "[";
04981:
04982: yyResult = pConditionalExpression(yyResult.index);
04983: yyError = yyResult.select(yyError);
04984: if (yyResult.hasValue()) {
04985: final Node v$g$2 = yyResult.semanticValue();
04986:
04987: final int yyChoice1 = yyResult.index;
04988:
04989: // Nested alternative 1.
04990:
04991: yyBase = yyChoice1;
04992: yyResult = pSymbol(yyBase);
04993: yyError = yyResult.select(yyError);
04994: if (yyResult.hasValue("]")) {
04995:
04996: yyValue = GNode.create("ObsoleteArrayDesignation",
04997: v$g$1, v$g$2);
04998: yyValue.setLocation(location(yyStart));
04999:
05000: return yyResult.createValue(yyValue, yyError);
05001: } else {
05002: yyError = yyError.select("\"]\" expected", yyBase);
05003: }
05004:
05005: // Nested alternative 2.
05006:
05007: yyBase = yyChoice1;
05008: yyResult = pSymbol(yyBase);
05009: yyError = yyResult.select(yyError);
05010: if (yyResult.hasValue("...")) {
05011:
05012: yyResult = pConditionalExpression(yyResult.index);
05013: yyError = yyResult.select(yyError);
05014: if (yyResult.hasValue()) {
05015: final Node v$g$3 = yyResult.semanticValue();
05016:
05017: yyBase = yyResult.index;
05018: yyResult = pSymbol(yyBase);
05019: yyError = yyResult.select(yyError);
05020: if (yyResult.hasValue("]")) {
05021:
05022: yyValue = GNode.create(
05023: "ObsoleteArrayDesignation", v$g$1,
05024: v$g$2, v$g$3);
05025: yyValue.setLocation(location(yyStart));
05026:
05027: return yyResult.createValue(yyValue,
05028: yyError);
05029: } else {
05030: yyError = yyError.select("\"]\" expected",
05031: yyBase);
05032: }
05033: }
05034: } else {
05035: yyError = yyError
05036: .select("\"...\" expected", yyBase);
05037: }
05038: }
05039: }
05040:
05041: // Done.
05042: yyError = yyError.select("obsolete array designation expected",
05043: yyStart);
05044: return yyError;
05045: }
05046:
05047: // =========================================================================
05048:
05049: /**
05050: * Parse nonterminal xtc.lang.c4.C4.ObsoleteFieldDesignation.
05051: *
05052: * @param yyStart The index.
05053: * @return The result.
05054: * @throws IOException Signals an I/O error.
05055: */
05056: private Result pObsoleteFieldDesignation(final int yyStart)
05057: throws IOException {
05058:
05059: Result yyResult;
05060: int yyBase;
05061: Node yyValue;
05062: ParseError yyError = ParseError.DUMMY;
05063:
05064: // Alternative 1.
05065:
05066: yyResult = pIdentifier(yyStart);
05067: yyError = yyResult.select(yyError);
05068: if (yyResult.hasValue()) {
05069: final String v$g$1 = yyResult.semanticValue();
05070:
05071: yyBase = yyResult.index;
05072: yyResult = pSymbol(yyBase);
05073: yyError = yyResult.select(yyError);
05074: if (yyResult.hasValue(":")) {
05075:
05076: yyValue = GNode.create("ObsoleteFieldDesignation",
05077: v$g$1);
05078: yyValue.setLocation(location(yyStart));
05079:
05080: return yyResult.createValue(yyValue, yyError);
05081: } else {
05082: yyError = yyError.select("\":\" expected", yyBase);
05083: }
05084: }
05085:
05086: // Done.
05087: return yyError;
05088: }
05089:
05090: // =========================================================================
05091:
05092: /**
05093: * Parse nonterminal xtc.lang.c4.C4.TypeName.
05094: *
05095: * @param yyStart The index.
05096: * @return The result.
05097: * @throws IOException Signals an I/O error.
05098: */
05099: private Result pTypeName(final int yyStart) throws IOException {
05100: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
05101: if (null == yyColumn.chunk2)
05102: yyColumn.chunk2 = new Chunk2();
05103: if (null == yyColumn.chunk2.fTypeName)
05104: yyColumn.chunk2.fTypeName = pTypeName$1(yyStart);
05105: return yyColumn.chunk2.fTypeName;
05106: }
05107:
05108: /** Actually parse xtc.lang.c4.C4.TypeName. */
05109: private Result pTypeName$1(final int yyStart) throws IOException {
05110: Result yyResult;
05111: int yyOption1;
05112: Node yyOpValue1;
05113: Node yyValue;
05114: ParseError yyError = ParseError.DUMMY;
05115:
05116: // Start a state modification.
05117: yyState.start();
05118:
05119: // Alternative 1.
05120:
05121: yyResult = pSpecifierQualifierList(yyStart);
05122: yyError = yyResult.select(yyError);
05123: if (yyResult.hasValue()) {
05124: final Node v$g$1 = yyResult.semanticValue();
05125:
05126: yyOption1 = yyResult.index;
05127: yyOpValue1 = null;
05128:
05129: yyResult = pAbstractDeclarator(yyOption1);
05130: yyError = yyResult.select(yyError);
05131: if (yyResult.hasValue()) {
05132: final Node v$el$1 = yyResult.semanticValue();
05133:
05134: yyOption1 = yyResult.index;
05135: yyOpValue1 = v$el$1;
05136: }
05137: { // Start scope for v$g$2.
05138: final Node v$g$2 = yyOpValue1;
05139:
05140: yyValue = GNode.create("TypeName", v$g$1, v$g$2);
05141: yyValue.setLocation(location(yyStart));
05142:
05143: // Commit the state modification.
05144: yyState.commit();
05145:
05146: return new SemanticValue(yyValue, yyOption1, yyError);
05147: } // End scope for v$g$2.
05148: }
05149:
05150: // Abort the state modification.
05151: yyState.abort();
05152:
05153: // Done.
05154: return yyError;
05155: }
05156:
05157: // =========================================================================
05158:
05159: /**
05160: * Parse nonterminal xtc.lang.c4.C4.AttributeSpecifierList.
05161: *
05162: * @param yyStart The index.
05163: * @return The result.
05164: * @throws IOException Signals an I/O error.
05165: */
05166: private Result pAttributeSpecifierList(final int yyStart)
05167: throws IOException {
05168:
05169: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
05170: if (null == yyColumn.chunk2)
05171: yyColumn.chunk2 = new Chunk2();
05172: if (null == yyColumn.chunk2.fAttributeSpecifierList)
05173: yyColumn.chunk2.fAttributeSpecifierList = pAttributeSpecifierList$1(yyStart);
05174: return yyColumn.chunk2.fAttributeSpecifierList;
05175: }
05176:
05177: /** Actually parse xtc.lang.c4.C4.AttributeSpecifierList. */
05178: private Result pAttributeSpecifierList$1(final int yyStart)
05179: throws IOException {
05180:
05181: Result yyResult;
05182: Node yyValue;
05183: ParseError yyError = ParseError.DUMMY;
05184:
05185: // Alternative 1.
05186:
05187: yyResult = pAttributeSpecifierPlus(yyStart);
05188: yyError = yyResult.select(yyError);
05189: if (yyResult.hasValue()) {
05190: final Pair<Node> v$g$1 = yyResult.semanticValue();
05191:
05192: yyValue = GNode.createFromPair("AttributeSpecifierList",
05193: v$g$1);
05194: yyValue.setLocation(location(yyStart));
05195:
05196: return yyResult.createValue(yyValue, yyError);
05197: }
05198:
05199: // Done.
05200: return yyError;
05201: }
05202:
05203: // =========================================================================
05204:
05205: /**
05206: * Parse nonterminal xtc.lang.c4.C4.AttributeSpecifierPlus.
05207: *
05208: * @param yyStart The index.
05209: * @return The result.
05210: * @throws IOException Signals an I/O error.
05211: */
05212: private Result pAttributeSpecifierPlus(final int yyStart)
05213: throws IOException {
05214:
05215: Result yyResult;
05216: int yyRepetition1;
05217: boolean yyRepeated1;
05218: Pair<Node> yyRepValue1;
05219: Pair<Node> yyValue;
05220: ParseError yyError = ParseError.DUMMY;
05221:
05222: // Alternative 1.
05223:
05224: yyRepetition1 = yyStart;
05225: yyRepeated1 = false;
05226: yyRepValue1 = Pair.empty();
05227: while (true) {
05228:
05229: yyResult = pAttributeSpecifier(yyRepetition1);
05230: yyError = yyResult.select(yyError);
05231: if (yyResult.hasValue()) {
05232: final Node v$el$1 = yyResult.semanticValue();
05233:
05234: yyRepetition1 = yyResult.index;
05235: yyRepeated1 = true;
05236: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
05237: continue;
05238: }
05239: break;
05240: }
05241:
05242: if (yyRepeated1) {
05243: yyValue = yyRepValue1.reverse();
05244:
05245: return new SemanticValue(yyValue, yyRepetition1, yyError);
05246: }
05247:
05248: // Done.
05249: return yyError;
05250: }
05251:
05252: // =========================================================================
05253:
05254: /**
05255: * Parse nonterminal xtc.lang.c4.C4.AttributeSpecifier.
05256: *
05257: * @param yyStart The index.
05258: * @return The result.
05259: * @throws IOException Signals an I/O error.
05260: */
05261: private Result pAttributeSpecifier(final int yyStart)
05262: throws IOException {
05263: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
05264: if (null == yyColumn.chunk2)
05265: yyColumn.chunk2 = new Chunk2();
05266: if (null == yyColumn.chunk2.fAttributeSpecifier)
05267: yyColumn.chunk2.fAttributeSpecifier = pAttributeSpecifier$1(yyStart);
05268: return yyColumn.chunk2.fAttributeSpecifier;
05269: }
05270:
05271: /** Actually parse xtc.lang.c4.C4.AttributeSpecifier. */
05272: private Result pAttributeSpecifier$1(final int yyStart)
05273: throws IOException {
05274: Result yyResult;
05275: int yyBase;
05276: int yyOption1;
05277: Node yyOpValue1;
05278: Node yyValue;
05279: ParseError yyError = ParseError.DUMMY;
05280:
05281: // Alternative 1.
05282:
05283: yyResult = pAttributeKeyword(yyStart);
05284: yyError = yyResult.select(yyError);
05285: if (yyResult.hasValue()) {
05286:
05287: yyBase = yyResult.index;
05288: yyResult = pSymbol(yyBase);
05289: yyError = yyResult.select(yyError);
05290: if (yyResult.hasValue("(")) {
05291:
05292: yyBase = yyResult.index;
05293: yyResult = pSymbol(yyBase);
05294: yyError = yyResult.select(yyError);
05295: if (yyResult.hasValue("(")) {
05296:
05297: yyOption1 = yyResult.index;
05298: yyOpValue1 = null;
05299:
05300: yyResult = pAttributeList(yyOption1);
05301: yyError = yyResult.select(yyError);
05302: if (yyResult.hasValue()) {
05303: final Node v$el$1 = yyResult.semanticValue();
05304:
05305: yyOption1 = yyResult.index;
05306: yyOpValue1 = v$el$1;
05307: }
05308: { // Start scope for v$g$1.
05309: final Node v$g$1 = yyOpValue1;
05310:
05311: yyBase = yyOption1;
05312: yyResult = pSymbol(yyBase);
05313: yyError = yyResult.select(yyError);
05314: if (yyResult.hasValue(")")) {
05315:
05316: yyBase = yyResult.index;
05317: yyResult = pSymbol(yyBase);
05318: yyError = yyResult.select(yyError);
05319: if (yyResult.hasValue(")")) {
05320:
05321: yyValue = GNode.create(
05322: "AttributeSpecifier", v$g$1);
05323: yyValue.setLocation(location(yyStart));
05324:
05325: return yyResult.createValue(yyValue,
05326: yyError);
05327: } else {
05328: yyError = yyError.select(
05329: "\")\" expected", yyBase);
05330: }
05331: } else {
05332: yyError = yyError.select("\")\" expected",
05333: yyBase);
05334: }
05335: } // End scope for v$g$1.
05336: } else {
05337: yyError = yyError.select("\"(\" expected", yyBase);
05338: }
05339: } else {
05340: yyError = yyError.select("\"(\" expected", yyBase);
05341: }
05342: }
05343:
05344: // Done.
05345: return yyError;
05346: }
05347:
05348: // =========================================================================
05349:
05350: /**
05351: * Parse nonterminal xtc.lang.c4.C4.AttributeKeyword.
05352: *
05353: * @param yyStart The index.
05354: * @return The result.
05355: * @throws IOException Signals an I/O error.
05356: */
05357: private Result pAttributeKeyword(final int yyStart)
05358: throws IOException {
05359: Result yyResult;
05360: Void yyValue;
05361: ParseError yyError = ParseError.DUMMY;
05362:
05363: // Alternative 1.
05364:
05365: yyResult = pKeyword(yyStart);
05366: yyError = yyResult.select(yyError);
05367: if (yyResult.hasValue("__attribute")) {
05368:
05369: yyValue = null;
05370:
05371: return yyResult.createValue(yyValue, yyError);
05372: }
05373:
05374: // Alternative 2.
05375:
05376: yyResult = pKeyword(yyStart);
05377: yyError = yyResult.select(yyError);
05378: if (yyResult.hasValue("__attribute__")) {
05379:
05380: yyValue = null;
05381:
05382: return yyResult.createValue(yyValue, yyError);
05383: }
05384:
05385: // Done.
05386: yyError = yyError.select("attribute keyword expected", yyStart);
05387: return yyError;
05388: }
05389:
05390: // =========================================================================
05391:
05392: /**
05393: * Parse nonterminal xtc.lang.c4.C4.AttributeList.
05394: *
05395: * @param yyStart The index.
05396: * @return The result.
05397: * @throws IOException Signals an I/O error.
05398: */
05399: private Result pAttributeList(final int yyStart) throws IOException {
05400: Result yyResult;
05401: int yyBase;
05402: int yyRepetition1;
05403: Pair<Node> yyRepValue1;
05404: Node yyValue;
05405: ParseError yyError = ParseError.DUMMY;
05406:
05407: // Alternative 1.
05408:
05409: yyResult = pAttributeListEntry(yyStart);
05410: yyError = yyResult.select(yyError);
05411: if (yyResult.hasValue()) {
05412: final Node v$g$1 = yyResult.semanticValue();
05413:
05414: yyRepetition1 = yyResult.index;
05415: yyRepValue1 = Pair.empty();
05416: while (true) {
05417:
05418: yyBase = yyRepetition1;
05419: yyResult = pSymbol(yyBase);
05420: yyError = yyResult.select(yyError);
05421: if (yyResult.hasValue(",")) {
05422:
05423: yyResult = pAttributeListEntry(yyResult.index);
05424: yyError = yyResult.select(yyError);
05425: if (yyResult.hasValue()) {
05426: final Node v$el$1 = yyResult.semanticValue();
05427:
05428: yyRepetition1 = yyResult.index;
05429: yyRepValue1 = new Pair<Node>(v$el$1,
05430: yyRepValue1);
05431: continue;
05432: }
05433: } else {
05434: yyError = yyError.select("\",\" expected", yyBase);
05435: }
05436: break;
05437: }
05438: { // Start scope for v$g$2.
05439: final Pair<Node> v$g$2 = yyRepValue1.reverse();
05440:
05441: yyValue = GNode.createFromPair("AttributeList", v$g$1,
05442: v$g$2);
05443: yyValue.setLocation(location(yyStart));
05444:
05445: return new SemanticValue(yyValue, yyRepetition1,
05446: yyError);
05447: } // End scope for v$g$2.
05448: }
05449:
05450: // Done.
05451: return yyError;
05452: }
05453:
05454: // =========================================================================
05455:
05456: /**
05457: * Parse nonterminal xtc.lang.c4.C4.AttributeListEntry.
05458: *
05459: * @param yyStart The index.
05460: * @return The result.
05461: * @throws IOException Signals an I/O error.
05462: */
05463: private Result pAttributeListEntry(final int yyStart)
05464: throws IOException {
05465: Result yyResult;
05466: int yyBase;
05467: int yyOption1;
05468: Node yyOpValue1;
05469: int yyOption2;
05470: Node yyOpValue2;
05471: Node yyValue;
05472: ParseError yyError = ParseError.DUMMY;
05473:
05474: // Alternative 1.
05475:
05476: yyResult = pWord(yyStart);
05477: yyError = yyResult.select(yyError);
05478: if (yyResult.hasValue()) {
05479: final String v$g$1 = yyResult.semanticValue();
05480:
05481: yyOption1 = yyResult.index;
05482: yyOpValue1 = null;
05483:
05484: yyBase = yyOption1;
05485: yyResult = pSymbol(yyBase);
05486: yyError = yyResult.select(yyError);
05487: if (yyResult.hasValue("(")) {
05488:
05489: yyOption2 = yyResult.index;
05490: yyOpValue2 = null;
05491:
05492: yyResult = pExpressionList(yyOption2);
05493: yyError = yyResult.select(yyError);
05494: if (yyResult.hasValue()) {
05495: final Node v$el$2 = yyResult.semanticValue();
05496:
05497: yyOption2 = yyResult.index;
05498: yyOpValue2 = v$el$2;
05499: }
05500: { // Start scope for v$el$1.
05501: final Node v$el$1 = yyOpValue2;
05502:
05503: yyBase = yyOption2;
05504: yyResult = pSymbol(yyBase);
05505: yyError = yyResult.select(yyError);
05506: if (yyResult.hasValue(")")) {
05507:
05508: yyOption1 = yyResult.index;
05509: yyOpValue1 = v$el$1;
05510: } else {
05511: yyError = yyError.select("\")\" expected",
05512: yyBase);
05513: }
05514: } // End scope for v$el$1.
05515: } else {
05516: yyError = yyError.select("\"(\" expected", yyBase);
05517: }
05518: { // Start scope for v$g$2.
05519: final Node v$g$2 = yyOpValue1;
05520:
05521: yyValue = GNode.create("AttributeListEntry", v$g$1,
05522: v$g$2);
05523: yyValue.setLocation(location(yyStart));
05524:
05525: return new SemanticValue(yyValue, yyOption1, yyError);
05526: } // End scope for v$g$2.
05527: }
05528:
05529: // Done.
05530: return yyError;
05531: }
05532:
05533: // =========================================================================
05534:
05535: /**
05536: * Parse nonterminal xtc.lang.c4.C4.Statement.
05537: *
05538: * @param yyStart The index.
05539: * @return The result.
05540: * @throws IOException Signals an I/O error.
05541: */
05542: private Result pStatement(final int yyStart) throws IOException {
05543: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
05544: if (null == yyColumn.chunk2)
05545: yyColumn.chunk2 = new Chunk2();
05546: if (null == yyColumn.chunk2.fStatement)
05547: yyColumn.chunk2.fStatement = pStatement$1(yyStart);
05548: return yyColumn.chunk2.fStatement;
05549: }
05550:
05551: /** Actually parse xtc.lang.c4.C4.Statement. */
05552: private Result pStatement$1(final int yyStart) throws IOException {
05553: Result yyResult;
05554: int yyBase;
05555: int yyOption1;
05556: Node yyOpValue1;
05557: Node yyValue;
05558: ParseError yyError = ParseError.DUMMY;
05559:
05560: // Alternative 1.
05561:
05562: yyResult = pCommaExpression(yyStart);
05563: yyError = yyResult.select(yyError);
05564: if (yyResult.hasValue()) {
05565: final Node v$g$1 = yyResult.semanticValue();
05566:
05567: yyBase = yyResult.index;
05568: yyResult = pSymbol(yyBase);
05569: yyError = yyResult.select(yyError);
05570: if (yyResult.hasValue(";")) {
05571:
05572: yyValue = GNode.create("ExpressionStatement", v$g$1);
05573: yyValue.setLocation(location(yyStart));
05574:
05575: return yyResult.createValue(yyValue, yyError);
05576: } else {
05577: yyError = yyError.select("\";\" expected", yyBase);
05578: }
05579: }
05580:
05581: // Alternative <Compound>.
05582:
05583: yyResult = pCompoundStatement(yyStart);
05584: yyError = yyResult.select(yyError);
05585: if (yyResult.hasValue()) {
05586: yyValue = yyResult.semanticValue();
05587:
05588: return yyResult.createValue(yyValue, yyError);
05589: }
05590:
05591: // Alternative 3.
05592:
05593: yyResult = pKeyword(yyStart);
05594: yyError = yyResult.select(yyError);
05595: if (yyResult.hasValue("if")) {
05596:
05597: yyBase = yyResult.index;
05598: yyResult = pSymbol(yyBase);
05599: yyError = yyResult.select(yyError);
05600: if (yyResult.hasValue("(")) {
05601:
05602: yyResult = pCommaExpression(yyResult.index);
05603: yyError = yyResult.select(yyError);
05604: if (yyResult.hasValue()) {
05605: final Node v$g$1 = yyResult.semanticValue();
05606:
05607: yyBase = yyResult.index;
05608: yyResult = pSymbol(yyBase);
05609: yyError = yyResult.select(yyError);
05610: if (yyResult.hasValue(")")) {
05611:
05612: yyResult = pStatement(yyResult.index);
05613: yyError = yyResult.select(yyError);
05614: if (yyResult.hasValue()) {
05615: final Node v$g$2 = yyResult.semanticValue();
05616:
05617: final int yyChoice1 = yyResult.index;
05618:
05619: // Nested alternative 1.
05620:
05621: yyBase = yyChoice1;
05622: yyResult = pKeyword(yyBase);
05623: yyError = yyResult.select(yyError);
05624: if (yyResult.hasValue("else")) {
05625:
05626: yyResult = pStatement(yyResult.index);
05627: yyError = yyResult.select(yyError);
05628: if (yyResult.hasValue()) {
05629: final Node v$g$3 = yyResult
05630: .semanticValue();
05631:
05632: yyValue = GNode.create(
05633: "IfElseStatement", v$g$1,
05634: v$g$2, v$g$3);
05635: yyValue
05636: .setLocation(location(yyStart));
05637:
05638: return yyResult.createValue(
05639: yyValue, yyError);
05640: }
05641: } else {
05642: yyError = yyError.select(
05643: "\"else\" expected", yyBase);
05644: }
05645:
05646: // Nested alternative 2.
05647:
05648: yyValue = GNode.create("IfStatement",
05649: v$g$1, v$g$2);
05650: yyValue.setLocation(location(yyStart));
05651:
05652: return new SemanticValue(yyValue,
05653: yyChoice1, yyError);
05654: }
05655: } else {
05656: yyError = yyError.select("\")\" expected",
05657: yyBase);
05658: }
05659: }
05660: } else {
05661: yyError = yyError.select("\"(\" expected", yyBase);
05662: }
05663: }
05664:
05665: // Alternative 4.
05666:
05667: yyResult = pKeyword(yyStart);
05668: yyError = yyResult.select(yyError);
05669: if (yyResult.hasValue("while")) {
05670:
05671: yyBase = yyResult.index;
05672: yyResult = pSymbol(yyBase);
05673: yyError = yyResult.select(yyError);
05674: if (yyResult.hasValue("(")) {
05675:
05676: yyResult = pCommaExpression(yyResult.index);
05677: yyError = yyResult.select(yyError);
05678: if (yyResult.hasValue()) {
05679: final Node v$g$1 = yyResult.semanticValue();
05680:
05681: yyBase = yyResult.index;
05682: yyResult = pSymbol(yyBase);
05683: yyError = yyResult.select(yyError);
05684: if (yyResult.hasValue(")")) {
05685:
05686: yyResult = pStatement(yyResult.index);
05687: yyError = yyResult.select(yyError);
05688: if (yyResult.hasValue()) {
05689: final Node v$g$2 = yyResult.semanticValue();
05690:
05691: yyValue = GNode.create("WhileStatement",
05692: v$g$1, v$g$2);
05693: yyValue.setLocation(location(yyStart));
05694:
05695: return yyResult.createValue(yyValue,
05696: yyError);
05697: }
05698: } else {
05699: yyError = yyError.select("\")\" expected",
05700: yyBase);
05701: }
05702: }
05703: } else {
05704: yyError = yyError.select("\"(\" expected", yyBase);
05705: }
05706: }
05707:
05708: // Alternative 5.
05709:
05710: yyResult = pKeyword(yyStart);
05711: yyError = yyResult.select(yyError);
05712: if (yyResult.hasValue("do")) {
05713:
05714: yyResult = pStatement(yyResult.index);
05715: yyError = yyResult.select(yyError);
05716: if (yyResult.hasValue()) {
05717: final Node v$g$1 = yyResult.semanticValue();
05718:
05719: yyBase = yyResult.index;
05720: yyResult = pKeyword(yyBase);
05721: yyError = yyResult.select(yyError);
05722: if (yyResult.hasValue("while")) {
05723:
05724: yyBase = yyResult.index;
05725: yyResult = pSymbol(yyBase);
05726: yyError = yyResult.select(yyError);
05727: if (yyResult.hasValue("(")) {
05728:
05729: yyResult = pCommaExpression(yyResult.index);
05730: yyError = yyResult.select(yyError);
05731: if (yyResult.hasValue()) {
05732: final Node v$g$2 = yyResult.semanticValue();
05733:
05734: yyBase = yyResult.index;
05735: yyResult = pSymbol(yyBase);
05736: yyError = yyResult.select(yyError);
05737: if (yyResult.hasValue(")")) {
05738:
05739: yyBase = yyResult.index;
05740: yyResult = pSymbol(yyBase);
05741: yyError = yyResult.select(yyError);
05742: if (yyResult.hasValue(";")) {
05743:
05744: yyValue = GNode
05745: .create("DoStatement",
05746: v$g$1, v$g$2);
05747: yyValue
05748: .setLocation(location(yyStart));
05749:
05750: return yyResult.createValue(
05751: yyValue, yyError);
05752: } else {
05753: yyError = yyError.select(
05754: "\";\" expected", yyBase);
05755: }
05756: } else {
05757: yyError = yyError.select(
05758: "\")\" expected", yyBase);
05759: }
05760: }
05761: } else {
05762: yyError = yyError.select("\"(\" expected",
05763: yyBase);
05764: }
05765: } else {
05766: yyError = yyError.select("\"while\" expected",
05767: yyBase);
05768: }
05769: }
05770: }
05771:
05772: // Alternative 6.
05773:
05774: yyResult = pKeyword(yyStart);
05775: yyError = yyResult.select(yyError);
05776: if (yyResult.hasValue("for")) {
05777:
05778: yyResult = pPushScope(yyResult.index);
05779: yyError = yyResult.select(yyError);
05780: if (yyResult.hasValue()) {
05781:
05782: yyBase = yyResult.index;
05783: yyResult = pSymbol(yyBase);
05784: yyError = yyResult.select(yyError);
05785: if (yyResult.hasValue("(")) {
05786:
05787: yyResult = pInitialClause(yyResult.index);
05788: yyError = yyResult.select(yyError);
05789: if (yyResult.hasValue()) {
05790: final Node v$g$1 = yyResult.semanticValue();
05791:
05792: yyOption1 = yyResult.index;
05793: yyOpValue1 = null;
05794:
05795: yyResult = pCommaExpression(yyOption1);
05796: yyError = yyResult.select(yyError);
05797: if (yyResult.hasValue()) {
05798: final Node v$el$1 = yyResult
05799: .semanticValue();
05800:
05801: yyOption1 = yyResult.index;
05802: yyOpValue1 = v$el$1;
05803: }
05804: { // Start scope for v$g$2.
05805: final Node v$g$2 = yyOpValue1;
05806:
05807: yyBase = yyOption1;
05808: yyResult = pSymbol(yyBase);
05809: yyError = yyResult.select(yyError);
05810: if (yyResult.hasValue(";")) {
05811:
05812: yyOption1 = yyResult.index;
05813: yyOpValue1 = null;
05814:
05815: yyResult = pCommaExpression(yyOption1);
05816: yyError = yyResult.select(yyError);
05817: if (yyResult.hasValue()) {
05818: final Node v$el$2 = yyResult
05819: .semanticValue();
05820:
05821: yyOption1 = yyResult.index;
05822: yyOpValue1 = v$el$2;
05823: }
05824: { // Start scope for v$g$3.
05825: final Node v$g$3 = yyOpValue1;
05826:
05827: yyBase = yyOption1;
05828: yyResult = pSymbol(yyBase);
05829: yyError = yyResult.select(yyError);
05830: if (yyResult.hasValue(")")) {
05831:
05832: yyResult = pStatement(yyResult.index);
05833: yyError = yyResult
05834: .select(yyError);
05835: if (yyResult.hasValue()) {
05836: final Node v$g$4 = yyResult
05837: .semanticValue();
05838:
05839: yyResult = pPopScope(yyResult.index);
05840: yyError = yyResult
05841: .select(yyError);
05842: if (yyResult.hasValue()) {
05843:
05844: yyValue = GNode.create(
05845: "ForStatement",
05846: v$g$1, v$g$2,
05847: v$g$3, v$g$4);
05848: yyValue
05849: .setLocation(location(yyStart));
05850:
05851: return yyResult
05852: .createValue(
05853: yyValue,
05854: yyError);
05855: }
05856: }
05857: } else {
05858: yyError = yyError.select(
05859: "\")\" expected",
05860: yyBase);
05861: }
05862: } // End scope for v$g$3.
05863: } else {
05864: yyError = yyError.select(
05865: "\";\" expected", yyBase);
05866: }
05867: } // End scope for v$g$2.
05868: }
05869: } else {
05870: yyError = yyError.select("\"(\" expected", yyBase);
05871: }
05872: }
05873: }
05874:
05875: // Alternative 7.
05876:
05877: yyResult = pKeyword(yyStart);
05878: yyError = yyResult.select(yyError);
05879: if (yyResult.hasValue("switch")) {
05880:
05881: yyBase = yyResult.index;
05882: yyResult = pSymbol(yyBase);
05883: yyError = yyResult.select(yyError);
05884: if (yyResult.hasValue("(")) {
05885:
05886: yyResult = pCommaExpression(yyResult.index);
05887: yyError = yyResult.select(yyError);
05888: if (yyResult.hasValue()) {
05889: final Node v$g$1 = yyResult.semanticValue();
05890:
05891: yyBase = yyResult.index;
05892: yyResult = pSymbol(yyBase);
05893: yyError = yyResult.select(yyError);
05894: if (yyResult.hasValue(")")) {
05895:
05896: yyResult = pStatement(yyResult.index);
05897: yyError = yyResult.select(yyError);
05898: if (yyResult.hasValue()) {
05899: final Node v$g$2 = yyResult.semanticValue();
05900:
05901: yyValue = GNode.create("SwitchStatement",
05902: v$g$1, v$g$2);
05903: yyValue.setLocation(location(yyStart));
05904:
05905: return yyResult.createValue(yyValue,
05906: yyError);
05907: }
05908: } else {
05909: yyError = yyError.select("\")\" expected",
05910: yyBase);
05911: }
05912: }
05913: } else {
05914: yyError = yyError.select("\"(\" expected", yyBase);
05915: }
05916: }
05917:
05918: // Alternative <Complete>.
05919:
05920: yyResult = pLabel(yyStart);
05921: yyError = yyResult.select(yyError);
05922: if (yyResult.hasValue()) {
05923: final Node v$g$1 = yyResult.semanticValue();
05924:
05925: yyResult = pStatement(yyResult.index);
05926: yyError = yyResult.select(yyError);
05927: if (yyResult.hasValue()) {
05928: final Node v$g$2 = yyResult.semanticValue();
05929:
05930: yyValue = GNode
05931: .create("LabeledStatement", v$g$1, v$g$2);
05932: yyValue.setLocation(location(yyStart));
05933:
05934: return yyResult.createValue(yyValue, yyError);
05935: }
05936: }
05937:
05938: // Alternative <Incomplete>.
05939:
05940: if (GCC) {
05941:
05942: yyResult = pLabel(yyStart);
05943: yyError = yyResult.select(yyError);
05944: if (yyResult.hasValue()) {
05945: final Node v$g$3 = yyResult.semanticValue();
05946:
05947: yyValue = GNode.create("LabeledStatement", v$g$3, null);
05948: yyValue.setLocation(location(yyStart));
05949:
05950: return yyResult.createValue(yyValue, yyError);
05951: }
05952: }
05953:
05954: // Alternative 10.
05955:
05956: yyResult = pKeyword(yyStart);
05957: yyError = yyResult.select(yyError);
05958: if (yyResult.hasValue("break")) {
05959:
05960: yyBase = yyResult.index;
05961: yyResult = pSymbol(yyBase);
05962: yyError = yyResult.select(yyError);
05963: if (yyResult.hasValue(";")) {
05964:
05965: yyValue = GNode.create("BreakStatement", false);
05966: yyValue.setLocation(location(yyStart));
05967:
05968: return yyResult.createValue(yyValue, yyError);
05969: } else {
05970: yyError = yyError.select("\";\" expected", yyBase);
05971: }
05972: }
05973:
05974: // Alternative 11.
05975:
05976: yyResult = pKeyword(yyStart);
05977: yyError = yyResult.select(yyError);
05978: if (yyResult.hasValue("continue")) {
05979:
05980: yyBase = yyResult.index;
05981: yyResult = pSymbol(yyBase);
05982: yyError = yyResult.select(yyError);
05983: if (yyResult.hasValue(";")) {
05984:
05985: yyValue = GNode.create("ContinueStatement", false);
05986: yyValue.setLocation(location(yyStart));
05987:
05988: return yyResult.createValue(yyValue, yyError);
05989: } else {
05990: yyError = yyError.select("\";\" expected", yyBase);
05991: }
05992: }
05993:
05994: // Alternative 12.
05995:
05996: yyResult = pKeyword(yyStart);
05997: yyError = yyResult.select(yyError);
05998: if (yyResult.hasValue("return")) {
05999:
06000: yyOption1 = yyResult.index;
06001: yyOpValue1 = null;
06002:
06003: yyResult = pCommaExpression(yyOption1);
06004: yyError = yyResult.select(yyError);
06005: if (yyResult.hasValue()) {
06006: final Node v$el$1 = yyResult.semanticValue();
06007:
06008: yyOption1 = yyResult.index;
06009: yyOpValue1 = v$el$1;
06010: }
06011: { // Start scope for v$g$1.
06012: final Node v$g$1 = yyOpValue1;
06013:
06014: yyBase = yyOption1;
06015: yyResult = pSymbol(yyBase);
06016: yyError = yyResult.select(yyError);
06017: if (yyResult.hasValue(";")) {
06018:
06019: yyValue = GNode.create("ReturnStatement", v$g$1);
06020: yyValue.setLocation(location(yyStart));
06021:
06022: return yyResult.createValue(yyValue, yyError);
06023: } else {
06024: yyError = yyError.select("\";\" expected", yyBase);
06025: }
06026: } // End scope for v$g$1.
06027: }
06028:
06029: // Alternative <Direct>.
06030:
06031: yyResult = pKeyword(yyStart);
06032: yyError = yyResult.select(yyError);
06033: if (yyResult.hasValue("goto")) {
06034:
06035: yyResult = pPrimaryIdentifier(yyResult.index);
06036: yyError = yyResult.select(yyError);
06037: if (yyResult.hasValue()) {
06038: final Node v$g$2 = yyResult.semanticValue();
06039:
06040: yyBase = yyResult.index;
06041: yyResult = pSymbol(yyBase);
06042: yyError = yyResult.select(yyError);
06043: if (yyResult.hasValue(";")) {
06044:
06045: yyValue = GNode
06046: .create("GotoStatement", null, v$g$2);
06047: yyValue.setLocation(location(yyStart));
06048:
06049: return yyResult.createValue(yyValue, yyError);
06050: } else {
06051: yyError = yyError.select("\";\" expected", yyBase);
06052: }
06053: }
06054: }
06055:
06056: // Alternative <Computed>.
06057:
06058: if (GCC) {
06059:
06060: yyResult = pKeyword(yyStart);
06061: yyError = yyResult.select(yyError);
06062: if (yyResult.hasValue("goto")) {
06063:
06064: yyBase = yyResult.index;
06065: yyResult = pSymbol(yyBase);
06066: yyError = yyResult.select(yyError);
06067: if (yyResult.hasValue("*")) {
06068: final String v$g$3 = "*";
06069:
06070: yyResult = pCommaExpression(yyResult.index);
06071: yyError = yyResult.select(yyError);
06072: if (yyResult.hasValue()) {
06073: final Node v$g$4 = yyResult.semanticValue();
06074:
06075: yyBase = yyResult.index;
06076: yyResult = pSymbol(yyBase);
06077: yyError = yyResult.select(yyError);
06078: if (yyResult.hasValue(";")) {
06079:
06080: yyValue = GNode.create("GotoStatement",
06081: v$g$3, v$g$4);
06082: yyValue.setLocation(location(yyStart));
06083:
06084: return yyResult.createValue(yyValue,
06085: yyError);
06086: } else {
06087: yyError = yyError.select("\";\" expected",
06088: yyBase);
06089: }
06090: }
06091: } else {
06092: yyError = yyError.select("\"*\" expected", yyBase);
06093: }
06094: }
06095: }
06096:
06097: // Alternative 15.
06098:
06099: yyResult = pAsmKeyword(yyStart);
06100: yyError = yyResult.select(yyError);
06101: if (yyResult.hasValue()) {
06102:
06103: yyOption1 = yyResult.index;
06104: yyOpValue1 = null;
06105:
06106: yyResult = pTypeQualifier(yyOption1);
06107: yyError = yyResult.select(yyError);
06108: if (yyResult.hasValue()) {
06109: final Node v$el$1 = yyResult.semanticValue();
06110:
06111: yyOption1 = yyResult.index;
06112: yyOpValue1 = v$el$1;
06113: }
06114: { // Start scope for v$g$1.
06115: final Node v$g$1 = yyOpValue1;
06116:
06117: yyBase = yyOption1;
06118: yyResult = pSymbol(yyBase);
06119: yyError = yyResult.select(yyError);
06120: if (yyResult.hasValue("(")) {
06121:
06122: yyResult = pAssemblyArgument(yyResult.index);
06123: yyError = yyResult.select(yyError);
06124: if (yyResult.hasValue()) {
06125: final Node v$g$2 = yyResult.semanticValue();
06126:
06127: yyBase = yyResult.index;
06128: yyResult = pSymbol(yyBase);
06129: yyError = yyResult.select(yyError);
06130: if (yyResult.hasValue(")")) {
06131:
06132: yyBase = yyResult.index;
06133: yyResult = pSymbol(yyBase);
06134: yyError = yyResult.select(yyError);
06135: if (yyResult.hasValue(";")) {
06136: final String v$g$3 = ";";
06137:
06138: yyValue = GNode.create(
06139: "AssemblyStatement", v$g$1,
06140: v$g$2, v$g$3);
06141: yyValue.setLocation(location(yyStart));
06142:
06143: return yyResult.createValue(yyValue,
06144: yyError);
06145: } else {
06146: yyError = yyError.select(
06147: "\";\" expected", yyBase);
06148: }
06149: } else {
06150: yyError = yyError.select("\")\" expected",
06151: yyBase);
06152: }
06153: }
06154: } else {
06155: yyError = yyError.select("\"(\" expected", yyBase);
06156: }
06157: } // End scope for v$g$1.
06158: }
06159:
06160: // Alternative 16.
06161:
06162: yyResult = pSymbol(yyStart);
06163: yyError = yyResult.select(yyError);
06164: if (yyResult.hasValue(";")) {
06165:
06166: yyValue = GNode.create("EmptyStatement", false);
06167: yyValue.setLocation(location(yyStart));
06168:
06169: return yyResult.createValue(yyValue, yyError);
06170: }
06171:
06172: // Done.
06173: yyError = yyError.select("statement expected", yyStart);
06174: return yyError;
06175: }
06176:
06177: // =========================================================================
06178:
06179: /**
06180: * Parse nonterminal xtc.lang.c4.C4.Label.
06181: *
06182: * @param yyStart The index.
06183: * @return The result.
06184: * @throws IOException Signals an I/O error.
06185: */
06186: private Result pLabel(final int yyStart) throws IOException {
06187: Result yyResult;
06188: int yyBase;
06189: int yyOption1;
06190: Node yyOpValue1;
06191: Node yyValue;
06192: ParseError yyError = ParseError.DUMMY;
06193:
06194: // Alternative <Label>.
06195:
06196: yyResult = pIdentifier(yyStart);
06197: yyError = yyResult.select(yyError);
06198: if (yyResult.hasValue()) {
06199: final String v$g$1 = yyResult.semanticValue();
06200:
06201: yyBase = yyResult.index;
06202: yyResult = pSymbol(yyBase);
06203: yyError = yyResult.select(yyError);
06204: if (yyResult.hasValue(":")) {
06205:
06206: yyOption1 = yyResult.index;
06207: yyOpValue1 = null;
06208:
06209: yyResult = pAttributeSpecifierList(yyOption1);
06210: yyError = yyResult.select(yyError);
06211: if (yyResult.hasValue()) {
06212: final Node v$el$1 = yyResult.semanticValue();
06213:
06214: yyOption1 = yyResult.index;
06215: yyOpValue1 = v$el$1;
06216: }
06217: { // Start scope for v$g$2.
06218: final Node v$g$2 = yyOpValue1;
06219:
06220: yyValue = GNode.create("NamedLabel", v$g$1, v$g$2);
06221: yyValue.setLocation(location(yyStart));
06222:
06223: return new SemanticValue(yyValue, yyOption1,
06224: yyError);
06225: } // End scope for v$g$2.
06226: } else {
06227: yyError = yyError.select("\":\" expected", yyBase);
06228: }
06229: }
06230:
06231: // Alternative <Range>.
06232:
06233: if (GCC) {
06234:
06235: yyResult = pKeyword(yyStart);
06236: yyError = yyResult.select(yyError);
06237: if (yyResult.hasValue("case")) {
06238:
06239: yyResult = pConditionalExpression(yyResult.index);
06240: yyError = yyResult.select(yyError);
06241: if (yyResult.hasValue()) {
06242: final Node v$g$1 = yyResult.semanticValue();
06243:
06244: yyBase = yyResult.index;
06245: yyResult = pSymbol(yyBase);
06246: yyError = yyResult.select(yyError);
06247: if (yyResult.hasValue("...")) {
06248:
06249: yyResult = pConditionalExpression(yyResult.index);
06250: yyError = yyResult.select(yyError);
06251: if (yyResult.hasValue()) {
06252: final Node v$g$2 = yyResult.semanticValue();
06253:
06254: yyBase = yyResult.index;
06255: yyResult = pSymbol(yyBase);
06256: yyError = yyResult.select(yyError);
06257: if (yyResult.hasValue(":")) {
06258:
06259: yyValue = GNode.create("CaseLabel",
06260: v$g$1, v$g$2);
06261: yyValue.setLocation(location(yyStart));
06262:
06263: return yyResult.createValue(yyValue,
06264: yyError);
06265: } else {
06266: yyError = yyError.select(
06267: "\":\" expected", yyBase);
06268: }
06269: }
06270: } else {
06271: yyError = yyError.select("\"...\" expected",
06272: yyBase);
06273: }
06274: }
06275: }
06276: }
06277:
06278: // Alternative <Simple>.
06279:
06280: yyResult = pKeyword(yyStart);
06281: yyError = yyResult.select(yyError);
06282: if (yyResult.hasValue("case")) {
06283:
06284: yyResult = pConditionalExpression(yyResult.index);
06285: yyError = yyResult.select(yyError);
06286: if (yyResult.hasValue()) {
06287: final Node v$g$3 = yyResult.semanticValue();
06288:
06289: yyBase = yyResult.index;
06290: yyResult = pSymbol(yyBase);
06291: yyError = yyResult.select(yyError);
06292: if (yyResult.hasValue(":")) {
06293:
06294: yyValue = GNode.create("CaseLabel", v$g$3);
06295: yyValue.setLocation(location(yyStart));
06296:
06297: return yyResult.createValue(yyValue, yyError);
06298: } else {
06299: yyError = yyError.select("\":\" expected", yyBase);
06300: }
06301: }
06302: }
06303:
06304: // Alternative 4.
06305:
06306: yyResult = pKeyword(yyStart);
06307: yyError = yyResult.select(yyError);
06308: if (yyResult.hasValue("default")) {
06309:
06310: yyBase = yyResult.index;
06311: yyResult = pSymbol(yyBase);
06312: yyError = yyResult.select(yyError);
06313: if (yyResult.hasValue(":")) {
06314:
06315: yyValue = GNode.create("DefaultLabel", false);
06316: yyValue.setLocation(location(yyStart));
06317:
06318: return yyResult.createValue(yyValue, yyError);
06319: } else {
06320: yyError = yyError.select("\":\" expected", yyBase);
06321: }
06322: }
06323:
06324: // Done.
06325: yyError = yyError.select("label expected", yyStart);
06326: return yyError;
06327: }
06328:
06329: // =========================================================================
06330:
06331: /**
06332: * Parse nonterminal xtc.lang.c4.C4.CompoundStatement.
06333: *
06334: * @param yyStart The index.
06335: * @return The result.
06336: * @throws IOException Signals an I/O error.
06337: */
06338: private Result pCompoundStatement(final int yyStart)
06339: throws IOException {
06340: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
06341: if (null == yyColumn.chunk2)
06342: yyColumn.chunk2 = new Chunk2();
06343: if (null == yyColumn.chunk2.fCompoundStatement)
06344: yyColumn.chunk2.fCompoundStatement = pCompoundStatement$1(yyStart);
06345: return yyColumn.chunk2.fCompoundStatement;
06346: }
06347:
06348: /** Actually parse xtc.lang.c4.C4.CompoundStatement. */
06349: private Result pCompoundStatement$1(final int yyStart)
06350: throws IOException {
06351: Result yyResult;
06352: int yyBase;
06353: Node yyValue;
06354: ParseError yyError = ParseError.DUMMY;
06355:
06356: // Alternative <Compound>.
06357:
06358: yyResult = pSymbol(yyStart);
06359: yyError = yyResult.select(yyError);
06360: if (yyResult.hasValue("{")) {
06361:
06362: yyResult = pPushScope(yyResult.index);
06363: yyError = yyResult.select(yyError);
06364: if (yyResult.hasValue()) {
06365:
06366: yyResult = pCompoundStatement$$Star1(yyResult.index);
06367: yyError = yyResult.select(yyError);
06368: if (yyResult.hasValue()) {
06369: final Pair<Node> v$g$1 = yyResult.semanticValue();
06370:
06371: yyResult = pCompoundStatement$$Star2(yyResult.index);
06372: yyError = yyResult.select(yyError);
06373: if (yyResult.hasValue()) {
06374: final Pair<Node> v$g$2 = yyResult
06375: .semanticValue();
06376:
06377: yyResult = pAnnotations(yyResult.index);
06378: yyError = yyResult.select(yyError);
06379: if (yyResult.hasValue()) {
06380: final Node v$g$3 = yyResult.semanticValue();
06381:
06382: yyBase = yyResult.index;
06383: yyResult = pSymbol(yyBase);
06384: yyError = yyResult.select(yyError);
06385: if (yyResult.hasValue("}")) {
06386:
06387: yyResult = pPopScope(yyResult.index);
06388: yyError = yyResult.select(yyError);
06389: if (yyResult.hasValue()) {
06390:
06391: yyValue = GNode.create(
06392: "CompoundStatement",
06393: v$g$1.size() + v$g$2.size()
06394: + 1).addAll(v$g$1)
06395: .addAll(v$g$2).add(v$g$3);
06396: yyValue
06397: .setLocation(location(yyStart));
06398:
06399: return yyResult.createValue(
06400: yyValue, yyError);
06401: }
06402: } else {
06403: yyError = yyError.select(
06404: "\"}\" expected", yyBase);
06405: }
06406: }
06407: }
06408: }
06409: }
06410: }
06411:
06412: // Done.
06413: yyError = yyError
06414: .select("compound statement expected", yyStart);
06415: return yyError;
06416: }
06417:
06418: // =========================================================================
06419:
06420: /**
06421: * Parse synthetic nonterminal xtc.lang.c4.C4.CompoundStatement$$Star1.
06422: *
06423: * @param yyStart The index.
06424: * @return The result.
06425: * @throws IOException Signals an I/O error.
06426: */
06427: private Result pCompoundStatement$$Star1(final int yyStart)
06428: throws IOException {
06429:
06430: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
06431: if (null == yyColumn.chunk2)
06432: yyColumn.chunk2 = new Chunk2();
06433: if (null == yyColumn.chunk2.fCompoundStatement$$Star1)
06434: yyColumn.chunk2.fCompoundStatement$$Star1 = pCompoundStatement$$Star1$1(yyStart);
06435: return yyColumn.chunk2.fCompoundStatement$$Star1;
06436: }
06437:
06438: /** Actually parse xtc.lang.c4.C4.CompoundStatement$$Star1. */
06439: private Result pCompoundStatement$$Star1$1(final int yyStart)
06440: throws IOException {
06441:
06442: Result yyResult;
06443: Pair<Node> yyValue;
06444: ParseError yyError = ParseError.DUMMY;
06445:
06446: // Alternative 1.
06447:
06448: yyResult = pLocalLabelDeclaration(yyStart);
06449: yyError = yyResult.select(yyError);
06450: if (yyResult.hasValue()) {
06451: final Node v$el$1 = yyResult.semanticValue();
06452:
06453: yyResult = pCompoundStatement$$Star1(yyResult.index);
06454: yyError = yyResult.select(yyError);
06455: if (yyResult.hasValue()) {
06456: final Pair<Node> v$2 = yyResult.semanticValue();
06457:
06458: yyValue = new Pair<Node>(v$el$1, v$2);
06459:
06460: return yyResult.createValue(yyValue, yyError);
06461: }
06462: }
06463:
06464: // Alternative 2.
06465:
06466: yyValue = Pair.empty();
06467:
06468: return new SemanticValue(yyValue, yyStart, yyError);
06469: }
06470:
06471: // =========================================================================
06472:
06473: /**
06474: * Parse synthetic nonterminal xtc.lang.c4.C4.CompoundStatement$$Star2.
06475: *
06476: * @param yyStart The index.
06477: * @return The result.
06478: * @throws IOException Signals an I/O error.
06479: */
06480: private Result pCompoundStatement$$Star2(final int yyStart)
06481: throws IOException {
06482:
06483: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
06484: if (null == yyColumn.chunk2)
06485: yyColumn.chunk2 = new Chunk2();
06486: if (null == yyColumn.chunk2.fCompoundStatement$$Star2)
06487: yyColumn.chunk2.fCompoundStatement$$Star2 = pCompoundStatement$$Star2$1(yyStart);
06488: return yyColumn.chunk2.fCompoundStatement$$Star2;
06489: }
06490:
06491: /** Actually parse xtc.lang.c4.C4.CompoundStatement$$Star2. */
06492: private Result pCompoundStatement$$Star2$1(final int yyStart)
06493: throws IOException {
06494:
06495: Result yyResult;
06496: Pair<Node> yyValue;
06497: ParseError yyError = ParseError.DUMMY;
06498:
06499: // Alternative 1.
06500:
06501: yyResult = pDeclarationOrStatement(yyStart);
06502: yyError = yyResult.select(yyError);
06503: if (yyResult.hasValue()) {
06504: final Node v$el$3 = yyResult.semanticValue();
06505:
06506: yyResult = pCompoundStatement$$Star2(yyResult.index);
06507: yyError = yyResult.select(yyError);
06508: if (yyResult.hasValue()) {
06509: final Pair<Node> v$4 = yyResult.semanticValue();
06510:
06511: yyValue = new Pair<Node>(v$el$3, v$4);
06512:
06513: return yyResult.createValue(yyValue, yyError);
06514: }
06515: }
06516:
06517: // Alternative 2.
06518:
06519: yyValue = Pair.empty();
06520:
06521: return new SemanticValue(yyValue, yyStart, yyError);
06522: }
06523:
06524: // =========================================================================
06525:
06526: /**
06527: * Parse nonterminal xtc.lang.c4.C4.LocalLabelDeclaration.
06528: *
06529: * @param yyStart The index.
06530: * @return The result.
06531: * @throws IOException Signals an I/O error.
06532: */
06533: private Result pLocalLabelDeclaration(final int yyStart)
06534: throws IOException {
06535:
06536: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
06537: if (null == yyColumn.chunk2)
06538: yyColumn.chunk2 = new Chunk2();
06539: if (null == yyColumn.chunk2.fLocalLabelDeclaration)
06540: yyColumn.chunk2.fLocalLabelDeclaration = pLocalLabelDeclaration$1(yyStart);
06541: return yyColumn.chunk2.fLocalLabelDeclaration;
06542: }
06543:
06544: /** Actually parse xtc.lang.c4.C4.LocalLabelDeclaration. */
06545: private Result pLocalLabelDeclaration$1(final int yyStart)
06546: throws IOException {
06547:
06548: Result yyResult;
06549: int yyBase;
06550: Node yyValue;
06551: ParseError yyError = ParseError.DUMMY;
06552:
06553: // Alternative 1.
06554:
06555: yyResult = pKeyword(yyStart);
06556: yyError = yyResult.select(yyError);
06557: if (yyResult.hasValue("__label__")) {
06558:
06559: yyResult = pIdentifier(yyResult.index);
06560: yyError = yyResult.select(yyError);
06561: if (yyResult.hasValue()) {
06562: final String v$g$1 = yyResult.semanticValue();
06563:
06564: yyResult = pLocalLabelDeclaration$$Star1(yyResult.index);
06565: yyError = yyResult.select(yyError);
06566: if (yyResult.hasValue()) {
06567: final Pair<String> v$g$2 = yyResult.semanticValue();
06568:
06569: yyBase = yyResult.index;
06570: yyResult = pSymbol(yyBase);
06571: yyError = yyResult.select(yyError);
06572: if (yyResult.hasValue(";")) {
06573:
06574: yyValue = GNode.createFromPair(
06575: "LocalLabelDeclaration", v$g$1, v$g$2);
06576: yyValue.setLocation(location(yyStart));
06577:
06578: return yyResult.createValue(yyValue, yyError);
06579: } else {
06580: yyError = yyError.select("\";\" expected",
06581: yyBase);
06582: }
06583: }
06584: }
06585: }
06586:
06587: // Done.
06588: yyError = yyError.select("local label declaration expected",
06589: yyStart);
06590: return yyError;
06591: }
06592:
06593: // =========================================================================
06594:
06595: /**
06596: * Parse synthetic nonterminal xtc.lang.c4.C4.LocalLabelDeclaration$$Star1.
06597: *
06598: * @param yyStart The index.
06599: * @return The result.
06600: * @throws IOException Signals an I/O error.
06601: */
06602: private Result pLocalLabelDeclaration$$Star1(final int yyStart)
06603: throws IOException {
06604:
06605: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
06606: if (null == yyColumn.chunk2)
06607: yyColumn.chunk2 = new Chunk2();
06608: if (null == yyColumn.chunk2.fLocalLabelDeclaration$$Star1)
06609: yyColumn.chunk2.fLocalLabelDeclaration$$Star1 = pLocalLabelDeclaration$$Star1$1(yyStart);
06610: return yyColumn.chunk2.fLocalLabelDeclaration$$Star1;
06611: }
06612:
06613: /** Actually parse xtc.lang.c4.C4.LocalLabelDeclaration$$Star1. */
06614: private Result pLocalLabelDeclaration$$Star1$1(final int yyStart)
06615: throws IOException {
06616:
06617: Result yyResult;
06618: Pair<String> yyValue;
06619: ParseError yyError = ParseError.DUMMY;
06620:
06621: // Alternative 1.
06622:
06623: yyResult = pSymbol(yyStart);
06624: yyError = yyResult.select(yyError);
06625: if (yyResult.hasValue(",")) {
06626:
06627: yyResult = pIdentifier(yyResult.index);
06628: yyError = yyResult.select(yyError);
06629: if (yyResult.hasValue()) {
06630: final String v$el$1 = yyResult.semanticValue();
06631:
06632: yyResult = pLocalLabelDeclaration$$Star1(yyResult.index);
06633: yyError = yyResult.select(yyError);
06634: if (yyResult.hasValue()) {
06635: final Pair<String> v$2 = yyResult.semanticValue();
06636:
06637: yyValue = new Pair<String>(v$el$1, v$2);
06638:
06639: return yyResult.createValue(yyValue, yyError);
06640: }
06641: }
06642: }
06643:
06644: // Alternative 2.
06645:
06646: yyValue = Pair.empty();
06647:
06648: return new SemanticValue(yyValue, yyStart, yyError);
06649: }
06650:
06651: // =========================================================================
06652:
06653: /**
06654: * Parse nonterminal xtc.lang.c4.C4.DeclarationOrStatement.
06655: *
06656: * @param yyStart The index.
06657: * @return The result.
06658: * @throws IOException Signals an I/O error.
06659: */
06660: private Result pDeclarationOrStatement(final int yyStart)
06661: throws IOException {
06662:
06663: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
06664: if (null == yyColumn.chunk3)
06665: yyColumn.chunk3 = new Chunk3();
06666: if (null == yyColumn.chunk3.fDeclarationOrStatement)
06667: yyColumn.chunk3.fDeclarationOrStatement = pDeclarationOrStatement$1(yyStart);
06668: return yyColumn.chunk3.fDeclarationOrStatement;
06669: }
06670:
06671: /** Actually parse xtc.lang.c4.C4.DeclarationOrStatement. */
06672: private Result pDeclarationOrStatement$1(final int yyStart)
06673: throws IOException {
06674:
06675: Result yyResult;
06676: Node yyValue;
06677: ParseError yyError = ParseError.DUMMY;
06678:
06679: // Start a state modification.
06680: yyState.start();
06681:
06682: // Alternative <Declaration>.
06683:
06684: yyState.mark();
06685:
06686: yyResult = pDeclaration(yyStart);
06687: yyError = yyResult.select(yyError);
06688: if (yyResult.hasValue()) {
06689: final Node d = yyResult.semanticValue();
06690:
06691: yyValue = yyState.annotate(d);
06692:
06693: // Commit the state modification.
06694: yyState.commit();
06695:
06696: setLocation(yyValue, yyStart);
06697: return yyResult.createValue(yyValue, yyError);
06698: }
06699:
06700: // Alternative <Statement>.
06701:
06702: yyResult = pStatement(yyStart);
06703: yyError = yyResult.select(yyError);
06704: if (yyResult.hasValue()) {
06705: final Node s = yyResult.semanticValue();
06706:
06707: yyValue = yyState.annotate(s);
06708:
06709: // Commit the state modification.
06710: yyState.commit();
06711:
06712: setLocation(yyValue, yyStart);
06713: return yyResult.createValue(yyValue, yyError);
06714: }
06715:
06716: // Abort the state modification.
06717: yyState.abort();
06718:
06719: // Done.
06720: return yyError;
06721: }
06722:
06723: // =========================================================================
06724:
06725: /**
06726: * Parse nonterminal xtc.lang.c4.C4.InitialClause.
06727: *
06728: * @param yyStart The index.
06729: * @return The result.
06730: * @throws IOException Signals an I/O error.
06731: */
06732: private Result pInitialClause(final int yyStart) throws IOException {
06733: Result yyResult;
06734: int yyBase;
06735: int yyOption1;
06736: Node yyOpValue1;
06737: Node yyValue;
06738: ParseError yyError = ParseError.DUMMY;
06739:
06740: // Start a state modification.
06741: yyState.start();
06742:
06743: // Alternative <Declaration>.
06744:
06745: yyResult = pDeclaration(yyStart);
06746: yyError = yyResult.select(yyError);
06747: if (yyResult.hasValue()) {
06748: yyValue = yyResult.semanticValue();
06749:
06750: // Commit the state modification.
06751: yyState.commit();
06752:
06753: return yyResult.createValue(yyValue, yyError);
06754: }
06755:
06756: // Alternative <Expression>.
06757:
06758: yyOption1 = yyStart;
06759: yyOpValue1 = null;
06760:
06761: yyResult = pCommaExpression(yyOption1);
06762: yyError = yyResult.select(yyError);
06763: if (yyResult.hasValue()) {
06764: final Node v$el$3 = yyResult.semanticValue();
06765:
06766: yyOption1 = yyResult.index;
06767: yyOpValue1 = v$el$3;
06768: }
06769: { // Start scope for yyValue.
06770: yyValue = yyOpValue1;
06771:
06772: yyBase = yyOption1;
06773: yyResult = pSymbol(yyBase);
06774: yyError = yyResult.select(yyError);
06775: if (yyResult.hasValue(";")) {
06776:
06777: // Commit the state modification.
06778: yyState.commit();
06779:
06780: return yyResult.createValue(yyValue, yyError);
06781: } else {
06782: yyError = yyError.select("\";\" expected", yyBase);
06783: }
06784: } // End scope for yyValue.
06785:
06786: // Abort the state modification.
06787: yyState.abort();
06788:
06789: // Done.
06790: return yyError;
06791: }
06792:
06793: // =========================================================================
06794:
06795: /**
06796: * Parse nonterminal xtc.lang.c4.C4.CommaExpression.
06797: *
06798: * @param yyStart The index.
06799: * @return The result.
06800: * @throws IOException Signals an I/O error.
06801: */
06802: private Result pCommaExpression(final int yyStart)
06803: throws IOException {
06804: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
06805: if (null == yyColumn.chunk3)
06806: yyColumn.chunk3 = new Chunk3();
06807: if (null == yyColumn.chunk3.fCommaExpression)
06808: yyColumn.chunk3.fCommaExpression = pCommaExpression$1(yyStart);
06809: return yyColumn.chunk3.fCommaExpression;
06810: }
06811:
06812: /** Actually parse xtc.lang.c4.C4.CommaExpression. */
06813: private Result pCommaExpression$1(final int yyStart)
06814: throws IOException {
06815: Result yyResult;
06816: int yyRepetition1;
06817: Pair<Action<Node>> yyRepValue1;
06818: Node yyValue;
06819: ParseError yyError = ParseError.DUMMY;
06820:
06821: // Alternative <Base>.
06822:
06823: yyResult = pAssignmentExpression(yyStart);
06824: yyError = yyResult.select(yyError);
06825: if (yyResult.hasValue()) {
06826: final Node v$3 = yyResult.semanticValue();
06827:
06828: yyRepetition1 = yyResult.index;
06829: yyRepValue1 = Pair.empty();
06830: while (true) {
06831:
06832: yyResult = pCommaExpression$$Tail1(yyRepetition1);
06833: yyError = yyResult.select(yyError);
06834: if (yyResult.hasValue()) {
06835: final Action<Node> v$4 = yyResult.semanticValue();
06836:
06837: yyRepetition1 = yyResult.index;
06838: yyRepValue1 = new Pair<Action<Node>>(v$4,
06839: yyRepValue1);
06840: continue;
06841: }
06842: break;
06843: }
06844: { // Start scope for v$5.
06845: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
06846:
06847: yyValue = apply(v$5, v$3, yyStart);
06848:
06849: return new SemanticValue(yyValue, yyRepetition1,
06850: yyError);
06851: } // End scope for v$5.
06852: }
06853:
06854: // Done.
06855: return yyError;
06856: }
06857:
06858: // =========================================================================
06859:
06860: /**
06861: * Parse synthetic nonterminal xtc.lang.c4.C4.CommaExpression$$Tail1.
06862: *
06863: * @param yyStart The index.
06864: * @return The result.
06865: * @throws IOException Signals an I/O error.
06866: */
06867: private Result pCommaExpression$$Tail1(final int yyStart)
06868: throws IOException {
06869:
06870: Result yyResult;
06871: Action<Node> yyValue;
06872: ParseError yyError = ParseError.DUMMY;
06873:
06874: // Alternative <Comma>.
06875:
06876: yyResult = pSymbol(yyStart);
06877: yyError = yyResult.select(yyError);
06878: if (yyResult.hasValue(",")) {
06879:
06880: yyResult = pAssignmentExpression(yyResult.index);
06881: yyError = yyResult.select(yyError);
06882: if (yyResult.hasValue()) {
06883: final Node v$g$2 = yyResult.semanticValue();
06884:
06885: yyValue = new Action<Node>() {
06886: public Node run(Node v$1) {
06887: return GNode.create("CommaExpression", v$1,
06888: v$g$2);
06889: }
06890: };
06891:
06892: return yyResult.createValue(yyValue, yyError);
06893: }
06894: }
06895:
06896: // Done.
06897: yyError = yyError.select("comma expression expected", yyStart);
06898: return yyError;
06899: }
06900:
06901: // =========================================================================
06902:
06903: /**
06904: * Parse nonterminal xtc.lang.c4.C4.AssignmentExpression.
06905: *
06906: * @param yyStart The index.
06907: * @return The result.
06908: * @throws IOException Signals an I/O error.
06909: */
06910: private Result pAssignmentExpression(final int yyStart)
06911: throws IOException {
06912: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
06913: if (null == yyColumn.chunk3)
06914: yyColumn.chunk3 = new Chunk3();
06915: if (null == yyColumn.chunk3.fAssignmentExpression)
06916: yyColumn.chunk3.fAssignmentExpression = pAssignmentExpression$1(yyStart);
06917: return yyColumn.chunk3.fAssignmentExpression;
06918: }
06919:
06920: /** Actually parse xtc.lang.c4.C4.AssignmentExpression. */
06921: private Result pAssignmentExpression$1(final int yyStart)
06922: throws IOException {
06923:
06924: Result yyResult;
06925: Node yyValue;
06926: ParseError yyError = ParseError.DUMMY;
06927:
06928: // Alternative <Assignment>.
06929:
06930: yyResult = pUnaryExpression(yyStart);
06931: yyError = yyResult.select(yyError);
06932: if (yyResult.hasValue()) {
06933: final Node v$g$1 = yyResult.semanticValue();
06934:
06935: yyResult = pAssignmentOperator(yyResult.index);
06936: yyError = yyResult.select(yyError);
06937: if (yyResult.hasValue()) {
06938: final String v$g$2 = yyResult.semanticValue();
06939:
06940: yyResult = pAssignmentExpression(yyResult.index);
06941: yyError = yyResult.select(yyError);
06942: if (yyResult.hasValue()) {
06943: final Node v$g$3 = yyResult.semanticValue();
06944:
06945: yyValue = GNode.create("AssignmentExpression",
06946: v$g$1, v$g$2, v$g$3);
06947: yyValue.setLocation(location(yyStart));
06948:
06949: return yyResult.createValue(yyValue, yyError);
06950: }
06951: }
06952: }
06953:
06954: // Alternative <Base>.
06955:
06956: yyResult = pConditionalExpression(yyStart);
06957: yyError = yyResult.select(yyError);
06958: if (yyResult.hasValue()) {
06959: yyValue = yyResult.semanticValue();
06960:
06961: return yyResult.createValue(yyValue, yyError);
06962: }
06963:
06964: // Done.
06965: return yyError;
06966: }
06967:
06968: // =========================================================================
06969:
06970: /**
06971: * Parse nonterminal xtc.lang.c4.C4.AssignmentOperator.
06972: *
06973: * @param yyStart The index.
06974: * @return The result.
06975: * @throws IOException Signals an I/O error.
06976: */
06977: private Result pAssignmentOperator(final int yyStart)
06978: throws IOException {
06979: Result yyResult;
06980: String yyValue;
06981: ParseError yyError = ParseError.DUMMY;
06982:
06983: // Alternative <Equal>.
06984:
06985: yyResult = pSymbol(yyStart);
06986: yyError = yyResult.select(yyError);
06987: if (yyResult.hasValue("=")) {
06988: yyValue = "=";
06989:
06990: return yyResult.createValue(yyValue, yyError);
06991: }
06992:
06993: // Alternative <PlusEqual>.
06994:
06995: yyResult = pSymbol(yyStart);
06996: yyError = yyResult.select(yyError);
06997: if (yyResult.hasValue("+=")) {
06998: yyValue = "+=";
06999:
07000: return yyResult.createValue(yyValue, yyError);
07001: }
07002:
07003: // Alternative <MinusEqual>.
07004:
07005: yyResult = pSymbol(yyStart);
07006: yyError = yyResult.select(yyError);
07007: if (yyResult.hasValue("-=")) {
07008: yyValue = "-=";
07009:
07010: return yyResult.createValue(yyValue, yyError);
07011: }
07012:
07013: // Alternative <TimesEqual>.
07014:
07015: yyResult = pSymbol(yyStart);
07016: yyError = yyResult.select(yyError);
07017: if (yyResult.hasValue("*=")) {
07018: yyValue = "*=";
07019:
07020: return yyResult.createValue(yyValue, yyError);
07021: }
07022:
07023: // Alternative <OverEqual>.
07024:
07025: yyResult = pSymbol(yyStart);
07026: yyError = yyResult.select(yyError);
07027: if (yyResult.hasValue("/=")) {
07028: yyValue = "/=";
07029:
07030: return yyResult.createValue(yyValue, yyError);
07031: }
07032:
07033: // Alternative <ModuloEqual>.
07034:
07035: yyResult = pSymbol(yyStart);
07036: yyError = yyResult.select(yyError);
07037: if (yyResult.hasValue("%=")) {
07038: yyValue = "%=";
07039:
07040: return yyResult.createValue(yyValue, yyError);
07041: }
07042:
07043: // Alternative <LeftEqual>.
07044:
07045: yyResult = pSymbol(yyStart);
07046: yyError = yyResult.select(yyError);
07047: if (yyResult.hasValue("<<=")) {
07048: yyValue = "<<=";
07049:
07050: return yyResult.createValue(yyValue, yyError);
07051: }
07052:
07053: // Alternative <RightEqual>.
07054:
07055: yyResult = pSymbol(yyStart);
07056: yyError = yyResult.select(yyError);
07057: if (yyResult.hasValue(">>=")) {
07058: yyValue = ">>=";
07059:
07060: return yyResult.createValue(yyValue, yyError);
07061: }
07062:
07063: // Alternative <AndEqual>.
07064:
07065: yyResult = pSymbol(yyStart);
07066: yyError = yyResult.select(yyError);
07067: if (yyResult.hasValue("&=")) {
07068: yyValue = "&=";
07069:
07070: return yyResult.createValue(yyValue, yyError);
07071: }
07072:
07073: // Alternative <XorEqual>.
07074:
07075: yyResult = pSymbol(yyStart);
07076: yyError = yyResult.select(yyError);
07077: if (yyResult.hasValue("^=")) {
07078: yyValue = "^=";
07079:
07080: return yyResult.createValue(yyValue, yyError);
07081: }
07082:
07083: // Alternative <OrEqual>.
07084:
07085: yyResult = pSymbol(yyStart);
07086: yyError = yyResult.select(yyError);
07087: if (yyResult.hasValue("|=")) {
07088: yyValue = "|=";
07089:
07090: return yyResult.createValue(yyValue, yyError);
07091: }
07092:
07093: // Done.
07094: yyError = yyError.select("assignment operator expected",
07095: yyStart);
07096: return yyError;
07097: }
07098:
07099: // =========================================================================
07100:
07101: /**
07102: * Parse nonterminal xtc.lang.c4.C4.ConditionalExpression.
07103: *
07104: * @param yyStart The index.
07105: * @return The result.
07106: * @throws IOException Signals an I/O error.
07107: */
07108: private Result pConditionalExpression(final int yyStart)
07109: throws IOException {
07110:
07111: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
07112: if (null == yyColumn.chunk3)
07113: yyColumn.chunk3 = new Chunk3();
07114: if (null == yyColumn.chunk3.fConditionalExpression)
07115: yyColumn.chunk3.fConditionalExpression = pConditionalExpression$1(yyStart);
07116: return yyColumn.chunk3.fConditionalExpression;
07117: }
07118:
07119: /** Actually parse xtc.lang.c4.C4.ConditionalExpression. */
07120: private Result pConditionalExpression$1(final int yyStart)
07121: throws IOException {
07122:
07123: Result yyResult;
07124: int yyBase;
07125: Node yyValue;
07126: ParseError yyError = ParseError.DUMMY;
07127:
07128: // Alternative <Conditional>.
07129:
07130: yyResult = pLogicalOrExpression(yyStart);
07131: yyError = yyResult.select(yyError);
07132: if (yyResult.hasValue()) {
07133: final Node v$g$1 = yyResult.semanticValue();
07134:
07135: yyBase = yyResult.index;
07136: yyResult = pSymbol(yyBase);
07137: yyError = yyResult.select(yyError);
07138: if (yyResult.hasValue("?")) {
07139:
07140: yyResult = pCommaExpression(yyResult.index);
07141: yyError = yyResult.select(yyError);
07142: if (yyResult.hasValue()) {
07143: final Node v$g$2 = yyResult.semanticValue();
07144:
07145: yyBase = yyResult.index;
07146: yyResult = pSymbol(yyBase);
07147: yyError = yyResult.select(yyError);
07148: if (yyResult.hasValue(":")) {
07149:
07150: yyResult = pConditionalExpression(yyResult.index);
07151: yyError = yyResult.select(yyError);
07152: if (yyResult.hasValue()) {
07153: final Node v$g$3 = yyResult.semanticValue();
07154:
07155: yyValue = GNode.create(
07156: "ConditionalExpression", v$g$1,
07157: v$g$2, v$g$3);
07158: yyValue.setLocation(location(yyStart));
07159:
07160: return yyResult.createValue(yyValue,
07161: yyError);
07162: }
07163: } else {
07164: yyError = yyError.select("\":\" expected",
07165: yyBase);
07166: }
07167: }
07168: } else {
07169: yyError = yyError.select("\"?\" expected", yyBase);
07170: }
07171: }
07172:
07173: // Alternative <IncompleteConditional>.
07174:
07175: if (GCC) {
07176:
07177: yyResult = pLogicalOrExpression(yyStart);
07178: yyError = yyResult.select(yyError);
07179: if (yyResult.hasValue()) {
07180: final Node v$g$4 = yyResult.semanticValue();
07181:
07182: yyBase = yyResult.index;
07183: yyResult = pSymbol(yyBase);
07184: yyError = yyResult.select(yyError);
07185: if (yyResult.hasValue("?")) {
07186:
07187: yyBase = yyResult.index;
07188: yyResult = pSymbol(yyBase);
07189: yyError = yyResult.select(yyError);
07190: if (yyResult.hasValue(":")) {
07191:
07192: yyResult = pConditionalExpression(yyResult.index);
07193: yyError = yyResult.select(yyError);
07194: if (yyResult.hasValue()) {
07195: final Node v$g$6 = yyResult.semanticValue();
07196:
07197: yyValue = GNode.create(
07198: "ConditionalExpression", v$g$4,
07199: null, v$g$6);
07200: yyValue.setLocation(location(yyStart));
07201:
07202: return yyResult.createValue(yyValue,
07203: yyError);
07204: }
07205: } else {
07206: yyError = yyError.select("\":\" expected",
07207: yyBase);
07208: }
07209: } else {
07210: yyError = yyError.select("\"?\" expected", yyBase);
07211: }
07212: }
07213: }
07214:
07215: // Alternative <Base>.
07216:
07217: yyResult = pLogicalOrExpression(yyStart);
07218: yyError = yyResult.select(yyError);
07219: if (yyResult.hasValue()) {
07220: yyValue = yyResult.semanticValue();
07221:
07222: return yyResult.createValue(yyValue, yyError);
07223: }
07224:
07225: // Done.
07226: yyError = yyError.select("conditional expression expected",
07227: yyStart);
07228: return yyError;
07229: }
07230:
07231: // =========================================================================
07232:
07233: /**
07234: * Parse nonterminal xtc.lang.c4.C4.LogicalOrExpression.
07235: *
07236: * @param yyStart The index.
07237: * @return The result.
07238: * @throws IOException Signals an I/O error.
07239: */
07240: private Result pLogicalOrExpression(final int yyStart)
07241: throws IOException {
07242: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
07243: if (null == yyColumn.chunk3)
07244: yyColumn.chunk3 = new Chunk3();
07245: if (null == yyColumn.chunk3.fLogicalOrExpression)
07246: yyColumn.chunk3.fLogicalOrExpression = pLogicalOrExpression$1(yyStart);
07247: return yyColumn.chunk3.fLogicalOrExpression;
07248: }
07249:
07250: /** Actually parse xtc.lang.c4.C4.LogicalOrExpression. */
07251: private Result pLogicalOrExpression$1(final int yyStart)
07252: throws IOException {
07253:
07254: Result yyResult;
07255: int yyRepetition1;
07256: Pair<Action<Node>> yyRepValue1;
07257: Node yyValue;
07258: ParseError yyError = ParseError.DUMMY;
07259:
07260: // Alternative <Base>.
07261:
07262: yyResult = pLogicalAndExpression(yyStart);
07263: yyError = yyResult.select(yyError);
07264: if (yyResult.hasValue()) {
07265: final Node v$3 = yyResult.semanticValue();
07266:
07267: yyRepetition1 = yyResult.index;
07268: yyRepValue1 = Pair.empty();
07269: while (true) {
07270:
07271: yyResult = pLogicalOrExpression$$Tail1(yyRepetition1);
07272: yyError = yyResult.select(yyError);
07273: if (yyResult.hasValue()) {
07274: final Action<Node> v$4 = yyResult.semanticValue();
07275:
07276: yyRepetition1 = yyResult.index;
07277: yyRepValue1 = new Pair<Action<Node>>(v$4,
07278: yyRepValue1);
07279: continue;
07280: }
07281: break;
07282: }
07283: { // Start scope for v$5.
07284: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07285:
07286: yyValue = apply(v$5, v$3, yyStart);
07287:
07288: return new SemanticValue(yyValue, yyRepetition1,
07289: yyError);
07290: } // End scope for v$5.
07291: }
07292:
07293: // Done.
07294: return yyError;
07295: }
07296:
07297: // =========================================================================
07298:
07299: /**
07300: * Parse synthetic nonterminal xtc.lang.c4.C4.LogicalOrExpression$$Tail1.
07301: *
07302: * @param yyStart The index.
07303: * @return The result.
07304: * @throws IOException Signals an I/O error.
07305: */
07306: private Result pLogicalOrExpression$$Tail1(final int yyStart)
07307: throws IOException {
07308:
07309: Result yyResult;
07310: Action<Node> yyValue;
07311: ParseError yyError = ParseError.DUMMY;
07312:
07313: // Alternative <Or>.
07314:
07315: yyResult = pSymbol(yyStart);
07316: yyError = yyResult.select(yyError);
07317: if (yyResult.hasValue("||")) {
07318:
07319: yyResult = pLogicalAndExpression(yyResult.index);
07320: yyError = yyResult.select(yyError);
07321: if (yyResult.hasValue()) {
07322: final Node v$g$2 = yyResult.semanticValue();
07323:
07324: yyValue = new Action<Node>() {
07325: public Node run(Node v$1) {
07326: return GNode.create("LogicalOrExpression", v$1,
07327: v$g$2);
07328: }
07329: };
07330:
07331: return yyResult.createValue(yyValue, yyError);
07332: }
07333: }
07334:
07335: // Done.
07336: yyError = yyError.select("logical or expression expected",
07337: yyStart);
07338: return yyError;
07339: }
07340:
07341: // =========================================================================
07342:
07343: /**
07344: * Parse nonterminal xtc.lang.c4.C4.LogicalAndExpression.
07345: *
07346: * @param yyStart The index.
07347: * @return The result.
07348: * @throws IOException Signals an I/O error.
07349: */
07350: private Result pLogicalAndExpression(final int yyStart)
07351: throws IOException {
07352: Result yyResult;
07353: int yyRepetition1;
07354: Pair<Action<Node>> yyRepValue1;
07355: Node yyValue;
07356: ParseError yyError = ParseError.DUMMY;
07357:
07358: // Alternative <Base>.
07359:
07360: yyResult = pBitwiseOrExpression(yyStart);
07361: yyError = yyResult.select(yyError);
07362: if (yyResult.hasValue()) {
07363: final Node v$3 = yyResult.semanticValue();
07364:
07365: yyRepetition1 = yyResult.index;
07366: yyRepValue1 = Pair.empty();
07367: while (true) {
07368:
07369: yyResult = pLogicalAndExpression$$Tail1(yyRepetition1);
07370: yyError = yyResult.select(yyError);
07371: if (yyResult.hasValue()) {
07372: final Action<Node> v$4 = yyResult.semanticValue();
07373:
07374: yyRepetition1 = yyResult.index;
07375: yyRepValue1 = new Pair<Action<Node>>(v$4,
07376: yyRepValue1);
07377: continue;
07378: }
07379: break;
07380: }
07381: { // Start scope for v$5.
07382: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07383:
07384: yyValue = apply(v$5, v$3, yyStart);
07385:
07386: return new SemanticValue(yyValue, yyRepetition1,
07387: yyError);
07388: } // End scope for v$5.
07389: }
07390:
07391: // Done.
07392: return yyError;
07393: }
07394:
07395: // =========================================================================
07396:
07397: /**
07398: * Parse synthetic nonterminal xtc.lang.c4.C4.LogicalAndExpression$$Tail1.
07399: *
07400: * @param yyStart The index.
07401: * @return The result.
07402: * @throws IOException Signals an I/O error.
07403: */
07404: private Result pLogicalAndExpression$$Tail1(final int yyStart)
07405: throws IOException {
07406:
07407: Result yyResult;
07408: Action<Node> yyValue;
07409: ParseError yyError = ParseError.DUMMY;
07410:
07411: // Alternative <And>.
07412:
07413: yyResult = pSymbol(yyStart);
07414: yyError = yyResult.select(yyError);
07415: if (yyResult.hasValue("&&")) {
07416:
07417: yyResult = pBitwiseOrExpression(yyResult.index);
07418: yyError = yyResult.select(yyError);
07419: if (yyResult.hasValue()) {
07420: final Node v$g$2 = yyResult.semanticValue();
07421:
07422: yyValue = new Action<Node>() {
07423: public Node run(Node v$1) {
07424: return GNode.create("LogicalAndExpression",
07425: v$1, v$g$2);
07426: }
07427: };
07428:
07429: return yyResult.createValue(yyValue, yyError);
07430: }
07431: }
07432:
07433: // Done.
07434: yyError = yyError.select("logical and expression expected",
07435: yyStart);
07436: return yyError;
07437: }
07438:
07439: // =========================================================================
07440:
07441: /**
07442: * Parse nonterminal xtc.lang.c4.C4.BitwiseOrExpression.
07443: *
07444: * @param yyStart The index.
07445: * @return The result.
07446: * @throws IOException Signals an I/O error.
07447: */
07448: private Result pBitwiseOrExpression(final int yyStart)
07449: throws IOException {
07450: Result yyResult;
07451: int yyRepetition1;
07452: Pair<Action<Node>> yyRepValue1;
07453: Node yyValue;
07454: ParseError yyError = ParseError.DUMMY;
07455:
07456: // Alternative <Base>.
07457:
07458: yyResult = pBitwiseXorExpression(yyStart);
07459: yyError = yyResult.select(yyError);
07460: if (yyResult.hasValue()) {
07461: final Node v$3 = yyResult.semanticValue();
07462:
07463: yyRepetition1 = yyResult.index;
07464: yyRepValue1 = Pair.empty();
07465: while (true) {
07466:
07467: yyResult = pBitwiseOrExpression$$Tail1(yyRepetition1);
07468: yyError = yyResult.select(yyError);
07469: if (yyResult.hasValue()) {
07470: final Action<Node> v$4 = yyResult.semanticValue();
07471:
07472: yyRepetition1 = yyResult.index;
07473: yyRepValue1 = new Pair<Action<Node>>(v$4,
07474: yyRepValue1);
07475: continue;
07476: }
07477: break;
07478: }
07479: { // Start scope for v$5.
07480: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07481:
07482: yyValue = apply(v$5, v$3, yyStart);
07483:
07484: return new SemanticValue(yyValue, yyRepetition1,
07485: yyError);
07486: } // End scope for v$5.
07487: }
07488:
07489: // Done.
07490: return yyError;
07491: }
07492:
07493: // =========================================================================
07494:
07495: /**
07496: * Parse synthetic nonterminal xtc.lang.c4.C4.BitwiseOrExpression$$Tail1.
07497: *
07498: * @param yyStart The index.
07499: * @return The result.
07500: * @throws IOException Signals an I/O error.
07501: */
07502: private Result pBitwiseOrExpression$$Tail1(final int yyStart)
07503: throws IOException {
07504:
07505: Result yyResult;
07506: Action<Node> yyValue;
07507: ParseError yyError = ParseError.DUMMY;
07508:
07509: // Alternative <Or>.
07510:
07511: yyResult = pSymbol(yyStart);
07512: yyError = yyResult.select(yyError);
07513: if (yyResult.hasValue("|")) {
07514:
07515: yyResult = pBitwiseXorExpression(yyResult.index);
07516: yyError = yyResult.select(yyError);
07517: if (yyResult.hasValue()) {
07518: final Node v$g$2 = yyResult.semanticValue();
07519:
07520: yyValue = new Action<Node>() {
07521: public Node run(Node v$1) {
07522: return GNode.create("BitwiseOrExpression", v$1,
07523: v$g$2);
07524: }
07525: };
07526:
07527: return yyResult.createValue(yyValue, yyError);
07528: }
07529: }
07530:
07531: // Done.
07532: yyError = yyError.select("bitwise or expression expected",
07533: yyStart);
07534: return yyError;
07535: }
07536:
07537: // =========================================================================
07538:
07539: /**
07540: * Parse nonterminal xtc.lang.c4.C4.BitwiseXorExpression.
07541: *
07542: * @param yyStart The index.
07543: * @return The result.
07544: * @throws IOException Signals an I/O error.
07545: */
07546: private Result pBitwiseXorExpression(final int yyStart)
07547: throws IOException {
07548: Result yyResult;
07549: int yyRepetition1;
07550: Pair<Action<Node>> yyRepValue1;
07551: Node yyValue;
07552: ParseError yyError = ParseError.DUMMY;
07553:
07554: // Alternative <Base>.
07555:
07556: yyResult = pBitwiseAndExpression(yyStart);
07557: yyError = yyResult.select(yyError);
07558: if (yyResult.hasValue()) {
07559: final Node v$3 = yyResult.semanticValue();
07560:
07561: yyRepetition1 = yyResult.index;
07562: yyRepValue1 = Pair.empty();
07563: while (true) {
07564:
07565: yyResult = pBitwiseXorExpression$$Tail1(yyRepetition1);
07566: yyError = yyResult.select(yyError);
07567: if (yyResult.hasValue()) {
07568: final Action<Node> v$4 = yyResult.semanticValue();
07569:
07570: yyRepetition1 = yyResult.index;
07571: yyRepValue1 = new Pair<Action<Node>>(v$4,
07572: yyRepValue1);
07573: continue;
07574: }
07575: break;
07576: }
07577: { // Start scope for v$5.
07578: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07579:
07580: yyValue = apply(v$5, v$3, yyStart);
07581:
07582: return new SemanticValue(yyValue, yyRepetition1,
07583: yyError);
07584: } // End scope for v$5.
07585: }
07586:
07587: // Done.
07588: return yyError;
07589: }
07590:
07591: // =========================================================================
07592:
07593: /**
07594: * Parse synthetic nonterminal xtc.lang.c4.C4.BitwiseXorExpression$$Tail1.
07595: *
07596: * @param yyStart The index.
07597: * @return The result.
07598: * @throws IOException Signals an I/O error.
07599: */
07600: private Result pBitwiseXorExpression$$Tail1(final int yyStart)
07601: throws IOException {
07602:
07603: Result yyResult;
07604: Action<Node> yyValue;
07605: ParseError yyError = ParseError.DUMMY;
07606:
07607: // Alternative <Xor>.
07608:
07609: yyResult = pSymbol(yyStart);
07610: yyError = yyResult.select(yyError);
07611: if (yyResult.hasValue("^")) {
07612:
07613: yyResult = pBitwiseAndExpression(yyResult.index);
07614: yyError = yyResult.select(yyError);
07615: if (yyResult.hasValue()) {
07616: final Node v$g$2 = yyResult.semanticValue();
07617:
07618: yyValue = new Action<Node>() {
07619: public Node run(Node v$1) {
07620: return GNode.create("BitwiseXorExpression",
07621: v$1, v$g$2);
07622: }
07623: };
07624:
07625: return yyResult.createValue(yyValue, yyError);
07626: }
07627: }
07628:
07629: // Done.
07630: yyError = yyError.select("bitwise xor expression expected",
07631: yyStart);
07632: return yyError;
07633: }
07634:
07635: // =========================================================================
07636:
07637: /**
07638: * Parse nonterminal xtc.lang.c4.C4.BitwiseAndExpression.
07639: *
07640: * @param yyStart The index.
07641: * @return The result.
07642: * @throws IOException Signals an I/O error.
07643: */
07644: private Result pBitwiseAndExpression(final int yyStart)
07645: throws IOException {
07646: Result yyResult;
07647: int yyRepetition1;
07648: Pair<Action<Node>> yyRepValue1;
07649: Node yyValue;
07650: ParseError yyError = ParseError.DUMMY;
07651:
07652: // Alternative <Base>.
07653:
07654: yyResult = pEqualityExpression(yyStart);
07655: yyError = yyResult.select(yyError);
07656: if (yyResult.hasValue()) {
07657: final Node v$3 = yyResult.semanticValue();
07658:
07659: yyRepetition1 = yyResult.index;
07660: yyRepValue1 = Pair.empty();
07661: while (true) {
07662:
07663: yyResult = pBitwiseAndExpression$$Tail1(yyRepetition1);
07664: yyError = yyResult.select(yyError);
07665: if (yyResult.hasValue()) {
07666: final Action<Node> v$4 = yyResult.semanticValue();
07667:
07668: yyRepetition1 = yyResult.index;
07669: yyRepValue1 = new Pair<Action<Node>>(v$4,
07670: yyRepValue1);
07671: continue;
07672: }
07673: break;
07674: }
07675: { // Start scope for v$5.
07676: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07677:
07678: yyValue = apply(v$5, v$3, yyStart);
07679:
07680: return new SemanticValue(yyValue, yyRepetition1,
07681: yyError);
07682: } // End scope for v$5.
07683: }
07684:
07685: // Done.
07686: return yyError;
07687: }
07688:
07689: // =========================================================================
07690:
07691: /**
07692: * Parse synthetic nonterminal xtc.lang.c4.C4.BitwiseAndExpression$$Tail1.
07693: *
07694: * @param yyStart The index.
07695: * @return The result.
07696: * @throws IOException Signals an I/O error.
07697: */
07698: private Result pBitwiseAndExpression$$Tail1(final int yyStart)
07699: throws IOException {
07700:
07701: Result yyResult;
07702: Action<Node> yyValue;
07703: ParseError yyError = ParseError.DUMMY;
07704:
07705: // Alternative <And>.
07706:
07707: yyResult = pSymbol(yyStart);
07708: yyError = yyResult.select(yyError);
07709: if (yyResult.hasValue("&")) {
07710:
07711: yyResult = pEqualityExpression(yyResult.index);
07712: yyError = yyResult.select(yyError);
07713: if (yyResult.hasValue()) {
07714: final Node v$g$2 = yyResult.semanticValue();
07715:
07716: yyValue = new Action<Node>() {
07717: public Node run(Node v$1) {
07718: return GNode.create("BitwiseAndExpression",
07719: v$1, v$g$2);
07720: }
07721: };
07722:
07723: return yyResult.createValue(yyValue, yyError);
07724: }
07725: }
07726:
07727: // Done.
07728: yyError = yyError.select("bitwise and expression expected",
07729: yyStart);
07730: return yyError;
07731: }
07732:
07733: // =========================================================================
07734:
07735: /**
07736: * Parse nonterminal xtc.lang.c4.C4.EqualityExpression.
07737: *
07738: * @param yyStart The index.
07739: * @return The result.
07740: * @throws IOException Signals an I/O error.
07741: */
07742: private Result pEqualityExpression(final int yyStart)
07743: throws IOException {
07744: Result yyResult;
07745: int yyRepetition1;
07746: Pair<Action<Node>> yyRepValue1;
07747: Node yyValue;
07748: ParseError yyError = ParseError.DUMMY;
07749:
07750: // Alternative <Base>.
07751:
07752: yyResult = pRelationalExpression(yyStart);
07753: yyError = yyResult.select(yyError);
07754: if (yyResult.hasValue()) {
07755: final Node v$4 = yyResult.semanticValue();
07756:
07757: yyRepetition1 = yyResult.index;
07758: yyRepValue1 = Pair.empty();
07759: while (true) {
07760:
07761: yyResult = pEqualityExpression$$Tail1(yyRepetition1);
07762: yyError = yyResult.select(yyError);
07763: if (yyResult.hasValue()) {
07764: final Action<Node> v$5 = yyResult.semanticValue();
07765:
07766: yyRepetition1 = yyResult.index;
07767: yyRepValue1 = new Pair<Action<Node>>(v$5,
07768: yyRepValue1);
07769: continue;
07770: }
07771: break;
07772: }
07773: { // Start scope for v$6.
07774: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
07775:
07776: yyValue = apply(v$6, v$4, yyStart);
07777:
07778: return new SemanticValue(yyValue, yyRepetition1,
07779: yyError);
07780: } // End scope for v$6.
07781: }
07782:
07783: // Done.
07784: return yyError;
07785: }
07786:
07787: // =========================================================================
07788:
07789: /**
07790: * Parse synthetic nonterminal xtc.lang.c4.C4.EqualityExpression$$Tail1.
07791: *
07792: * @param yyStart The index.
07793: * @return The result.
07794: * @throws IOException Signals an I/O error.
07795: */
07796: private Result pEqualityExpression$$Tail1(final int yyStart)
07797: throws IOException {
07798:
07799: Result yyResult;
07800: Action<Node> yyValue;
07801: ParseError yyError = ParseError.DUMMY;
07802:
07803: // Alternative <Recursion>.
07804:
07805: yyResult = pEqualityOperator(yyStart);
07806: yyError = yyResult.select(yyError);
07807: if (yyResult.hasValue()) {
07808: final String v$g$2 = yyResult.semanticValue();
07809:
07810: yyResult = pRelationalExpression(yyResult.index);
07811: yyError = yyResult.select(yyError);
07812: if (yyResult.hasValue()) {
07813: final Node v$g$3 = yyResult.semanticValue();
07814:
07815: yyValue = new Action<Node>() {
07816: public Node run(Node v$1) {
07817: return GNode.create("EqualityExpression", v$1,
07818: v$g$2, v$g$3);
07819: }
07820: };
07821:
07822: return yyResult.createValue(yyValue, yyError);
07823: }
07824: }
07825:
07826: // Done.
07827: return yyError;
07828: }
07829:
07830: // =========================================================================
07831:
07832: /**
07833: * Parse nonterminal xtc.lang.c4.C4.EqualityOperator.
07834: *
07835: * @param yyStart The index.
07836: * @return The result.
07837: * @throws IOException Signals an I/O error.
07838: */
07839: private Result pEqualityOperator(final int yyStart)
07840: throws IOException {
07841: Result yyResult;
07842: String yyValue;
07843: ParseError yyError = ParseError.DUMMY;
07844:
07845: // Alternative <Equal>.
07846:
07847: yyResult = pSymbol(yyStart);
07848: yyError = yyResult.select(yyError);
07849: if (yyResult.hasValue("==")) {
07850: yyValue = "==";
07851:
07852: return yyResult.createValue(yyValue, yyError);
07853: }
07854:
07855: // Alternative <NotEqual>.
07856:
07857: yyResult = pSymbol(yyStart);
07858: yyError = yyResult.select(yyError);
07859: if (yyResult.hasValue("!=")) {
07860: yyValue = "!=";
07861:
07862: return yyResult.createValue(yyValue, yyError);
07863: }
07864:
07865: // Done.
07866: yyError = yyError.select("equality operator expected", yyStart);
07867: return yyError;
07868: }
07869:
07870: // =========================================================================
07871:
07872: /**
07873: * Parse nonterminal xtc.lang.c4.C4.RelationalExpression.
07874: *
07875: * @param yyStart The index.
07876: * @return The result.
07877: * @throws IOException Signals an I/O error.
07878: */
07879: private Result pRelationalExpression(final int yyStart)
07880: throws IOException {
07881: Result yyResult;
07882: int yyRepetition1;
07883: Pair<Action<Node>> yyRepValue1;
07884: Node yyValue;
07885: ParseError yyError = ParseError.DUMMY;
07886:
07887: // Alternative <Base>.
07888:
07889: yyResult = pShiftExpression(yyStart);
07890: yyError = yyResult.select(yyError);
07891: if (yyResult.hasValue()) {
07892: final Node v$4 = yyResult.semanticValue();
07893:
07894: yyRepetition1 = yyResult.index;
07895: yyRepValue1 = Pair.empty();
07896: while (true) {
07897:
07898: yyResult = pRelationalExpression$$Tail1(yyRepetition1);
07899: yyError = yyResult.select(yyError);
07900: if (yyResult.hasValue()) {
07901: final Action<Node> v$5 = yyResult.semanticValue();
07902:
07903: yyRepetition1 = yyResult.index;
07904: yyRepValue1 = new Pair<Action<Node>>(v$5,
07905: yyRepValue1);
07906: continue;
07907: }
07908: break;
07909: }
07910: { // Start scope for v$6.
07911: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
07912:
07913: yyValue = apply(v$6, v$4, yyStart);
07914:
07915: return new SemanticValue(yyValue, yyRepetition1,
07916: yyError);
07917: } // End scope for v$6.
07918: }
07919:
07920: // Done.
07921: return yyError;
07922: }
07923:
07924: // =========================================================================
07925:
07926: /**
07927: * Parse synthetic nonterminal xtc.lang.c4.C4.RelationalExpression$$Tail1.
07928: *
07929: * @param yyStart The index.
07930: * @return The result.
07931: * @throws IOException Signals an I/O error.
07932: */
07933: private Result pRelationalExpression$$Tail1(final int yyStart)
07934: throws IOException {
07935:
07936: Result yyResult;
07937: Action<Node> yyValue;
07938: ParseError yyError = ParseError.DUMMY;
07939:
07940: // Alternative <Recursion>.
07941:
07942: yyResult = pRelationalOperator(yyStart);
07943: yyError = yyResult.select(yyError);
07944: if (yyResult.hasValue()) {
07945: final String v$g$2 = yyResult.semanticValue();
07946:
07947: yyResult = pShiftExpression(yyResult.index);
07948: yyError = yyResult.select(yyError);
07949: if (yyResult.hasValue()) {
07950: final Node v$g$3 = yyResult.semanticValue();
07951:
07952: yyValue = new Action<Node>() {
07953: public Node run(Node v$1) {
07954: return GNode.create("RelationalExpression",
07955: v$1, v$g$2, v$g$3);
07956: }
07957: };
07958:
07959: return yyResult.createValue(yyValue, yyError);
07960: }
07961: }
07962:
07963: // Done.
07964: return yyError;
07965: }
07966:
07967: // =========================================================================
07968:
07969: /**
07970: * Parse nonterminal xtc.lang.c4.C4.RelationalOperator.
07971: *
07972: * @param yyStart The index.
07973: * @return The result.
07974: * @throws IOException Signals an I/O error.
07975: */
07976: private Result pRelationalOperator(final int yyStart)
07977: throws IOException {
07978: Result yyResult;
07979: String yyValue;
07980: ParseError yyError = ParseError.DUMMY;
07981:
07982: // Alternative <LessEqual>.
07983:
07984: yyResult = pSymbol(yyStart);
07985: yyError = yyResult.select(yyError);
07986: if (yyResult.hasValue("<=")) {
07987: yyValue = "<=";
07988:
07989: return yyResult.createValue(yyValue, yyError);
07990: }
07991:
07992: // Alternative <Less>.
07993:
07994: yyResult = pSymbol(yyStart);
07995: yyError = yyResult.select(yyError);
07996: if (yyResult.hasValue("<")) {
07997: yyValue = "<";
07998:
07999: return yyResult.createValue(yyValue, yyError);
08000: }
08001:
08002: // Alternative <GreaterEqual>.
08003:
08004: yyResult = pSymbol(yyStart);
08005: yyError = yyResult.select(yyError);
08006: if (yyResult.hasValue(">=")) {
08007: yyValue = ">=";
08008:
08009: return yyResult.createValue(yyValue, yyError);
08010: }
08011:
08012: // Alternative <Greater>.
08013:
08014: yyResult = pSymbol(yyStart);
08015: yyError = yyResult.select(yyError);
08016: if (yyResult.hasValue(">")) {
08017: yyValue = ">";
08018:
08019: return yyResult.createValue(yyValue, yyError);
08020: }
08021:
08022: // Done.
08023: yyError = yyError.select("relational operator expected",
08024: yyStart);
08025: return yyError;
08026: }
08027:
08028: // =========================================================================
08029:
08030: /**
08031: * Parse nonterminal xtc.lang.c4.C4.ShiftExpression.
08032: *
08033: * @param yyStart The index.
08034: * @return The result.
08035: * @throws IOException Signals an I/O error.
08036: */
08037: private Result pShiftExpression(final int yyStart)
08038: throws IOException {
08039: Result yyResult;
08040: int yyRepetition1;
08041: Pair<Action<Node>> yyRepValue1;
08042: Node yyValue;
08043: ParseError yyError = ParseError.DUMMY;
08044:
08045: // Alternative <Base>.
08046:
08047: yyResult = pAdditiveExpression(yyStart);
08048: yyError = yyResult.select(yyError);
08049: if (yyResult.hasValue()) {
08050: final Node v$4 = yyResult.semanticValue();
08051:
08052: yyRepetition1 = yyResult.index;
08053: yyRepValue1 = Pair.empty();
08054: while (true) {
08055:
08056: yyResult = pShiftExpression$$Tail1(yyRepetition1);
08057: yyError = yyResult.select(yyError);
08058: if (yyResult.hasValue()) {
08059: final Action<Node> v$5 = yyResult.semanticValue();
08060:
08061: yyRepetition1 = yyResult.index;
08062: yyRepValue1 = new Pair<Action<Node>>(v$5,
08063: yyRepValue1);
08064: continue;
08065: }
08066: break;
08067: }
08068: { // Start scope for v$6.
08069: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
08070:
08071: yyValue = apply(v$6, v$4, yyStart);
08072:
08073: return new SemanticValue(yyValue, yyRepetition1,
08074: yyError);
08075: } // End scope for v$6.
08076: }
08077:
08078: // Done.
08079: return yyError;
08080: }
08081:
08082: // =========================================================================
08083:
08084: /**
08085: * Parse synthetic nonterminal xtc.lang.c4.C4.ShiftExpression$$Tail1.
08086: *
08087: * @param yyStart The index.
08088: * @return The result.
08089: * @throws IOException Signals an I/O error.
08090: */
08091: private Result pShiftExpression$$Tail1(final int yyStart)
08092: throws IOException {
08093:
08094: Result yyResult;
08095: Action<Node> yyValue;
08096: ParseError yyError = ParseError.DUMMY;
08097:
08098: // Alternative <Recursion>.
08099:
08100: yyResult = pShiftOperator(yyStart);
08101: yyError = yyResult.select(yyError);
08102: if (yyResult.hasValue()) {
08103: final String v$g$2 = yyResult.semanticValue();
08104:
08105: yyResult = pAdditiveExpression(yyResult.index);
08106: yyError = yyResult.select(yyError);
08107: if (yyResult.hasValue()) {
08108: final Node v$g$3 = yyResult.semanticValue();
08109:
08110: yyValue = new Action<Node>() {
08111: public Node run(Node v$1) {
08112: return GNode.create("ShiftExpression", v$1,
08113: v$g$2, v$g$3);
08114: }
08115: };
08116:
08117: return yyResult.createValue(yyValue, yyError);
08118: }
08119: }
08120:
08121: // Done.
08122: return yyError;
08123: }
08124:
08125: // =========================================================================
08126:
08127: /**
08128: * Parse nonterminal xtc.lang.c4.C4.ShiftOperator.
08129: *
08130: * @param yyStart The index.
08131: * @return The result.
08132: * @throws IOException Signals an I/O error.
08133: */
08134: private Result pShiftOperator(final int yyStart) throws IOException {
08135: Result yyResult;
08136: String yyValue;
08137: ParseError yyError = ParseError.DUMMY;
08138:
08139: // Alternative <Left>.
08140:
08141: yyResult = pSymbol(yyStart);
08142: yyError = yyResult.select(yyError);
08143: if (yyResult.hasValue("<<")) {
08144: yyValue = "<<";
08145:
08146: return yyResult.createValue(yyValue, yyError);
08147: }
08148:
08149: // Alternative <Right>.
08150:
08151: yyResult = pSymbol(yyStart);
08152: yyError = yyResult.select(yyError);
08153: if (yyResult.hasValue(">>")) {
08154: yyValue = ">>";
08155:
08156: return yyResult.createValue(yyValue, yyError);
08157: }
08158:
08159: // Done.
08160: yyError = yyError.select("shift operator expected", yyStart);
08161: return yyError;
08162: }
08163:
08164: // =========================================================================
08165:
08166: /**
08167: * Parse nonterminal xtc.lang.c4.C4.AdditiveExpression.
08168: *
08169: * @param yyStart The index.
08170: * @return The result.
08171: * @throws IOException Signals an I/O error.
08172: */
08173: private Result pAdditiveExpression(final int yyStart)
08174: throws IOException {
08175: Result yyResult;
08176: int yyRepetition1;
08177: Pair<Action<Node>> yyRepValue1;
08178: Node yyValue;
08179: ParseError yyError = ParseError.DUMMY;
08180:
08181: // Alternative <Base>.
08182:
08183: yyResult = pMultiplicativeExpression(yyStart);
08184: yyError = yyResult.select(yyError);
08185: if (yyResult.hasValue()) {
08186: final Node v$4 = yyResult.semanticValue();
08187:
08188: yyRepetition1 = yyResult.index;
08189: yyRepValue1 = Pair.empty();
08190: while (true) {
08191:
08192: yyResult = pAdditiveExpression$$Tail1(yyRepetition1);
08193: yyError = yyResult.select(yyError);
08194: if (yyResult.hasValue()) {
08195: final Action<Node> v$5 = yyResult.semanticValue();
08196:
08197: yyRepetition1 = yyResult.index;
08198: yyRepValue1 = new Pair<Action<Node>>(v$5,
08199: yyRepValue1);
08200: continue;
08201: }
08202: break;
08203: }
08204: { // Start scope for v$6.
08205: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
08206:
08207: yyValue = apply(v$6, v$4, yyStart);
08208:
08209: return new SemanticValue(yyValue, yyRepetition1,
08210: yyError);
08211: } // End scope for v$6.
08212: }
08213:
08214: // Done.
08215: return yyError;
08216: }
08217:
08218: // =========================================================================
08219:
08220: /**
08221: * Parse synthetic nonterminal xtc.lang.c4.C4.AdditiveExpression$$Tail1.
08222: *
08223: * @param yyStart The index.
08224: * @return The result.
08225: * @throws IOException Signals an I/O error.
08226: */
08227: private Result pAdditiveExpression$$Tail1(final int yyStart)
08228: throws IOException {
08229:
08230: Result yyResult;
08231: Action<Node> yyValue;
08232: ParseError yyError = ParseError.DUMMY;
08233:
08234: // Alternative <Recursion>.
08235:
08236: yyResult = pAdditiveOperator(yyStart);
08237: yyError = yyResult.select(yyError);
08238: if (yyResult.hasValue()) {
08239: final String v$g$2 = yyResult.semanticValue();
08240:
08241: yyResult = pMultiplicativeExpression(yyResult.index);
08242: yyError = yyResult.select(yyError);
08243: if (yyResult.hasValue()) {
08244: final Node v$g$3 = yyResult.semanticValue();
08245:
08246: yyValue = new Action<Node>() {
08247: public Node run(Node v$1) {
08248: return GNode.create("AdditiveExpression", v$1,
08249: v$g$2, v$g$3);
08250: }
08251: };
08252:
08253: return yyResult.createValue(yyValue, yyError);
08254: }
08255: }
08256:
08257: // Done.
08258: return yyError;
08259: }
08260:
08261: // =========================================================================
08262:
08263: /**
08264: * Parse nonterminal xtc.lang.c4.C4.AdditiveOperator.
08265: *
08266: * @param yyStart The index.
08267: * @return The result.
08268: * @throws IOException Signals an I/O error.
08269: */
08270: private Result pAdditiveOperator(final int yyStart)
08271: throws IOException {
08272: Result yyResult;
08273: String yyValue;
08274: ParseError yyError = ParseError.DUMMY;
08275:
08276: // Alternative <Plus>.
08277:
08278: yyResult = pSymbol(yyStart);
08279: yyError = yyResult.select(yyError);
08280: if (yyResult.hasValue("+")) {
08281: yyValue = "+";
08282:
08283: return yyResult.createValue(yyValue, yyError);
08284: }
08285:
08286: // Alternative <Minus>.
08287:
08288: yyResult = pSymbol(yyStart);
08289: yyError = yyResult.select(yyError);
08290: if (yyResult.hasValue("-")) {
08291: yyValue = "-";
08292:
08293: return yyResult.createValue(yyValue, yyError);
08294: }
08295:
08296: // Done.
08297: yyError = yyError.select("additive operator expected", yyStart);
08298: return yyError;
08299: }
08300:
08301: // =========================================================================
08302:
08303: /**
08304: * Parse nonterminal xtc.lang.c4.C4.MultiplicativeExpression.
08305: *
08306: * @param yyStart The index.
08307: * @return The result.
08308: * @throws IOException Signals an I/O error.
08309: */
08310: private Result pMultiplicativeExpression(final int yyStart)
08311: throws IOException {
08312:
08313: Result yyResult;
08314: int yyRepetition1;
08315: Pair<Action<Node>> yyRepValue1;
08316: Node yyValue;
08317: ParseError yyError = ParseError.DUMMY;
08318:
08319: // Alternative <Base>.
08320:
08321: yyResult = pCastExpression(yyStart);
08322: yyError = yyResult.select(yyError);
08323: if (yyResult.hasValue()) {
08324: final Node v$4 = yyResult.semanticValue();
08325:
08326: yyRepetition1 = yyResult.index;
08327: yyRepValue1 = Pair.empty();
08328: while (true) {
08329:
08330: yyResult = pMultiplicativeExpression$$Tail1(yyRepetition1);
08331: yyError = yyResult.select(yyError);
08332: if (yyResult.hasValue()) {
08333: final Action<Node> v$5 = yyResult.semanticValue();
08334:
08335: yyRepetition1 = yyResult.index;
08336: yyRepValue1 = new Pair<Action<Node>>(v$5,
08337: yyRepValue1);
08338: continue;
08339: }
08340: break;
08341: }
08342: { // Start scope for v$6.
08343: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
08344:
08345: yyValue = apply(v$6, v$4, yyStart);
08346:
08347: return new SemanticValue(yyValue, yyRepetition1,
08348: yyError);
08349: } // End scope for v$6.
08350: }
08351:
08352: // Done.
08353: return yyError;
08354: }
08355:
08356: // =========================================================================
08357:
08358: /**
08359: * Parse synthetic nonterminal
08360: * xtc.lang.c4.C4.MultiplicativeExpression$$Tail1.
08361: *
08362: * @param yyStart The index.
08363: * @return The result.
08364: * @throws IOException Signals an I/O error.
08365: */
08366: private Result pMultiplicativeExpression$$Tail1(final int yyStart)
08367: throws IOException {
08368:
08369: Result yyResult;
08370: Action<Node> yyValue;
08371: ParseError yyError = ParseError.DUMMY;
08372:
08373: // Alternative <Recursion>.
08374:
08375: yyResult = pMultiplicativeOperator(yyStart);
08376: yyError = yyResult.select(yyError);
08377: if (yyResult.hasValue()) {
08378: final String v$g$2 = yyResult.semanticValue();
08379:
08380: yyResult = pCastExpression(yyResult.index);
08381: yyError = yyResult.select(yyError);
08382: if (yyResult.hasValue()) {
08383: final Node v$g$3 = yyResult.semanticValue();
08384:
08385: yyValue = new Action<Node>() {
08386: public Node run(Node v$1) {
08387: return GNode.create("MultiplicativeExpression",
08388: v$1, v$g$2, v$g$3);
08389: }
08390: };
08391:
08392: return yyResult.createValue(yyValue, yyError);
08393: }
08394: }
08395:
08396: // Done.
08397: return yyError;
08398: }
08399:
08400: // =========================================================================
08401:
08402: /**
08403: * Parse nonterminal xtc.lang.c4.C4.MultiplicativeOperator.
08404: *
08405: * @param yyStart The index.
08406: * @return The result.
08407: * @throws IOException Signals an I/O error.
08408: */
08409: private Result pMultiplicativeOperator(final int yyStart)
08410: throws IOException {
08411:
08412: Result yyResult;
08413: String yyValue;
08414: ParseError yyError = ParseError.DUMMY;
08415:
08416: // Alternative <Times>.
08417:
08418: yyResult = pSymbol(yyStart);
08419: yyError = yyResult.select(yyError);
08420: if (yyResult.hasValue("*")) {
08421: yyValue = "*";
08422:
08423: return yyResult.createValue(yyValue, yyError);
08424: }
08425:
08426: // Alternative <Over>.
08427:
08428: yyResult = pSymbol(yyStart);
08429: yyError = yyResult.select(yyError);
08430: if (yyResult.hasValue("/")) {
08431: yyValue = "/";
08432:
08433: return yyResult.createValue(yyValue, yyError);
08434: }
08435:
08436: // Alternative <Modulo>.
08437:
08438: yyResult = pSymbol(yyStart);
08439: yyError = yyResult.select(yyError);
08440: if (yyResult.hasValue("%")) {
08441: yyValue = "%";
08442:
08443: return yyResult.createValue(yyValue, yyError);
08444: }
08445:
08446: // Done.
08447: yyError = yyError.select("multiplicative operator expected",
08448: yyStart);
08449: return yyError;
08450: }
08451:
08452: // =========================================================================
08453:
08454: /**
08455: * Parse nonterminal xtc.lang.c4.C4.CastExpression.
08456: *
08457: * @param yyStart The index.
08458: * @return The result.
08459: * @throws IOException Signals an I/O error.
08460: */
08461: private Result pCastExpression(final int yyStart)
08462: throws IOException {
08463: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
08464: if (null == yyColumn.chunk3)
08465: yyColumn.chunk3 = new Chunk3();
08466: if (null == yyColumn.chunk3.fCastExpression)
08467: yyColumn.chunk3.fCastExpression = pCastExpression$1(yyStart);
08468: return yyColumn.chunk3.fCastExpression;
08469: }
08470:
08471: /** Actually parse xtc.lang.c4.C4.CastExpression. */
08472: private Result pCastExpression$1(final int yyStart)
08473: throws IOException {
08474: Result yyResult;
08475: int yyBase;
08476: Node yyValue;
08477: ParseError yyError = ParseError.DUMMY;
08478:
08479: // Alternative <Cast>.
08480:
08481: yyResult = pSymbol(yyStart);
08482: yyError = yyResult.select(yyError);
08483: if (yyResult.hasValue("(")) {
08484:
08485: yyResult = pTypeName(yyResult.index);
08486: yyError = yyResult.select(yyError);
08487: if (yyResult.hasValue()) {
08488: final Node v$g$1 = yyResult.semanticValue();
08489:
08490: yyBase = yyResult.index;
08491: yyResult = pSymbol(yyBase);
08492: yyError = yyResult.select(yyError);
08493: if (yyResult.hasValue(")")) {
08494:
08495: yyResult = pCastExpression(yyResult.index);
08496: yyError = yyResult.select(yyError);
08497: if (yyResult.hasValue()) {
08498: final Node v$g$2 = yyResult.semanticValue();
08499:
08500: yyValue = GNode.create("CastExpression", v$g$1,
08501: v$g$2);
08502: yyValue.setLocation(location(yyStart));
08503:
08504: return yyResult.createValue(yyValue, yyError);
08505: }
08506: } else {
08507: yyError = yyError.select("\")\" expected", yyBase);
08508: }
08509: }
08510: }
08511:
08512: // Alternative <Base>.
08513:
08514: yyResult = pUnaryExpression(yyStart);
08515: yyError = yyResult.select(yyError);
08516: if (yyResult.hasValue()) {
08517: yyValue = yyResult.semanticValue();
08518:
08519: return yyResult.createValue(yyValue, yyError);
08520: }
08521:
08522: // Done.
08523: yyError = yyError.select("cast expression expected", yyStart);
08524: return yyError;
08525: }
08526:
08527: // =========================================================================
08528:
08529: /**
08530: * Parse nonterminal xtc.lang.c4.C4.UnaryExpression.
08531: *
08532: * @param yyStart The index.
08533: * @return The result.
08534: * @throws IOException Signals an I/O error.
08535: */
08536: private Result pUnaryExpression(final int yyStart)
08537: throws IOException {
08538: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
08539: if (null == yyColumn.chunk3)
08540: yyColumn.chunk3 = new Chunk3();
08541: if (null == yyColumn.chunk3.fUnaryExpression)
08542: yyColumn.chunk3.fUnaryExpression = pUnaryExpression$1(yyStart);
08543: return yyColumn.chunk3.fUnaryExpression;
08544: }
08545:
08546: /** Actually parse xtc.lang.c4.C4.UnaryExpression. */
08547: private Result pUnaryExpression$1(final int yyStart)
08548: throws IOException {
08549: Result yyResult;
08550: Result yyPredResult;
08551: boolean yyPredMatched;
08552: int yyBase;
08553: Node yyValue;
08554: ParseError yyError = ParseError.DUMMY;
08555:
08556: // Alternative 1.
08557:
08558: yyResult = pKeyword(yyStart);
08559: yyError = yyResult.select(yyError);
08560: if (yyResult.hasValue("sizeof")) {
08561:
08562: final int yyChoice1 = yyResult.index;
08563:
08564: // Nested alternative 1.
08565:
08566: yyBase = yyChoice1;
08567: yyResult = pSymbol(yyBase);
08568: yyError = yyResult.select(yyError);
08569: if (yyResult.hasValue("(")) {
08570:
08571: yyResult = pTypeName(yyResult.index);
08572: yyError = yyResult.select(yyError);
08573: if (yyResult.hasValue()) {
08574: final Node v$g$1 = yyResult.semanticValue();
08575:
08576: yyBase = yyResult.index;
08577: yyResult = pSymbol(yyBase);
08578: yyError = yyResult.select(yyError);
08579: if (yyResult.hasValue(")")) {
08580:
08581: yyPredMatched = false;
08582:
08583: yyPredResult = pSymbol(yyResult.index);
08584: if (yyPredResult.hasValue("{")) {
08585:
08586: yyPredMatched = true;
08587: }
08588:
08589: if (!yyPredMatched) {
08590:
08591: yyValue = GNode.create("SizeofExpression",
08592: v$g$1);
08593: yyValue.setLocation(location(yyStart));
08594:
08595: return yyResult.createValue(yyValue,
08596: yyError);
08597: } else {
08598: yyError = yyError.select(
08599: "unary expression expected",
08600: yyStart);
08601: }
08602: } else {
08603: yyError = yyError.select("\")\" expected",
08604: yyBase);
08605: }
08606: }
08607: } else {
08608: yyError = yyError.select("\"(\" expected", yyBase);
08609: }
08610:
08611: // Nested alternative 2.
08612:
08613: yyResult = pUnaryExpression(yyChoice1);
08614: yyError = yyResult.select(yyError);
08615: if (yyResult.hasValue()) {
08616: final Node v$g$2 = yyResult.semanticValue();
08617:
08618: yyValue = GNode.create("SizeofExpression", v$g$2);
08619: yyValue.setLocation(location(yyStart));
08620:
08621: return yyResult.createValue(yyValue, yyError);
08622: }
08623: }
08624:
08625: // Alternative 2.
08626:
08627: yyResult = pAlignofKeyword(yyStart);
08628: yyError = yyResult.select(yyError);
08629: if (yyResult.hasValue()) {
08630:
08631: final int yyChoice1 = yyResult.index;
08632:
08633: // Nested alternative 1.
08634:
08635: yyBase = yyChoice1;
08636: yyResult = pSymbol(yyBase);
08637: yyError = yyResult.select(yyError);
08638: if (yyResult.hasValue("(")) {
08639:
08640: yyResult = pTypeName(yyResult.index);
08641: yyError = yyResult.select(yyError);
08642: if (yyResult.hasValue()) {
08643: final Node v$g$1 = yyResult.semanticValue();
08644:
08645: yyBase = yyResult.index;
08646: yyResult = pSymbol(yyBase);
08647: yyError = yyResult.select(yyError);
08648: if (yyResult.hasValue(")")) {
08649:
08650: yyPredMatched = false;
08651:
08652: yyPredResult = pSymbol(yyResult.index);
08653: if (yyPredResult.hasValue("{")) {
08654:
08655: yyPredMatched = true;
08656: }
08657:
08658: if (!yyPredMatched) {
08659:
08660: yyValue = GNode.create("AlignofExpression",
08661: v$g$1);
08662: yyValue.setLocation(location(yyStart));
08663:
08664: return yyResult.createValue(yyValue,
08665: yyError);
08666: } else {
08667: yyError = yyError.select(
08668: "unary expression expected",
08669: yyStart);
08670: }
08671: } else {
08672: yyError = yyError.select("\")\" expected",
08673: yyBase);
08674: }
08675: }
08676: } else {
08677: yyError = yyError.select("\"(\" expected", yyBase);
08678: }
08679:
08680: // Nested alternative 2.
08681:
08682: yyResult = pUnaryExpression(yyChoice1);
08683: yyError = yyResult.select(yyError);
08684: if (yyResult.hasValue()) {
08685: final Node v$g$2 = yyResult.semanticValue();
08686:
08687: yyValue = GNode.create("AlignofExpression", v$g$2);
08688: yyValue.setLocation(location(yyStart));
08689:
08690: return yyResult.createValue(yyValue, yyError);
08691: }
08692: }
08693:
08694: // Alternative 3.
08695:
08696: yyResult = pKeyword(yyStart);
08697: yyError = yyResult.select(yyError);
08698: if (yyResult.hasValue("__builtin_offsetof")) {
08699:
08700: yyBase = yyResult.index;
08701: yyResult = pSymbol(yyBase);
08702: yyError = yyResult.select(yyError);
08703: if (yyResult.hasValue("(")) {
08704:
08705: yyResult = pTypeName(yyResult.index);
08706: yyError = yyResult.select(yyError);
08707: if (yyResult.hasValue()) {
08708: final Node v$g$1 = yyResult.semanticValue();
08709:
08710: yyBase = yyResult.index;
08711: yyResult = pSymbol(yyBase);
08712: yyError = yyResult.select(yyError);
08713: if (yyResult.hasValue(",")) {
08714:
08715: yyResult = pPostfixExpression(yyResult.index);
08716: yyError = yyResult.select(yyError);
08717: if (yyResult.hasValue()) {
08718: final Node v$g$2 = yyResult.semanticValue();
08719:
08720: yyBase = yyResult.index;
08721: yyResult = pSymbol(yyBase);
08722: yyError = yyResult.select(yyError);
08723: if (yyResult.hasValue(")")) {
08724:
08725: yyValue = GNode.create(
08726: "OffsetofExpression", v$g$1,
08727: v$g$2);
08728: yyValue.setLocation(location(yyStart));
08729:
08730: return yyResult.createValue(yyValue,
08731: yyError);
08732: } else {
08733: yyError = yyError.select(
08734: "\")\" expected", yyBase);
08735: }
08736: }
08737: } else {
08738: yyError = yyError.select("\",\" expected",
08739: yyBase);
08740: }
08741: }
08742: } else {
08743: yyError = yyError.select("\"(\" expected", yyBase);
08744: }
08745: }
08746:
08747: // Alternative 4.
08748:
08749: yyResult = pKeyword(yyStart);
08750: yyError = yyResult.select(yyError);
08751: if (yyResult.hasValue("__builtin_types_compatible_p")) {
08752:
08753: yyBase = yyResult.index;
08754: yyResult = pSymbol(yyBase);
08755: yyError = yyResult.select(yyError);
08756: if (yyResult.hasValue("(")) {
08757:
08758: yyResult = pTypeName(yyResult.index);
08759: yyError = yyResult.select(yyError);
08760: if (yyResult.hasValue()) {
08761: final Node v$g$1 = yyResult.semanticValue();
08762:
08763: yyBase = yyResult.index;
08764: yyResult = pSymbol(yyBase);
08765: yyError = yyResult.select(yyError);
08766: if (yyResult.hasValue(",")) {
08767:
08768: yyResult = pTypeName(yyResult.index);
08769: yyError = yyResult.select(yyError);
08770: if (yyResult.hasValue()) {
08771: final Node v$g$2 = yyResult.semanticValue();
08772:
08773: yyBase = yyResult.index;
08774: yyResult = pSymbol(yyBase);
08775: yyError = yyResult.select(yyError);
08776: if (yyResult.hasValue(")")) {
08777:
08778: yyValue = GNode.create(
08779: "TypeCompatibilityExpression",
08780: v$g$1, v$g$2);
08781: yyValue.setLocation(location(yyStart));
08782:
08783: return yyResult.createValue(yyValue,
08784: yyError);
08785: } else {
08786: yyError = yyError.select(
08787: "\")\" expected", yyBase);
08788: }
08789: }
08790: } else {
08791: yyError = yyError.select("\",\" expected",
08792: yyBase);
08793: }
08794: }
08795: } else {
08796: yyError = yyError.select("\"(\" expected", yyBase);
08797: }
08798: }
08799:
08800: // Alternative 5.
08801:
08802: yyResult = pSymbol(yyStart);
08803: yyError = yyResult.select(yyError);
08804: if (yyResult.hasValue("-")) {
08805:
08806: yyResult = pCastExpression(yyResult.index);
08807: yyError = yyResult.select(yyError);
08808: if (yyResult.hasValue()) {
08809: final Node v$g$1 = yyResult.semanticValue();
08810:
08811: yyValue = GNode.create("UnaryMinusExpression", v$g$1);
08812: yyValue.setLocation(location(yyStart));
08813:
08814: return yyResult.createValue(yyValue, yyError);
08815: }
08816: }
08817:
08818: // Alternative 6.
08819:
08820: yyResult = pSymbol(yyStart);
08821: yyError = yyResult.select(yyError);
08822: if (yyResult.hasValue("+")) {
08823:
08824: yyResult = pCastExpression(yyResult.index);
08825: yyError = yyResult.select(yyError);
08826: if (yyResult.hasValue()) {
08827: final Node v$g$1 = yyResult.semanticValue();
08828:
08829: yyValue = GNode.create("UnaryPlusExpression", v$g$1);
08830: yyValue.setLocation(location(yyStart));
08831:
08832: return yyResult.createValue(yyValue, yyError);
08833: }
08834: }
08835:
08836: // Alternative 7.
08837:
08838: yyResult = pSymbol(yyStart);
08839: yyError = yyResult.select(yyError);
08840: if (yyResult.hasValue("!")) {
08841:
08842: yyResult = pCastExpression(yyResult.index);
08843: yyError = yyResult.select(yyError);
08844: if (yyResult.hasValue()) {
08845: final Node v$g$1 = yyResult.semanticValue();
08846:
08847: yyValue = GNode.create("LogicalNegationExpression",
08848: v$g$1);
08849: yyValue.setLocation(location(yyStart));
08850:
08851: return yyResult.createValue(yyValue, yyError);
08852: }
08853: }
08854:
08855: // Alternative 8.
08856:
08857: yyResult = pSymbol(yyStart);
08858: yyError = yyResult.select(yyError);
08859: if (yyResult.hasValue("~")) {
08860:
08861: yyResult = pCastExpression(yyResult.index);
08862: yyError = yyResult.select(yyError);
08863: if (yyResult.hasValue()) {
08864: final Node v$g$1 = yyResult.semanticValue();
08865:
08866: yyValue = GNode.create("BitwiseNegationExpression",
08867: v$g$1);
08868: yyValue.setLocation(location(yyStart));
08869:
08870: return yyResult.createValue(yyValue, yyError);
08871: }
08872: }
08873:
08874: // Alternative 9.
08875:
08876: yyResult = pSymbol(yyStart);
08877: yyError = yyResult.select(yyError);
08878: if (yyResult.hasValue("&")) {
08879:
08880: yyResult = pCastExpression(yyResult.index);
08881: yyError = yyResult.select(yyError);
08882: if (yyResult.hasValue()) {
08883: final Node v$g$1 = yyResult.semanticValue();
08884:
08885: yyValue = GNode.create("AddressExpression", v$g$1);
08886: yyValue.setLocation(location(yyStart));
08887:
08888: return yyResult.createValue(yyValue, yyError);
08889: }
08890: }
08891:
08892: // Alternative 10.
08893:
08894: if (GCC) {
08895:
08896: yyResult = pSymbol(yyStart);
08897: yyError = yyResult.select(yyError);
08898: if (yyResult.hasValue("&&")) {
08899:
08900: yyResult = pIdentifier(yyResult.index);
08901: yyError = yyResult.select(yyError);
08902: if (yyResult.hasValue()) {
08903: final String v$g$1 = yyResult.semanticValue();
08904:
08905: yyValue = GNode.create("LabelAddressExpression",
08906: v$g$1);
08907: yyValue.setLocation(location(yyStart));
08908:
08909: return yyResult.createValue(yyValue, yyError);
08910: }
08911: }
08912: }
08913:
08914: // Alternative 11.
08915:
08916: yyResult = pSymbol(yyStart);
08917: yyError = yyResult.select(yyError);
08918: if (yyResult.hasValue("*")) {
08919:
08920: yyResult = pCastExpression(yyResult.index);
08921: yyError = yyResult.select(yyError);
08922: if (yyResult.hasValue()) {
08923: final Node v$g$1 = yyResult.semanticValue();
08924:
08925: yyValue = GNode.create("IndirectionExpression", v$g$1);
08926: yyValue.setLocation(location(yyStart));
08927:
08928: return yyResult.createValue(yyValue, yyError);
08929: }
08930: }
08931:
08932: // Alternative 12.
08933:
08934: yyResult = pSymbol(yyStart);
08935: yyError = yyResult.select(yyError);
08936: if (yyResult.hasValue("++")) {
08937:
08938: yyResult = pUnaryExpression(yyResult.index);
08939: yyError = yyResult.select(yyError);
08940: if (yyResult.hasValue()) {
08941: final Node v$g$1 = yyResult.semanticValue();
08942:
08943: yyValue = GNode.create("PreincrementExpression", v$g$1);
08944: yyValue.setLocation(location(yyStart));
08945:
08946: return yyResult.createValue(yyValue, yyError);
08947: }
08948: }
08949:
08950: // Alternative 13.
08951:
08952: yyResult = pSymbol(yyStart);
08953: yyError = yyResult.select(yyError);
08954: if (yyResult.hasValue("--")) {
08955:
08956: yyResult = pUnaryExpression(yyResult.index);
08957: yyError = yyResult.select(yyError);
08958: if (yyResult.hasValue()) {
08959: final Node v$g$1 = yyResult.semanticValue();
08960:
08961: yyValue = GNode.create("PredecrementExpression", v$g$1);
08962: yyValue.setLocation(location(yyStart));
08963:
08964: return yyResult.createValue(yyValue, yyError);
08965: }
08966: }
08967:
08968: // Alternative 14.
08969:
08970: if (GCC) {
08971:
08972: yyResult = pKeyword(yyStart);
08973: yyError = yyResult.select(yyError);
08974: if (yyResult.hasValue("__extension__")) {
08975:
08976: yyResult = pCastExpression(yyResult.index);
08977: yyError = yyResult.select(yyError);
08978: if (yyResult.hasValue()) {
08979: final Node v$g$1 = yyResult.semanticValue();
08980:
08981: yyValue = GNode
08982: .create("ExtensionExpression", v$g$1);
08983: yyValue.setLocation(location(yyStart));
08984:
08985: return yyResult.createValue(yyValue, yyError);
08986: }
08987: }
08988: }
08989:
08990: // Alternative <Base>.
08991:
08992: yyResult = pPostfixExpression(yyStart);
08993: yyError = yyResult.select(yyError);
08994: if (yyResult.hasValue()) {
08995: yyValue = yyResult.semanticValue();
08996:
08997: return yyResult.createValue(yyValue, yyError);
08998: }
08999:
09000: // Done.
09001: yyError = yyError.select("unary expression expected", yyStart);
09002: return yyError;
09003: }
09004:
09005: // =========================================================================
09006:
09007: /**
09008: * Parse nonterminal xtc.lang.c4.C4.AlignofKeyword.
09009: *
09010: * @param yyStart The index.
09011: * @return The result.
09012: * @throws IOException Signals an I/O error.
09013: */
09014: private Result pAlignofKeyword(final int yyStart)
09015: throws IOException {
09016: Result yyResult;
09017: Void yyValue;
09018: ParseError yyError = ParseError.DUMMY;
09019:
09020: // Alternative 1.
09021:
09022: yyResult = pKeyword(yyStart);
09023: yyError = yyResult.select(yyError);
09024: if (yyResult.hasValue("__alignof__")) {
09025:
09026: yyValue = null;
09027:
09028: return yyResult.createValue(yyValue, yyError);
09029: }
09030:
09031: // Alternative 2.
09032:
09033: yyResult = pKeyword(yyStart);
09034: yyError = yyResult.select(yyError);
09035: if (yyResult.hasValue("__alignof")) {
09036:
09037: yyValue = null;
09038:
09039: return yyResult.createValue(yyValue, yyError);
09040: }
09041:
09042: // Done.
09043: yyError = yyError.select("alignof keyword expected", yyStart);
09044: return yyError;
09045: }
09046:
09047: // =========================================================================
09048:
09049: /**
09050: * Parse nonterminal xtc.lang.c4.C4.PostfixExpression.
09051: *
09052: * @param yyStart The index.
09053: * @return The result.
09054: * @throws IOException Signals an I/O error.
09055: */
09056: private Result pPostfixExpression(final int yyStart)
09057: throws IOException {
09058: Result yyResult;
09059: int yyRepetition1;
09060: Pair<Action<Node>> yyRepValue1;
09061: Node yyValue;
09062: ParseError yyError = ParseError.DUMMY;
09063:
09064: // Alternative <Compound>.
09065:
09066: yyResult = pCompoundLiteral(yyStart);
09067: yyError = yyResult.select(yyError);
09068: if (yyResult.hasValue()) {
09069: final Node v$g$6 = yyResult.semanticValue();
09070:
09071: yyRepetition1 = yyResult.index;
09072: yyRepValue1 = Pair.empty();
09073: while (true) {
09074:
09075: yyResult = pPostfixExpression$$Tail1(yyRepetition1);
09076: yyError = yyResult.select(yyError);
09077: if (yyResult.hasValue()) {
09078: final Action<Node> v$7 = yyResult.semanticValue();
09079:
09080: yyRepetition1 = yyResult.index;
09081: yyRepValue1 = new Pair<Action<Node>>(v$7,
09082: yyRepValue1);
09083: continue;
09084: }
09085: break;
09086: }
09087: { // Start scope for v$8.
09088: final Pair<Action<Node>> v$8 = yyRepValue1.reverse();
09089:
09090: yyValue = apply(v$8, v$g$6, yyStart);
09091:
09092: return new SemanticValue(yyValue, yyRepetition1,
09093: yyError);
09094: } // End scope for v$8.
09095: }
09096:
09097: // Alternative <Primary>.
09098:
09099: yyResult = pPrimaryExpression(yyStart);
09100: yyError = yyResult.select(yyError);
09101: if (yyResult.hasValue()) {
09102: final Node v$g$9 = yyResult.semanticValue();
09103:
09104: yyRepetition1 = yyResult.index;
09105: yyRepValue1 = Pair.empty();
09106: while (true) {
09107:
09108: yyResult = pPostfixExpression$$Tail1(yyRepetition1);
09109: yyError = yyResult.select(yyError);
09110: if (yyResult.hasValue()) {
09111: final Action<Node> v$10 = yyResult.semanticValue();
09112:
09113: yyRepetition1 = yyResult.index;
09114: yyRepValue1 = new Pair<Action<Node>>(v$10,
09115: yyRepValue1);
09116: continue;
09117: }
09118: break;
09119: }
09120: { // Start scope for v$11.
09121: final Pair<Action<Node>> v$11 = yyRepValue1.reverse();
09122:
09123: yyValue = apply(v$11, v$g$9, yyStart);
09124:
09125: return new SemanticValue(yyValue, yyRepetition1,
09126: yyError);
09127: } // End scope for v$11.
09128: }
09129:
09130: // Done.
09131: return yyError;
09132: }
09133:
09134: // =========================================================================
09135:
09136: /**
09137: * Parse synthetic nonterminal xtc.lang.c4.C4.PostfixExpression$$Tail1.
09138: *
09139: * @param yyStart The index.
09140: * @return The result.
09141: * @throws IOException Signals an I/O error.
09142: */
09143: private Result pPostfixExpression$$Tail1(final int yyStart)
09144: throws IOException {
09145:
09146: Result yyResult;
09147: int yyBase;
09148: int yyOption1;
09149: Node yyOpValue1;
09150: Action<Node> yyValue;
09151: ParseError yyError = ParseError.DUMMY;
09152:
09153: // Alternative 1.
09154:
09155: yyResult = pSymbol(yyStart);
09156: yyError = yyResult.select(yyError);
09157: if (yyResult.hasValue("[")) {
09158:
09159: yyResult = pCommaExpression(yyResult.index);
09160: yyError = yyResult.select(yyError);
09161: if (yyResult.hasValue()) {
09162: final Node v$g$2 = yyResult.semanticValue();
09163:
09164: yyBase = yyResult.index;
09165: yyResult = pSymbol(yyBase);
09166: yyError = yyResult.select(yyError);
09167: if (yyResult.hasValue("]")) {
09168:
09169: yyValue = new Action<Node>() {
09170: public Node run(Node v$1) {
09171: return GNode.create("SubscriptExpression",
09172: v$1, v$g$2);
09173: }
09174: };
09175:
09176: return yyResult.createValue(yyValue, yyError);
09177: } else {
09178: yyError = yyError.select("\"]\" expected", yyBase);
09179: }
09180: }
09181: }
09182:
09183: // Alternative 2.
09184:
09185: yyResult = pSymbol(yyStart);
09186: yyError = yyResult.select(yyError);
09187: if (yyResult.hasValue(".")) {
09188:
09189: yyResult = pIdentifier(yyResult.index);
09190: yyError = yyResult.select(yyError);
09191: if (yyResult.hasValue()) {
09192: final String v$g$3 = yyResult.semanticValue();
09193:
09194: yyValue = new Action<Node>() {
09195: public Node run(Node v$1) {
09196: return GNode.create("DirectComponentSelection",
09197: v$1, v$g$3);
09198: }
09199: };
09200:
09201: return yyResult.createValue(yyValue, yyError);
09202: }
09203: }
09204:
09205: // Alternative 3.
09206:
09207: yyResult = pSymbol(yyStart);
09208: yyError = yyResult.select(yyError);
09209: if (yyResult.hasValue("->")) {
09210:
09211: yyResult = pIdentifier(yyResult.index);
09212: yyError = yyResult.select(yyError);
09213: if (yyResult.hasValue()) {
09214: final String v$g$4 = yyResult.semanticValue();
09215:
09216: yyValue = new Action<Node>() {
09217: public Node run(Node v$1) {
09218: return GNode.create(
09219: "IndirectComponentSelection", v$1,
09220: v$g$4);
09221: }
09222: };
09223:
09224: return yyResult.createValue(yyValue, yyError);
09225: }
09226: }
09227:
09228: // Alternative 4.
09229:
09230: yyResult = pSymbol(yyStart);
09231: yyError = yyResult.select(yyError);
09232: if (yyResult.hasValue("(")) {
09233:
09234: yyOption1 = yyResult.index;
09235: yyOpValue1 = null;
09236:
09237: yyResult = pExpressionList(yyOption1);
09238: yyError = yyResult.select(yyError);
09239: if (yyResult.hasValue()) {
09240: final Node v$el$1 = yyResult.semanticValue();
09241:
09242: yyOption1 = yyResult.index;
09243: yyOpValue1 = v$el$1;
09244: }
09245: { // Start scope for v$g$5.
09246: final Node v$g$5 = yyOpValue1;
09247:
09248: yyBase = yyOption1;
09249: yyResult = pSymbol(yyBase);
09250: yyError = yyResult.select(yyError);
09251: if (yyResult.hasValue(")")) {
09252:
09253: yyValue = new Action<Node>() {
09254: public Node run(Node v$1) {
09255: return GNode.create("FunctionCall", v$1,
09256: v$g$5);
09257: }
09258: };
09259:
09260: return yyResult.createValue(yyValue, yyError);
09261: } else {
09262: yyError = yyError.select("\")\" expected", yyBase);
09263: }
09264: } // End scope for v$g$5.
09265: }
09266:
09267: // Alternative 5.
09268:
09269: yyResult = pSymbol(yyStart);
09270: yyError = yyResult.select(yyError);
09271: if (yyResult.hasValue("++")) {
09272:
09273: yyValue = new Action<Node>() {
09274: public Node run(Node v$1) {
09275: return GNode.create("PostincrementExpression", v$1);
09276: }
09277: };
09278:
09279: return yyResult.createValue(yyValue, yyError);
09280: }
09281:
09282: // Alternative 6.
09283:
09284: yyResult = pSymbol(yyStart);
09285: yyError = yyResult.select(yyError);
09286: if (yyResult.hasValue("--")) {
09287:
09288: yyValue = new Action<Node>() {
09289: public Node run(Node v$1) {
09290: return GNode.create("PostdecrementExpression", v$1);
09291: }
09292: };
09293:
09294: return yyResult.createValue(yyValue, yyError);
09295: }
09296:
09297: // Done.
09298: yyError = yyError
09299: .select("postfix expression expected", yyStart);
09300: return yyError;
09301: }
09302:
09303: // =========================================================================
09304:
09305: /**
09306: * Parse nonterminal xtc.lang.c4.C4.ExpressionList.
09307: *
09308: * @param yyStart The index.
09309: * @return The result.
09310: * @throws IOException Signals an I/O error.
09311: */
09312: private Result pExpressionList(final int yyStart)
09313: throws IOException {
09314: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
09315: if (null == yyColumn.chunk3)
09316: yyColumn.chunk3 = new Chunk3();
09317: if (null == yyColumn.chunk3.fExpressionList)
09318: yyColumn.chunk3.fExpressionList = pExpressionList$1(yyStart);
09319: return yyColumn.chunk3.fExpressionList;
09320: }
09321:
09322: /** Actually parse xtc.lang.c4.C4.ExpressionList. */
09323: private Result pExpressionList$1(final int yyStart)
09324: throws IOException {
09325: Result yyResult;
09326: Node yyValue;
09327: ParseError yyError = ParseError.DUMMY;
09328:
09329: // Alternative <Expressions>.
09330:
09331: yyResult = pAssignmentExpression(yyStart);
09332: yyError = yyResult.select(yyError);
09333: if (yyResult.hasValue()) {
09334: final Node v$g$1 = yyResult.semanticValue();
09335:
09336: yyResult = pExpressionList$$Star1(yyResult.index);
09337: yyError = yyResult.select(yyError);
09338: if (yyResult.hasValue()) {
09339: final Pair<Node> v$g$2 = yyResult.semanticValue();
09340:
09341: yyValue = GNode.createFromPair("ExpressionList", v$g$1,
09342: v$g$2);
09343: yyValue.setLocation(location(yyStart));
09344:
09345: return yyResult.createValue(yyValue, yyError);
09346: }
09347: }
09348:
09349: // Done.
09350: return yyError;
09351: }
09352:
09353: // =========================================================================
09354:
09355: /**
09356: * Parse synthetic nonterminal xtc.lang.c4.C4.ExpressionList$$Star1.
09357: *
09358: * @param yyStart The index.
09359: * @return The result.
09360: * @throws IOException Signals an I/O error.
09361: */
09362: private Result pExpressionList$$Star1(final int yyStart)
09363: throws IOException {
09364:
09365: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
09366: if (null == yyColumn.chunk3)
09367: yyColumn.chunk3 = new Chunk3();
09368: if (null == yyColumn.chunk3.fExpressionList$$Star1)
09369: yyColumn.chunk3.fExpressionList$$Star1 = pExpressionList$$Star1$1(yyStart);
09370: return yyColumn.chunk3.fExpressionList$$Star1;
09371: }
09372:
09373: /** Actually parse xtc.lang.c4.C4.ExpressionList$$Star1. */
09374: private Result pExpressionList$$Star1$1(final int yyStart)
09375: throws IOException {
09376:
09377: Result yyResult;
09378: Pair<Node> yyValue;
09379: ParseError yyError = ParseError.DUMMY;
09380:
09381: // Alternative 1.
09382:
09383: yyResult = pSymbol(yyStart);
09384: yyError = yyResult.select(yyError);
09385: if (yyResult.hasValue(",")) {
09386:
09387: yyResult = pAssignmentExpression(yyResult.index);
09388: yyError = yyResult.select(yyError);
09389: if (yyResult.hasValue()) {
09390: final Node v$el$1 = yyResult.semanticValue();
09391:
09392: yyResult = pExpressionList$$Star1(yyResult.index);
09393: yyError = yyResult.select(yyError);
09394: if (yyResult.hasValue()) {
09395: final Pair<Node> v$2 = yyResult.semanticValue();
09396:
09397: yyValue = new Pair<Node>(v$el$1, v$2);
09398:
09399: return yyResult.createValue(yyValue, yyError);
09400: }
09401: }
09402: }
09403:
09404: // Alternative 2.
09405:
09406: yyValue = Pair.empty();
09407:
09408: return new SemanticValue(yyValue, yyStart, yyError);
09409: }
09410:
09411: // =========================================================================
09412:
09413: /**
09414: * Parse nonterminal xtc.lang.c4.C4.CompoundLiteral.
09415: *
09416: * @param yyStart The index.
09417: * @return The result.
09418: * @throws IOException Signals an I/O error.
09419: */
09420: private Result pCompoundLiteral(final int yyStart)
09421: throws IOException {
09422: Result yyResult;
09423: int yyBase;
09424: int yyOption1;
09425: Node yyValue;
09426: ParseError yyError = ParseError.DUMMY;
09427:
09428: // Alternative 1.
09429:
09430: yyResult = pSymbol(yyStart);
09431: yyError = yyResult.select(yyError);
09432: if (yyResult.hasValue("(")) {
09433:
09434: yyResult = pTypeName(yyResult.index);
09435: yyError = yyResult.select(yyError);
09436: if (yyResult.hasValue()) {
09437: final Node v$g$1 = yyResult.semanticValue();
09438:
09439: yyBase = yyResult.index;
09440: yyResult = pSymbol(yyBase);
09441: yyError = yyResult.select(yyError);
09442: if (yyResult.hasValue(")")) {
09443:
09444: yyBase = yyResult.index;
09445: yyResult = pSymbol(yyBase);
09446: yyError = yyResult.select(yyError);
09447: if (yyResult.hasValue("{")) {
09448:
09449: yyResult = pInitializerList(yyResult.index);
09450: yyError = yyResult.select(yyError);
09451: if (yyResult.hasValue()) {
09452: final Node v$g$2 = yyResult.semanticValue();
09453:
09454: yyOption1 = yyResult.index;
09455:
09456: yyBase = yyOption1;
09457: yyResult = pSymbol(yyBase);
09458: yyError = yyResult.select(yyError);
09459: if (yyResult.hasValue(",")) {
09460:
09461: yyOption1 = yyResult.index;
09462: } else {
09463: yyError = yyError.select(
09464: "\",\" expected", yyBase);
09465: }
09466:
09467: yyBase = yyOption1;
09468: yyResult = pSymbol(yyBase);
09469: yyError = yyResult.select(yyError);
09470: if (yyResult.hasValue("}")) {
09471:
09472: yyValue = GNode
09473: .create("CompoundLiteral",
09474: v$g$1, v$g$2);
09475: yyValue.setLocation(location(yyStart));
09476:
09477: return yyResult.createValue(yyValue,
09478: yyError);
09479: } else {
09480: yyError = yyError.select(
09481: "\"}\" expected", yyBase);
09482: }
09483: }
09484: } else {
09485: yyError = yyError.select("\"{\" expected",
09486: yyBase);
09487: }
09488: } else {
09489: yyError = yyError.select("\")\" expected", yyBase);
09490: }
09491: }
09492: }
09493:
09494: // Done.
09495: yyError = yyError.select("compound literal expected", yyStart);
09496: return yyError;
09497: }
09498:
09499: // =========================================================================
09500:
09501: /**
09502: * Parse nonterminal xtc.lang.c4.C4.PrimaryExpression.
09503: *
09504: * @param yyStart The index.
09505: * @return The result.
09506: * @throws IOException Signals an I/O error.
09507: */
09508: private Result pPrimaryExpression(final int yyStart)
09509: throws IOException {
09510: Result yyResult;
09511: int yyBase;
09512: Node yyValue;
09513: ParseError yyError = ParseError.DUMMY;
09514:
09515: // Alternative <Constant>.
09516:
09517: yyResult = pConstant(yyStart);
09518: yyError = yyResult.select(yyError);
09519: if (yyResult.hasValue()) {
09520: yyValue = yyResult.semanticValue();
09521:
09522: return yyResult.createValue(yyValue, yyError);
09523: }
09524:
09525: // Alternative 2.
09526:
09527: yyResult = pIdentifier(yyStart);
09528: yyError = yyResult.select(yyError);
09529: if (yyResult.hasValue()) {
09530: final String v$g$1 = yyResult.semanticValue();
09531:
09532: yyValue = GNode.create("PrimaryIdentifier", v$g$1);
09533: yyValue.setLocation(location(yyStart));
09534:
09535: return yyResult.createValue(yyValue, yyError);
09536: }
09537:
09538: // Alternative 3.
09539:
09540: if (GCC) {
09541:
09542: yyResult = pSymbol(yyStart);
09543: yyError = yyResult.select(yyError);
09544: if (yyResult.hasValue("(")) {
09545:
09546: yyResult = pCompoundStatement(yyResult.index);
09547: yyError = yyResult.select(yyError);
09548: if (yyResult.hasValue()) {
09549: final Node v$g$1 = yyResult.semanticValue();
09550:
09551: yyBase = yyResult.index;
09552: yyResult = pSymbol(yyBase);
09553: yyError = yyResult.select(yyError);
09554: if (yyResult.hasValue(")")) {
09555:
09556: yyValue = GNode.create("StatementAsExpression",
09557: v$g$1);
09558: yyValue.setLocation(location(yyStart));
09559:
09560: return yyResult.createValue(yyValue, yyError);
09561: } else {
09562: yyError = yyError.select("\")\" expected",
09563: yyBase);
09564: }
09565: }
09566: }
09567: }
09568:
09569: // Alternative 4.
09570:
09571: yyResult = pKeyword(yyStart);
09572: yyError = yyResult.select(yyError);
09573: if (yyResult.hasValue("__builtin_va_arg")) {
09574:
09575: yyBase = yyResult.index;
09576: yyResult = pSymbol(yyBase);
09577: yyError = yyResult.select(yyError);
09578: if (yyResult.hasValue("(")) {
09579:
09580: yyResult = pAssignmentExpression(yyResult.index);
09581: yyError = yyResult.select(yyError);
09582: if (yyResult.hasValue()) {
09583: final Node v$g$1 = yyResult.semanticValue();
09584:
09585: yyBase = yyResult.index;
09586: yyResult = pSymbol(yyBase);
09587: yyError = yyResult.select(yyError);
09588: if (yyResult.hasValue(",")) {
09589:
09590: yyResult = pTypeName(yyResult.index);
09591: yyError = yyResult.select(yyError);
09592: if (yyResult.hasValue()) {
09593: final Node v$g$2 = yyResult.semanticValue();
09594:
09595: yyBase = yyResult.index;
09596: yyResult = pSymbol(yyBase);
09597: yyError = yyResult.select(yyError);
09598: if (yyResult.hasValue(")")) {
09599:
09600: yyValue = GNode.create(
09601: "VariableArgumentAccess",
09602: v$g$1, v$g$2);
09603: yyValue.setLocation(location(yyStart));
09604:
09605: return yyResult.createValue(yyValue,
09606: yyError);
09607: } else {
09608: yyError = yyError.select(
09609: "\")\" expected", yyBase);
09610: }
09611: }
09612: } else {
09613: yyError = yyError.select("\",\" expected",
09614: yyBase);
09615: }
09616: }
09617: } else {
09618: yyError = yyError.select("\"(\" expected", yyBase);
09619: }
09620: }
09621:
09622: // Alternative <ParenthesizedExpression>.
09623:
09624: yyResult = pSymbol(yyStart);
09625: yyError = yyResult.select(yyError);
09626: if (yyResult.hasValue("(")) {
09627:
09628: yyResult = pCommaExpression(yyResult.index);
09629: yyError = yyResult.select(yyError);
09630: if (yyResult.hasValue()) {
09631: yyValue = yyResult.semanticValue();
09632:
09633: yyBase = yyResult.index;
09634: yyResult = pSymbol(yyBase);
09635: yyError = yyResult.select(yyError);
09636: if (yyResult.hasValue(")")) {
09637:
09638: return yyResult.createValue(yyValue, yyError);
09639: } else {
09640: yyError = yyError.select("\")\" expected", yyBase);
09641: }
09642: }
09643: }
09644:
09645: // Done.
09646: yyError = yyError
09647: .select("primary expression expected", yyStart);
09648: return yyError;
09649: }
09650:
09651: // =========================================================================
09652:
09653: /**
09654: * Parse nonterminal xtc.lang.c4.C4.PrimaryIdentifier.
09655: *
09656: * @param yyStart The index.
09657: * @return The result.
09658: * @throws IOException Signals an I/O error.
09659: */
09660: private Result pPrimaryIdentifier(final int yyStart)
09661: throws IOException {
09662: Result yyResult;
09663: Node yyValue;
09664: ParseError yyError = ParseError.DUMMY;
09665:
09666: // Alternative 1.
09667:
09668: yyResult = pIdentifier(yyStart);
09669: yyError = yyResult.select(yyError);
09670: if (yyResult.hasValue()) {
09671: final String v$g$1 = yyResult.semanticValue();
09672:
09673: yyValue = GNode.create("PrimaryIdentifier", v$g$1);
09674: yyValue.setLocation(location(yyStart));
09675:
09676: return yyResult.createValue(yyValue, yyError);
09677: }
09678:
09679: // Done.
09680: return yyError;
09681: }
09682:
09683: // =========================================================================
09684:
09685: /**
09686: * Parse nonterminal xtc.lang.c4.C4.AssemblyDefinition.
09687: *
09688: * @param yyStart The index.
09689: * @return The result.
09690: * @throws IOException Signals an I/O error.
09691: */
09692: private Result pAssemblyDefinition(final int yyStart)
09693: throws IOException {
09694: Result yyResult;
09695: int yyBase;
09696: Node yyValue;
09697: ParseError yyError = ParseError.DUMMY;
09698:
09699: // Alternative 1.
09700:
09701: yyResult = pSimpleAssemblyExpression(yyStart);
09702: yyError = yyResult.select(yyError);
09703: if (yyResult.hasValue()) {
09704: final Node v$g$1 = yyResult.semanticValue();
09705:
09706: yyBase = yyResult.index;
09707: yyResult = pSymbol(yyBase);
09708: yyError = yyResult.select(yyError);
09709: if (yyResult.hasValue(";")) {
09710:
09711: yyValue = GNode.create("AssemblyDefinition", v$g$1);
09712: yyValue.setLocation(location(yyStart));
09713:
09714: return yyResult.createValue(yyValue, yyError);
09715: } else {
09716: yyError = yyError.select("\";\" expected", yyBase);
09717: }
09718: }
09719:
09720: // Done.
09721: return yyError;
09722: }
09723:
09724: // =========================================================================
09725:
09726: /**
09727: * Parse nonterminal xtc.lang.c4.C4.SimpleAssemblyExpression.
09728: *
09729: * @param yyStart The index.
09730: * @return The result.
09731: * @throws IOException Signals an I/O error.
09732: */
09733: private Result pSimpleAssemblyExpression(final int yyStart)
09734: throws IOException {
09735:
09736: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
09737: if (null == yyColumn.chunk3)
09738: yyColumn.chunk3 = new Chunk3();
09739: if (null == yyColumn.chunk3.fSimpleAssemblyExpression)
09740: yyColumn.chunk3.fSimpleAssemblyExpression = pSimpleAssemblyExpression$1(yyStart);
09741: return yyColumn.chunk3.fSimpleAssemblyExpression;
09742: }
09743:
09744: /** Actually parse xtc.lang.c4.C4.SimpleAssemblyExpression. */
09745: private Result pSimpleAssemblyExpression$1(final int yyStart)
09746: throws IOException {
09747:
09748: Result yyResult;
09749: int yyBase;
09750: Node yyValue;
09751: ParseError yyError = ParseError.DUMMY;
09752:
09753: // Alternative 1.
09754:
09755: yyResult = pAsmKeyword(yyStart);
09756: yyError = yyResult.select(yyError);
09757: if (yyResult.hasValue()) {
09758:
09759: yyBase = yyResult.index;
09760: yyResult = pSymbol(yyBase);
09761: yyError = yyResult.select(yyError);
09762: if (yyResult.hasValue("(")) {
09763:
09764: yyResult = pStringConstant(yyResult.index);
09765: yyError = yyResult.select(yyError);
09766: if (yyResult.hasValue()) {
09767: final Node v$g$1 = yyResult.semanticValue();
09768:
09769: yyBase = yyResult.index;
09770: yyResult = pSymbol(yyBase);
09771: yyError = yyResult.select(yyError);
09772: if (yyResult.hasValue(")")) {
09773:
09774: yyValue = GNode.create(
09775: "SimpleAssemblyExpression", v$g$1);
09776: yyValue.setLocation(location(yyStart));
09777:
09778: return yyResult.createValue(yyValue, yyError);
09779: } else {
09780: yyError = yyError.select("\")\" expected",
09781: yyBase);
09782: }
09783: }
09784: } else {
09785: yyError = yyError.select("\"(\" expected", yyBase);
09786: }
09787: }
09788:
09789: // Done.
09790: return yyError;
09791: }
09792:
09793: // =========================================================================
09794:
09795: /**
09796: * Parse nonterminal xtc.lang.c4.C4.AssemblyArgument.
09797: *
09798: * @param yyStart The index.
09799: * @return The result.
09800: * @throws IOException Signals an I/O error.
09801: */
09802: private Result pAssemblyArgument(final int yyStart)
09803: throws IOException {
09804: Result yyResult;
09805: int yyBase;
09806: int yyOption1;
09807: Node yyOpValue1;
09808: Node yyValue;
09809: ParseError yyError = ParseError.DUMMY;
09810:
09811: // Alternative 1.
09812:
09813: yyResult = pStringConstant(yyStart);
09814: yyError = yyResult.select(yyError);
09815: if (yyResult.hasValue()) {
09816: final Node v$g$1 = yyResult.semanticValue();
09817:
09818: final int yyChoice1 = yyResult.index;
09819:
09820: // Nested alternative 1.
09821:
09822: yyBase = yyChoice1;
09823: yyResult = pSymbol(yyBase);
09824: yyError = yyResult.select(yyError);
09825: if (yyResult.hasValue(":")) {
09826:
09827: yyOption1 = yyResult.index;
09828: yyOpValue1 = null;
09829:
09830: yyResult = pAssemblyOperands(yyOption1);
09831: yyError = yyResult.select(yyError);
09832: if (yyResult.hasValue()) {
09833: final Node v$el$1 = yyResult.semanticValue();
09834:
09835: yyOption1 = yyResult.index;
09836: yyOpValue1 = v$el$1;
09837: }
09838: { // Start scope for v$g$2.
09839: final Node v$g$2 = yyOpValue1;
09840:
09841: final int yyChoice2 = yyOption1;
09842:
09843: // Nested alternative 1.
09844:
09845: yyBase = yyChoice2;
09846: yyResult = pSymbol(yyBase);
09847: yyError = yyResult.select(yyError);
09848: if (yyResult.hasValue(":")) {
09849:
09850: yyOption1 = yyResult.index;
09851: yyOpValue1 = null;
09852:
09853: yyResult = pAssemblyOperands(yyOption1);
09854: yyError = yyResult.select(yyError);
09855: if (yyResult.hasValue()) {
09856: final Node v$el$2 = yyResult
09857: .semanticValue();
09858:
09859: yyOption1 = yyResult.index;
09860: yyOpValue1 = v$el$2;
09861: }
09862: { // Start scope for v$g$3.
09863: final Node v$g$3 = yyOpValue1;
09864:
09865: final int yyChoice3 = yyOption1;
09866:
09867: // Nested alternative 1.
09868:
09869: yyBase = yyChoice3;
09870: yyResult = pSymbol(yyBase);
09871: yyError = yyResult.select(yyError);
09872: if (yyResult.hasValue(":")) {
09873:
09874: yyResult = pAssemblyClobbers(yyResult.index);
09875: yyError = yyResult.select(yyError);
09876: if (yyResult.hasValue()) {
09877: final Node v$g$4 = yyResult
09878: .semanticValue();
09879:
09880: yyValue = GNode.create(
09881: "AssemblyArgument", v$g$1,
09882: v$g$2, v$g$3, v$g$4);
09883: yyValue
09884: .setLocation(location(yyStart));
09885:
09886: return yyResult.createValue(
09887: yyValue, yyError);
09888: }
09889: } else {
09890: yyError = yyError.select(
09891: "\":\" expected", yyBase);
09892: }
09893:
09894: // Nested alternative 2.
09895:
09896: yyValue = GNode.create("AssemblyArgument",
09897: v$g$1, v$g$2, v$g$3);
09898: yyValue.setLocation(location(yyStart));
09899:
09900: return new SemanticValue(yyValue,
09901: yyChoice3, yyError);
09902: } // End scope for v$g$3.
09903: } else {
09904: yyError = yyError.select("\":\" expected",
09905: yyBase);
09906: }
09907:
09908: // Nested alternative 2.
09909:
09910: yyValue = GNode.create("AssemblyArgument", v$g$1,
09911: v$g$2);
09912: yyValue.setLocation(location(yyStart));
09913:
09914: return new SemanticValue(yyValue, yyChoice2,
09915: yyError);
09916: } // End scope for v$g$2.
09917: } else {
09918: yyError = yyError.select("\":\" expected", yyBase);
09919: }
09920:
09921: // Nested alternative 2.
09922:
09923: yyValue = GNode.create("AssemblyArgument", v$g$1);
09924: yyValue.setLocation(location(yyStart));
09925:
09926: return new SemanticValue(yyValue, yyChoice1, yyError);
09927: }
09928:
09929: // Done.
09930: return yyError;
09931: }
09932:
09933: // =========================================================================
09934:
09935: /**
09936: * Parse nonterminal xtc.lang.c4.C4.AssemblyOperands.
09937: *
09938: * @param yyStart The index.
09939: * @return The result.
09940: * @throws IOException Signals an I/O error.
09941: */
09942: private Result pAssemblyOperands(final int yyStart)
09943: throws IOException {
09944: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
09945: if (null == yyColumn.chunk4)
09946: yyColumn.chunk4 = new Chunk4();
09947: if (null == yyColumn.chunk4.fAssemblyOperands)
09948: yyColumn.chunk4.fAssemblyOperands = pAssemblyOperands$1(yyStart);
09949: return yyColumn.chunk4.fAssemblyOperands;
09950: }
09951:
09952: /** Actually parse xtc.lang.c4.C4.AssemblyOperands. */
09953: private Result pAssemblyOperands$1(final int yyStart)
09954: throws IOException {
09955: Result yyResult;
09956: Node yyValue;
09957: ParseError yyError = ParseError.DUMMY;
09958:
09959: // Alternative 1.
09960:
09961: yyResult = pAssemblyOperand(yyStart);
09962: yyError = yyResult.select(yyError);
09963: if (yyResult.hasValue()) {
09964: final Node v$g$1 = yyResult.semanticValue();
09965:
09966: yyResult = pAssemblyOperands$$Star1(yyResult.index);
09967: yyError = yyResult.select(yyError);
09968: if (yyResult.hasValue()) {
09969: final Pair<Node> v$g$2 = yyResult.semanticValue();
09970:
09971: yyValue = GNode.createFromPair("AssemblyOperands",
09972: v$g$1, v$g$2);
09973: yyValue.setLocation(location(yyStart));
09974:
09975: return yyResult.createValue(yyValue, yyError);
09976: }
09977: }
09978:
09979: // Done.
09980: return yyError;
09981: }
09982:
09983: // =========================================================================
09984:
09985: /**
09986: * Parse synthetic nonterminal xtc.lang.c4.C4.AssemblyOperands$$Star1.
09987: *
09988: * @param yyStart The index.
09989: * @return The result.
09990: * @throws IOException Signals an I/O error.
09991: */
09992: private Result pAssemblyOperands$$Star1(final int yyStart)
09993: throws IOException {
09994:
09995: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
09996: if (null == yyColumn.chunk4)
09997: yyColumn.chunk4 = new Chunk4();
09998: if (null == yyColumn.chunk4.fAssemblyOperands$$Star1)
09999: yyColumn.chunk4.fAssemblyOperands$$Star1 = pAssemblyOperands$$Star1$1(yyStart);
10000: return yyColumn.chunk4.fAssemblyOperands$$Star1;
10001: }
10002:
10003: /** Actually parse xtc.lang.c4.C4.AssemblyOperands$$Star1. */
10004: private Result pAssemblyOperands$$Star1$1(final int yyStart)
10005: throws IOException {
10006:
10007: Result yyResult;
10008: Pair<Node> yyValue;
10009: ParseError yyError = ParseError.DUMMY;
10010:
10011: // Alternative 1.
10012:
10013: yyResult = pSymbol(yyStart);
10014: yyError = yyResult.select(yyError);
10015: if (yyResult.hasValue(",")) {
10016:
10017: yyResult = pAssemblyOperand(yyResult.index);
10018: yyError = yyResult.select(yyError);
10019: if (yyResult.hasValue()) {
10020: final Node v$el$1 = yyResult.semanticValue();
10021:
10022: yyResult = pAssemblyOperands$$Star1(yyResult.index);
10023: yyError = yyResult.select(yyError);
10024: if (yyResult.hasValue()) {
10025: final Pair<Node> v$2 = yyResult.semanticValue();
10026:
10027: yyValue = new Pair<Node>(v$el$1, v$2);
10028:
10029: return yyResult.createValue(yyValue, yyError);
10030: }
10031: }
10032: }
10033:
10034: // Alternative 2.
10035:
10036: yyValue = Pair.empty();
10037:
10038: return new SemanticValue(yyValue, yyStart, yyError);
10039: }
10040:
10041: // =========================================================================
10042:
10043: /**
10044: * Parse nonterminal xtc.lang.c4.C4.AssemblyOperand.
10045: *
10046: * @param yyStart The index.
10047: * @return The result.
10048: * @throws IOException Signals an I/O error.
10049: */
10050: private Result pAssemblyOperand(final int yyStart)
10051: throws IOException {
10052: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
10053: if (null == yyColumn.chunk4)
10054: yyColumn.chunk4 = new Chunk4();
10055: if (null == yyColumn.chunk4.fAssemblyOperand)
10056: yyColumn.chunk4.fAssemblyOperand = pAssemblyOperand$1(yyStart);
10057: return yyColumn.chunk4.fAssemblyOperand;
10058: }
10059:
10060: /** Actually parse xtc.lang.c4.C4.AssemblyOperand. */
10061: private Result pAssemblyOperand$1(final int yyStart)
10062: throws IOException {
10063: Result yyResult;
10064: int yyBase;
10065: int yyOption1;
10066: String yyOpValue1;
10067: Node yyValue;
10068: ParseError yyError = ParseError.DUMMY;
10069:
10070: // Alternative 1.
10071:
10072: yyOption1 = yyStart;
10073: yyOpValue1 = null;
10074:
10075: yyBase = yyOption1;
10076: yyResult = pSymbol(yyBase);
10077: yyError = yyResult.select(yyError);
10078: if (yyResult.hasValue("[")) {
10079:
10080: yyResult = pWord(yyResult.index);
10081: yyError = yyResult.select(yyError);
10082: if (yyResult.hasValue()) {
10083: final String v$el$1 = yyResult.semanticValue();
10084:
10085: yyBase = yyResult.index;
10086: yyResult = pSymbol(yyBase);
10087: yyError = yyResult.select(yyError);
10088: if (yyResult.hasValue("]")) {
10089:
10090: yyOption1 = yyResult.index;
10091: yyOpValue1 = v$el$1;
10092: } else {
10093: yyError = yyError.select("\"]\" expected", yyBase);
10094: }
10095: }
10096: } else {
10097: yyError = yyError.select("\"[\" expected", yyBase);
10098: }
10099: { // Start scope for v$g$1.
10100: final String v$g$1 = yyOpValue1;
10101:
10102: yyResult = pStringConstant(yyOption1);
10103: yyError = yyResult.select(yyError);
10104: if (yyResult.hasValue()) {
10105: final Node v$g$2 = yyResult.semanticValue();
10106:
10107: yyBase = yyResult.index;
10108: yyResult = pSymbol(yyBase);
10109: yyError = yyResult.select(yyError);
10110: if (yyResult.hasValue("(")) {
10111:
10112: yyResult = pCommaExpression(yyResult.index);
10113: yyError = yyResult.select(yyError);
10114: if (yyResult.hasValue()) {
10115: final Node v$g$3 = yyResult.semanticValue();
10116:
10117: yyBase = yyResult.index;
10118: yyResult = pSymbol(yyBase);
10119: yyError = yyResult.select(yyError);
10120: if (yyResult.hasValue(")")) {
10121:
10122: yyValue = GNode.create("AssemblyOperand",
10123: v$g$1, v$g$2, v$g$3);
10124: yyValue.setLocation(location(yyStart));
10125:
10126: return yyResult.createValue(yyValue,
10127: yyError);
10128: } else {
10129: yyError = yyError.select("\")\" expected",
10130: yyBase);
10131: }
10132: }
10133: } else {
10134: yyError = yyError.select("\"(\" expected", yyBase);
10135: }
10136: }
10137: } // End scope for v$g$1.
10138:
10139: // Done.
10140: return yyError;
10141: }
10142:
10143: // =========================================================================
10144:
10145: /**
10146: * Parse nonterminal xtc.lang.c4.C4.AssemblyClobbers.
10147: *
10148: * @param yyStart The index.
10149: * @return The result.
10150: * @throws IOException Signals an I/O error.
10151: */
10152: private Result pAssemblyClobbers(final int yyStart)
10153: throws IOException {
10154: Result yyResult;
10155: int yyBase;
10156: int yyRepetition1;
10157: Pair<Node> yyRepValue1;
10158: Node yyValue;
10159: ParseError yyError = ParseError.DUMMY;
10160:
10161: // Alternative 1.
10162:
10163: yyResult = pStringConstant(yyStart);
10164: yyError = yyResult.select(yyError);
10165: if (yyResult.hasValue()) {
10166: final Node v$g$1 = yyResult.semanticValue();
10167:
10168: yyRepetition1 = yyResult.index;
10169: yyRepValue1 = Pair.empty();
10170: while (true) {
10171:
10172: yyBase = yyRepetition1;
10173: yyResult = pSymbol(yyBase);
10174: yyError = yyResult.select(yyError);
10175: if (yyResult.hasValue(",")) {
10176:
10177: yyResult = pStringConstant(yyResult.index);
10178: yyError = yyResult.select(yyError);
10179: if (yyResult.hasValue()) {
10180: final Node v$el$1 = yyResult.semanticValue();
10181:
10182: yyRepetition1 = yyResult.index;
10183: yyRepValue1 = new Pair<Node>(v$el$1,
10184: yyRepValue1);
10185: continue;
10186: }
10187: } else {
10188: yyError = yyError.select("\",\" expected", yyBase);
10189: }
10190: break;
10191: }
10192: { // Start scope for v$g$2.
10193: final Pair<Node> v$g$2 = yyRepValue1.reverse();
10194:
10195: yyValue = GNode.createFromPair("AssemblyClobbers",
10196: v$g$1, v$g$2);
10197: yyValue.setLocation(location(yyStart));
10198:
10199: return new SemanticValue(yyValue, yyRepetition1,
10200: yyError);
10201: } // End scope for v$g$2.
10202: }
10203:
10204: // Done.
10205: return yyError;
10206: }
10207:
10208: // =========================================================================
10209:
10210: /**
10211: * Parse nonterminal xtc.lang.c4.C4.AsmKeyword.
10212: *
10213: * @param yyStart The index.
10214: * @return The result.
10215: * @throws IOException Signals an I/O error.
10216: */
10217: private Result pAsmKeyword(final int yyStart) throws IOException {
10218: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
10219: if (null == yyColumn.chunk4)
10220: yyColumn.chunk4 = new Chunk4();
10221: if (null == yyColumn.chunk4.fAsmKeyword)
10222: yyColumn.chunk4.fAsmKeyword = pAsmKeyword$1(yyStart);
10223: return yyColumn.chunk4.fAsmKeyword;
10224: }
10225:
10226: /** Actually parse xtc.lang.c4.C4.AsmKeyword. */
10227: private Result pAsmKeyword$1(final int yyStart) throws IOException {
10228: Result yyResult;
10229: Void yyValue;
10230: ParseError yyError = ParseError.DUMMY;
10231:
10232: // Alternative 1.
10233:
10234: yyResult = pKeyword(yyStart);
10235: yyError = yyResult.select(yyError);
10236: if (yyResult.hasValue("asm")) {
10237:
10238: yyValue = null;
10239:
10240: return yyResult.createValue(yyValue, yyError);
10241: }
10242:
10243: // Alternative 2.
10244:
10245: yyResult = pKeyword(yyStart);
10246: yyError = yyResult.select(yyError);
10247: if (yyResult.hasValue("__asm")) {
10248:
10249: yyValue = null;
10250:
10251: return yyResult.createValue(yyValue, yyError);
10252: }
10253:
10254: // Alternative 3.
10255:
10256: yyResult = pKeyword(yyStart);
10257: yyError = yyResult.select(yyError);
10258: if (yyResult.hasValue("__asm__")) {
10259:
10260: yyValue = null;
10261:
10262: return yyResult.createValue(yyValue, yyError);
10263: }
10264:
10265: // Done.
10266: yyError = yyError.select("asm keyword expected", yyStart);
10267: return yyError;
10268: }
10269:
10270: // =========================================================================
10271:
10272: /**
10273: * Parse nonterminal xtc.lang.c4.C4.DeclarationOrFunctionDefinition.
10274: *
10275: * @param yyStart The index.
10276: * @return The result.
10277: * @throws IOException Signals an I/O error.
10278: */
10279: private Result pDeclarationOrFunctionDefinition(final int yyStart)
10280: throws IOException {
10281:
10282: Result yyResult;
10283: Node yyValue;
10284: ParseError yyError = ParseError.DUMMY;
10285:
10286: // Start a state modification.
10287: yyState.start();
10288:
10289: // Alternative 1.
10290:
10291: yyState.mark();
10292:
10293: yyResult = pDeclaration(yyStart);
10294: yyError = yyResult.select(yyError);
10295: if (yyResult.hasValue()) {
10296: final Node d = yyResult.semanticValue();
10297:
10298: yyValue = yyState.annotate(d);
10299:
10300: // Commit the state modification.
10301: yyState.commit();
10302:
10303: setLocation(yyValue, yyStart);
10304: return yyResult.createValue(yyValue, yyError);
10305: }
10306:
10307: // Alternative 2.
10308:
10309: yyResult = pFunctionDefinition(yyStart);
10310: yyError = yyResult.select(yyError);
10311: if (yyResult.hasValue()) {
10312: final Node fd = yyResult.semanticValue();
10313:
10314: yyValue = yyState.annotate(fd);
10315:
10316: // Commit the state modification.
10317: yyState.commit();
10318:
10319: setLocation(yyValue, yyStart);
10320: return yyResult.createValue(yyValue, yyError);
10321: }
10322:
10323: // Abort the state modification.
10324: yyState.abort();
10325:
10326: // Done.
10327: return yyError;
10328: }
10329:
10330: // =========================================================================
10331:
10332: /**
10333: * Parse nonterminal xtc.lang.c4.C4.AspectDefinition.
10334: *
10335: * @param yyStart The index.
10336: * @return The result.
10337: * @throws IOException Signals an I/O error.
10338: */
10339: public Result pAspectDefinition(final int yyStart)
10340: throws IOException {
10341: Result yyResult;
10342: int yyBase;
10343: int yyRepetition1;
10344: Pair<Node> yyRepValue1;
10345: Node yyValue;
10346: ParseError yyError = ParseError.DUMMY;
10347:
10348: // Alternative 1.
10349:
10350: yyResult = pKeyword(yyStart);
10351: yyError = yyResult.select(yyError);
10352: if (yyResult.hasValue("aspect")) {
10353: final String v$g$1 = "aspect";
10354:
10355: yyBase = yyResult.index;
10356: yyResult = pSymbol(yyBase);
10357: yyError = yyResult.select(yyError);
10358: if (yyResult.hasValue("(")) {
10359:
10360: yyResult = pIdentifier(yyResult.index);
10361: yyError = yyResult.select(yyError);
10362: if (yyResult.hasValue()) {
10363: final String aName = yyResult.semanticValue();
10364:
10365: yyBase = yyResult.index;
10366: yyResult = pSymbol(yyBase);
10367: yyError = yyResult.select(yyError);
10368: if (yyResult.hasValue(")")) {
10369:
10370: yyBase = yyResult.index;
10371: yyResult = pSymbol(yyBase);
10372: yyError = yyResult.select(yyError);
10373: if (yyResult.hasValue("{")) {
10374:
10375: yyResult = pPushScope(yyResult.index);
10376: yyError = yyResult.select(yyError);
10377: if (yyResult.hasValue()) {
10378:
10379: yyState.setAdvice(aName);
10380:
10381: yyRepetition1 = yyResult.index;
10382: yyRepValue1 = Pair.empty();
10383: while (true) {
10384:
10385: yyResult = pDeclarationOrFunctionDefinition(yyRepetition1);
10386: yyError = yyResult.select(yyError);
10387: if (yyResult.hasValue()) {
10388: final Node v$el$1 = yyResult
10389: .semanticValue();
10390:
10391: yyRepetition1 = yyResult.index;
10392: yyRepValue1 = new Pair<Node>(
10393: v$el$1, yyRepValue1);
10394: continue;
10395: }
10396: break;
10397: }
10398: { // Start scope for v$g$2.
10399: final Pair<Node> v$g$2 = yyRepValue1
10400: .reverse();
10401:
10402: yyBase = yyRepetition1;
10403: yyResult = pSymbol(yyBase);
10404: yyError = yyResult.select(yyError);
10405: if (yyResult.hasValue("}")) {
10406:
10407: yyBase = yyResult.index;
10408: yyResult = pSymbol(yyBase);
10409: yyError = yyResult
10410: .select(yyError);
10411: if (yyResult.hasValue(";")) {
10412:
10413: yyResult = pPopScope(yyResult.index);
10414: yyError = yyResult
10415: .select(yyError);
10416: if (yyResult.hasValue()) {
10417:
10418: yyValue = GNode
10419: .create(
10420: "AspectDefinition",
10421: v$g$2
10422: .size() + 2)
10423: .add(v$g$1)
10424: .add(aName)
10425: .addAll(v$g$2);
10426: yyValue
10427: .setLocation(location(yyStart));
10428:
10429: return yyResult
10430: .createValue(
10431: yyValue,
10432: yyError);
10433: }
10434: } else {
10435: yyError = yyError.select(
10436: "\";\" expected",
10437: yyBase);
10438: }
10439: } else {
10440: yyError = yyError.select(
10441: "\"}\" expected",
10442: yyBase);
10443: }
10444: } // End scope for v$g$2.
10445: }
10446: } else {
10447: yyError = yyError.select("\"{\" expected",
10448: yyBase);
10449: }
10450: } else {
10451: yyError = yyError.select("\")\" expected",
10452: yyBase);
10453: }
10454: }
10455: } else {
10456: yyError = yyError.select("\"(\" expected", yyBase);
10457: }
10458: }
10459:
10460: // Done.
10461: yyError = yyError.select("aspect definition expected", yyStart);
10462: return yyError;
10463: }
10464:
10465: // =========================================================================
10466:
10467: /**
10468: * Parse nonterminal xtc.lang.c4.C4.AspectStructureDeclaration.
10469: *
10470: * @param yyStart The index.
10471: * @return The result.
10472: * @throws IOException Signals an I/O error.
10473: */
10474: private Result pAspectStructureDeclaration(final int yyStart)
10475: throws IOException {
10476:
10477: Result yyResult;
10478: int yyBase;
10479: Node yyValue;
10480: ParseError yyError = ParseError.DUMMY;
10481:
10482: // Alternative 1.
10483:
10484: yyResult = pKeyword(yyStart);
10485: yyError = yyResult.select(yyError);
10486: if (yyResult.hasValue("aspect")) {
10487: final String v$g$1 = "aspect";
10488:
10489: yyBase = yyResult.index;
10490: yyResult = pSymbol(yyBase);
10491: yyError = yyResult.select(yyError);
10492: if (yyResult.hasValue("(")) {
10493:
10494: yyResult = pIdentifier(yyResult.index);
10495: yyError = yyResult.select(yyError);
10496: if (yyResult.hasValue()) {
10497: final String aName = yyResult.semanticValue();
10498:
10499: yyBase = yyResult.index;
10500: yyResult = pSymbol(yyBase);
10501: yyError = yyResult.select(yyError);
10502: if (yyResult.hasValue(")")) {
10503:
10504: yyBase = yyResult.index;
10505: yyResult = pSymbol(yyBase);
10506: yyError = yyResult.select(yyError);
10507: if (yyResult.hasValue("{")) {
10508:
10509: yyResult = pPushScope(yyResult.index);
10510: yyError = yyResult.select(yyError);
10511: if (yyResult.hasValue()) {
10512:
10513: yyState.setAdvice(aName);
10514:
10515: yyResult = pStructureDeclarationList(yyResult.index);
10516: yyError = yyResult.select(yyError);
10517: if (yyResult.hasValue()) {
10518: final Node v$g$2 = yyResult
10519: .semanticValue();
10520:
10521: yyBase = yyResult.index;
10522: yyResult = pSymbol(yyBase);
10523: yyError = yyResult.select(yyError);
10524: if (yyResult.hasValue("}")) {
10525:
10526: yyResult = pPopScope(yyResult.index);
10527: yyError = yyResult
10528: .select(yyError);
10529: if (yyResult.hasValue()) {
10530:
10531: yyValue = GNode
10532: .create(
10533: "AspectStructureDeclaration",
10534: v$g$1,
10535: aName,
10536: v$g$2);
10537: yyValue
10538: .setLocation(location(yyStart));
10539:
10540: return yyResult
10541: .createValue(
10542: yyValue,
10543: yyError);
10544: }
10545: } else {
10546: yyError = yyError.select(
10547: "\"}\" expected",
10548: yyBase);
10549: }
10550: }
10551: }
10552: } else {
10553: yyError = yyError.select("\"{\" expected",
10554: yyBase);
10555: }
10556: } else {
10557: yyError = yyError.select("\")\" expected",
10558: yyBase);
10559: }
10560: }
10561: } else {
10562: yyError = yyError.select("\"(\" expected", yyBase);
10563: }
10564: }
10565:
10566: // Done.
10567: yyError = yyError.select(
10568: "aspect structure declaration expected", yyStart);
10569: return yyError;
10570: }
10571:
10572: // =========================================================================
10573:
10574: /**
10575: * Parse nonterminal xtc.lang.c4.C4.AspectFunctionDefinition.
10576: *
10577: * @param yyStart The index.
10578: * @return The result.
10579: * @throws IOException Signals an I/O error.
10580: */
10581: private Result pAspectFunctionDefinition(final int yyStart)
10582: throws IOException {
10583:
10584: Result yyResult;
10585: int yyBase;
10586: int yyOption1;
10587: Object yyOpValue1;
10588: Node yyValue;
10589: ParseError yyError = ParseError.DUMMY;
10590:
10591: // Alternative 1.
10592:
10593: yyOption1 = yyStart;
10594: yyOpValue1 = null;
10595:
10596: yyBase = yyOption1;
10597: yyResult = pKeyword(yyBase);
10598: yyError = yyResult.select(yyError);
10599: if (yyResult.hasValue("__extension__")) {
10600: final String v$el$1 = "__extension__";
10601:
10602: yyOption1 = yyResult.index;
10603: yyOpValue1 = v$el$1;
10604: } else {
10605: yyError = yyError.select("\"__extension__\" expected",
10606: yyBase);
10607: }
10608: { // Start scope for v$g$1.
10609: final String v$g$1 = cast(yyOpValue1);
10610:
10611: yyOpValue1 = null;
10612:
10613: yyResult = pDeclarationSpecifiers(yyOption1);
10614: yyError = yyResult.select(yyError);
10615: if (yyResult.hasValue()) {
10616: final Node v$el$2 = yyResult.semanticValue();
10617:
10618: yyOption1 = yyResult.index;
10619: yyOpValue1 = v$el$2;
10620: }
10621: { // Start scope for v$g$2.
10622: final Node v$g$2 = cast(yyOpValue1);
10623:
10624: yyResult = pDeclarator(yyOption1);
10625: yyError = yyResult.select(yyError);
10626: if (yyResult.hasValue()) {
10627: final Node v$g$3 = yyResult.semanticValue();
10628:
10629: yyResult = pFunctionDeclaratorContext(yyResult.index);
10630: yyError = yyResult.select(yyError);
10631: if (yyResult.hasValue()) {
10632:
10633: yyOption1 = yyResult.index;
10634: yyOpValue1 = null;
10635:
10636: yyResult = pDeclarationList(yyOption1);
10637: yyError = yyResult.select(yyError);
10638: if (yyResult.hasValue()) {
10639: final Node v$el$3 = yyResult
10640: .semanticValue();
10641:
10642: yyOption1 = yyResult.index;
10643: yyOpValue1 = v$el$3;
10644: }
10645: { // Start scope for v$g$4.
10646: final Node v$g$4 = cast(yyOpValue1);
10647:
10648: yyResult = pAspectCompoundStatement(yyOption1);
10649: yyError = yyResult.select(yyError);
10650: if (yyResult.hasValue()) {
10651: final Node v$g$5 = yyResult
10652: .semanticValue();
10653:
10654: yyValue = GNode.create(
10655: "AspectFunctionDefinition",
10656: v$g$1, v$g$2, v$g$3, v$g$4,
10657: v$g$5);
10658: yyValue.setLocation(location(yyStart));
10659:
10660: return yyResult.createValue(yyValue,
10661: yyError);
10662: }
10663: } // End scope for v$g$4.
10664: }
10665: }
10666: } // End scope for v$g$2.
10667: } // End scope for v$g$1.
10668:
10669: // Done.
10670: return yyError;
10671: }
10672:
10673: // =========================================================================
10674:
10675: /**
10676: * Parse nonterminal xtc.lang.c4.C4.AspectCompoundStatement.
10677: *
10678: * @param yyStart The index.
10679: * @return The result.
10680: * @throws IOException Signals an I/O error.
10681: */
10682: private Result pAspectCompoundStatement(final int yyStart)
10683: throws IOException {
10684:
10685: Result yyResult;
10686: int yyBase;
10687: int yyRepetition1;
10688: Pair<Node> yyRepValue1;
10689: Node yyValue;
10690: ParseError yyError = ParseError.DUMMY;
10691:
10692: // Alternative 1.
10693:
10694: yyResult = pSymbol(yyStart);
10695: yyError = yyResult.select(yyError);
10696: if (yyResult.hasValue("{")) {
10697:
10698: yyResult = pPushScope(yyResult.index);
10699: yyError = yyResult.select(yyError);
10700: if (yyResult.hasValue()) {
10701:
10702: yyRepetition1 = yyResult.index;
10703: yyRepValue1 = Pair.empty();
10704: while (true) {
10705:
10706: yyResult = pLocalLabelDeclaration(yyRepetition1);
10707: yyError = yyResult.select(yyError);
10708: if (yyResult.hasValue()) {
10709: final Node v$el$1 = yyResult.semanticValue();
10710:
10711: yyRepetition1 = yyResult.index;
10712: yyRepValue1 = new Pair<Node>(v$el$1,
10713: yyRepValue1);
10714: continue;
10715: }
10716: break;
10717: }
10718: { // Start scope for v$g$1.
10719: final Pair<Node> v$g$1 = yyRepValue1.reverse();
10720:
10721: yyResult = pAspectStatementList(yyRepetition1);
10722: yyError = yyResult.select(yyError);
10723: if (yyResult.hasValue()) {
10724: final Node v$g$2 = yyResult.semanticValue();
10725:
10726: yyRepetition1 = yyResult.index;
10727: yyRepValue1 = Pair.empty();
10728: while (true) {
10729:
10730: yyResult = pDeclarationOrStatement(yyRepetition1);
10731: yyError = yyResult.select(yyError);
10732: if (yyResult.hasValue()) {
10733: final Node v$el$2 = yyResult
10734: .semanticValue();
10735:
10736: yyRepetition1 = yyResult.index;
10737: yyRepValue1 = new Pair<Node>(v$el$2,
10738: yyRepValue1);
10739: continue;
10740: }
10741: break;
10742: }
10743: { // Start scope for v$g$3.
10744: final Pair<Node> v$g$3 = yyRepValue1
10745: .reverse();
10746:
10747: yyResult = pAspectStatementList(yyRepetition1);
10748: yyError = yyResult.select(yyError);
10749: if (yyResult.hasValue()) {
10750: final Node v$g$4 = yyResult
10751: .semanticValue();
10752:
10753: yyResult = pAnnotations(yyResult.index);
10754: yyError = yyResult.select(yyError);
10755: if (yyResult.hasValue()) {
10756: final Node v$g$5 = yyResult
10757: .semanticValue();
10758:
10759: yyBase = yyResult.index;
10760: yyResult = pSymbol(yyBase);
10761: yyError = yyResult.select(yyError);
10762: if (yyResult.hasValue("}")) {
10763:
10764: yyResult = pPopScope(yyResult.index);
10765: yyError = yyResult
10766: .select(yyError);
10767: if (yyResult.hasValue()) {
10768:
10769: yyValue = GNode
10770: .create(
10771: "AspectCompoundStatement",
10772: v$g$1
10773: .size()
10774: + v$g$3
10775: .size()
10776: + 3)
10777: .addAll(v$g$1).add(
10778: v$g$2)
10779: .addAll(v$g$3).add(
10780: v$g$4).add(
10781: v$g$5);
10782: yyValue
10783: .setLocation(location(yyStart));
10784:
10785: return yyResult
10786: .createValue(
10787: yyValue,
10788: yyError);
10789: }
10790: } else {
10791: yyError = yyError.select(
10792: "\"}\" expected",
10793: yyBase);
10794: }
10795: }
10796: }
10797: } // End scope for v$g$3.
10798: }
10799: } // End scope for v$g$1.
10800: }
10801: }
10802:
10803: // Done.
10804: yyError = yyError.select("aspect compound statement expected",
10805: yyStart);
10806: return yyError;
10807: }
10808:
10809: // =========================================================================
10810:
10811: /**
10812: * Parse nonterminal xtc.lang.c4.C4.AspectStatementList.
10813: *
10814: * @param yyStart The index.
10815: * @return The result.
10816: * @throws IOException Signals an I/O error.
10817: */
10818: private Result pAspectStatementList(final int yyStart)
10819: throws IOException {
10820: Result yyResult;
10821: int yyRepetition1;
10822: Pair<Node> yyRepValue1;
10823: Node yyValue;
10824: ParseError yyError = ParseError.DUMMY;
10825:
10826: // Alternative 1.
10827:
10828: yyRepetition1 = yyStart;
10829: yyRepValue1 = Pair.empty();
10830: while (true) {
10831:
10832: yyResult = pAspectStatement(yyRepetition1);
10833: yyError = yyResult.select(yyError);
10834: if (yyResult.hasValue()) {
10835: final Node v$el$1 = yyResult.semanticValue();
10836:
10837: yyRepetition1 = yyResult.index;
10838: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
10839: continue;
10840: }
10841: break;
10842: }
10843: { // Start scope for v$g$1.
10844: final Pair<Node> v$g$1 = yyRepValue1.reverse();
10845:
10846: yyValue = GNode
10847: .createFromPair("AspectStatementList", v$g$1);
10848: yyValue.setLocation(location(yyStart));
10849:
10850: return new SemanticValue(yyValue, yyRepetition1, yyError);
10851: } // End scope for v$g$1.
10852: }
10853:
10854: // =========================================================================
10855:
10856: /**
10857: * Parse nonterminal xtc.lang.c4.C4.AspectStatement.
10858: *
10859: * @param yyStart The index.
10860: * @return The result.
10861: * @throws IOException Signals an I/O error.
10862: */
10863: private Result pAspectStatement(final int yyStart)
10864: throws IOException {
10865: Result yyResult;
10866: int yyBase;
10867: int yyRepetition1;
10868: Pair<Node> yyRepValue1;
10869: Node yyValue;
10870: ParseError yyError = ParseError.DUMMY;
10871:
10872: // Alternative 1.
10873:
10874: yyResult = pKeyword(yyStart);
10875: yyError = yyResult.select(yyError);
10876: if (yyResult.hasValue("aspect")) {
10877: final String v$g$1 = "aspect";
10878:
10879: yyBase = yyResult.index;
10880: yyResult = pSymbol(yyBase);
10881: yyError = yyResult.select(yyError);
10882: if (yyResult.hasValue("(")) {
10883:
10884: yyResult = pIdentifier(yyResult.index);
10885: yyError = yyResult.select(yyError);
10886: if (yyResult.hasValue()) {
10887: final String aName = yyResult.semanticValue();
10888:
10889: yyBase = yyResult.index;
10890: yyResult = pSymbol(yyBase);
10891: yyError = yyResult.select(yyError);
10892: if (yyResult.hasValue(")")) {
10893:
10894: yyBase = yyResult.index;
10895: yyResult = pSymbol(yyBase);
10896: yyError = yyResult.select(yyError);
10897: if (yyResult.hasValue("{")) {
10898:
10899: yyResult = pPushScope(yyResult.index);
10900: yyError = yyResult.select(yyError);
10901: if (yyResult.hasValue()) {
10902:
10903: yyState.setAdvice(aName);
10904:
10905: yyRepetition1 = yyResult.index;
10906: yyRepValue1 = Pair.empty();
10907: while (true) {
10908:
10909: yyResult = pDeclarationOrStatement(yyRepetition1);
10910: yyError = yyResult.select(yyError);
10911: if (yyResult.hasValue()) {
10912: final Node v$el$1 = yyResult
10913: .semanticValue();
10914:
10915: yyRepetition1 = yyResult.index;
10916: yyRepValue1 = new Pair<Node>(
10917: v$el$1, yyRepValue1);
10918: continue;
10919: }
10920: break;
10921: }
10922: { // Start scope for v$g$2.
10923: final Pair<Node> v$g$2 = yyRepValue1
10924: .reverse();
10925:
10926: yyBase = yyRepetition1;
10927: yyResult = pSymbol(yyBase);
10928: yyError = yyResult.select(yyError);
10929: if (yyResult.hasValue("}")) {
10930:
10931: yyBase = yyResult.index;
10932: yyResult = pSymbol(yyBase);
10933: yyError = yyResult
10934: .select(yyError);
10935: if (yyResult.hasValue(";")) {
10936:
10937: yyResult = pPopScope(yyResult.index);
10938: yyError = yyResult
10939: .select(yyError);
10940: if (yyResult.hasValue()) {
10941:
10942: yyValue = GNode
10943: .create(
10944: "AspectStatement",
10945: v$g$2
10946: .size() + 2)
10947: .add(v$g$1)
10948: .add(aName)
10949: .addAll(v$g$2);
10950: yyValue
10951: .setLocation(location(yyStart));
10952:
10953: return yyResult
10954: .createValue(
10955: yyValue,
10956: yyError);
10957: }
10958: } else {
10959: yyError = yyError.select(
10960: "\";\" expected",
10961: yyBase);
10962: }
10963: } else {
10964: yyError = yyError.select(
10965: "\"}\" expected",
10966: yyBase);
10967: }
10968: } // End scope for v$g$2.
10969: }
10970: } else {
10971: yyError = yyError.select("\"{\" expected",
10972: yyBase);
10973: }
10974: } else {
10975: yyError = yyError.select("\")\" expected",
10976: yyBase);
10977: }
10978: }
10979: } else {
10980: yyError = yyError.select("\"(\" expected", yyBase);
10981: }
10982: }
10983:
10984: // Done.
10985: yyError = yyError.select("aspect statement expected", yyStart);
10986: return yyError;
10987: }
10988:
10989: // =========================================================================
10990:
10991: /**
10992: * Parse nonterminal xtc.lang.CConstant.Constant.
10993: *
10994: * @param yyStart The index.
10995: * @return The result.
10996: * @throws IOException Signals an I/O error.
10997: */
10998: private Result pConstant(final int yyStart) throws IOException {
10999: Result yyResult;
11000: Node yyValue;
11001: ParseError yyError = ParseError.DUMMY;
11002:
11003: // Alternative 1.
11004:
11005: yyResult = pFloatingConstant(yyStart);
11006: yyError = yyResult.select(yyError);
11007: if (yyResult.hasValue()) {
11008: yyValue = yyResult.semanticValue();
11009:
11010: yyResult = pSpacing(yyResult.index);
11011: yyError = yyResult.select(yyError);
11012: if (yyResult.hasValue()) {
11013:
11014: return yyResult.createValue(yyValue, yyError);
11015: }
11016: }
11017:
11018: // Alternative 2.
11019:
11020: yyResult = pIntegerConstant(yyStart);
11021: yyError = yyResult.select(yyError);
11022: if (yyResult.hasValue()) {
11023: yyValue = yyResult.semanticValue();
11024:
11025: yyResult = pSpacing(yyResult.index);
11026: yyError = yyResult.select(yyError);
11027: if (yyResult.hasValue()) {
11028:
11029: return yyResult.createValue(yyValue, yyError);
11030: }
11031: }
11032:
11033: // Alternative 3.
11034:
11035: yyResult = pCharacterConstant(yyStart);
11036: yyError = yyResult.select(yyError);
11037: if (yyResult.hasValue()) {
11038: yyValue = yyResult.semanticValue();
11039:
11040: return yyResult.createValue(yyValue, yyError);
11041: }
11042:
11043: // Alternative 4.
11044:
11045: yyResult = pStringConstant(yyStart);
11046: yyError = yyResult.select(yyError);
11047: if (yyResult.hasValue()) {
11048: yyValue = yyResult.semanticValue();
11049:
11050: return yyResult.createValue(yyValue, yyError);
11051: }
11052:
11053: // Done.
11054: return yyError;
11055: }
11056:
11057: // =========================================================================
11058:
11059: /**
11060: * Parse nonterminal xtc.lang.CConstant.IntegerConstant.
11061: *
11062: * @param yyStart The index.
11063: * @return The result.
11064: * @throws IOException Signals an I/O error.
11065: */
11066: private Result pIntegerConstant(final int yyStart)
11067: throws IOException {
11068: Result yyResult;
11069: Node yyValue;
11070: ParseError yyError = ParseError.DUMMY;
11071:
11072: // Alternative <Hex>.
11073:
11074: yyResult = pHexConstant(yyStart);
11075: yyError = yyResult.select(yyError);
11076: if (yyResult.hasValue()) {
11077: final String v$g$1 = yyResult.semanticValue();
11078:
11079: yyValue = GNode.create("IntegerConstant", v$g$1);
11080: yyValue.setLocation(location(yyStart));
11081:
11082: return yyResult.createValue(yyValue, yyError);
11083: }
11084:
11085: // Alternative <Octal>.
11086:
11087: yyResult = pOctalConstant(yyStart);
11088: yyError = yyResult.select(yyError);
11089: if (yyResult.hasValue()) {
11090: final String v$g$2 = yyResult.semanticValue();
11091:
11092: yyValue = GNode.create("IntegerConstant", v$g$2);
11093: yyValue.setLocation(location(yyStart));
11094:
11095: return yyResult.createValue(yyValue, yyError);
11096: }
11097:
11098: // Alternative <Decimal>.
11099:
11100: yyResult = pDecimalConstant(yyStart);
11101: yyError = yyResult.select(yyError);
11102: if (yyResult.hasValue()) {
11103: final String v$g$3 = yyResult.semanticValue();
11104:
11105: yyValue = GNode.create("IntegerConstant", v$g$3);
11106: yyValue.setLocation(location(yyStart));
11107:
11108: return yyResult.createValue(yyValue, yyError);
11109: }
11110:
11111: // Done.
11112: return yyError;
11113: }
11114:
11115: // =========================================================================
11116:
11117: /**
11118: * Parse nonterminal xtc.lang.CConstant.DecimalConstant.
11119: *
11120: * @param yyStart The index.
11121: * @return The result.
11122: * @throws IOException Signals an I/O error.
11123: */
11124: private Result pDecimalConstant(final int yyStart)
11125: throws IOException {
11126: int yyC;
11127: int yyIndex;
11128: Result yyResult;
11129: int yyRepetition1;
11130: int yyOption1;
11131: String yyValue;
11132: ParseError yyError = ParseError.DUMMY;
11133:
11134: // Alternative 1.
11135:
11136: yyC = character(yyStart);
11137: if (-1 != yyC) {
11138: yyIndex = yyStart + 1;
11139:
11140: switch (yyC) {
11141: case '1':
11142: case '2':
11143: case '3':
11144: case '4':
11145: case '5':
11146: case '6':
11147: case '7':
11148: case '8':
11149: case '9': {
11150: yyRepetition1 = yyIndex;
11151: while (true) {
11152:
11153: yyC = character(yyRepetition1);
11154: if (-1 != yyC) {
11155: yyIndex = yyRepetition1 + 1;
11156:
11157: switch (yyC) {
11158: case '0':
11159: case '1':
11160: case '2':
11161: case '3':
11162: case '4':
11163: case '5':
11164: case '6':
11165: case '7':
11166: case '8':
11167: case '9': {
11168: yyRepetition1 = yyIndex;
11169: continue;
11170: }
11171:
11172: default:
11173: /* No match. */
11174: }
11175: }
11176: break;
11177: }
11178:
11179: yyOption1 = yyRepetition1;
11180:
11181: yyResult = pIntegerSuffix(yyOption1);
11182: yyError = yyResult.select(yyError);
11183: if (yyResult.hasValue()) {
11184:
11185: yyOption1 = yyResult.index;
11186: }
11187:
11188: yyValue = difference(yyStart, yyOption1);
11189:
11190: return new SemanticValue(yyValue, yyOption1, yyError);
11191: }
11192:
11193: default:
11194: /* No match. */
11195: }
11196: }
11197:
11198: // Done.
11199: yyError = yyError.select("decimal constant expected", yyStart);
11200: return yyError;
11201: }
11202:
11203: // =========================================================================
11204:
11205: /**
11206: * Parse nonterminal xtc.lang.CConstant.HexConstant.
11207: *
11208: * @param yyStart The index.
11209: * @return The result.
11210: * @throws IOException Signals an I/O error.
11211: */
11212: private Result pHexConstant(final int yyStart) throws IOException {
11213: int yyC;
11214: int yyIndex;
11215: Result yyResult;
11216: int yyRepetition1;
11217: boolean yyRepeated1;
11218: int yyOption1;
11219: String yyValue;
11220: ParseError yyError = ParseError.DUMMY;
11221:
11222: // Alternative 1.
11223:
11224: yyResult = pHexPrefix(yyStart);
11225: yyError = yyResult.select(yyError);
11226: if (yyResult.hasValue()) {
11227:
11228: yyRepetition1 = yyResult.index;
11229: yyRepeated1 = false;
11230: while (true) {
11231:
11232: yyC = character(yyRepetition1);
11233: if (-1 != yyC) {
11234: yyIndex = yyRepetition1 + 1;
11235:
11236: switch (yyC) {
11237: case '0':
11238: case '1':
11239: case '2':
11240: case '3':
11241: case '4':
11242: case '5':
11243: case '6':
11244: case '7':
11245: case '8':
11246: case '9':
11247: case 'A':
11248: case 'B':
11249: case 'C':
11250: case 'D':
11251: case 'E':
11252: case 'F':
11253: case 'a':
11254: case 'b':
11255: case 'c':
11256: case 'd':
11257: case 'e':
11258: case 'f': {
11259: yyRepetition1 = yyIndex;
11260: yyRepeated1 = true;
11261: continue;
11262: }
11263:
11264: default:
11265: /* No match. */
11266: }
11267: }
11268: break;
11269: }
11270:
11271: if (yyRepeated1) {
11272:
11273: yyOption1 = yyRepetition1;
11274:
11275: yyResult = pIntegerSuffix(yyOption1);
11276: yyError = yyResult.select(yyError);
11277: if (yyResult.hasValue()) {
11278:
11279: yyOption1 = yyResult.index;
11280: }
11281:
11282: yyValue = difference(yyStart, yyOption1);
11283:
11284: return new SemanticValue(yyValue, yyOption1, yyError);
11285: }
11286: }
11287:
11288: // Done.
11289: yyError = yyError.select("hex constant expected", yyStart);
11290: return yyError;
11291: }
11292:
11293: // =========================================================================
11294:
11295: /**
11296: * Parse nonterminal xtc.lang.CConstant.HexPrefix.
11297: *
11298: * @param yyStart The index.
11299: * @return The result.
11300: * @throws IOException Signals an I/O error.
11301: */
11302: private Result pHexPrefix(final int yyStart) throws IOException {
11303: int yyC;
11304: int yyIndex;
11305: Void yyValue;
11306: ParseError yyError = ParseError.DUMMY;
11307:
11308: // Alternative 1.
11309:
11310: yyC = character(yyStart);
11311: if ('0' == yyC) {
11312: yyIndex = yyStart + 1;
11313:
11314: yyC = character(yyIndex);
11315: if (-1 != yyC) {
11316: yyIndex = yyIndex + 1;
11317:
11318: switch (yyC) {
11319: case 'X':
11320: case 'x': {
11321: yyValue = null;
11322:
11323: return new SemanticValue(yyValue, yyIndex, yyError);
11324: }
11325:
11326: default:
11327: /* No match. */
11328: }
11329: }
11330: }
11331:
11332: // Done.
11333: yyError = yyError.select("hex prefix expected", yyStart);
11334: return yyError;
11335: }
11336:
11337: // =========================================================================
11338:
11339: /**
11340: * Parse nonterminal xtc.lang.CConstant.OctalConstant.
11341: *
11342: * @param yyStart The index.
11343: * @return The result.
11344: * @throws IOException Signals an I/O error.
11345: */
11346: private Result pOctalConstant(final int yyStart) throws IOException {
11347: int yyC;
11348: int yyIndex;
11349: Result yyResult;
11350: int yyRepetition1;
11351: int yyOption1;
11352: String yyValue;
11353: ParseError yyError = ParseError.DUMMY;
11354:
11355: // Alternative 1.
11356:
11357: yyC = character(yyStart);
11358: if ('0' == yyC) {
11359: yyIndex = yyStart + 1;
11360:
11361: yyRepetition1 = yyIndex;
11362: while (true) {
11363:
11364: yyC = character(yyRepetition1);
11365: if (-1 != yyC) {
11366: yyIndex = yyRepetition1 + 1;
11367:
11368: switch (yyC) {
11369: case '0':
11370: case '1':
11371: case '2':
11372: case '3':
11373: case '4':
11374: case '5':
11375: case '6':
11376: case '7': {
11377: yyRepetition1 = yyIndex;
11378: continue;
11379: }
11380:
11381: default:
11382: /* No match. */
11383: }
11384: }
11385: break;
11386: }
11387:
11388: yyOption1 = yyRepetition1;
11389:
11390: yyResult = pIntegerSuffix(yyOption1);
11391: yyError = yyResult.select(yyError);
11392: if (yyResult.hasValue()) {
11393:
11394: yyOption1 = yyResult.index;
11395: }
11396:
11397: yyValue = difference(yyStart, yyOption1);
11398:
11399: return new SemanticValue(yyValue, yyOption1, yyError);
11400: }
11401:
11402: // Done.
11403: yyError = yyError.select("octal constant expected", yyStart);
11404: return yyError;
11405: }
11406:
11407: // =========================================================================
11408:
11409: /**
11410: * Parse nonterminal xtc.lang.CConstant.IntegerSuffix.
11411: *
11412: * @param yyStart The index.
11413: * @return The result.
11414: * @throws IOException Signals an I/O error.
11415: */
11416: private Result pIntegerSuffix(final int yyStart) throws IOException {
11417: int yyC;
11418: int yyIndex;
11419: Result yyResult;
11420: Void yyValue;
11421: ParseError yyError = ParseError.DUMMY;
11422:
11423: // Alternative 1.
11424:
11425: yyResult = pLongLongSuffix(yyStart);
11426: yyError = yyResult.select(yyError);
11427: if (yyResult.hasValue()) {
11428:
11429: final int yyChoice1 = yyResult.index;
11430:
11431: // Nested alternative 1.
11432:
11433: yyC = character(yyChoice1);
11434: if (-1 != yyC) {
11435: yyIndex = yyChoice1 + 1;
11436:
11437: switch (yyC) {
11438: case 'U':
11439: case 'u': {
11440: yyValue = null;
11441:
11442: return new SemanticValue(yyValue, yyIndex, yyError);
11443: }
11444:
11445: default:
11446: /* No match. */
11447: }
11448: }
11449:
11450: // Nested alternative 2.
11451:
11452: yyValue = null;
11453:
11454: return new SemanticValue(yyValue, yyChoice1, yyError);
11455: }
11456:
11457: // Alternative 2.
11458:
11459: yyC = character(yyStart);
11460: if (-1 != yyC) {
11461: yyIndex = yyStart + 1;
11462:
11463: switch (yyC) {
11464: case 'L':
11465: case 'l': {
11466: final int yyChoice1 = yyIndex;
11467:
11468: // Nested alternative 1.
11469:
11470: yyC = character(yyChoice1);
11471: if (-1 != yyC) {
11472: yyIndex = yyChoice1 + 1;
11473:
11474: switch (yyC) {
11475: case 'U':
11476: case 'u': {
11477: yyValue = null;
11478:
11479: return new SemanticValue(yyValue, yyIndex,
11480: yyError);
11481: }
11482:
11483: default:
11484: /* No match. */
11485: }
11486: }
11487:
11488: // Nested alternative 2.
11489:
11490: yyValue = null;
11491:
11492: return new SemanticValue(yyValue, yyChoice1, yyError);
11493: }
11494:
11495: case 'U':
11496: case 'u': {
11497: final int yyChoice1 = yyIndex;
11498:
11499: // Nested alternative 1.
11500:
11501: yyC = character(yyChoice1);
11502: if (-1 != yyC) {
11503: yyIndex = yyChoice1 + 1;
11504:
11505: switch (yyC) {
11506: case 'l': {
11507: yyC = character(yyIndex);
11508: if (-1 != yyC) {
11509: yyIndex = yyIndex + 1;
11510: if ('l' == yyC) {
11511:
11512: yyValue = null;
11513:
11514: return new SemanticValue(yyValue,
11515: yyIndex, yyError);
11516: }
11517: }
11518: }
11519: break;
11520:
11521: case 'L': {
11522: yyC = character(yyIndex);
11523: if (-1 != yyC) {
11524: yyIndex = yyIndex + 1;
11525: if ('L' == yyC) {
11526:
11527: yyValue = null;
11528:
11529: return new SemanticValue(yyValue,
11530: yyIndex, yyError);
11531: }
11532: }
11533: }
11534: break;
11535:
11536: default:
11537: /* No match. */
11538: }
11539: }
11540:
11541: // Nested alternative 2.
11542:
11543: yyC = character(yyChoice1);
11544: if (-1 != yyC) {
11545: yyIndex = yyChoice1 + 1;
11546:
11547: switch (yyC) {
11548: case 'L':
11549: case 'l': {
11550: yyValue = null;
11551:
11552: return new SemanticValue(yyValue, yyIndex,
11553: yyError);
11554: }
11555:
11556: default:
11557: /* No match. */
11558: }
11559: }
11560:
11561: // Nested alternative 3.
11562:
11563: yyValue = null;
11564:
11565: return new SemanticValue(yyValue, yyChoice1, yyError);
11566: }
11567:
11568: default:
11569: /* No match. */
11570: }
11571: }
11572:
11573: // Done.
11574: yyError = yyError.select("integer suffix expected", yyStart);
11575: return yyError;
11576: }
11577:
11578: // =========================================================================
11579:
11580: /**
11581: * Parse nonterminal xtc.lang.CConstant.LongLongSuffix.
11582: *
11583: * @param yyStart The index.
11584: * @return The result.
11585: * @throws IOException Signals an I/O error.
11586: */
11587: private Result pLongLongSuffix(final int yyStart)
11588: throws IOException {
11589: int yyC;
11590: int yyIndex;
11591: Void yyValue;
11592: ParseError yyError = ParseError.DUMMY;
11593:
11594: // Alternative 1.
11595:
11596: yyC = character(yyStart);
11597: if (-1 != yyC) {
11598: yyIndex = yyStart + 1;
11599:
11600: switch (yyC) {
11601: case 'l': {
11602: yyC = character(yyIndex);
11603: if (-1 != yyC) {
11604: yyIndex = yyIndex + 1;
11605: if ('l' == yyC) {
11606:
11607: yyValue = null;
11608:
11609: return new SemanticValue(yyValue, yyIndex,
11610: yyError);
11611: }
11612: }
11613: }
11614: break;
11615:
11616: case 'L': {
11617: yyC = character(yyIndex);
11618: if (-1 != yyC) {
11619: yyIndex = yyIndex + 1;
11620: if ('L' == yyC) {
11621:
11622: yyValue = null;
11623:
11624: return new SemanticValue(yyValue, yyIndex,
11625: yyError);
11626: }
11627: }
11628: }
11629: break;
11630:
11631: default:
11632: /* No match. */
11633: }
11634: }
11635:
11636: // Done.
11637: yyError = yyError.select("long long suffix expected", yyStart);
11638: return yyError;
11639: }
11640:
11641: // =========================================================================
11642:
11643: /**
11644: * Parse nonterminal xtc.lang.CConstant.FloatingConstant.
11645: *
11646: * @param yyStart The index.
11647: * @return The result.
11648: * @throws IOException Signals an I/O error.
11649: */
11650: private Result pFloatingConstant(final int yyStart)
11651: throws IOException {
11652: Result yyResult;
11653: Node yyValue;
11654: ParseError yyError = ParseError.DUMMY;
11655:
11656: // Alternative <Decimal>.
11657:
11658: yyResult = pDecimalFloatingConstant(yyStart);
11659: yyError = yyResult.select(yyError);
11660: if (yyResult.hasValue()) {
11661: final String v$g$1 = yyResult.semanticValue();
11662:
11663: yyValue = GNode.create("FloatingConstant", v$g$1);
11664: yyValue.setLocation(location(yyStart));
11665:
11666: return yyResult.createValue(yyValue, yyError);
11667: }
11668:
11669: // Alternative <Hex>.
11670:
11671: yyResult = pHexFloatingConstant(yyStart);
11672: yyError = yyResult.select(yyError);
11673: if (yyResult.hasValue()) {
11674: final String v$g$2 = yyResult.semanticValue();
11675:
11676: yyValue = GNode.create("FloatingConstant", v$g$2);
11677: yyValue.setLocation(location(yyStart));
11678:
11679: return yyResult.createValue(yyValue, yyError);
11680: }
11681:
11682: // Done.
11683: return yyError;
11684: }
11685:
11686: // =========================================================================
11687:
11688: /**
11689: * Parse nonterminal xtc.lang.CConstant.DecimalFloatingConstant.
11690: *
11691: * @param yyStart The index.
11692: * @return The result.
11693: * @throws IOException Signals an I/O error.
11694: */
11695: private Result pDecimalFloatingConstant(final int yyStart)
11696: throws IOException {
11697:
11698: int yyC;
11699: int yyIndex;
11700: Result yyResult;
11701: int yyRepetition1;
11702: boolean yyRepeated1;
11703: int yyOption1;
11704: String yyValue;
11705: ParseError yyError = ParseError.DUMMY;
11706:
11707: // Alternative 1.
11708:
11709: yyRepetition1 = yyStart;
11710: yyRepeated1 = false;
11711: while (true) {
11712:
11713: yyC = character(yyRepetition1);
11714: if (-1 != yyC) {
11715: yyIndex = yyRepetition1 + 1;
11716:
11717: switch (yyC) {
11718: case '0':
11719: case '1':
11720: case '2':
11721: case '3':
11722: case '4':
11723: case '5':
11724: case '6':
11725: case '7':
11726: case '8':
11727: case '9': {
11728: yyRepetition1 = yyIndex;
11729: yyRepeated1 = true;
11730: continue;
11731: }
11732:
11733: default:
11734: /* No match. */
11735: }
11736: }
11737: break;
11738: }
11739:
11740: if (yyRepeated1) {
11741:
11742: yyC = character(yyRepetition1);
11743: if ('.' == yyC) {
11744: yyIndex = yyRepetition1 + 1;
11745:
11746: yyRepetition1 = yyIndex;
11747: while (true) {
11748:
11749: yyC = character(yyRepetition1);
11750: if (-1 != yyC) {
11751: yyIndex = yyRepetition1 + 1;
11752:
11753: switch (yyC) {
11754: case '0':
11755: case '1':
11756: case '2':
11757: case '3':
11758: case '4':
11759: case '5':
11760: case '6':
11761: case '7':
11762: case '8':
11763: case '9': {
11764: yyRepetition1 = yyIndex;
11765: continue;
11766: }
11767:
11768: default:
11769: /* No match. */
11770: }
11771: }
11772: break;
11773: }
11774:
11775: yyOption1 = yyRepetition1;
11776:
11777: yyResult = pExponent(yyOption1);
11778: yyError = yyResult.select(yyError);
11779: if (yyResult.hasValue()) {
11780:
11781: yyOption1 = yyResult.index;
11782: }
11783:
11784: yyC = character(yyOption1);
11785: if (-1 != yyC) {
11786: yyIndex = yyOption1 + 1;
11787:
11788: switch (yyC) {
11789: case 'F':
11790: case 'L':
11791: case 'f':
11792: case 'l': {
11793: yyOption1 = yyIndex;
11794: }
11795:
11796: default:
11797: /* No match. */
11798: }
11799: }
11800:
11801: yyValue = difference(yyStart, yyOption1);
11802:
11803: return new SemanticValue(yyValue, yyOption1, yyError);
11804: }
11805: }
11806:
11807: // Alternative 2.
11808:
11809: yyC = character(yyStart);
11810: if ('.' == yyC) {
11811: yyIndex = yyStart + 1;
11812:
11813: yyRepetition1 = yyIndex;
11814: yyRepeated1 = false;
11815: while (true) {
11816:
11817: yyC = character(yyRepetition1);
11818: if (-1 != yyC) {
11819: yyIndex = yyRepetition1 + 1;
11820:
11821: switch (yyC) {
11822: case '0':
11823: case '1':
11824: case '2':
11825: case '3':
11826: case '4':
11827: case '5':
11828: case '6':
11829: case '7':
11830: case '8':
11831: case '9': {
11832: yyRepetition1 = yyIndex;
11833: yyRepeated1 = true;
11834: continue;
11835: }
11836:
11837: default:
11838: /* No match. */
11839: }
11840: }
11841: break;
11842: }
11843:
11844: if (yyRepeated1) {
11845:
11846: yyOption1 = yyRepetition1;
11847:
11848: yyResult = pExponent(yyOption1);
11849: yyError = yyResult.select(yyError);
11850: if (yyResult.hasValue()) {
11851:
11852: yyOption1 = yyResult.index;
11853: }
11854:
11855: yyC = character(yyOption1);
11856: if (-1 != yyC) {
11857: yyIndex = yyOption1 + 1;
11858:
11859: switch (yyC) {
11860: case 'F':
11861: case 'L':
11862: case 'f':
11863: case 'l': {
11864: yyOption1 = yyIndex;
11865: }
11866:
11867: default:
11868: /* No match. */
11869: }
11870: }
11871:
11872: yyValue = difference(yyStart, yyOption1);
11873:
11874: return new SemanticValue(yyValue, yyOption1, yyError);
11875: }
11876: }
11877:
11878: // Alternative 3.
11879:
11880: yyRepetition1 = yyStart;
11881: yyRepeated1 = false;
11882: while (true) {
11883:
11884: yyC = character(yyRepetition1);
11885: if (-1 != yyC) {
11886: yyIndex = yyRepetition1 + 1;
11887:
11888: switch (yyC) {
11889: case '0':
11890: case '1':
11891: case '2':
11892: case '3':
11893: case '4':
11894: case '5':
11895: case '6':
11896: case '7':
11897: case '8':
11898: case '9': {
11899: yyRepetition1 = yyIndex;
11900: yyRepeated1 = true;
11901: continue;
11902: }
11903:
11904: default:
11905: /* No match. */
11906: }
11907: }
11908: break;
11909: }
11910:
11911: if (yyRepeated1) {
11912:
11913: yyResult = pExponent(yyRepetition1);
11914: yyError = yyResult.select(yyError);
11915: if (yyResult.hasValue()) {
11916:
11917: yyOption1 = yyResult.index;
11918:
11919: yyC = character(yyOption1);
11920: if (-1 != yyC) {
11921: yyIndex = yyOption1 + 1;
11922:
11923: switch (yyC) {
11924: case 'F':
11925: case 'L':
11926: case 'f':
11927: case 'l': {
11928: yyOption1 = yyIndex;
11929: }
11930:
11931: default:
11932: /* No match. */
11933: }
11934: }
11935:
11936: yyValue = difference(yyStart, yyOption1);
11937:
11938: return new SemanticValue(yyValue, yyOption1, yyError);
11939: }
11940: }
11941:
11942: // Done.
11943: yyError = yyError.select("decimal floating constant expected",
11944: yyStart);
11945: return yyError;
11946: }
11947:
11948: // =========================================================================
11949:
11950: /**
11951: * Parse nonterminal xtc.lang.CConstant.HexFloatingConstant.
11952: *
11953: * @param yyStart The index.
11954: * @return The result.
11955: * @throws IOException Signals an I/O error.
11956: */
11957: private Result pHexFloatingConstant(final int yyStart)
11958: throws IOException {
11959: int yyC;
11960: int yyIndex;
11961: Result yyResult;
11962: int yyRepetition1;
11963: boolean yyRepeated1;
11964: int yyOption1;
11965: String yyValue;
11966: ParseError yyError = ParseError.DUMMY;
11967:
11968: // Alternative 1.
11969:
11970: yyResult = pHexPrefix(yyStart);
11971: yyError = yyResult.select(yyError);
11972: if (yyResult.hasValue()) {
11973:
11974: final int yyChoice1 = yyResult.index;
11975:
11976: // Nested alternative 1.
11977:
11978: yyRepetition1 = yyChoice1;
11979: yyRepeated1 = false;
11980: while (true) {
11981:
11982: yyC = character(yyRepetition1);
11983: if (-1 != yyC) {
11984: yyIndex = yyRepetition1 + 1;
11985:
11986: switch (yyC) {
11987: case '0':
11988: case '1':
11989: case '2':
11990: case '3':
11991: case '4':
11992: case '5':
11993: case '6':
11994: case '7':
11995: case '8':
11996: case '9':
11997: case 'A':
11998: case 'B':
11999: case 'C':
12000: case 'D':
12001: case 'E':
12002: case 'F':
12003: case 'a':
12004: case 'b':
12005: case 'c':
12006: case 'd':
12007: case 'e':
12008: case 'f': {
12009: yyRepetition1 = yyIndex;
12010: yyRepeated1 = true;
12011: continue;
12012: }
12013:
12014: default:
12015: /* No match. */
12016: }
12017: }
12018: break;
12019: }
12020:
12021: if (yyRepeated1) {
12022:
12023: yyC = character(yyRepetition1);
12024: if ('.' == yyC) {
12025: yyIndex = yyRepetition1 + 1;
12026:
12027: yyRepetition1 = yyIndex;
12028: while (true) {
12029:
12030: yyC = character(yyRepetition1);
12031: if (-1 != yyC) {
12032: yyIndex = yyRepetition1 + 1;
12033:
12034: switch (yyC) {
12035: case '0':
12036: case '1':
12037: case '2':
12038: case '3':
12039: case '4':
12040: case '5':
12041: case '6':
12042: case '7':
12043: case '8':
12044: case '9':
12045: case 'A':
12046: case 'B':
12047: case 'C':
12048: case 'D':
12049: case 'E':
12050: case 'F':
12051: case 'a':
12052: case 'b':
12053: case 'c':
12054: case 'd':
12055: case 'e':
12056: case 'f': {
12057: yyRepetition1 = yyIndex;
12058: continue;
12059: }
12060:
12061: default:
12062: /* No match. */
12063: }
12064: }
12065: break;
12066: }
12067:
12068: yyResult = pBinaryExponent(yyRepetition1);
12069: yyError = yyResult.select(yyError);
12070: if (yyResult.hasValue()) {
12071:
12072: yyOption1 = yyResult.index;
12073:
12074: yyC = character(yyOption1);
12075: if (-1 != yyC) {
12076: yyIndex = yyOption1 + 1;
12077:
12078: switch (yyC) {
12079: case 'F':
12080: case 'L':
12081: case 'f':
12082: case 'l': {
12083: yyOption1 = yyIndex;
12084: }
12085:
12086: default:
12087: /* No match. */
12088: }
12089: }
12090:
12091: yyValue = difference(yyStart, yyOption1);
12092:
12093: return new SemanticValue(yyValue, yyOption1,
12094: yyError);
12095: }
12096: }
12097: }
12098:
12099: // Nested alternative 2.
12100:
12101: yyC = character(yyChoice1);
12102: if ('.' == yyC) {
12103: yyIndex = yyChoice1 + 1;
12104:
12105: yyRepetition1 = yyIndex;
12106: yyRepeated1 = false;
12107: while (true) {
12108:
12109: yyC = character(yyRepetition1);
12110: if (-1 != yyC) {
12111: yyIndex = yyRepetition1 + 1;
12112:
12113: switch (yyC) {
12114: case '0':
12115: case '1':
12116: case '2':
12117: case '3':
12118: case '4':
12119: case '5':
12120: case '6':
12121: case '7':
12122: case '8':
12123: case '9':
12124: case 'A':
12125: case 'B':
12126: case 'C':
12127: case 'D':
12128: case 'E':
12129: case 'F':
12130: case 'a':
12131: case 'b':
12132: case 'c':
12133: case 'd':
12134: case 'e':
12135: case 'f': {
12136: yyRepetition1 = yyIndex;
12137: yyRepeated1 = true;
12138: continue;
12139: }
12140:
12141: default:
12142: /* No match. */
12143: }
12144: }
12145: break;
12146: }
12147:
12148: if (yyRepeated1) {
12149:
12150: yyResult = pBinaryExponent(yyRepetition1);
12151: yyError = yyResult.select(yyError);
12152: if (yyResult.hasValue()) {
12153:
12154: yyOption1 = yyResult.index;
12155:
12156: yyC = character(yyOption1);
12157: if (-1 != yyC) {
12158: yyIndex = yyOption1 + 1;
12159:
12160: switch (yyC) {
12161: case 'F':
12162: case 'L':
12163: case 'f':
12164: case 'l': {
12165: yyOption1 = yyIndex;
12166: }
12167:
12168: default:
12169: /* No match. */
12170: }
12171: }
12172:
12173: yyValue = difference(yyStart, yyOption1);
12174:
12175: return new SemanticValue(yyValue, yyOption1,
12176: yyError);
12177: }
12178: }
12179: }
12180:
12181: // Nested alternative 3.
12182:
12183: yyRepetition1 = yyChoice1;
12184: yyRepeated1 = false;
12185: while (true) {
12186:
12187: yyC = character(yyRepetition1);
12188: if (-1 != yyC) {
12189: yyIndex = yyRepetition1 + 1;
12190:
12191: switch (yyC) {
12192: case '0':
12193: case '1':
12194: case '2':
12195: case '3':
12196: case '4':
12197: case '5':
12198: case '6':
12199: case '7':
12200: case '8':
12201: case '9':
12202: case 'A':
12203: case 'B':
12204: case 'C':
12205: case 'D':
12206: case 'E':
12207: case 'F':
12208: case 'a':
12209: case 'b':
12210: case 'c':
12211: case 'd':
12212: case 'e':
12213: case 'f': {
12214: yyRepetition1 = yyIndex;
12215: yyRepeated1 = true;
12216: continue;
12217: }
12218:
12219: default:
12220: /* No match. */
12221: }
12222: }
12223: break;
12224: }
12225:
12226: if (yyRepeated1) {
12227:
12228: yyResult = pBinaryExponent(yyRepetition1);
12229: yyError = yyResult.select(yyError);
12230: if (yyResult.hasValue()) {
12231:
12232: yyOption1 = yyResult.index;
12233:
12234: yyC = character(yyOption1);
12235: if (-1 != yyC) {
12236: yyIndex = yyOption1 + 1;
12237:
12238: switch (yyC) {
12239: case 'F':
12240: case 'L':
12241: case 'f':
12242: case 'l': {
12243: yyOption1 = yyIndex;
12244: }
12245:
12246: default:
12247: /* No match. */
12248: }
12249: }
12250:
12251: yyValue = difference(yyStart, yyOption1);
12252:
12253: return new SemanticValue(yyValue, yyOption1,
12254: yyError);
12255: }
12256: }
12257: }
12258:
12259: // Done.
12260: yyError = yyError.select("hex floating constant expected",
12261: yyStart);
12262: return yyError;
12263: }
12264:
12265: // =========================================================================
12266:
12267: /**
12268: * Parse nonterminal xtc.lang.CConstant.Exponent.
12269: *
12270: * @param yyStart The index.
12271: * @return The result.
12272: * @throws IOException Signals an I/O error.
12273: */
12274: private Result pExponent(final int yyStart) throws IOException {
12275: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
12276: if (null == yyColumn.chunk4)
12277: yyColumn.chunk4 = new Chunk4();
12278: if (null == yyColumn.chunk4.fExponent)
12279: yyColumn.chunk4.fExponent = pExponent$1(yyStart);
12280: return yyColumn.chunk4.fExponent;
12281: }
12282:
12283: /** Actually parse xtc.lang.CConstant.Exponent. */
12284: private Result pExponent$1(final int yyStart) throws IOException {
12285: int yyC;
12286: int yyIndex;
12287: Result yyResult;
12288: int yyOption1;
12289: Void yyValue;
12290: ParseError yyError = ParseError.DUMMY;
12291:
12292: // Alternative 1.
12293:
12294: yyC = character(yyStart);
12295: if (-1 != yyC) {
12296: yyIndex = yyStart + 1;
12297:
12298: switch (yyC) {
12299: case 'E':
12300: case 'e': {
12301: yyOption1 = yyIndex;
12302:
12303: yyC = character(yyOption1);
12304: if (-1 != yyC) {
12305: yyIndex = yyOption1 + 1;
12306:
12307: switch (yyC) {
12308: case '+':
12309: case '-': {
12310: yyOption1 = yyIndex;
12311: }
12312:
12313: default:
12314: /* No match. */
12315: }
12316: }
12317:
12318: yyResult = p$$Shared2(yyOption1);
12319: yyError = yyResult.select(yyError);
12320: if (yyResult.hasValue()) {
12321:
12322: yyValue = null;
12323:
12324: return yyResult.createValue(yyValue, yyError);
12325: }
12326: }
12327: break;
12328:
12329: default:
12330: /* No match. */
12331: }
12332: }
12333:
12334: // Done.
12335: yyError = yyError.select("exponent expected", yyStart);
12336: return yyError;
12337: }
12338:
12339: // =========================================================================
12340:
12341: /**
12342: * Parse synthetic nonterminal xtc.lang.c4.C4.$$Shared2.
12343: * This nonterminal represents the duplicate productions
12344: * xtc.lang.c4.C4.Exponent$$Plus1 and xtc.lang.c4.C4.BinaryExponent$$Plus1.
12345: *
12346: * @param yyStart The index.
12347: * @return The result.
12348: * @throws IOException Signals an I/O error.
12349: */
12350: private Result p$$Shared2(final int yyStart) throws IOException {
12351: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
12352: if (null == yyColumn.chunk4)
12353: yyColumn.chunk4 = new Chunk4();
12354: if (null == yyColumn.chunk4.f$$Shared2)
12355: yyColumn.chunk4.f$$Shared2 = p$$Shared2$1(yyStart);
12356: return yyColumn.chunk4.f$$Shared2;
12357: }
12358:
12359: /** Actually parse xtc.lang.c4.C4.$$Shared2. */
12360: private Result p$$Shared2$1(final int yyStart) throws IOException {
12361: int yyC;
12362: int yyIndex;
12363: Result yyResult;
12364: Void yyValue;
12365: ParseError yyError = ParseError.DUMMY;
12366:
12367: // Alternative 1.
12368:
12369: yyC = character(yyStart);
12370: if (-1 != yyC) {
12371: yyIndex = yyStart + 1;
12372:
12373: switch (yyC) {
12374: case '0':
12375: case '1':
12376: case '2':
12377: case '3':
12378: case '4':
12379: case '5':
12380: case '6':
12381: case '7':
12382: case '8':
12383: case '9': {
12384: final int yyChoice1 = yyIndex;
12385:
12386: // Nested alternative 1.
12387:
12388: yyResult = p$$Shared2(yyChoice1);
12389: yyError = yyResult.select(yyError);
12390: if (yyResult.hasValue()) {
12391:
12392: yyValue = null;
12393:
12394: return yyResult.createValue(yyValue, yyError);
12395: }
12396:
12397: // Nested alternative 2.
12398:
12399: yyValue = null;
12400:
12401: return new SemanticValue(yyValue, yyChoice1, yyError);
12402: }
12403:
12404: default:
12405: /* No match. */
12406: }
12407: }
12408:
12409: // Done.
12410: yyError = yyError.select(" expected", yyStart);
12411: return yyError;
12412: }
12413:
12414: // =========================================================================
12415:
12416: /**
12417: * Parse nonterminal xtc.lang.CConstant.BinaryExponent.
12418: *
12419: * @param yyStart The index.
12420: * @return The result.
12421: * @throws IOException Signals an I/O error.
12422: */
12423: private Result pBinaryExponent(final int yyStart)
12424: throws IOException {
12425: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
12426: if (null == yyColumn.chunk4)
12427: yyColumn.chunk4 = new Chunk4();
12428: if (null == yyColumn.chunk4.fBinaryExponent)
12429: yyColumn.chunk4.fBinaryExponent = pBinaryExponent$1(yyStart);
12430: return yyColumn.chunk4.fBinaryExponent;
12431: }
12432:
12433: /** Actually parse xtc.lang.CConstant.BinaryExponent. */
12434: private Result pBinaryExponent$1(final int yyStart)
12435: throws IOException {
12436: int yyC;
12437: int yyIndex;
12438: Result yyResult;
12439: int yyOption1;
12440: Void yyValue;
12441: ParseError yyError = ParseError.DUMMY;
12442:
12443: // Alternative 1.
12444:
12445: yyC = character(yyStart);
12446: if (-1 != yyC) {
12447: yyIndex = yyStart + 1;
12448:
12449: switch (yyC) {
12450: case 'P':
12451: case 'p': {
12452: yyOption1 = yyIndex;
12453:
12454: yyC = character(yyOption1);
12455: if (-1 != yyC) {
12456: yyIndex = yyOption1 + 1;
12457:
12458: switch (yyC) {
12459: case '+':
12460: case '-': {
12461: yyOption1 = yyIndex;
12462: }
12463:
12464: default:
12465: /* No match. */
12466: }
12467: }
12468:
12469: yyResult = p$$Shared2(yyOption1);
12470: yyError = yyResult.select(yyError);
12471: if (yyResult.hasValue()) {
12472:
12473: yyValue = null;
12474:
12475: return yyResult.createValue(yyValue, yyError);
12476: }
12477: }
12478: break;
12479:
12480: default:
12481: /* No match. */
12482: }
12483: }
12484:
12485: // Done.
12486: yyError = yyError.select("binary exponent expected", yyStart);
12487: return yyError;
12488: }
12489:
12490: // =========================================================================
12491:
12492: /**
12493: * Parse nonterminal xtc.lang.CConstant.CharacterConstant.
12494: *
12495: * @param yyStart The index.
12496: * @return The result.
12497: * @throws IOException Signals an I/O error.
12498: */
12499: private Result pCharacterConstant(final int yyStart)
12500: throws IOException {
12501: Result yyResult;
12502: Node yyValue;
12503: ParseError yyError = ParseError.DUMMY;
12504:
12505: // Alternative 1.
12506:
12507: yyResult = pWideCharacterLiteral(yyStart);
12508: yyError = yyResult.select(yyError);
12509: if (yyResult.hasValue()) {
12510: final String v$g$1 = yyResult.semanticValue();
12511:
12512: yyResult = pSpacing(yyResult.index);
12513: yyError = yyResult.select(yyError);
12514: if (yyResult.hasValue()) {
12515:
12516: yyValue = GNode.create("CharacterConstant", v$g$1);
12517: yyValue.setLocation(location(yyStart));
12518:
12519: return yyResult.createValue(yyValue, yyError);
12520: }
12521: }
12522:
12523: // Alternative 2.
12524:
12525: yyResult = pCharacterLiteral(yyStart);
12526: yyError = yyResult.select(yyError);
12527: if (yyResult.hasValue()) {
12528: final String v$g$2 = yyResult.semanticValue();
12529:
12530: yyResult = pSpacing(yyResult.index);
12531: yyError = yyResult.select(yyError);
12532: if (yyResult.hasValue()) {
12533:
12534: yyValue = GNode.create("CharacterConstant", v$g$2);
12535: yyValue.setLocation(location(yyStart));
12536:
12537: return yyResult.createValue(yyValue, yyError);
12538: }
12539: }
12540:
12541: // Done.
12542: return yyError;
12543: }
12544:
12545: // =========================================================================
12546:
12547: /**
12548: * Parse nonterminal xtc.lang.CConstant.WideCharacterLiteral.
12549: *
12550: * @param yyStart The index.
12551: * @return The result.
12552: * @throws IOException Signals an I/O error.
12553: */
12554: private Result pWideCharacterLiteral(final int yyStart)
12555: throws IOException {
12556: int yyC;
12557: int yyIndex;
12558: Result yyResult;
12559: String yyValue;
12560: ParseError yyError = ParseError.DUMMY;
12561:
12562: // Alternative 1.
12563:
12564: yyC = character(yyStart);
12565: if ('L' == yyC) {
12566: yyIndex = yyStart + 1;
12567:
12568: yyResult = pCharacterLiteral(yyIndex);
12569: yyError = yyResult.select(yyError);
12570: if (yyResult.hasValue()) {
12571:
12572: yyValue = difference(yyStart, yyResult.index);
12573:
12574: return yyResult.createValue(yyValue, yyError);
12575: }
12576: }
12577:
12578: // Done.
12579: yyError = yyError.select("wide character literal expected",
12580: yyStart);
12581: return yyError;
12582: }
12583:
12584: // =========================================================================
12585:
12586: /**
12587: * Parse nonterminal xtc.lang.CConstant.CharacterLiteral.
12588: *
12589: * @param yyStart The index.
12590: * @return The result.
12591: * @throws IOException Signals an I/O error.
12592: */
12593: private Result pCharacterLiteral(final int yyStart)
12594: throws IOException {
12595: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
12596: if (null == yyColumn.chunk4)
12597: yyColumn.chunk4 = new Chunk4();
12598: if (null == yyColumn.chunk4.fCharacterLiteral)
12599: yyColumn.chunk4.fCharacterLiteral = pCharacterLiteral$1(yyStart);
12600: return yyColumn.chunk4.fCharacterLiteral;
12601: }
12602:
12603: /** Actually parse xtc.lang.CConstant.CharacterLiteral. */
12604: private Result pCharacterLiteral$1(final int yyStart)
12605: throws IOException {
12606: int yyC;
12607: int yyIndex;
12608: Result yyResult;
12609: String yyValue;
12610: ParseError yyError = ParseError.DUMMY;
12611:
12612: // Alternative 1.
12613:
12614: yyC = character(yyStart);
12615: if ('\'' == yyC) {
12616: yyIndex = yyStart + 1;
12617:
12618: yyResult = pCharacterLiteral$$Plus1(yyIndex);
12619: yyError = yyResult.select(yyError);
12620: if (yyResult.hasValue()) {
12621:
12622: yyC = character(yyResult.index);
12623: if ('\'' == yyC) {
12624: yyIndex = yyResult.index + 1;
12625:
12626: yyValue = difference(yyStart, yyIndex);
12627:
12628: return new SemanticValue(yyValue, yyIndex, yyError);
12629: }
12630: }
12631: }
12632:
12633: // Done.
12634: yyError = yyError.select("character literal expected", yyStart);
12635: return yyError;
12636: }
12637:
12638: // =========================================================================
12639:
12640: /**
12641: * Parse synthetic nonterminal xtc.lang.c4.C4.CharacterLiteral$$Plus1.
12642: *
12643: * @param yyStart The index.
12644: * @return The result.
12645: * @throws IOException Signals an I/O error.
12646: */
12647: private Result pCharacterLiteral$$Plus1(final int yyStart)
12648: throws IOException {
12649:
12650: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
12651: if (null == yyColumn.chunk4)
12652: yyColumn.chunk4 = new Chunk4();
12653: if (null == yyColumn.chunk4.fCharacterLiteral$$Plus1)
12654: yyColumn.chunk4.fCharacterLiteral$$Plus1 = pCharacterLiteral$$Plus1$1(yyStart);
12655: return yyColumn.chunk4.fCharacterLiteral$$Plus1;
12656: }
12657:
12658: /** Actually parse xtc.lang.c4.C4.CharacterLiteral$$Plus1. */
12659: private Result pCharacterLiteral$$Plus1$1(final int yyStart)
12660: throws IOException {
12661:
12662: int yyC;
12663: int yyIndex;
12664: Result yyResult;
12665: Void yyValue;
12666: ParseError yyError = ParseError.DUMMY;
12667:
12668: // Alternative 1.
12669:
12670: yyResult = pEscapeCharacter(yyStart);
12671: yyError = yyResult.select(yyError);
12672: if (yyResult.hasValue()) {
12673:
12674: yyResult = pCharacterLiteral$$Plus1(yyResult.index);
12675: yyError = yyResult.select(yyError);
12676: if (yyResult.hasValue()) {
12677:
12678: yyValue = null;
12679:
12680: return yyResult.createValue(yyValue, yyError);
12681: }
12682: }
12683:
12684: // Alternative 2.
12685:
12686: yyC = character(yyStart);
12687: if (-1 != yyC) {
12688: yyIndex = yyStart + 1;
12689:
12690: switch (yyC) {
12691: case '\n':
12692: case '\r':
12693: case '\'':
12694: case '\\':
12695: /* No match. */
12696: break;
12697:
12698: default: {
12699: yyResult = pCharacterLiteral$$Plus1(yyIndex);
12700: yyError = yyResult.select(yyError);
12701: if (yyResult.hasValue()) {
12702:
12703: yyValue = null;
12704:
12705: return yyResult.createValue(yyValue, yyError);
12706: }
12707: }
12708: }
12709: }
12710:
12711: // Alternative 3.
12712:
12713: yyC = character(yyStart);
12714: if (-1 != yyC) {
12715: yyIndex = yyStart + 1;
12716:
12717: switch (yyC) {
12718: case '\\': {
12719: final int yyChoice1 = yyIndex;
12720:
12721: // Nested alternative 1.
12722:
12723: yyResult = pEscapeCode(yyChoice1);
12724: yyError = yyResult.select(yyError);
12725: if (yyResult.hasValue()) {
12726:
12727: yyValue = null;
12728:
12729: return yyResult.createValue(yyValue, yyError);
12730: }
12731:
12732: // Nested alternative 2.
12733:
12734: yyC = character(yyChoice1);
12735: if (-1 != yyC) {
12736: yyIndex = yyChoice1 + 1;
12737:
12738: switch (yyC) {
12739: case 'u': {
12740: yyResult = pHexQuad(yyIndex);
12741: yyError = yyResult.select(yyError);
12742: if (yyResult.hasValue()) {
12743:
12744: yyValue = null;
12745:
12746: return yyResult.createValue(yyValue,
12747: yyError);
12748: }
12749: }
12750: break;
12751:
12752: case 'U': {
12753: yyResult = pHexQuad(yyIndex);
12754: yyError = yyResult.select(yyError);
12755: if (yyResult.hasValue()) {
12756:
12757: yyResult = pHexQuad(yyResult.index);
12758: yyError = yyResult.select(yyError);
12759: if (yyResult.hasValue()) {
12760:
12761: yyValue = null;
12762:
12763: return yyResult.createValue(yyValue,
12764: yyError);
12765: }
12766: }
12767: }
12768: break;
12769:
12770: default:
12771: /* No match. */
12772: }
12773: }
12774: }
12775: break;
12776:
12777: default:
12778: /* No match. */
12779: }
12780: }
12781:
12782: // Alternative 4.
12783:
12784: yyC = character(yyStart);
12785: if (-1 != yyC) {
12786: yyIndex = yyStart + 1;
12787:
12788: switch (yyC) {
12789: case '\n':
12790: case '\r':
12791: case '\'':
12792: case '\\':
12793: /* No match. */
12794: break;
12795:
12796: default: {
12797: yyValue = null;
12798:
12799: return new SemanticValue(yyValue, yyIndex, yyError);
12800: }
12801: }
12802: }
12803:
12804: // Done.
12805: yyError = yyError.select("character literal expected", yyStart);
12806: return yyError;
12807: }
12808:
12809: // =========================================================================
12810:
12811: /**
12812: * Parse nonterminal xtc.lang.CConstant.StringConstant.
12813: *
12814: * @param yyStart The index.
12815: * @return The result.
12816: * @throws IOException Signals an I/O error.
12817: */
12818: private Result pStringConstant(final int yyStart)
12819: throws IOException {
12820: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
12821: if (null == yyColumn.chunk4)
12822: yyColumn.chunk4 = new Chunk4();
12823: if (null == yyColumn.chunk4.fStringConstant)
12824: yyColumn.chunk4.fStringConstant = pStringConstant$1(yyStart);
12825: return yyColumn.chunk4.fStringConstant;
12826: }
12827:
12828: /** Actually parse xtc.lang.CConstant.StringConstant. */
12829: private Result pStringConstant$1(final int yyStart)
12830: throws IOException {
12831: Result yyResult;
12832: Node yyValue;
12833: ParseError yyError = ParseError.DUMMY;
12834:
12835: // Alternative 1.
12836:
12837: yyResult = pStringConstant$$Plus1(yyStart);
12838: yyError = yyResult.select(yyError);
12839: if (yyResult.hasValue()) {
12840: final Pair<String> v$g$1 = yyResult.semanticValue();
12841:
12842: yyValue = GNode.createFromPair("StringConstant", v$g$1);
12843: yyValue.setLocation(location(yyStart));
12844:
12845: return yyResult.createValue(yyValue, yyError);
12846: }
12847:
12848: // Done.
12849: return yyError;
12850: }
12851:
12852: // =========================================================================
12853:
12854: /**
12855: * Parse synthetic nonterminal xtc.lang.c4.C4.StringConstant$$Choice1.
12856: *
12857: * @param yyStart The index.
12858: * @return The result.
12859: * @throws IOException Signals an I/O error.
12860: */
12861: private Result pStringConstant$$Choice1(final int yyStart)
12862: throws IOException {
12863:
12864: Result yyResult;
12865: String yyValue;
12866: ParseError yyError = ParseError.DUMMY;
12867:
12868: // Alternative 1.
12869:
12870: yyResult = pWideStringLiteral(yyStart);
12871: yyError = yyResult.select(yyError);
12872: if (yyResult.hasValue()) {
12873: yyValue = yyResult.semanticValue();
12874:
12875: yyResult = pSpacing(yyResult.index);
12876: yyError = yyResult.select(yyError);
12877: if (yyResult.hasValue()) {
12878:
12879: return yyResult.createValue(yyValue, yyError);
12880: }
12881: }
12882:
12883: // Alternative 2.
12884:
12885: yyResult = pStringLiteral(yyStart);
12886: yyError = yyResult.select(yyError);
12887: if (yyResult.hasValue()) {
12888: yyValue = yyResult.semanticValue();
12889:
12890: yyResult = pSpacing(yyResult.index);
12891: yyError = yyResult.select(yyError);
12892: if (yyResult.hasValue()) {
12893:
12894: return yyResult.createValue(yyValue, yyError);
12895: }
12896: }
12897:
12898: // Done.
12899: return yyError;
12900: }
12901:
12902: // =========================================================================
12903:
12904: /**
12905: * Parse synthetic nonterminal xtc.lang.c4.C4.StringConstant$$Plus1.
12906: *
12907: * @param yyStart The index.
12908: * @return The result.
12909: * @throws IOException Signals an I/O error.
12910: */
12911: private Result pStringConstant$$Plus1(final int yyStart)
12912: throws IOException {
12913:
12914: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
12915: if (null == yyColumn.chunk5)
12916: yyColumn.chunk5 = new Chunk5();
12917: if (null == yyColumn.chunk5.fStringConstant$$Plus1)
12918: yyColumn.chunk5.fStringConstant$$Plus1 = pStringConstant$$Plus1$1(yyStart);
12919: return yyColumn.chunk5.fStringConstant$$Plus1;
12920: }
12921:
12922: /** Actually parse xtc.lang.c4.C4.StringConstant$$Plus1. */
12923: private Result pStringConstant$$Plus1$1(final int yyStart)
12924: throws IOException {
12925:
12926: Result yyResult;
12927: Pair<String> yyValue;
12928: ParseError yyError = ParseError.DUMMY;
12929:
12930: // Alternative 1.
12931:
12932: yyResult = pStringConstant$$Choice1(yyStart);
12933: yyError = yyResult.select(yyError);
12934: if (yyResult.hasValue()) {
12935: final String v$el$1 = yyResult.semanticValue();
12936:
12937: final int yyChoice1 = yyResult.index;
12938:
12939: // Nested alternative 1.
12940:
12941: yyResult = pStringConstant$$Plus1(yyChoice1);
12942: yyError = yyResult.select(yyError);
12943: if (yyResult.hasValue()) {
12944: final Pair<String> v$4 = yyResult.semanticValue();
12945:
12946: yyValue = new Pair<String>(v$el$1, v$4);
12947:
12948: return yyResult.createValue(yyValue, yyError);
12949: }
12950:
12951: // Nested alternative 2.
12952:
12953: yyValue = new Pair<String>(v$el$1);
12954:
12955: return new SemanticValue(yyValue, yyChoice1, yyError);
12956: }
12957:
12958: // Done.
12959: return yyError;
12960: }
12961:
12962: // =========================================================================
12963:
12964: /**
12965: * Parse nonterminal xtc.lang.CConstant.WideStringLiteral.
12966: *
12967: * @param yyStart The index.
12968: * @return The result.
12969: * @throws IOException Signals an I/O error.
12970: */
12971: private Result pWideStringLiteral(final int yyStart)
12972: throws IOException {
12973: int yyC;
12974: int yyIndex;
12975: Result yyResult;
12976: String yyValue;
12977: ParseError yyError = ParseError.DUMMY;
12978:
12979: // Alternative 1.
12980:
12981: yyC = character(yyStart);
12982: if ('L' == yyC) {
12983: yyIndex = yyStart + 1;
12984:
12985: yyResult = pStringLiteral(yyIndex);
12986: yyError = yyResult.select(yyError);
12987: if (yyResult.hasValue()) {
12988:
12989: yyValue = difference(yyStart, yyResult.index);
12990:
12991: return yyResult.createValue(yyValue, yyError);
12992: }
12993: }
12994:
12995: // Done.
12996: yyError = yyError.select("wide string literal expected",
12997: yyStart);
12998: return yyError;
12999: }
13000:
13001: // =========================================================================
13002:
13003: /**
13004: * Parse nonterminal xtc.lang.CConstant.StringLiteral.
13005: *
13006: * @param yyStart The index.
13007: * @return The result.
13008: * @throws IOException Signals an I/O error.
13009: */
13010: private Result pStringLiteral(final int yyStart) throws IOException {
13011: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
13012: if (null == yyColumn.chunk5)
13013: yyColumn.chunk5 = new Chunk5();
13014: if (null == yyColumn.chunk5.fStringLiteral)
13015: yyColumn.chunk5.fStringLiteral = pStringLiteral$1(yyStart);
13016: return yyColumn.chunk5.fStringLiteral;
13017: }
13018:
13019: /** Actually parse xtc.lang.CConstant.StringLiteral. */
13020: private Result pStringLiteral$1(final int yyStart)
13021: throws IOException {
13022: int yyC;
13023: int yyIndex;
13024: Result yyResult;
13025: String yyValue;
13026: ParseError yyError = ParseError.DUMMY;
13027:
13028: // Alternative 1.
13029:
13030: yyC = character(yyStart);
13031: if ('\"' == yyC) {
13032: yyIndex = yyStart + 1;
13033:
13034: yyResult = pStringLiteral$$Star1(yyIndex);
13035: yyError = yyResult.select(yyError);
13036: if (yyResult.hasValue()) {
13037:
13038: yyC = character(yyResult.index);
13039: if ('\"' == yyC) {
13040: yyIndex = yyResult.index + 1;
13041:
13042: yyValue = difference(yyStart, yyIndex);
13043:
13044: return new SemanticValue(yyValue, yyIndex, yyError);
13045: }
13046: }
13047: }
13048:
13049: // Done.
13050: yyError = yyError.select("string literal expected", yyStart);
13051: return yyError;
13052: }
13053:
13054: // =========================================================================
13055:
13056: /**
13057: * Parse synthetic nonterminal xtc.lang.c4.C4.StringLiteral$$Star1.
13058: *
13059: * @param yyStart The index.
13060: * @return The result.
13061: * @throws IOException Signals an I/O error.
13062: */
13063: private Result pStringLiteral$$Star1(final int yyStart)
13064: throws IOException {
13065: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
13066: if (null == yyColumn.chunk5)
13067: yyColumn.chunk5 = new Chunk5();
13068: if (null == yyColumn.chunk5.fStringLiteral$$Star1)
13069: yyColumn.chunk5.fStringLiteral$$Star1 = pStringLiteral$$Star1$1(yyStart);
13070: return yyColumn.chunk5.fStringLiteral$$Star1;
13071: }
13072:
13073: /** Actually parse xtc.lang.c4.C4.StringLiteral$$Star1. */
13074: private Result pStringLiteral$$Star1$1(final int yyStart)
13075: throws IOException {
13076:
13077: int yyC;
13078: int yyIndex;
13079: Result yyResult;
13080: Void yyValue;
13081: ParseError yyError = ParseError.DUMMY;
13082:
13083: // Alternative 1.
13084:
13085: yyResult = pEscapeCharacter(yyStart);
13086: yyError = yyResult.select(yyError);
13087: if (yyResult.hasValue()) {
13088:
13089: yyResult = pStringLiteral$$Star1(yyResult.index);
13090: yyError = yyResult.select(yyError);
13091: if (yyResult.hasValue()) {
13092:
13093: yyValue = null;
13094:
13095: return yyResult.createValue(yyValue, yyError);
13096: }
13097: }
13098:
13099: // Alternative 2.
13100:
13101: yyC = character(yyStart);
13102: if (-1 != yyC) {
13103: yyIndex = yyStart + 1;
13104:
13105: switch (yyC) {
13106: case '\n':
13107: case '\r':
13108: case '\"':
13109: case '\\':
13110: /* No match. */
13111: break;
13112:
13113: default: {
13114: yyResult = pStringLiteral$$Star1(yyIndex);
13115: yyError = yyResult.select(yyError);
13116: if (yyResult.hasValue()) {
13117:
13118: yyValue = null;
13119:
13120: return yyResult.createValue(yyValue, yyError);
13121: }
13122: }
13123: }
13124: }
13125:
13126: // Alternative 3.
13127:
13128: yyValue = null;
13129:
13130: return new SemanticValue(yyValue, yyStart, yyError);
13131: }
13132:
13133: // =========================================================================
13134:
13135: /**
13136: * Parse nonterminal xtc.lang.CConstant.EscapeCharacter.
13137: *
13138: * @param yyStart The index.
13139: * @return The result.
13140: * @throws IOException Signals an I/O error.
13141: */
13142: private Result pEscapeCharacter(final int yyStart)
13143: throws IOException {
13144: int yyC;
13145: int yyIndex;
13146: Result yyResult;
13147: Void yyValue;
13148: ParseError yyError = ParseError.DUMMY;
13149:
13150: // Alternative 1.
13151:
13152: yyC = character(yyStart);
13153: if (-1 != yyC) {
13154: yyIndex = yyStart + 1;
13155: if ('\\' == yyC) {
13156:
13157: final int yyChoice1 = yyIndex;
13158:
13159: // Nested alternative 1.
13160:
13161: yyResult = pEscapeCode(yyChoice1);
13162: yyError = yyResult.select(yyError);
13163: if (yyResult.hasValue()) {
13164:
13165: yyValue = null;
13166:
13167: return yyResult.createValue(yyValue, yyError);
13168: }
13169:
13170: // Nested alternative 2.
13171:
13172: yyC = character(yyChoice1);
13173: if (-1 != yyC) {
13174: yyIndex = yyChoice1 + 1;
13175:
13176: switch (yyC) {
13177: case 'u': {
13178: yyResult = pHexQuad(yyIndex);
13179: yyError = yyResult.select(yyError);
13180: if (yyResult.hasValue()) {
13181:
13182: yyValue = null;
13183:
13184: return yyResult.createValue(yyValue,
13185: yyError);
13186: }
13187: }
13188: break;
13189:
13190: case 'U': {
13191: yyResult = pHexQuad(yyIndex);
13192: yyError = yyResult.select(yyError);
13193: if (yyResult.hasValue()) {
13194:
13195: yyResult = pHexQuad(yyResult.index);
13196: yyError = yyResult.select(yyError);
13197: if (yyResult.hasValue()) {
13198:
13199: yyValue = null;
13200:
13201: return yyResult.createValue(yyValue,
13202: yyError);
13203: }
13204: }
13205: }
13206: break;
13207:
13208: default:
13209: /* No match. */
13210: }
13211: }
13212: }
13213: }
13214:
13215: // Done.
13216: yyError = yyError.select("escape character expected", yyStart);
13217: return yyError;
13218: }
13219:
13220: // =========================================================================
13221:
13222: /**
13223: * Parse nonterminal xtc.lang.CConstant.EscapeCode.
13224: *
13225: * @param yyStart The index.
13226: * @return The result.
13227: * @throws IOException Signals an I/O error.
13228: */
13229: private Result pEscapeCode(final int yyStart) throws IOException {
13230: int yyC;
13231: int yyIndex;
13232: int yyRepetition1;
13233: boolean yyRepeated1;
13234: Void yyValue;
13235: ParseError yyError = ParseError.DUMMY;
13236:
13237: // Alternative 1.
13238:
13239: yyC = character(yyStart);
13240: if (-1 != yyC) {
13241: yyIndex = yyStart + 1;
13242:
13243: switch (yyC) {
13244: case '\"':
13245: case '\'':
13246: case '?':
13247: case '\\':
13248: case 'a':
13249: case 'b':
13250: case 'f':
13251: case 'n':
13252: case 'r':
13253: case 't':
13254: case 'v': {
13255: yyValue = null;
13256:
13257: return new SemanticValue(yyValue, yyIndex, yyError);
13258: }
13259:
13260: case '0':
13261: case '1':
13262: case '2':
13263: case '3':
13264: case '4':
13265: case '5':
13266: case '6':
13267: case '7': {
13268: final int yyChoice1 = yyIndex;
13269:
13270: // Nested alternative 1.
13271:
13272: yyC = character(yyChoice1);
13273: if (-1 != yyC) {
13274: yyIndex = yyChoice1 + 1;
13275:
13276: switch (yyC) {
13277: case '0':
13278: case '1':
13279: case '2':
13280: case '3':
13281: case '4':
13282: case '5':
13283: case '6':
13284: case '7': {
13285: final int yyChoice2 = yyIndex;
13286:
13287: // Nested alternative 1.
13288:
13289: yyC = character(yyChoice2);
13290: if (-1 != yyC) {
13291: yyIndex = yyChoice2 + 1;
13292:
13293: switch (yyC) {
13294: case '0':
13295: case '1':
13296: case '2':
13297: case '3':
13298: case '4':
13299: case '5':
13300: case '6':
13301: case '7': {
13302: yyValue = null;
13303:
13304: return new SemanticValue(yyValue,
13305: yyIndex, yyError);
13306: }
13307:
13308: default:
13309: /* No match. */
13310: }
13311: }
13312:
13313: // Nested alternative 2.
13314:
13315: yyValue = null;
13316:
13317: return new SemanticValue(yyValue, yyChoice2,
13318: yyError);
13319: }
13320:
13321: default:
13322: /* No match. */
13323: }
13324: }
13325:
13326: // Nested alternative 2.
13327:
13328: yyValue = null;
13329:
13330: return new SemanticValue(yyValue, yyChoice1, yyError);
13331: }
13332:
13333: case 'x': {
13334: yyRepetition1 = yyIndex;
13335: yyRepeated1 = false;
13336: while (true) {
13337:
13338: yyC = character(yyRepetition1);
13339: if (-1 != yyC) {
13340: yyIndex = yyRepetition1 + 1;
13341:
13342: switch (yyC) {
13343: case '0':
13344: case '1':
13345: case '2':
13346: case '3':
13347: case '4':
13348: case '5':
13349: case '6':
13350: case '7':
13351: case '8':
13352: case '9':
13353: case 'A':
13354: case 'B':
13355: case 'C':
13356: case 'D':
13357: case 'E':
13358: case 'F':
13359: case 'a':
13360: case 'b':
13361: case 'c':
13362: case 'd':
13363: case 'e':
13364: case 'f': {
13365: yyRepetition1 = yyIndex;
13366: yyRepeated1 = true;
13367: continue;
13368: }
13369:
13370: default:
13371: /* No match. */
13372: }
13373: }
13374: break;
13375: }
13376:
13377: if (yyRepeated1) {
13378:
13379: yyValue = null;
13380:
13381: return new SemanticValue(yyValue, yyRepetition1,
13382: yyError);
13383: }
13384: }
13385: break;
13386:
13387: default:
13388: /* No match. */
13389: }
13390: }
13391:
13392: // Done.
13393: yyError = yyError.select("escape code expected", yyStart);
13394: return yyError;
13395: }
13396:
13397: // =========================================================================
13398:
13399: /**
13400: * Parse nonterminal xtc.lang.CConstant.HexQuad.
13401: *
13402: * @param yyStart The index.
13403: * @return The result.
13404: * @throws IOException Signals an I/O error.
13405: */
13406: private Result pHexQuad(final int yyStart) throws IOException {
13407: int yyC;
13408: int yyIndex;
13409: Void yyValue;
13410: ParseError yyError = ParseError.DUMMY;
13411:
13412: // Alternative 1.
13413:
13414: yyC = character(yyStart);
13415: if (-1 != yyC) {
13416: yyIndex = yyStart + 1;
13417:
13418: switch (yyC) {
13419: case '0':
13420: case '1':
13421: case '2':
13422: case '3':
13423: case '4':
13424: case '5':
13425: case '6':
13426: case '7':
13427: case '8':
13428: case '9':
13429: case 'A':
13430: case 'B':
13431: case 'C':
13432: case 'D':
13433: case 'E':
13434: case 'F':
13435: case 'a':
13436: case 'b':
13437: case 'c':
13438: case 'd':
13439: case 'e':
13440: case 'f': {
13441: yyC = character(yyIndex);
13442: if (-1 != yyC) {
13443: yyIndex = yyIndex + 1;
13444:
13445: switch (yyC) {
13446: case '0':
13447: case '1':
13448: case '2':
13449: case '3':
13450: case '4':
13451: case '5':
13452: case '6':
13453: case '7':
13454: case '8':
13455: case '9':
13456: case 'A':
13457: case 'B':
13458: case 'C':
13459: case 'D':
13460: case 'E':
13461: case 'F':
13462: case 'a':
13463: case 'b':
13464: case 'c':
13465: case 'd':
13466: case 'e':
13467: case 'f': {
13468: yyC = character(yyIndex);
13469: if (-1 != yyC) {
13470: yyIndex = yyIndex + 1;
13471:
13472: switch (yyC) {
13473: case '0':
13474: case '1':
13475: case '2':
13476: case '3':
13477: case '4':
13478: case '5':
13479: case '6':
13480: case '7':
13481: case '8':
13482: case '9':
13483: case 'A':
13484: case 'B':
13485: case 'C':
13486: case 'D':
13487: case 'E':
13488: case 'F':
13489: case 'a':
13490: case 'b':
13491: case 'c':
13492: case 'd':
13493: case 'e':
13494: case 'f': {
13495: yyC = character(yyIndex);
13496: if (-1 != yyC) {
13497: yyIndex = yyIndex + 1;
13498:
13499: switch (yyC) {
13500: case '0':
13501: case '1':
13502: case '2':
13503: case '3':
13504: case '4':
13505: case '5':
13506: case '6':
13507: case '7':
13508: case '8':
13509: case '9':
13510: case 'A':
13511: case 'B':
13512: case 'C':
13513: case 'D':
13514: case 'E':
13515: case 'F':
13516: case 'a':
13517: case 'b':
13518: case 'c':
13519: case 'd':
13520: case 'e':
13521: case 'f': {
13522: yyValue = null;
13523:
13524: return new SemanticValue(
13525: yyValue, yyIndex,
13526: yyError);
13527: }
13528:
13529: default:
13530: /* No match. */
13531: }
13532: }
13533: }
13534: break;
13535:
13536: default:
13537: /* No match. */
13538: }
13539: }
13540: }
13541: break;
13542:
13543: default:
13544: /* No match. */
13545: }
13546: }
13547: }
13548: break;
13549:
13550: default:
13551: /* No match. */
13552: }
13553: }
13554:
13555: // Done.
13556: yyError = yyError.select("hex quad expected", yyStart);
13557: return yyError;
13558: }
13559:
13560: // =========================================================================
13561:
13562: /**
13563: * Parse nonterminal xtc.lang.CIdentifier.Identifier.
13564: *
13565: * @param yyStart The index.
13566: * @return The result.
13567: * @throws IOException Signals an I/O error.
13568: */
13569: private Result pIdentifier(final int yyStart) throws IOException {
13570: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
13571: if (null == yyColumn.chunk5)
13572: yyColumn.chunk5 = new Chunk5();
13573: if (null == yyColumn.chunk5.fIdentifier)
13574: yyColumn.chunk5.fIdentifier = pIdentifier$1(yyStart);
13575: return yyColumn.chunk5.fIdentifier;
13576: }
13577:
13578: /** Actually parse xtc.lang.CIdentifier.Identifier. */
13579: private Result pIdentifier$1(final int yyStart) throws IOException {
13580: Result yyResult;
13581: String yyValue;
13582: ParseError yyError = ParseError.DUMMY;
13583:
13584: // Alternative 1.
13585:
13586: yyResult = pWord(yyStart);
13587: yyError = yyResult.select(yyError);
13588: if (yyResult.hasValue()) {
13589: yyValue = yyResult.semanticValue();
13590:
13591: if (!contains(C_KEYWORDS, toText(yyValue))) {
13592:
13593: return yyResult.createValue(yyValue, yyError);
13594: }
13595: }
13596:
13597: // Done.
13598: yyError = yyError.select("identifier expected", yyStart);
13599: return yyError;
13600: }
13601:
13602: // =========================================================================
13603:
13604: /**
13605: * Parse nonterminal xtc.lang.CIdentifier.Keyword.
13606: *
13607: * @param yyStart The index.
13608: * @return The result.
13609: * @throws IOException Signals an I/O error.
13610: */
13611: private Result pKeyword(final int yyStart) throws IOException {
13612: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
13613: if (null == yyColumn.chunk5)
13614: yyColumn.chunk5 = new Chunk5();
13615: if (null == yyColumn.chunk5.fKeyword)
13616: yyColumn.chunk5.fKeyword = pKeyword$1(yyStart);
13617: return yyColumn.chunk5.fKeyword;
13618: }
13619:
13620: /** Actually parse xtc.lang.CIdentifier.Keyword. */
13621: private Result pKeyword$1(final int yyStart) throws IOException {
13622: Result yyResult;
13623: String yyValue;
13624: ParseError yyError = ParseError.DUMMY;
13625:
13626: // Alternative 1.
13627:
13628: yyResult = pWord(yyStart);
13629: yyError = yyResult.select(yyError);
13630: if (yyResult.hasValue()) {
13631: yyValue = yyResult.semanticValue();
13632:
13633: if (contains(C_KEYWORDS, toText(yyValue))) {
13634:
13635: return yyResult.createValue(yyValue, yyError);
13636: }
13637: }
13638:
13639: // Done.
13640: yyError = yyError.select("keyword expected", yyStart);
13641: return yyError;
13642: }
13643:
13644: // =========================================================================
13645:
13646: /**
13647: * Parse nonterminal xtc.lang.CIdentifier.Word.
13648: *
13649: * @param yyStart The index.
13650: * @return The result.
13651: * @throws IOException Signals an I/O error.
13652: */
13653: private Result pWord(final int yyStart) throws IOException {
13654: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
13655: if (null == yyColumn.chunk5)
13656: yyColumn.chunk5 = new Chunk5();
13657: if (null == yyColumn.chunk5.fWord)
13658: yyColumn.chunk5.fWord = pWord$1(yyStart);
13659: return yyColumn.chunk5.fWord;
13660: }
13661:
13662: /** Actually parse xtc.lang.CIdentifier.Word. */
13663: private Result pWord$1(final int yyStart) throws IOException {
13664: Result yyResult;
13665: String yyValue;
13666: ParseError yyError = ParseError.DUMMY;
13667:
13668: // Alternative 1.
13669:
13670: yyResult = pWordCharacters(yyStart);
13671: yyError = yyResult.select(yyError);
13672: if (yyResult.hasValue()) {
13673: yyValue = yyResult.semanticValue();
13674:
13675: yyResult = pSpacing(yyResult.index);
13676: yyError = yyResult.select(yyError);
13677: if (yyResult.hasValue()) {
13678:
13679: return yyResult.createValue(yyValue, yyError);
13680: }
13681: }
13682:
13683: // Done.
13684: return yyError;
13685: }
13686:
13687: // =========================================================================
13688:
13689: /**
13690: * Parse nonterminal xtc.lang.CIdentifier.WordCharacters.
13691: *
13692: * @param yyStart The index.
13693: * @return The result.
13694: * @throws IOException Signals an I/O error.
13695: */
13696: private Result pWordCharacters(final int yyStart)
13697: throws IOException {
13698: int yyC;
13699: int yyIndex;
13700: int yyRepetition1;
13701: String yyValue;
13702: ParseError yyError = ParseError.DUMMY;
13703:
13704: // Alternative 1.
13705:
13706: yyC = character(yyStart);
13707: if (-1 != yyC) {
13708: yyIndex = yyStart + 1;
13709: if ((('A' <= yyC) && (yyC <= 'Z')) || ('_' == yyC)
13710: || (('a' <= yyC) && (yyC <= 'z'))) {
13711:
13712: yyRepetition1 = yyIndex;
13713: while (true) {
13714:
13715: yyC = character(yyRepetition1);
13716: if (-1 != yyC) {
13717: yyIndex = yyRepetition1 + 1;
13718: if ((('0' <= yyC) && (yyC <= '9'))
13719: || (('A' <= yyC) && (yyC <= 'Z'))
13720: || ('_' == yyC)
13721: || (('a' <= yyC) && (yyC <= 'z'))) {
13722:
13723: yyRepetition1 = yyIndex;
13724: continue;
13725: }
13726: }
13727: break;
13728: }
13729:
13730: yyValue = difference(yyStart, yyRepetition1);
13731:
13732: return new SemanticValue(yyValue, yyRepetition1,
13733: yyError);
13734: }
13735: }
13736:
13737: // Done.
13738: yyError = yyError.select("word characters expected", yyStart);
13739: return yyError;
13740: }
13741:
13742: // =========================================================================
13743:
13744: /**
13745: * Parse nonterminal xtc.lang.CSymbol.Symbol.
13746: *
13747: * @param yyStart The index.
13748: * @return The result.
13749: * @throws IOException Signals an I/O error.
13750: */
13751: private Result pSymbol(final int yyStart) throws IOException {
13752: C4ParserColumn yyColumn = (C4ParserColumn) column(yyStart);
13753: if (null == yyColumn.chunk5)
13754: yyColumn.chunk5 = new Chunk5();
13755: if (null == yyColumn.chunk5.fSymbol)
13756: yyColumn.chunk5.fSymbol = pSymbol$1(yyStart);
13757: return yyColumn.chunk5.fSymbol;
13758: }
13759:
13760: /** Actually parse xtc.lang.CSymbol.Symbol. */
13761: private Result pSymbol$1(final int yyStart) throws IOException {
13762: Result yyResult;
13763: String yyValue;
13764: ParseError yyError = ParseError.DUMMY;
13765:
13766: // Alternative 1.
13767:
13768: yyResult = pSymbolCharacters(yyStart);
13769: yyError = yyResult.select(yyError);
13770: if (yyResult.hasValue()) {
13771: yyValue = yyResult.semanticValue();
13772:
13773: yyResult = pSpacing(yyResult.index);
13774: yyError = yyResult.select(yyError);
13775: if (yyResult.hasValue()) {
13776:
13777: return yyResult.createValue(yyValue, yyError);
13778: }
13779: }
13780:
13781: // Done.
13782: return yyError;
13783: }
13784:
13785: // =========================================================================
13786:
13787: /**
13788: * Parse nonterminal xtc.lang.CSymbol.SymbolCharacters.
13789: *
13790: * @param yyStart The index.
13791: * @return The result.
13792: * @throws IOException Signals an I/O error.
13793: */
13794: private Result pSymbolCharacters(final int yyStart)
13795: throws IOException {
13796: int yyC;
13797: int yyIndex;
13798: String yyValue;
13799: ParseError yyError = ParseError.DUMMY;
13800:
13801: // Alternative 1.
13802:
13803: yyC = character(yyStart);
13804: if (-1 != yyC) {
13805: yyIndex = yyStart + 1;
13806:
13807: switch (yyC) {
13808: case '>': {
13809: final int yyChoice1 = yyIndex;
13810:
13811: // Nested alternative 1.
13812:
13813: yyC = character(yyChoice1);
13814: if (-1 != yyC) {
13815: yyIndex = yyChoice1 + 1;
13816:
13817: switch (yyC) {
13818: case '>': {
13819: final int yyChoice2 = yyIndex;
13820:
13821: // Nested alternative 1.
13822:
13823: yyC = character(yyChoice2);
13824: if (-1 != yyC) {
13825: yyIndex = yyChoice2 + 1;
13826: if ('=' == yyC) {
13827:
13828: yyValue = ">>=";
13829:
13830: return new SemanticValue(yyValue,
13831: yyIndex, yyError);
13832: }
13833: }
13834:
13835: // Nested alternative 2.
13836:
13837: yyValue = ">>";
13838:
13839: return new SemanticValue(yyValue, yyChoice2,
13840: yyError);
13841: }
13842:
13843: case '=': {
13844: yyValue = ">=";
13845:
13846: return new SemanticValue(yyValue, yyIndex,
13847: yyError);
13848: }
13849:
13850: default:
13851: /* No match. */
13852: }
13853: }
13854:
13855: // Nested alternative 2.
13856:
13857: yyValue = ">";
13858:
13859: return new SemanticValue(yyValue, yyChoice1, yyError);
13860: }
13861:
13862: case '<': {
13863: final int yyChoice1 = yyIndex;
13864:
13865: // Nested alternative 1.
13866:
13867: yyC = character(yyChoice1);
13868: if (-1 != yyC) {
13869: yyIndex = yyChoice1 + 1;
13870:
13871: switch (yyC) {
13872: case '<': {
13873: final int yyChoice2 = yyIndex;
13874:
13875: // Nested alternative 1.
13876:
13877: yyC = character(yyChoice2);
13878: if (-1 != yyC) {
13879: yyIndex = yyChoice2 + 1;
13880: if ('=' == yyC) {
13881:
13882: yyValue = "<<=";
13883:
13884: return new SemanticValue(yyValue,
13885: yyIndex, yyError);
13886: }
13887: }
13888:
13889: // Nested alternative 2.
13890:
13891: yyValue = "<<";
13892:
13893: return new SemanticValue(yyValue, yyChoice2,
13894: yyError);
13895: }
13896:
13897: case '=': {
13898: yyValue = "<=";
13899:
13900: return new SemanticValue(yyValue, yyIndex,
13901: yyError);
13902: }
13903:
13904: default:
13905: /* No match. */
13906: }
13907: }
13908:
13909: // Nested alternative 2.
13910:
13911: yyValue = "<";
13912:
13913: return new SemanticValue(yyValue, yyChoice1, yyError);
13914: }
13915:
13916: case '.': {
13917: final int yyChoice1 = yyIndex;
13918:
13919: // Nested alternative 1.
13920:
13921: yyC = character(yyChoice1);
13922: if (-1 != yyC) {
13923: yyIndex = yyChoice1 + 1;
13924: if ('.' == yyC) {
13925:
13926: yyC = character(yyIndex);
13927: if (-1 != yyC) {
13928: yyIndex = yyIndex + 1;
13929: if ('.' == yyC) {
13930:
13931: yyValue = "...";
13932:
13933: return new SemanticValue(yyValue,
13934: yyIndex, yyError);
13935: }
13936: }
13937: }
13938: }
13939:
13940: // Nested alternative 2.
13941:
13942: yyValue = ".";
13943:
13944: return new SemanticValue(yyValue, yyChoice1, yyError);
13945: }
13946:
13947: case '+': {
13948: final int yyChoice1 = yyIndex;
13949:
13950: // Nested alternative 1.
13951:
13952: yyC = character(yyChoice1);
13953: if (-1 != yyC) {
13954: yyIndex = yyChoice1 + 1;
13955:
13956: switch (yyC) {
13957: case '=': {
13958: yyValue = "+=";
13959:
13960: return new SemanticValue(yyValue, yyIndex,
13961: yyError);
13962: }
13963:
13964: case '+': {
13965: yyValue = "++";
13966:
13967: return new SemanticValue(yyValue, yyIndex,
13968: yyError);
13969: }
13970:
13971: default:
13972: /* No match. */
13973: }
13974: }
13975:
13976: // Nested alternative 2.
13977:
13978: yyValue = "+";
13979:
13980: return new SemanticValue(yyValue, yyChoice1, yyError);
13981: }
13982:
13983: case '-': {
13984: final int yyChoice1 = yyIndex;
13985:
13986: // Nested alternative 1.
13987:
13988: yyC = character(yyChoice1);
13989: if (-1 != yyC) {
13990: yyIndex = yyChoice1 + 1;
13991:
13992: switch (yyC) {
13993: case '=': {
13994: yyValue = "-=";
13995:
13996: return new SemanticValue(yyValue, yyIndex,
13997: yyError);
13998: }
13999:
14000: case '-': {
14001: yyValue = "--";
14002:
14003: return new SemanticValue(yyValue, yyIndex,
14004: yyError);
14005: }
14006:
14007: case '>': {
14008: yyValue = "->";
14009:
14010: return new SemanticValue(yyValue, yyIndex,
14011: yyError);
14012: }
14013:
14014: default:
14015: /* No match. */
14016: }
14017: }
14018:
14019: // Nested alternative 2.
14020:
14021: yyValue = "-";
14022:
14023: return new SemanticValue(yyValue, yyChoice1, yyError);
14024: }
14025:
14026: case '*': {
14027: final int yyChoice1 = yyIndex;
14028:
14029: // Nested alternative 1.
14030:
14031: yyC = character(yyChoice1);
14032: if (-1 != yyC) {
14033: yyIndex = yyChoice1 + 1;
14034: if ('=' == yyC) {
14035:
14036: yyValue = "*=";
14037:
14038: return new SemanticValue(yyValue, yyIndex,
14039: yyError);
14040: }
14041: }
14042:
14043: // Nested alternative 2.
14044:
14045: yyValue = "*";
14046:
14047: return new SemanticValue(yyValue, yyChoice1, yyError);
14048: }
14049:
14050: case '/': {
14051: final int yyChoice1 = yyIndex;
14052:
14053: // Nested alternative 1.
14054:
14055: yyC = character(yyChoice1);
14056: if (-1 != yyC) {
14057: yyIndex = yyChoice1 + 1;
14058: if ('=' == yyC) {
14059:
14060: yyValue = "/=";
14061:
14062: return new SemanticValue(yyValue, yyIndex,
14063: yyError);
14064: }
14065: }
14066:
14067: // Nested alternative 2.
14068:
14069: yyValue = "/";
14070:
14071: return new SemanticValue(yyValue, yyChoice1, yyError);
14072: }
14073:
14074: case '%': {
14075: final int yyChoice1 = yyIndex;
14076:
14077: // Nested alternative 1.
14078:
14079: yyC = character(yyChoice1);
14080: if (-1 != yyC) {
14081: yyIndex = yyChoice1 + 1;
14082: if ('=' == yyC) {
14083:
14084: yyValue = "%=";
14085:
14086: return new SemanticValue(yyValue, yyIndex,
14087: yyError);
14088: }
14089: }
14090:
14091: // Nested alternative 2.
14092:
14093: yyValue = "%";
14094:
14095: return new SemanticValue(yyValue, yyChoice1, yyError);
14096: }
14097:
14098: case '&': {
14099: final int yyChoice1 = yyIndex;
14100:
14101: // Nested alternative 1.
14102:
14103: yyC = character(yyChoice1);
14104: if (-1 != yyC) {
14105: yyIndex = yyChoice1 + 1;
14106:
14107: switch (yyC) {
14108: case '=': {
14109: yyValue = "&=";
14110:
14111: return new SemanticValue(yyValue, yyIndex,
14112: yyError);
14113: }
14114:
14115: case '&': {
14116: yyValue = "&&";
14117:
14118: return new SemanticValue(yyValue, yyIndex,
14119: yyError);
14120: }
14121:
14122: default:
14123: /* No match. */
14124: }
14125: }
14126:
14127: // Nested alternative 2.
14128:
14129: yyValue = "&";
14130:
14131: return new SemanticValue(yyValue, yyChoice1, yyError);
14132: }
14133:
14134: case '^': {
14135: final int yyChoice1 = yyIndex;
14136:
14137: // Nested alternative 1.
14138:
14139: yyC = character(yyChoice1);
14140: if (-1 != yyC) {
14141: yyIndex = yyChoice1 + 1;
14142: if ('=' == yyC) {
14143:
14144: yyValue = "^=";
14145:
14146: return new SemanticValue(yyValue, yyIndex,
14147: yyError);
14148: }
14149: }
14150:
14151: // Nested alternative 2.
14152:
14153: yyValue = "^";
14154:
14155: return new SemanticValue(yyValue, yyChoice1, yyError);
14156: }
14157:
14158: case '|': {
14159: final int yyChoice1 = yyIndex;
14160:
14161: // Nested alternative 1.
14162:
14163: yyC = character(yyChoice1);
14164: if (-1 != yyC) {
14165: yyIndex = yyChoice1 + 1;
14166:
14167: switch (yyC) {
14168: case '=': {
14169: yyValue = "|=";
14170:
14171: return new SemanticValue(yyValue, yyIndex,
14172: yyError);
14173: }
14174:
14175: case '|': {
14176: yyValue = "||";
14177:
14178: return new SemanticValue(yyValue, yyIndex,
14179: yyError);
14180: }
14181:
14182: default:
14183: /* No match. */
14184: }
14185: }
14186:
14187: // Nested alternative 2.
14188:
14189: yyValue = "|";
14190:
14191: return new SemanticValue(yyValue, yyChoice1, yyError);
14192: }
14193:
14194: case '=': {
14195: final int yyChoice1 = yyIndex;
14196:
14197: // Nested alternative 1.
14198:
14199: yyC = character(yyChoice1);
14200: if (-1 != yyC) {
14201: yyIndex = yyChoice1 + 1;
14202: if ('=' == yyC) {
14203:
14204: yyValue = "==";
14205:
14206: return new SemanticValue(yyValue, yyIndex,
14207: yyError);
14208: }
14209: }
14210:
14211: // Nested alternative 2.
14212:
14213: yyValue = "=";
14214:
14215: return new SemanticValue(yyValue, yyChoice1, yyError);
14216: }
14217:
14218: case '!': {
14219: final int yyChoice1 = yyIndex;
14220:
14221: // Nested alternative 1.
14222:
14223: yyC = character(yyChoice1);
14224: if (-1 != yyC) {
14225: yyIndex = yyChoice1 + 1;
14226: if ('=' == yyC) {
14227:
14228: yyValue = "!=";
14229:
14230: return new SemanticValue(yyValue, yyIndex,
14231: yyError);
14232: }
14233: }
14234:
14235: // Nested alternative 2.
14236:
14237: yyValue = "!";
14238:
14239: return new SemanticValue(yyValue, yyChoice1, yyError);
14240: }
14241:
14242: case ';': {
14243: yyValue = ";";
14244:
14245: return new SemanticValue(yyValue, yyIndex, yyError);
14246: }
14247:
14248: case ':': {
14249: yyValue = ":";
14250:
14251: return new SemanticValue(yyValue, yyIndex, yyError);
14252: }
14253:
14254: case ',': {
14255: yyValue = ",";
14256:
14257: return new SemanticValue(yyValue, yyIndex, yyError);
14258: }
14259:
14260: case '{': {
14261: yyValue = "{";
14262:
14263: return new SemanticValue(yyValue, yyIndex, yyError);
14264: }
14265:
14266: case '}': {
14267: yyValue = "}";
14268:
14269: return new SemanticValue(yyValue, yyIndex, yyError);
14270: }
14271:
14272: case '(': {
14273: yyValue = "(";
14274:
14275: return new SemanticValue(yyValue, yyIndex, yyError);
14276: }
14277:
14278: case ')': {
14279: yyValue = ")";
14280:
14281: return new SemanticValue(yyValue, yyIndex, yyError);
14282: }
14283:
14284: case '[': {
14285: yyValue = "[";
14286:
14287: return new SemanticValue(yyValue, yyIndex, yyError);
14288: }
14289:
14290: case ']': {
14291: yyValue = "]";
14292:
14293: return new SemanticValue(yyValue, yyIndex, yyError);
14294: }
14295:
14296: case '~': {
14297: yyValue = "~";
14298:
14299: return new SemanticValue(yyValue, yyIndex, yyError);
14300: }
14301:
14302: case '?': {
14303: yyValue = "?";
14304:
14305: return new SemanticValue(yyValue, yyIndex, yyError);
14306: }
14307:
14308: default:
14309: /* No match. */
14310: }
14311: }
14312:
14313: // Done.
14314: yyError = yyError.select("symbol characters expected", yyStart);
14315: return yyError;
14316: }
14317:
14318: // =========================================================================
14319:
14320: /**
14321: * Parse nonterminal xtc.lang.CSpacing.Spacing.
14322: *
14323: * @param yyStart The index.
14324: * @return The result.
14325: * @throws IOException Signals an I/O error.
14326: */
14327: private Result pSpacing(final int yyStart) throws IOException {
14328: int yyC;
14329: int yyIndex;
14330: Result yyResult;
14331: Result yyPredResult;
14332: boolean yyPredMatched;
14333: int yyBase;
14334: int yyRepetition1;
14335: int yyRepetition2;
14336: Void yyValue;
14337: ParseError yyError = ParseError.DUMMY;
14338:
14339: // Alternative 1.
14340:
14341: yyRepetition1 = yyStart;
14342: while (true) {
14343:
14344: final int yyChoice1 = yyRepetition1;
14345:
14346: // Nested alternative 1.
14347:
14348: yyC = character(yyChoice1);
14349: if (-1 != yyC) {
14350: yyIndex = yyChoice1 + 1;
14351:
14352: switch (yyC) {
14353: case ' ': {
14354: yyRepetition1 = yyIndex;
14355: continue;
14356: }
14357:
14358: case '\t': {
14359: yyRepetition1 = yyIndex;
14360: continue;
14361: }
14362:
14363: case '\f': {
14364: yyRepetition1 = yyIndex;
14365: continue;
14366: }
14367:
14368: case '/': {
14369: yyC = character(yyIndex);
14370: if (-1 != yyC) {
14371: yyIndex = yyIndex + 1;
14372:
14373: switch (yyC) {
14374: case '*': {
14375: yyRepetition2 = yyIndex;
14376: while (true) {
14377:
14378: final int yyChoice2 = yyRepetition2;
14379:
14380: // Nested alternative 1.
14381:
14382: yyC = character(yyChoice2);
14383: if (-1 != yyC) {
14384: yyIndex = yyChoice2 + 1;
14385:
14386: switch (yyC) {
14387: case '*': {
14388: yyPredMatched = false;
14389:
14390: yyC = character(yyIndex);
14391: if ('/' == yyC) {
14392:
14393: yyPredMatched = true;
14394: }
14395:
14396: if (!yyPredMatched) {
14397:
14398: yyRepetition2 = yyIndex;
14399: continue;
14400: } else {
14401: yyError = yyError.select(
14402: "spacing expected",
14403: yyStart);
14404: }
14405: }
14406: break;
14407:
14408: default: {
14409: yyRepetition2 = yyIndex;
14410: continue;
14411: }
14412: }
14413: }
14414: break;
14415: }
14416:
14417: yyBase = yyRepetition2;
14418: yyC = character(yyBase);
14419: if ('*' == yyC) {
14420: yyIndex = yyRepetition2 + 1;
14421:
14422: yyC = character(yyIndex);
14423: if ('/' == yyC) {
14424: yyIndex = yyIndex + 1;
14425:
14426: yyRepetition1 = yyIndex;
14427: continue;
14428: } else {
14429: yyError = yyError.select(
14430: "\"*/\" expected", yyBase);
14431: }
14432: } else {
14433: yyError = yyError.select(
14434: "\"*/\" expected", yyBase);
14435: }
14436: }
14437: break;
14438:
14439: case '/': {
14440: yyRepetition2 = yyIndex;
14441: while (true) {
14442:
14443: yyC = character(yyRepetition2);
14444: if (-1 != yyC) {
14445: yyIndex = yyRepetition2 + 1;
14446:
14447: switch (yyC) {
14448: case '\n':
14449: case '\r':
14450: /* No match. */
14451: break;
14452:
14453: default: {
14454: yyRepetition2 = yyIndex;
14455: continue;
14456: }
14457: }
14458: }
14459: break;
14460: }
14461:
14462: yyPredResult = pLineTerminator(yyRepetition2);
14463: yyError = yyPredResult.select(yyError);
14464: if (yyPredResult.hasValue()) {
14465:
14466: yyRepetition1 = yyRepetition2;
14467: continue;
14468: }
14469: }
14470: break;
14471:
14472: default:
14473: /* No match. */
14474: }
14475: }
14476: }
14477: break;
14478:
14479: case '\r': {
14480: final int yyChoice2 = yyIndex;
14481:
14482: // Nested alternative 1.
14483:
14484: yyC = character(yyChoice2);
14485: if ('\n' == yyC) {
14486: yyIndex = yyChoice2 + 1;
14487:
14488: yyResult = pDirective(yyIndex);
14489: yyError = yyResult.select(yyError);
14490: if (yyResult.hasValue()) {
14491:
14492: yyRepetition1 = yyResult.index;
14493: continue;
14494: }
14495: }
14496:
14497: // Nested alternative 2.
14498:
14499: yyResult = pDirective(yyChoice2);
14500: yyError = yyResult.select(yyError);
14501: if (yyResult.hasValue()) {
14502:
14503: yyRepetition1 = yyResult.index;
14504: continue;
14505: }
14506: }
14507: break;
14508:
14509: case '\n': {
14510: yyResult = pDirective(yyIndex);
14511: yyError = yyResult.select(yyError);
14512: if (yyResult.hasValue()) {
14513:
14514: yyRepetition1 = yyResult.index;
14515: continue;
14516: }
14517: }
14518: break;
14519:
14520: default:
14521: /* No match. */
14522: }
14523: }
14524: break;
14525: }
14526:
14527: yyValue = null;
14528:
14529: return new SemanticValue(yyValue, yyRepetition1, yyError);
14530: }
14531:
14532: // =========================================================================
14533:
14534: /**
14535: * Parse nonterminal xtc.lang.CSpacing.Space.
14536: *
14537: * @param yyStart The index.
14538: * @return The result.
14539: * @throws IOException Signals an I/O error.
14540: */
14541: private Result pSpace(final int yyStart) throws IOException {
14542: int yyC;
14543: int yyIndex;
14544: Void yyValue;
14545: ParseError yyError = ParseError.DUMMY;
14546:
14547: // Alternative 1.
14548:
14549: yyC = character(yyStart);
14550: if (-1 != yyC) {
14551: yyIndex = yyStart + 1;
14552:
14553: switch (yyC) {
14554: case ' ': {
14555: yyValue = null;
14556:
14557: return new SemanticValue(yyValue, yyIndex, yyError);
14558: }
14559:
14560: case '\t': {
14561: yyValue = null;
14562:
14563: return new SemanticValue(yyValue, yyIndex, yyError);
14564: }
14565:
14566: case '\f': {
14567: yyValue = null;
14568:
14569: return new SemanticValue(yyValue, yyIndex, yyError);
14570: }
14571:
14572: default:
14573: /* No match. */
14574: }
14575: }
14576:
14577: // Done.
14578: yyError = yyError.select("space expected", yyStart);
14579: return yyError;
14580: }
14581:
14582: // =========================================================================
14583:
14584: /**
14585: * Parse nonterminal xtc.lang.CSpacing.LineTerminator.
14586: *
14587: * @param yyStart The index.
14588: * @return The result.
14589: * @throws IOException Signals an I/O error.
14590: */
14591: private Result pLineTerminator(final int yyStart)
14592: throws IOException {
14593: int yyC;
14594: int yyIndex;
14595: Void yyValue;
14596: ParseError yyError = ParseError.DUMMY;
14597:
14598: // Alternative 1.
14599:
14600: yyC = character(yyStart);
14601: if (-1 != yyC) {
14602: yyIndex = yyStart + 1;
14603:
14604: switch (yyC) {
14605: case '\r': {
14606: final int yyChoice1 = yyIndex;
14607:
14608: // Nested alternative 1.
14609:
14610: yyC = character(yyChoice1);
14611: if ('\n' == yyC) {
14612: yyIndex = yyChoice1 + 1;
14613:
14614: yyValue = null;
14615:
14616: return new SemanticValue(yyValue, yyIndex, yyError);
14617: }
14618:
14619: // Nested alternative 2.
14620:
14621: yyValue = null;
14622:
14623: return new SemanticValue(yyValue, yyChoice1, yyError);
14624: }
14625:
14626: case '\n': {
14627: yyValue = null;
14628:
14629: return new SemanticValue(yyValue, yyIndex, yyError);
14630: }
14631:
14632: default:
14633: /* No match. */
14634: }
14635: }
14636:
14637: // Done.
14638: yyError = yyError.select("line terminator expected", yyStart);
14639: return yyError;
14640: }
14641:
14642: // =========================================================================
14643:
14644: /**
14645: * Parse nonterminal xtc.lang.CSpacing.EndOfFile.
14646: *
14647: * @param yyStart The index.
14648: * @return The result.
14649: * @throws IOException Signals an I/O error.
14650: */
14651: private Result pEndOfFile(final int yyStart) throws IOException {
14652: int yyC;
14653: boolean yyPredMatched;
14654: Void yyValue;
14655: ParseError yyError = ParseError.DUMMY;
14656:
14657: // Alternative 1.
14658:
14659: yyPredMatched = false;
14660:
14661: yyC = character(yyStart);
14662: if (-1 != yyC) {
14663:
14664: yyPredMatched = true;
14665: }
14666:
14667: if (!yyPredMatched) {
14668:
14669: yyValue = null;
14670:
14671: return new SemanticValue(yyValue, yyStart, yyError);
14672: } else {
14673: yyError = yyError.select("end of file expected", yyStart);
14674: }
14675:
14676: // Done.
14677: return yyError;
14678: }
14679:
14680: // =========================================================================
14681:
14682: /**
14683: * Parse nonterminal xtc.lang.CSpacing.Directive.
14684: *
14685: * @param yyStart The index.
14686: * @return The result.
14687: * @throws IOException Signals an I/O error.
14688: */
14689: private Result pDirective(final int yyStart) throws IOException {
14690: int yyC;
14691: int yyIndex;
14692: Result yyResult;
14693: Result yyPredResult;
14694: int yyBase;
14695: int yyRepetition1;
14696: boolean yyRepeated1;
14697: int yyOption1;
14698: String yyOpValue1;
14699: Void yyValue;
14700: ParseError yyError = ParseError.DUMMY;
14701:
14702: // Alternative 1.
14703:
14704: yyC = character(yyStart);
14705: if ('#' == yyC) {
14706: yyIndex = yyStart + 1;
14707:
14708: final int yyChoice1 = yyIndex;
14709:
14710: // Nested alternative 1.
14711:
14712: yyC = character(yyChoice1);
14713: if (' ' == yyC) {
14714: yyIndex = yyChoice1 + 1;
14715:
14716: yyResult = pLineNumber(yyIndex);
14717: yyError = yyResult.select(yyError);
14718: if (yyResult.hasValue()) {
14719: final String line = yyResult.semanticValue();
14720:
14721: yyC = character(yyResult.index);
14722: if (' ' == yyC) {
14723: yyIndex = yyResult.index + 1;
14724:
14725: yyC = character(yyIndex);
14726: if ('\"' == yyC) {
14727: yyIndex = yyIndex + 1;
14728:
14729: yyResult = pFileName(yyIndex);
14730: yyError = yyResult.select(yyError);
14731: if (yyResult.hasValue()) {
14732: final String file = yyResult
14733: .semanticValue();
14734:
14735: yyC = character(yyResult.index);
14736: if ('\"' == yyC) {
14737: yyIndex = yyResult.index + 1;
14738:
14739: yyOption1 = yyIndex;
14740: yyOpValue1 = null;
14741:
14742: yyBase = yyOption1;
14743: yyC = character(yyBase);
14744: if (' ' == yyC) {
14745: yyIndex = yyOption1 + 1;
14746:
14747: yyC = character(yyIndex);
14748: if ('1' == yyC) {
14749: yyIndex = yyIndex + 1;
14750: final String v$el$1 = " 1";
14751:
14752: yyOption1 = yyIndex;
14753: yyOpValue1 = v$el$1;
14754: } else {
14755: yyError = yyError.select(
14756: "\" 1\" expected",
14757: yyBase);
14758: }
14759: } else {
14760: yyError = yyError.select(
14761: "\" 1\" expected",
14762: yyBase);
14763: }
14764: { // Start scope for f1.
14765: final String f1 = yyOpValue1;
14766:
14767: yyOpValue1 = null;
14768:
14769: yyBase = yyOption1;
14770: yyC = character(yyBase);
14771: if (' ' == yyC) {
14772: yyIndex = yyOption1 + 1;
14773:
14774: yyC = character(yyIndex);
14775: if ('2' == yyC) {
14776: yyIndex = yyIndex + 1;
14777: final String v$el$2 = " 2";
14778:
14779: yyOption1 = yyIndex;
14780: yyOpValue1 = v$el$2;
14781: } else {
14782: yyError = yyError
14783: .select(
14784: "\" 2\" expected",
14785: yyBase);
14786: }
14787: } else {
14788: yyError = yyError.select(
14789: "\" 2\" expected",
14790: yyBase);
14791: }
14792: { // Start scope for f2.
14793: final String f2 = yyOpValue1;
14794:
14795: yyOpValue1 = null;
14796:
14797: yyBase = yyOption1;
14798: yyC = character(yyBase);
14799: if (' ' == yyC) {
14800: yyIndex = yyOption1 + 1;
14801:
14802: yyC = character(yyIndex);
14803: if ('3' == yyC) {
14804: yyIndex = yyIndex + 1;
14805: final String v$el$3 = " 3";
14806:
14807: yyOption1 = yyIndex;
14808: yyOpValue1 = v$el$3;
14809: } else {
14810: yyError = yyError
14811: .select(
14812: "\" 3\" expected",
14813: yyBase);
14814: }
14815: } else {
14816: yyError = yyError
14817: .select(
14818: "\" 3\" expected",
14819: yyBase);
14820: }
14821: { // Start scope for f3.
14822: final String f3 = yyOpValue1;
14823:
14824: yyOpValue1 = null;
14825:
14826: yyBase = yyOption1;
14827: yyC = character(yyBase);
14828: if (' ' == yyC) {
14829: yyIndex = yyOption1 + 1;
14830:
14831: yyC = character(yyIndex);
14832: if ('4' == yyC) {
14833: yyIndex = yyIndex + 1;
14834: final String v$el$4 = " 4";
14835:
14836: yyOption1 = yyIndex;
14837: yyOpValue1 = v$el$4;
14838: } else {
14839: yyError = yyError
14840: .select(
14841: "\" 4\" expected",
14842: yyBase);
14843: }
14844: } else {
14845: yyError = yyError
14846: .select(
14847: "\" 4\" expected",
14848: yyBase);
14849: }
14850: { // Start scope for f4.
14851: final String f4 = yyOpValue1;
14852:
14853: yyPredResult = pLineTerminator(yyOption1);
14854: yyError = yyPredResult
14855: .select(yyError);
14856: if (yyPredResult
14857: .hasValue()) {
14858:
14859: final int lineNo = Integer
14860: .parseInt(line);
14861: if (RELOCATE)
14862: setLocation(
14863: yyStart,
14864: file,
14865: lineNo - 1,
14866: FIRST_COLUMN);
14867: yyState
14868: .lineMarker(
14869: file,
14870: lineNo,
14871: f1,
14872: f2,
14873: f3,
14874: f4,
14875: location(yyStart));
14876:
14877: yyValue = null;
14878:
14879: return new SemanticValue(
14880: yyValue,
14881: yyOption1,
14882: yyError);
14883: }
14884: } // End scope for f4.
14885: } // End scope for f3.
14886: } // End scope for f2.
14887: } // End scope for f1.
14888: }
14889: }
14890: }
14891: }
14892: }
14893: }
14894:
14895: // Nested alternative 2.
14896:
14897: yyRepetition1 = yyChoice1;
14898: while (true) {
14899:
14900: yyResult = pSpace(yyRepetition1);
14901: yyError = yyResult.select(yyError);
14902: if (yyResult.hasValue()) {
14903:
14904: yyRepetition1 = yyResult.index;
14905: continue;
14906: }
14907: break;
14908: }
14909: { // Start scope for nested choice.
14910:
14911: final int yyChoice2 = yyRepetition1;
14912:
14913: // Nested alternative 1.
14914:
14915: yyC = character(yyChoice2);
14916: if (-1 != yyC) {
14917: yyIndex = yyChoice2 + 1;
14918:
14919: switch (yyC) {
14920: case 'p': {
14921: yyC = character(yyIndex);
14922: if (-1 != yyC) {
14923: yyIndex = yyIndex + 1;
14924: if ('r' == yyC) {
14925:
14926: yyC = character(yyIndex);
14927: if (-1 != yyC) {
14928: yyIndex = yyIndex + 1;
14929: if ('a' == yyC) {
14930:
14931: yyC = character(yyIndex);
14932: if (-1 != yyC) {
14933: yyIndex = yyIndex + 1;
14934: if ('g' == yyC) {
14935:
14936: yyC = character(yyIndex);
14937: if (-1 != yyC) {
14938: yyIndex = yyIndex + 1;
14939: if ('m' == yyC) {
14940:
14941: yyC = character(yyIndex);
14942: if (-1 != yyC) {
14943: yyIndex = yyIndex + 1;
14944: if ('a' == yyC) {
14945:
14946: yyC = character(yyIndex);
14947: if (-1 != yyC) {
14948: yyIndex = yyIndex + 1;
14949: if (' ' == yyC) {
14950:
14951: yyResult = pPragma(yyIndex);
14952: yyError = yyResult
14953: .select(yyError);
14954: if (yyResult
14955: .hasValue()) {
14956: final String pragma = yyResult
14957: .semanticValue();
14958:
14959: yyPredResult = pLineTerminator(yyResult.index);
14960: yyError = yyPredResult
14961: .select(yyError);
14962: if (yyPredResult
14963: .hasValue()) {
14964:
14965: yyState
14966: .pragma(
14967: pragma,
14968: location(yyStart));
14969:
14970: yyValue = null;
14971:
14972: return yyResult
14973: .createValue(
14974: yyValue,
14975: yyError);
14976: }
14977: }
14978: }
14979: }
14980: }
14981: }
14982: }
14983: }
14984: }
14985: }
14986: }
14987: }
14988: }
14989: }
14990: }
14991: break;
14992:
14993: case 'i': {
14994: yyC = character(yyIndex);
14995: if (-1 != yyC) {
14996: yyIndex = yyIndex + 1;
14997: if ('d' == yyC) {
14998:
14999: yyC = character(yyIndex);
15000: if (-1 != yyC) {
15001: yyIndex = yyIndex + 1;
15002: if ('e' == yyC) {
15003:
15004: yyC = character(yyIndex);
15005: if (-1 != yyC) {
15006: yyIndex = yyIndex + 1;
15007: if ('n' == yyC) {
15008:
15009: yyC = character(yyIndex);
15010: if (-1 != yyC) {
15011: yyIndex = yyIndex + 1;
15012: if ('t' == yyC) {
15013:
15014: yyRepetition1 = yyIndex;
15015: yyRepeated1 = false;
15016: while (true) {
15017:
15018: yyResult = pSpace(yyRepetition1);
15019: yyError = yyResult
15020: .select(yyError);
15021: if (yyResult
15022: .hasValue()) {
15023:
15024: yyRepetition1 = yyResult.index;
15025: yyRepeated1 = true;
15026: continue;
15027: }
15028: break;
15029: }
15030:
15031: if (yyRepeated1) {
15032:
15033: yyC = character(yyRepetition1);
15034: if ('\"' == yyC) {
15035: yyIndex = yyRepetition1 + 1;
15036:
15037: yyResult = pFileName(yyIndex);
15038: yyError = yyResult
15039: .select(yyError);
15040: if (yyResult
15041: .hasValue()) {
15042: final String s = yyResult
15043: .semanticValue();
15044:
15045: yyC = character(yyResult.index);
15046: if ('\"' == yyC) {
15047: yyIndex = yyResult.index + 1;
15048:
15049: yyPredResult = pLineTerminator(yyIndex);
15050: yyError = yyPredResult
15051: .select(yyError);
15052: if (yyPredResult
15053: .hasValue()) {
15054:
15055: yyState
15056: .ident(
15057: s,
15058: location(yyStart));
15059:
15060: yyValue = null;
15061:
15062: return new SemanticValue(
15063: yyValue,
15064: yyIndex,
15065: yyError);
15066: }
15067: }
15068: }
15069: }
15070: }
15071: }
15072: }
15073: }
15074: }
15075: }
15076: }
15077: }
15078: }
15079: }
15080: break;
15081:
15082: default:
15083: /* No match. */
15084: }
15085: }
15086: } // End scope for nested choice.
15087: }
15088:
15089: // Alternative 2.
15090:
15091: yyValue = null;
15092:
15093: return new SemanticValue(yyValue, yyStart, yyError);
15094: }
15095:
15096: // =========================================================================
15097:
15098: /**
15099: * Parse nonterminal xtc.lang.CSpacing.LineNumber.
15100: *
15101: * @param yyStart The index.
15102: * @return The result.
15103: * @throws IOException Signals an I/O error.
15104: */
15105: private Result pLineNumber(final int yyStart) throws IOException {
15106: int yyC;
15107: int yyIndex;
15108: int yyRepetition1;
15109: String yyValue;
15110: ParseError yyError = ParseError.DUMMY;
15111:
15112: // Alternative 1.
15113:
15114: yyC = character(yyStart);
15115: if (-1 != yyC) {
15116: yyIndex = yyStart + 1;
15117:
15118: switch (yyC) {
15119: case '1':
15120: case '2':
15121: case '3':
15122: case '4':
15123: case '5':
15124: case '6':
15125: case '7':
15126: case '8':
15127: case '9': {
15128: yyRepetition1 = yyIndex;
15129: while (true) {
15130:
15131: yyC = character(yyRepetition1);
15132: if (-1 != yyC) {
15133: yyIndex = yyRepetition1 + 1;
15134:
15135: switch (yyC) {
15136: case '0':
15137: case '1':
15138: case '2':
15139: case '3':
15140: case '4':
15141: case '5':
15142: case '6':
15143: case '7':
15144: case '8':
15145: case '9': {
15146: yyRepetition1 = yyIndex;
15147: continue;
15148: }
15149:
15150: default:
15151: /* No match. */
15152: }
15153: }
15154: break;
15155: }
15156:
15157: yyValue = difference(yyStart, yyRepetition1);
15158:
15159: return new SemanticValue(yyValue, yyRepetition1,
15160: yyError);
15161: }
15162:
15163: default:
15164: /* No match. */
15165: }
15166: }
15167:
15168: // Done.
15169: yyError = yyError.select("line number expected", yyStart);
15170: return yyError;
15171: }
15172:
15173: // =========================================================================
15174:
15175: /**
15176: * Parse nonterminal xtc.lang.CSpacing.FileName.
15177: *
15178: * @param yyStart The index.
15179: * @return The result.
15180: * @throws IOException Signals an I/O error.
15181: */
15182: private Result pFileName(final int yyStart) throws IOException {
15183: int yyC;
15184: int yyIndex;
15185: int yyRepetition1;
15186: String yyValue;
15187: ParseError yyError = ParseError.DUMMY;
15188:
15189: // Alternative 1.
15190:
15191: yyRepetition1 = yyStart;
15192: while (true) {
15193:
15194: final int yyChoice1 = yyRepetition1;
15195:
15196: // Nested alternative 1.
15197:
15198: yyC = character(yyChoice1);
15199: if (-1 != yyC) {
15200: yyIndex = yyChoice1 + 1;
15201:
15202: switch (yyC) {
15203: case '\\': {
15204: yyC = character(yyIndex);
15205: if (-1 != yyC) {
15206: yyIndex = yyIndex + 1;
15207:
15208: yyRepetition1 = yyIndex;
15209: continue;
15210: }
15211: }
15212: break;
15213:
15214: default:
15215: /* No match. */
15216: }
15217: }
15218:
15219: // Nested alternative 2.
15220:
15221: yyC = character(yyChoice1);
15222: if (-1 != yyC) {
15223: yyIndex = yyChoice1 + 1;
15224:
15225: switch (yyC) {
15226: case '\"':
15227: case '\\':
15228: /* No match. */
15229: break;
15230:
15231: default: {
15232: yyRepetition1 = yyIndex;
15233: continue;
15234: }
15235: }
15236: }
15237: break;
15238: }
15239:
15240: yyValue = difference(yyStart, yyRepetition1);
15241:
15242: return new SemanticValue(yyValue, yyRepetition1, yyError);
15243: }
15244:
15245: // =========================================================================
15246:
15247: /**
15248: * Parse nonterminal xtc.lang.CSpacing.Pragma.
15249: *
15250: * @param yyStart The index.
15251: * @return The result.
15252: * @throws IOException Signals an I/O error.
15253: */
15254: private Result pPragma(final int yyStart) throws IOException {
15255: int yyC;
15256: int yyIndex;
15257: int yyRepetition1;
15258: String yyValue;
15259: ParseError yyError = ParseError.DUMMY;
15260:
15261: // Alternative 1.
15262:
15263: yyRepetition1 = yyStart;
15264: while (true) {
15265:
15266: yyC = character(yyRepetition1);
15267: if (-1 != yyC) {
15268: yyIndex = yyRepetition1 + 1;
15269:
15270: switch (yyC) {
15271: case '\n':
15272: case '\r':
15273: /* No match. */
15274: break;
15275:
15276: default: {
15277: yyRepetition1 = yyIndex;
15278: continue;
15279: }
15280: }
15281: }
15282: break;
15283: }
15284:
15285: yyValue = difference(yyStart, yyRepetition1);
15286:
15287: return new SemanticValue(yyValue, yyRepetition1, yyError);
15288: }
15289:
15290: // =========================================================================
15291:
15292: /**
15293: * Parse nonterminal xtc.lang.CContext.TypedefContext.
15294: *
15295: * @param yyStart The index.
15296: * @return The result.
15297: * @throws IOException Signals an I/O error.
15298: */
15299: private Result pTypedefContext(final int yyStart)
15300: throws IOException {
15301: Void yyValue;
15302: ParseError yyError = ParseError.DUMMY;
15303:
15304: // Alternative 1.
15305:
15306: yyState.typedef();
15307:
15308: yyValue = null;
15309:
15310: return new SemanticValue(yyValue, yyStart, yyError);
15311: }
15312:
15313: // =========================================================================
15314:
15315: /**
15316: * Parse nonterminal xtc.lang.CContext.ParameterContext.
15317: *
15318: * @param yyStart The index.
15319: * @return The result.
15320: * @throws IOException Signals an I/O error.
15321: */
15322: private Result pParameterContext(final int yyStart)
15323: throws IOException {
15324: Void yyValue;
15325: ParseError yyError = ParseError.DUMMY;
15326:
15327: // Alternative 1.
15328:
15329: yyState.parameters();
15330:
15331: yyValue = null;
15332:
15333: return new SemanticValue(yyValue, yyStart, yyError);
15334: }
15335:
15336: // =========================================================================
15337:
15338: /**
15339: * Parse nonterminal xtc.lang.CContext.FunctionDeclaratorContext.
15340: *
15341: * @param yyStart The index.
15342: * @return The result.
15343: * @throws IOException Signals an I/O error.
15344: */
15345: private Result pFunctionDeclaratorContext(final int yyStart)
15346: throws IOException {
15347:
15348: Void yyValue;
15349: ParseError yyError = ParseError.DUMMY;
15350:
15351: // Alternative 1.
15352:
15353: yyState.functionDeclarator();
15354:
15355: yyValue = null;
15356:
15357: return new SemanticValue(yyValue, yyStart, yyError);
15358: }
15359:
15360: // =========================================================================
15361:
15362: /**
15363: * Parse nonterminal xtc.lang.CContext.TypeSpecContext.
15364: *
15365: * @param yyStart The index.
15366: * @return The result.
15367: * @throws IOException Signals an I/O error.
15368: */
15369: private Result pTypeSpecContext(final int yyStart)
15370: throws IOException {
15371: Void yyValue;
15372: ParseError yyError = ParseError.DUMMY;
15373:
15374: // Alternative 1.
15375:
15376: yyState.typeSpecifier();
15377:
15378: yyValue = null;
15379:
15380: return new SemanticValue(yyValue, yyStart, yyError);
15381: }
15382:
15383: // =========================================================================
15384:
15385: /**
15386: * Parse nonterminal xtc.lang.CContext.PushScope.
15387: *
15388: * @param yyStart The index.
15389: * @return The result.
15390: * @throws IOException Signals an I/O error.
15391: */
15392: private Result pPushScope(final int yyStart) throws IOException {
15393: Void yyValue;
15394: ParseError yyError = ParseError.DUMMY;
15395:
15396: // Alternative 1.
15397:
15398: yyState.pushScope();
15399:
15400: yyValue = null;
15401:
15402: return new SemanticValue(yyValue, yyStart, yyError);
15403: }
15404:
15405: // =========================================================================
15406:
15407: /**
15408: * Parse nonterminal xtc.lang.CContext.PopScope.
15409: *
15410: * @param yyStart The index.
15411: * @return The result.
15412: * @throws IOException Signals an I/O error.
15413: */
15414: private Result pPopScope(final int yyStart) throws IOException {
15415: Void yyValue;
15416: ParseError yyError = ParseError.DUMMY;
15417:
15418: // Alternative 1.
15419:
15420: yyState.popScope();
15421:
15422: yyValue = null;
15423:
15424: return new SemanticValue(yyValue, yyStart, yyError);
15425: }
15426:
15427: // =========================================================================
15428:
15429: /**
15430: * Parse nonterminal xtc.lang.CContext.EnterStructure.
15431: *
15432: * @param yyStart The index.
15433: * @return The result.
15434: * @throws IOException Signals an I/O error.
15435: */
15436: private Result pEnterStructure(final int yyStart)
15437: throws IOException {
15438: Void yyValue;
15439: ParseError yyError = ParseError.DUMMY;
15440:
15441: // Alternative 1.
15442:
15443: yyState.enterStructure();
15444:
15445: yyValue = null;
15446:
15447: return new SemanticValue(yyValue, yyStart, yyError);
15448: }
15449:
15450: // =========================================================================
15451:
15452: /**
15453: * Parse nonterminal xtc.lang.CContext.ExitStructure.
15454: *
15455: * @param yyStart The index.
15456: * @return The result.
15457: * @throws IOException Signals an I/O error.
15458: */
15459: private Result pExitStructure(final int yyStart) throws IOException {
15460: Void yyValue;
15461: ParseError yyError = ParseError.DUMMY;
15462:
15463: // Alternative 1.
15464:
15465: yyState.exitStructure();
15466:
15467: yyValue = null;
15468:
15469: return new SemanticValue(yyValue, yyStart, yyError);
15470: }
15471:
15472: // =========================================================================
15473:
15474: static {
15475: if (ASPECT)
15476: add(C_KEYWORDS, new String[] { "aspect" });
15477: }
15478: static {
15479: add(C_KEYWORDS, new String[] { "auto", "break", "case", "char",
15480: "const", "continue", "default", "do", "double", "else",
15481: "enum", "extern", "float", "for", "goto", "if", "int",
15482: "long", "register", "return", "short", "signed",
15483: "sizeof", "static", "struct", "switch", "typedef",
15484: "union", "unsigned", "void", "volatile", "while" });
15485:
15486: if (C99)
15487: add(C_KEYWORDS, new String[] { "_Bool", "_Complex",
15488: "inline", "restrict" });
15489:
15490: if (GCC)
15491: add(C_KEYWORDS, new String[] { "__alignof", "__alignof__",
15492: "asm", "__asm", "__asm__", "__attribute",
15493: "__attribute__", "__builtin_offsetof",
15494: "__builtin_types_compatible_p", "__builtin_va_arg",
15495: "__builtin_va_list", "__complex__", "__const",
15496: "__const__", "__extension__", "__inline",
15497: "__inline__", "__label__", "__restrict",
15498: "__restrict__", "__signed", "__signed__", "typeof",
15499: "__typeof", "__typeof__", "__volatile",
15500: "__volatile__" });
15501:
15502: }
15503:
15504: // =========================================================================
15505:
15506: /**
15507: * Get the specified text.
15508: *
15509: * @param s The text.
15510: * @return The text.
15511: */
15512: protected static final String toText(String s) {
15513: return s;
15514: }
15515:
15516: // =========================================================================
15517:
15518: /**
15519: * Add the specified values to the specified set.
15520: *
15521: * @param set The set.
15522: * @param values The new values.
15523: */
15524: protected static final <T> void add(Set<T> set, T[] values) {
15525: for (T v : values)
15526: set.add(v);
15527: }
15528:
15529: /**
15530: * Check whether the specified set contains the specified value.
15531: *
15532: * @param set The set.
15533: * @param value The value.
15534: * @return <code>true</code> if the set contains the value.
15535: */
15536: protected static final <T> boolean contains(Set<T> set, T value) {
15537: return set.contains(value);
15538: }
15539:
15540: // =========================================================================
15541:
15542: /**
15543: * Parse the specified files.
15544: *
15545: * @param args The file names.
15546: */
15547: public static void main(String[] args) {
15548: if ((null == args) || (0 == args.length)) {
15549: System.err.println("Usage: <file-name>+");
15550:
15551: } else {
15552: for (int i = 0; i < args.length; i++) {
15553: System.err.println("Processing " + args[i] + " ...");
15554:
15555: Reader in = null;
15556: try {
15557: in = new BufferedReader(new FileReader(args[i]));
15558: C4Parser p = new C4Parser(in, args[i],
15559: (int) new File(args[i]).length());
15560: Result r = p.pTranslationUnit(0);
15561:
15562: if (r.hasValue()) {
15563: SemanticValue v = (SemanticValue) r;
15564:
15565: if (v.value instanceof Node) {
15566: Printer ptr = new Printer(
15567: new BufferedWriter(
15568: new OutputStreamWriter(
15569: System.out)));
15570: ptr.format((Node) v.value).pln().flush();
15571: } else {
15572: System.out.println(v.value.toString());
15573: }
15574:
15575: } else {
15576: ParseError err = (ParseError) r;
15577: if (-1 == err.index) {
15578: System.err.println(" Parse error");
15579: } else {
15580: System.err.println(" "
15581: + p.location(err.index) + ": "
15582: + err.msg);
15583: }
15584: }
15585:
15586: } catch (Throwable x) {
15587: while (null != x.getCause()) {
15588: x = x.getCause();
15589: }
15590: x.printStackTrace();
15591: } finally {
15592: try {
15593: in.close();
15594: } catch (Throwable x) {
15595: /* Ignore. */
15596: }
15597: }
15598: }
15599: }
15600: }
15601:
15602: }
|