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:18:09 PM.
00006: // Edit at your own risk.
00007: // ===========================================================================
00008:
00009: package xtc.lang;
00010:
00011: import java.io.Reader;
00012: import java.io.IOException;
00013:
00014: import java.util.HashSet;
00015: import java.util.Set;
00016:
00017: import xtc.util.Action;
00018: import xtc.util.Pair;
00019:
00020: import xtc.tree.Node;
00021: import xtc.tree.GNode;
00022: import xtc.tree.Token;
00023: import xtc.tree.Formatting;
00024:
00025: import xtc.parser.ParserBase;
00026: import xtc.parser.Column;
00027: import xtc.parser.Result;
00028: import xtc.parser.SemanticValue;
00029: import xtc.parser.ParseError;
00030:
00031: /**
00032: * Packrat parser for grammar <code>xtc.lang.C</code>.
00033: *
00034: * <p />This class has been generated by the <i>Rats!</i> parser
00035: * generator, version 1.13.2, (C) 2004-2007 Robert Grimm.
00036: */
00037: public final class CReader extends ParserBase {
00038:
00039: /** The GCC flag. */
00040: public static final boolean GCC = true;
00041:
00042: /** The C_KEYWORDS set. */
00043: public static final Set<String> C_KEYWORDS = new HashSet<String>();
00044:
00045: /** The RELOCATE flag. */
00046: public static final boolean RELOCATE = true;
00047:
00048: /** The C99 flag. */
00049: public static final boolean C99 = true;
00050:
00051: // =========================================================================
00052:
00053: /** Chunk 1 of memoized results. */
00054: static final class Chunk1 {
00055: Result fDeclarationSpecifiers;
00056: Result fSpecifierQualifierList;
00057: Result fAttributedDeclarator;
00058: Result fDeclarator;
00059: Result fPointer;
00060: Result fVariableLength;
00061: Result fParameterTypeList;
00062: Result fAbstractDeclarator;
00063: Result fTypeName;
00064: Result fAttributeSpecifierList;
00065: }
00066:
00067: /** Chunk 2 of memoized results. */
00068: static final class Chunk2 {
00069: Result fAttributeSpecifier;
00070: Result fStatement;
00071: Result fCompoundStatement;
00072: Result fCommaExpression;
00073: Result fAssignmentExpression;
00074: Result fConditionalExpression;
00075: Result fLogicalOrExpression;
00076: Result fCastExpression;
00077: Result fUnaryExpression;
00078: Result fExpressionList;
00079: }
00080:
00081: /** Chunk 3 of memoized results. */
00082: static final class Chunk3 {
00083: Result fExpressionList$$Star1;
00084: Result fSimpleAssemblyExpression;
00085: Result fAssemblyOperands;
00086: Result fAssemblyOperands$$Star1;
00087: Result fAssemblyOperand;
00088: Result fAsmKeyword;
00089: Result fExponent;
00090: Result f$$Shared2;
00091: Result fBinaryExponent;
00092: Result fCharacterLiteral;
00093: }
00094:
00095: /** Chunk 4 of memoized results. */
00096: static final class Chunk4 {
00097: Result fCharacterLiteral$$Plus1;
00098: Result fStringConstant;
00099: Result fStringConstant$$Plus1;
00100: Result fStringLiteral;
00101: Result fStringLiteral$$Star1;
00102: Result fIdentifier;
00103: Result fKeyword;
00104: Result fWord;
00105: Result fSymbol;
00106: }
00107:
00108: // =========================================================================
00109:
00110: /** Memoization table column. */
00111: static final class CReaderColumn extends Column {
00112: Chunk1 chunk1;
00113: Chunk2 chunk2;
00114: Chunk3 chunk3;
00115: Chunk4 chunk4;
00116: }
00117:
00118: // =========================================================================
00119:
00120: /** The global state object. */
00121: protected final CParserState yyState;
00122:
00123: // =========================================================================
00124:
00125: /**
00126: * Create a new packrat parser.
00127: *
00128: * @param reader The reader.
00129: * @param file The file name.
00130: */
00131: public CReader(final Reader reader, final String file) {
00132: super (reader, file);
00133: yyState = new CParserState();
00134: }
00135:
00136: /**
00137: * Create a new packrat parser.
00138: *
00139: * @param reader The file reader.
00140: * @param file The file name.
00141: * @param size The file size.
00142: */
00143: public CReader(final Reader reader, final String file,
00144: final int size) {
00145: super (reader, file, size);
00146: yyState = new CParserState();
00147: }
00148:
00149: // =========================================================================
00150:
00151: protected Column newColumn() {
00152: return new CReaderColumn();
00153: }
00154:
00155: // =========================================================================
00156:
00157: /**
00158: * Parse nonterminal xtc.lang.C.TranslationUnit.
00159: *
00160: * @param yyStart The index.
00161: * @return The result.
00162: * @throws IOException Signals an I/O error.
00163: */
00164: public Result pTranslationUnit(final int yyStart)
00165: throws IOException {
00166: Result yyResult;
00167: Node yyValue;
00168: ParseError yyError = ParseError.DUMMY;
00169:
00170: // Alternative <Unit>.
00171:
00172: yyResult = pPrelude(yyStart);
00173: yyError = yyResult.select(yyError);
00174: if (yyResult.hasValue()) {
00175: final Token v$pt$1 = yyResult.semanticValue();
00176:
00177: yyResult = pTranslationUnit$$Split1(yyResult.index);
00178: yyError = yyResult.select(yyError);
00179: if (yyResult.hasValue()) {
00180: final Node v$pt$2 = yyResult.semanticValue();
00181: yyValue = Formatting.before1(v$pt$1, v$pt$2);
00182:
00183: return yyResult.createValue(yyValue, yyError);
00184: }
00185: }
00186:
00187: // Done.
00188: return yyError;
00189: }
00190:
00191: // =========================================================================
00192:
00193: /**
00194: * Parse synthetic nonterminal xtc.lang.C.TranslationUnit$$Split1.
00195: *
00196: * @param yyStart The index.
00197: * @return The result.
00198: * @throws IOException Signals an I/O error.
00199: */
00200: public Result pTranslationUnit$$Split1(final int yyStart)
00201: throws IOException {
00202:
00203: Result yyResult;
00204: int yyRepetition1;
00205: Pair<Node> yyRepValue1;
00206: Node yyValue;
00207: ParseError yyError = ParseError.DUMMY;
00208:
00209: // Alternative <Unit>.
00210:
00211: yyRepetition1 = yyStart;
00212: yyRepValue1 = Pair.empty();
00213: while (true) {
00214:
00215: yyResult = pExternalDeclaration(yyRepetition1);
00216: yyError = yyResult.select(yyError);
00217: if (yyResult.hasValue()) {
00218: final Node v$el$1 = yyResult.semanticValue();
00219:
00220: yyRepetition1 = yyResult.index;
00221: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
00222: continue;
00223: }
00224: break;
00225: }
00226: { // Start scope for v$g$1.
00227: final Pair<Node> v$g$1 = yyRepValue1.reverse();
00228:
00229: yyResult = pAnnotations(yyRepetition1);
00230: yyError = yyResult.select(yyError);
00231: if (yyResult.hasValue()) {
00232: final Node v$g$2 = yyResult.semanticValue();
00233:
00234: yyResult = pEndOfFile(yyResult.index);
00235: yyError = yyResult.select(yyError);
00236: if (yyResult.hasValue()) {
00237:
00238: yyValue = GNode.create("TranslationUnit",
00239: v$g$1.size() + 1).addAll(v$g$1).add(v$g$2);
00240: yyValue.setLocation(location(yyStart));
00241:
00242: return yyResult.createValue(yyValue, yyError);
00243: }
00244: }
00245: } // End scope for v$g$1.
00246:
00247: // Done.
00248: return yyError;
00249: }
00250:
00251: // =========================================================================
00252:
00253: /**
00254: * Parse nonterminal xtc.lang.C.Prelude.
00255: *
00256: * @param yyStart The index.
00257: * @return The result.
00258: * @throws IOException Signals an I/O error.
00259: */
00260: public Result pPrelude(final int yyStart) throws IOException {
00261: Result yyResult;
00262: Token yyValue;
00263: ParseError yyError = ParseError.DUMMY;
00264:
00265: // Reset the global state object.
00266: yyState.reset(column(yyStart).file);
00267:
00268: // Alternative 1.
00269:
00270: yyResult = pDirective(yyStart);
00271: yyError = yyResult.select(yyError);
00272: if (yyResult.hasValue()) {
00273:
00274: yyResult = pSpacing(yyResult.index);
00275: yyError = yyResult.select(yyError);
00276: if (yyResult.hasValue()) {
00277:
00278: yyValue = new Token(difference(yyStart, yyResult.index));
00279: yyValue.setLocation(location(yyStart));
00280:
00281: return yyResult.createValue(yyValue, yyError);
00282: }
00283: }
00284:
00285: // Done.
00286: return yyError;
00287: }
00288:
00289: // =========================================================================
00290:
00291: /**
00292: * Parse nonterminal xtc.lang.C.ExternalDeclaration.
00293: *
00294: * @param yyStart The index.
00295: * @return The result.
00296: * @throws IOException Signals an I/O error.
00297: */
00298: public Result pExternalDeclaration(final int yyStart)
00299: throws IOException {
00300: Result yyResult;
00301: Node yyValue;
00302: ParseError yyError = ParseError.DUMMY;
00303:
00304: // Start a state modification.
00305: yyState.start();
00306:
00307: // Alternative <Declaration>.
00308:
00309: yyState.mark();
00310:
00311: yyResult = pDeclaration(yyStart);
00312: yyError = yyResult.select(yyError);
00313: if (yyResult.hasValue()) {
00314: final Node d = yyResult.semanticValue();
00315:
00316: yyValue = yyState.annotate(d);
00317:
00318: // Commit the state modification.
00319: yyState.commit();
00320:
00321: setLocation(yyValue, yyStart);
00322: return yyResult.createValue(yyValue, yyError);
00323: }
00324:
00325: // Alternative <Function>.
00326:
00327: yyResult = pFunctionDefinition(yyStart);
00328: yyError = yyResult.select(yyError);
00329: if (yyResult.hasValue()) {
00330: final Node fd = yyResult.semanticValue();
00331:
00332: yyValue = yyState.annotate(fd);
00333:
00334: // Commit the state modification.
00335: yyState.commit();
00336:
00337: setLocation(yyValue, yyStart);
00338: return yyResult.createValue(yyValue, yyError);
00339: }
00340:
00341: // Alternative <Assembly>.
00342:
00343: yyResult = pAssemblyDefinition(yyStart);
00344: yyError = yyResult.select(yyError);
00345: if (yyResult.hasValue()) {
00346: final Node a = yyResult.semanticValue();
00347:
00348: yyValue = yyState.annotate(a);
00349:
00350: // Commit the state modification.
00351: yyState.commit();
00352:
00353: setLocation(yyValue, yyStart);
00354: return yyResult.createValue(yyValue, yyError);
00355: }
00356:
00357: // Alternative <Empty>.
00358:
00359: yyResult = pEmptyDefinition(yyStart);
00360: yyError = yyResult.select(yyError);
00361: if (yyResult.hasValue()) {
00362: final Node e = yyResult.semanticValue();
00363:
00364: yyValue = yyState.annotate(e);
00365:
00366: // Commit the state modification.
00367: yyState.commit();
00368:
00369: setLocation(yyValue, yyStart);
00370: return yyResult.createValue(yyValue, yyError);
00371: }
00372:
00373: // Abort the state modification.
00374: yyState.abort();
00375:
00376: // Done.
00377: return yyError;
00378: }
00379:
00380: // =========================================================================
00381:
00382: /**
00383: * Parse nonterminal xtc.lang.C.FunctionDefinition.
00384: *
00385: * @param yyStart The index.
00386: * @return The result.
00387: * @throws IOException Signals an I/O error.
00388: */
00389: private Result pFunctionDefinition(final int yyStart)
00390: throws IOException {
00391: Result yyResult;
00392: int yyBase;
00393: int yyOption1;
00394: Node yyOpValue1;
00395: Node yyValue;
00396: ParseError yyError = ParseError.DUMMY;
00397:
00398: // Alternative <Definition>.
00399:
00400: yyOption1 = yyStart;
00401: yyOpValue1 = null;
00402:
00403: yyBase = yyOption1;
00404: yyResult = pKeyword(yyBase);
00405: yyError = yyResult.select(yyError);
00406: if (yyResult.hasValue()
00407: && ((Node) yyResult.semanticValue()).getTokenText()
00408: .equals("__extension__")) {
00409: final Node v$el$1 = yyResult.semanticValue();
00410:
00411: yyOption1 = yyResult.index;
00412: yyOpValue1 = v$el$1;
00413: } else {
00414: yyError = yyError.select("\"__extension__\" expected",
00415: yyBase);
00416: }
00417: { // Start scope for v$g$1.
00418: final Node v$g$1 = yyOpValue1;
00419:
00420: yyOpValue1 = null;
00421:
00422: yyResult = pDeclarationSpecifiers(yyOption1);
00423: yyError = yyResult.select(yyError);
00424: if (yyResult.hasValue()) {
00425: final Node v$el$2 = yyResult.semanticValue();
00426:
00427: yyOption1 = yyResult.index;
00428: yyOpValue1 = v$el$2;
00429: }
00430: { // Start scope for v$g$2.
00431: final Node v$g$2 = yyOpValue1;
00432:
00433: yyResult = pDeclarator(yyOption1);
00434: yyError = yyResult.select(yyError);
00435: if (yyResult.hasValue()) {
00436: final Node v$g$3 = yyResult.semanticValue();
00437:
00438: yyResult = pFunctionDeclaratorContext(yyResult.index);
00439: yyError = yyResult.select(yyError);
00440: if (yyResult.hasValue()) {
00441:
00442: yyOption1 = yyResult.index;
00443: yyOpValue1 = null;
00444:
00445: yyResult = pDeclarationList(yyOption1);
00446: yyError = yyResult.select(yyError);
00447: if (yyResult.hasValue()) {
00448: final Node v$el$3 = yyResult
00449: .semanticValue();
00450:
00451: yyOption1 = yyResult.index;
00452: yyOpValue1 = v$el$3;
00453: }
00454: { // Start scope for v$g$4.
00455: final Node v$g$4 = yyOpValue1;
00456:
00457: yyResult = pCompoundStatement(yyOption1);
00458: yyError = yyResult.select(yyError);
00459: if (yyResult.hasValue()) {
00460: final Node v$g$5 = yyResult
00461: .semanticValue();
00462:
00463: yyValue = GNode.create(
00464: "FunctionDefinition", v$g$1,
00465: v$g$2, v$g$3, v$g$4, v$g$5);
00466: yyValue.setLocation(location(yyStart));
00467:
00468: return yyResult.createValue(yyValue,
00469: yyError);
00470: }
00471: } // End scope for v$g$4.
00472: }
00473: }
00474: } // End scope for v$g$2.
00475: } // End scope for v$g$1.
00476:
00477: // Done.
00478: return yyError;
00479: }
00480:
00481: // =========================================================================
00482:
00483: /**
00484: * Parse nonterminal xtc.lang.C.DeclarationList.
00485: *
00486: * @param yyStart The index.
00487: * @return The result.
00488: * @throws IOException Signals an I/O error.
00489: */
00490: private Result pDeclarationList(final int yyStart)
00491: throws IOException {
00492: Result yyResult;
00493: int yyRepetition1;
00494: boolean yyRepeated1;
00495: Pair<Node> yyRepValue1;
00496: Node yyValue;
00497: ParseError yyError = ParseError.DUMMY;
00498:
00499: // Alternative <List>.
00500:
00501: yyRepetition1 = yyStart;
00502: yyRepeated1 = false;
00503: yyRepValue1 = Pair.empty();
00504: while (true) {
00505:
00506: yyResult = pDeclarationListEntry(yyRepetition1);
00507: yyError = yyResult.select(yyError);
00508: if (yyResult.hasValue()) {
00509: final Node v$el$1 = yyResult.semanticValue();
00510:
00511: yyRepetition1 = yyResult.index;
00512: yyRepeated1 = true;
00513: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
00514: continue;
00515: }
00516: break;
00517: }
00518:
00519: if (yyRepeated1) {
00520: final Pair<Node> v$g$1 = yyRepValue1.reverse();
00521:
00522: yyValue = GNode.createFromPair("DeclarationList", v$g$1);
00523: yyValue.setLocation(location(yyStart));
00524:
00525: return new SemanticValue(yyValue, yyRepetition1, yyError);
00526: }
00527:
00528: // Done.
00529: return yyError;
00530: }
00531:
00532: // =========================================================================
00533:
00534: /**
00535: * Parse nonterminal xtc.lang.C.DeclarationListEntry.
00536: *
00537: * @param yyStart The index.
00538: * @return The result.
00539: * @throws IOException Signals an I/O error.
00540: */
00541: private Result pDeclarationListEntry(final int yyStart)
00542: throws IOException {
00543: Result yyResult;
00544: Node yyValue;
00545: ParseError yyError = ParseError.DUMMY;
00546:
00547: // Start a state modification.
00548: yyState.start();
00549:
00550: // Alternative <Entry>.
00551:
00552: yyResult = pDeclaration(yyStart);
00553: yyError = yyResult.select(yyError);
00554: if (yyResult.hasValue()) {
00555: yyValue = yyResult.semanticValue();
00556:
00557: // Commit the state modification.
00558: yyState.commit();
00559:
00560: return yyResult.createValue(yyValue, yyError);
00561: }
00562:
00563: // Abort the state modification.
00564: yyState.abort();
00565:
00566: // Done.
00567: return yyError;
00568: }
00569:
00570: // =========================================================================
00571:
00572: /**
00573: * Parse nonterminal xtc.lang.C.EmptyDefinition.
00574: *
00575: * @param yyStart The index.
00576: * @return The result.
00577: * @throws IOException Signals an I/O error.
00578: */
00579: private Result pEmptyDefinition(final int yyStart)
00580: throws IOException {
00581: Result yyResult;
00582: Node yyValue;
00583: ParseError yyError = ParseError.DUMMY;
00584:
00585: // Alternative 1.
00586:
00587: yyResult = pSymbol(yyStart);
00588: yyError = yyResult.select(yyError);
00589: if (yyResult.hasValue()
00590: && ((Node) yyResult.semanticValue()).getTokenText()
00591: .equals(";")) {
00592: final Node v$pt$1 = yyResult.semanticValue();
00593:
00594: yyValue = GNode.create("EmptyDefinition", false);
00595: yyValue.setLocation(location(yyStart));
00596: yyValue = Formatting.after1(yyValue, v$pt$1);
00597:
00598: return yyResult.createValue(yyValue, yyError);
00599: }
00600:
00601: // Done.
00602: yyError = yyError.select("empty definition expected", yyStart);
00603: return yyError;
00604: }
00605:
00606: // =========================================================================
00607:
00608: /**
00609: * Parse nonterminal xtc.lang.C.Annotations.
00610: *
00611: * @param yyStart The index.
00612: * @return The result.
00613: * @throws IOException Signals an I/O error.
00614: */
00615: public Result pAnnotations(final int yyStart) throws IOException {
00616: Node yyValue;
00617: ParseError yyError = ParseError.DUMMY;
00618:
00619: // Start a state modification.
00620: yyState.start();
00621:
00622: // Alternative 1.
00623:
00624: yyState.mark();
00625: yyValue = yyState.annotate(null);
00626:
00627: // Commit the state modification.
00628: yyState.commit();
00629:
00630: setLocation(yyValue, yyStart);
00631: return new SemanticValue(yyValue, yyStart, yyError);
00632: }
00633:
00634: // =========================================================================
00635:
00636: /**
00637: * Parse nonterminal xtc.lang.C.Declaration.
00638: *
00639: * @param yyStart The index.
00640: * @return The result.
00641: * @throws IOException Signals an I/O error.
00642: */
00643: private Result pDeclaration(final int yyStart) throws IOException {
00644: Result yyResult;
00645: int yyBase;
00646: int yyOption1;
00647: Node yyOpValue1;
00648: Node yyValue;
00649: ParseError yyError = ParseError.DUMMY;
00650:
00651: // Alternative 1.
00652:
00653: yyOption1 = yyStart;
00654: yyOpValue1 = null;
00655:
00656: yyBase = yyOption1;
00657: yyResult = pKeyword(yyBase);
00658: yyError = yyResult.select(yyError);
00659: if (yyResult.hasValue()
00660: && ((Node) yyResult.semanticValue()).getTokenText()
00661: .equals("__extension__")) {
00662: final Node v$el$1 = yyResult.semanticValue();
00663:
00664: yyOption1 = yyResult.index;
00665: yyOpValue1 = v$el$1;
00666: } else {
00667: yyError = yyError.select("\"__extension__\" expected",
00668: yyBase);
00669: }
00670: { // Start scope for v$g$1.
00671: final Node v$g$1 = yyOpValue1;
00672:
00673: yyResult = pDeclarationSpecifiers(yyOption1);
00674: yyError = yyResult.select(yyError);
00675: if (yyResult.hasValue()) {
00676: final Node v$g$2 = yyResult.semanticValue();
00677:
00678: yyOption1 = yyResult.index;
00679: yyOpValue1 = null;
00680:
00681: yyResult = pInitializedDeclaratorList(yyOption1);
00682: yyError = yyResult.select(yyError);
00683: if (yyResult.hasValue()) {
00684: final Node v$el$2 = yyResult.semanticValue();
00685:
00686: yyOption1 = yyResult.index;
00687: yyOpValue1 = v$el$2;
00688: }
00689: { // Start scope for l.
00690: final Node l = yyOpValue1;
00691:
00692: if (yyState.isValid(l)) {
00693:
00694: yyBase = yyOption1;
00695: yyResult = pSymbol(yyBase);
00696: yyError = yyResult.select(yyError);
00697: if (yyResult.hasValue()
00698: && ((Node) yyResult.semanticValue())
00699: .getTokenText().equals(";")) {
00700: final Node v$pt$1 = yyResult
00701: .semanticValue();
00702: final Node v$g$3 = Formatting.after1(l,
00703: v$pt$1);
00704:
00705: yyValue = GNode.create("Declaration",
00706: v$g$1, v$g$2, v$g$3);
00707: yyValue.setLocation(location(yyStart));
00708:
00709: return yyResult.createValue(yyValue,
00710: yyError);
00711: } else {
00712: yyError = yyError.select("\";\" expected",
00713: yyBase);
00714: }
00715: }
00716: } // End scope for l.
00717: }
00718: } // End scope for v$g$1.
00719:
00720: // Done.
00721: yyError = yyError.select("declaration expected", yyStart);
00722: return yyError;
00723: }
00724:
00725: // =========================================================================
00726:
00727: /**
00728: * Parse nonterminal xtc.lang.C.DeclarationSpecifiers.
00729: *
00730: * @param yyStart The index.
00731: * @return The result.
00732: * @throws IOException Signals an I/O error.
00733: */
00734: private Result pDeclarationSpecifiers(final int yyStart)
00735: throws IOException {
00736:
00737: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
00738: if (null == yyColumn.chunk1)
00739: yyColumn.chunk1 = new Chunk1();
00740: if (null == yyColumn.chunk1.fDeclarationSpecifiers)
00741: yyColumn.chunk1.fDeclarationSpecifiers = pDeclarationSpecifiers$1(yyStart);
00742: return yyColumn.chunk1.fDeclarationSpecifiers;
00743: }
00744:
00745: /** Actually parse xtc.lang.C.DeclarationSpecifiers. */
00746: private Result pDeclarationSpecifiers$1(final int yyStart)
00747: throws IOException {
00748:
00749: Result yyResult;
00750: Node yyValue;
00751: ParseError yyError = ParseError.DUMMY;
00752:
00753: // Alternative 1.
00754:
00755: yyResult = pDeclarationSpecifierPlus(yyStart);
00756: yyError = yyResult.select(yyError);
00757: if (yyResult.hasValue()) {
00758: final Pair<Node> v$g$1 = yyResult.semanticValue();
00759:
00760: yyValue = GNode.createFromPair("DeclarationSpecifiers",
00761: v$g$1);
00762: yyValue.setLocation(location(yyStart));
00763:
00764: return yyResult.createValue(yyValue, yyError);
00765: }
00766:
00767: // Done.
00768: return yyError;
00769: }
00770:
00771: // =========================================================================
00772:
00773: /**
00774: * Parse nonterminal xtc.lang.C.DeclarationSpecifierPlus.
00775: *
00776: * @param yyStart The index.
00777: * @return The result.
00778: * @throws IOException Signals an I/O error.
00779: */
00780: private Result pDeclarationSpecifierPlus(final int yyStart)
00781: throws IOException {
00782:
00783: Result yyResult;
00784: int yyRepetition1;
00785: boolean yyRepeated1;
00786: Pair<Node> yyRepValue1;
00787: Pair<Node> yyValue;
00788: ParseError yyError = ParseError.DUMMY;
00789:
00790: // Alternative 1.
00791:
00792: yyRepetition1 = yyStart;
00793: yyRepeated1 = false;
00794: yyRepValue1 = Pair.empty();
00795: while (true) {
00796:
00797: yyResult = pDeclarationSpecifier(yyRepetition1);
00798: yyError = yyResult.select(yyError);
00799: if (yyResult.hasValue()) {
00800: final Node v$el$1 = yyResult.semanticValue();
00801:
00802: yyRepetition1 = yyResult.index;
00803: yyRepeated1 = true;
00804: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
00805: continue;
00806: }
00807: break;
00808: }
00809:
00810: if (yyRepeated1) {
00811: yyValue = yyRepValue1.reverse();
00812:
00813: return new SemanticValue(yyValue, yyRepetition1, yyError);
00814: }
00815:
00816: // Done.
00817: return yyError;
00818: }
00819:
00820: // =========================================================================
00821:
00822: /**
00823: * Parse nonterminal xtc.lang.C.DeclarationSpecifier.
00824: *
00825: * @param yyStart The index.
00826: * @return The result.
00827: * @throws IOException Signals an I/O error.
00828: */
00829: private Result pDeclarationSpecifier(final int yyStart)
00830: throws IOException {
00831: Result yyResult;
00832: Node yyValue;
00833: ParseError yyError = ParseError.DUMMY;
00834:
00835: // Alternative <StorageClass>.
00836:
00837: yyResult = pStorageClassSpecifier(yyStart);
00838: yyError = yyResult.select(yyError);
00839: if (yyResult.hasValue()) {
00840: yyValue = yyResult.semanticValue();
00841:
00842: return yyResult.createValue(yyValue, yyError);
00843: }
00844:
00845: // Alternative <TypeSpecifier>.
00846:
00847: yyResult = pTypeSpecifier(yyStart);
00848: yyError = yyResult.select(yyError);
00849: if (yyResult.hasValue()) {
00850: yyValue = yyResult.semanticValue();
00851:
00852: yyResult = pTypeSpecContext(yyResult.index);
00853: yyError = yyResult.select(yyError);
00854: if (yyResult.hasValue()) {
00855:
00856: return yyResult.createValue(yyValue, yyError);
00857: }
00858: }
00859:
00860: // Alternative <TypeQualifier>.
00861:
00862: yyResult = pTypeQualifier(yyStart);
00863: yyError = yyResult.select(yyError);
00864: if (yyResult.hasValue()) {
00865: yyValue = yyResult.semanticValue();
00866:
00867: return yyResult.createValue(yyValue, yyError);
00868: }
00869:
00870: // Alternative 4.
00871:
00872: yyResult = pKeyword(yyStart);
00873: yyError = yyResult.select(yyError);
00874: if (yyResult.hasValue()
00875: && ((Node) yyResult.semanticValue()).getTokenText()
00876: .equals("inline")) {
00877: final Node v$g$1 = yyResult.semanticValue();
00878:
00879: yyValue = GNode.create("FunctionSpecifier", v$g$1);
00880: yyValue.setLocation(location(yyStart));
00881:
00882: return yyResult.createValue(yyValue, yyError);
00883: }
00884:
00885: // Alternative 5.
00886:
00887: yyResult = pKeyword(yyStart);
00888: yyError = yyResult.select(yyError);
00889: if (yyResult.hasValue()
00890: && ((Node) yyResult.semanticValue()).getTokenText()
00891: .equals("__inline")) {
00892: final Node v$g$2 = yyResult.semanticValue();
00893:
00894: yyValue = GNode.create("FunctionSpecifier", v$g$2);
00895: yyValue.setLocation(location(yyStart));
00896:
00897: return yyResult.createValue(yyValue, yyError);
00898: }
00899:
00900: // Alternative 6.
00901:
00902: yyResult = pKeyword(yyStart);
00903: yyError = yyResult.select(yyError);
00904: if (yyResult.hasValue()
00905: && ((Node) yyResult.semanticValue()).getTokenText()
00906: .equals("__inline__")) {
00907: final Node v$g$3 = yyResult.semanticValue();
00908:
00909: yyValue = GNode.create("FunctionSpecifier", v$g$3);
00910: yyValue.setLocation(location(yyStart));
00911:
00912: return yyResult.createValue(yyValue, yyError);
00913: }
00914:
00915: // Alternative <Attribute>.
00916:
00917: yyResult = pAttributeSpecifier(yyStart);
00918: yyError = yyResult.select(yyError);
00919: if (yyResult.hasValue()) {
00920: yyValue = yyResult.semanticValue();
00921:
00922: return yyResult.createValue(yyValue, yyError);
00923: }
00924:
00925: // Done.
00926: yyError = yyError.select("declaration specifier expected",
00927: yyStart);
00928: return yyError;
00929: }
00930:
00931: // =========================================================================
00932:
00933: /**
00934: * Parse nonterminal xtc.lang.C.InitializedDeclaratorList.
00935: *
00936: * @param yyStart The index.
00937: * @return The result.
00938: * @throws IOException Signals an I/O error.
00939: */
00940: private Result pInitializedDeclaratorList(final int yyStart)
00941: throws IOException {
00942:
00943: Result yyResult;
00944: int yyBase;
00945: int yyRepetition1;
00946: Pair<Node> yyRepValue1;
00947: Node yyValue;
00948: ParseError yyError = ParseError.DUMMY;
00949:
00950: // Alternative <List>.
00951:
00952: yyResult = pInitializedDeclarator(yyStart);
00953: yyError = yyResult.select(yyError);
00954: if (yyResult.hasValue()) {
00955: final Node v$g$1 = yyResult.semanticValue();
00956:
00957: yyRepetition1 = yyResult.index;
00958: yyRepValue1 = Pair.empty();
00959: while (true) {
00960:
00961: yyBase = yyRepetition1;
00962: yyResult = pSymbol(yyBase);
00963: yyError = yyResult.select(yyError);
00964: if (yyResult.hasValue()
00965: && ((Node) yyResult.semanticValue())
00966: .getTokenText().equals(",")) {
00967: final Node v$pt$1 = yyResult.semanticValue();
00968:
00969: yyResult = pInitializedDeclarator(yyResult.index);
00970: yyError = yyResult.select(yyError);
00971: if (yyResult.hasValue()) {
00972: final Node v$pt$2 = yyResult.semanticValue();
00973: final Node v$el$1 = Formatting.before1(v$pt$1,
00974: v$pt$2);
00975:
00976: yyRepetition1 = yyResult.index;
00977: yyRepValue1 = new Pair<Node>(v$el$1,
00978: yyRepValue1);
00979: continue;
00980: }
00981: } else {
00982: yyError = yyError.select("\",\" expected", yyBase);
00983: }
00984: break;
00985: }
00986: { // Start scope for v$g$2.
00987: final Pair<Node> v$g$2 = yyRepValue1.reverse();
00988:
00989: yyValue = GNode.createFromPair(
00990: "InitializedDeclaratorList", v$g$1, v$g$2);
00991: yyValue.setLocation(location(yyStart));
00992:
00993: return new SemanticValue(yyValue, yyRepetition1,
00994: yyError);
00995: } // End scope for v$g$2.
00996: }
00997:
00998: // Done.
00999: return yyError;
01000: }
01001:
01002: // =========================================================================
01003:
01004: /**
01005: * Parse nonterminal xtc.lang.C.InitializedDeclarator.
01006: *
01007: * @param yyStart The index.
01008: * @return The result.
01009: * @throws IOException Signals an I/O error.
01010: */
01011: private Result pInitializedDeclarator(final int yyStart)
01012: throws IOException {
01013:
01014: Result yyResult;
01015: int yyBase;
01016: int yyOption1;
01017: Node yyOpValue1;
01018: Node yyValue;
01019: ParseError yyError = ParseError.DUMMY;
01020:
01021: // Alternative 1.
01022:
01023: yyOption1 = yyStart;
01024: yyOpValue1 = null;
01025:
01026: yyResult = pAttributeSpecifierList(yyOption1);
01027: yyError = yyResult.select(yyError);
01028: if (yyResult.hasValue()) {
01029: final Node v$el$1 = yyResult.semanticValue();
01030:
01031: yyOption1 = yyResult.index;
01032: yyOpValue1 = v$el$1;
01033: }
01034: { // Start scope for v$g$1.
01035: final Node v$g$1 = yyOpValue1;
01036:
01037: yyResult = pDeclarator(yyOption1);
01038: yyError = yyResult.select(yyError);
01039: if (yyResult.hasValue()) {
01040: final Node v$g$2 = yyResult.semanticValue();
01041:
01042: yyOption1 = yyResult.index;
01043: yyOpValue1 = null;
01044:
01045: yyResult = pSimpleAssemblyExpression(yyOption1);
01046: yyError = yyResult.select(yyError);
01047: if (yyResult.hasValue()) {
01048: final Node v$el$2 = yyResult.semanticValue();
01049:
01050: yyOption1 = yyResult.index;
01051: yyOpValue1 = v$el$2;
01052: }
01053: { // Start scope for v$g$3.
01054: final Node v$g$3 = yyOpValue1;
01055:
01056: yyOpValue1 = null;
01057:
01058: yyResult = pAttributeSpecifierList(yyOption1);
01059: yyError = yyResult.select(yyError);
01060: if (yyResult.hasValue()) {
01061: final Node v$el$3 = yyResult.semanticValue();
01062:
01063: yyOption1 = yyResult.index;
01064: yyOpValue1 = v$el$3;
01065: }
01066: { // Start scope for v$g$4.
01067: final Node v$g$4 = yyOpValue1;
01068:
01069: yyOpValue1 = null;
01070:
01071: yyBase = yyOption1;
01072: yyResult = pSymbol(yyBase);
01073: yyError = yyResult.select(yyError);
01074: if (yyResult.hasValue()
01075: && ((Node) yyResult.semanticValue())
01076: .getTokenText().equals("=")) {
01077: final Node v$pt$1 = yyResult
01078: .semanticValue();
01079:
01080: yyResult = pInitializer(yyResult.index);
01081: yyError = yyResult.select(yyError);
01082: if (yyResult.hasValue()) {
01083: final Node v$pt$2 = yyResult
01084: .semanticValue();
01085: final Node v$el$4 = Formatting.before1(
01086: v$pt$1, v$pt$2);
01087:
01088: yyOption1 = yyResult.index;
01089: yyOpValue1 = v$el$4;
01090: }
01091: } else {
01092: yyError = yyError.select("\"=\" expected",
01093: yyBase);
01094: }
01095: { // Start scope for v$g$5.
01096: final Node v$g$5 = yyOpValue1;
01097:
01098: yyValue = GNode.create(
01099: "InitializedDeclarator", v$g$1,
01100: v$g$2, v$g$3, v$g$4, v$g$5);
01101: yyValue.setLocation(location(yyStart));
01102:
01103: return new SemanticValue(yyValue,
01104: yyOption1, yyError);
01105: } // End scope for v$g$5.
01106: } // End scope for v$g$4.
01107: } // End scope for v$g$3.
01108: }
01109: } // End scope for v$g$1.
01110:
01111: // Done.
01112: return yyError;
01113: }
01114:
01115: // =========================================================================
01116:
01117: /**
01118: * Parse nonterminal xtc.lang.C.StorageClassSpecifier.
01119: *
01120: * @param yyStart The index.
01121: * @return The result.
01122: * @throws IOException Signals an I/O error.
01123: */
01124: private Result pStorageClassSpecifier(final int yyStart)
01125: throws IOException {
01126:
01127: Result yyResult;
01128: Node yyValue;
01129: ParseError yyError = ParseError.DUMMY;
01130:
01131: // Alternative 1.
01132:
01133: yyResult = pKeyword(yyStart);
01134: yyError = yyResult.select(yyError);
01135: if (yyResult.hasValue()
01136: && ((Node) yyResult.semanticValue()).getTokenText()
01137: .equals("auto")) {
01138: final Node v$pt$1 = yyResult.semanticValue();
01139:
01140: yyValue = GNode.create("AutoSpecifier", false);
01141: yyValue.setLocation(location(yyStart));
01142: yyValue = Formatting.after1(yyValue, v$pt$1);
01143:
01144: return yyResult.createValue(yyValue, yyError);
01145: }
01146:
01147: // Alternative 2.
01148:
01149: yyResult = pKeyword(yyStart);
01150: yyError = yyResult.select(yyError);
01151: if (yyResult.hasValue()
01152: && ((Node) yyResult.semanticValue()).getTokenText()
01153: .equals("extern")) {
01154: final Node v$pt$1 = yyResult.semanticValue();
01155:
01156: yyValue = GNode.create("ExternSpecifier", false);
01157: yyValue.setLocation(location(yyStart));
01158: yyValue = Formatting.after1(yyValue, v$pt$1);
01159:
01160: return yyResult.createValue(yyValue, yyError);
01161: }
01162:
01163: // Alternative 3.
01164:
01165: yyResult = pKeyword(yyStart);
01166: yyError = yyResult.select(yyError);
01167: if (yyResult.hasValue()
01168: && ((Node) yyResult.semanticValue()).getTokenText()
01169: .equals("register")) {
01170: final Node v$pt$1 = yyResult.semanticValue();
01171:
01172: yyValue = GNode.create("RegisterSpecifier", false);
01173: yyValue.setLocation(location(yyStart));
01174: yyValue = Formatting.after1(yyValue, v$pt$1);
01175:
01176: return yyResult.createValue(yyValue, yyError);
01177: }
01178:
01179: // Alternative 4.
01180:
01181: yyResult = pKeyword(yyStart);
01182: yyError = yyResult.select(yyError);
01183: if (yyResult.hasValue()
01184: && ((Node) yyResult.semanticValue()).getTokenText()
01185: .equals("static")) {
01186: final Node v$pt$1 = yyResult.semanticValue();
01187:
01188: yyValue = GNode.create("StaticSpecifier", false);
01189: yyValue.setLocation(location(yyStart));
01190: yyValue = Formatting.after1(yyValue, v$pt$1);
01191:
01192: return yyResult.createValue(yyValue, yyError);
01193: }
01194:
01195: // Alternative 5.
01196:
01197: yyResult = pKeyword(yyStart);
01198: yyError = yyResult.select(yyError);
01199: if (yyResult.hasValue()
01200: && ((Node) yyResult.semanticValue()).getTokenText()
01201: .equals("typedef")) {
01202: final Node v$pt$1 = yyResult.semanticValue();
01203:
01204: yyResult = pTypedefContext(yyResult.index);
01205: yyError = yyResult.select(yyError);
01206: if (yyResult.hasValue()) {
01207:
01208: yyValue = GNode.create("TypedefSpecifier", false);
01209: yyValue.setLocation(location(yyStart));
01210: yyValue = Formatting.after1(yyValue, v$pt$1);
01211:
01212: return yyResult.createValue(yyValue, yyError);
01213: }
01214: }
01215:
01216: // Done.
01217: yyError = yyError.select("storage class specifier expected",
01218: yyStart);
01219: return yyError;
01220: }
01221:
01222: // =========================================================================
01223:
01224: /**
01225: * Parse nonterminal xtc.lang.C.TypeQualifier.
01226: *
01227: * @param yyStart The index.
01228: * @return The result.
01229: * @throws IOException Signals an I/O error.
01230: */
01231: private Result pTypeQualifier(final int yyStart) throws IOException {
01232: Result yyResult;
01233: Node yyValue;
01234: ParseError yyError = ParseError.DUMMY;
01235:
01236: // Alternative 1.
01237:
01238: yyResult = pKeyword(yyStart);
01239: yyError = yyResult.select(yyError);
01240: if (yyResult.hasValue()
01241: && ((Node) yyResult.semanticValue()).getTokenText()
01242: .equals("volatile")) {
01243: final Node v$g$1 = yyResult.semanticValue();
01244:
01245: yyValue = GNode.create("VolatileQualifier", v$g$1);
01246: yyValue.setLocation(location(yyStart));
01247:
01248: return yyResult.createValue(yyValue, yyError);
01249: }
01250:
01251: // Alternative 2.
01252:
01253: yyResult = pKeyword(yyStart);
01254: yyError = yyResult.select(yyError);
01255: if (yyResult.hasValue()
01256: && ((Node) yyResult.semanticValue()).getTokenText()
01257: .equals("__volatile")) {
01258: final Node v$g$2 = yyResult.semanticValue();
01259:
01260: yyValue = GNode.create("VolatileQualifier", v$g$2);
01261: yyValue.setLocation(location(yyStart));
01262:
01263: return yyResult.createValue(yyValue, yyError);
01264: }
01265:
01266: // Alternative 3.
01267:
01268: yyResult = pKeyword(yyStart);
01269: yyError = yyResult.select(yyError);
01270: if (yyResult.hasValue()
01271: && ((Node) yyResult.semanticValue()).getTokenText()
01272: .equals("__volatile__")) {
01273: final Node v$g$3 = yyResult.semanticValue();
01274:
01275: yyValue = GNode.create("VolatileQualifier", v$g$3);
01276: yyValue.setLocation(location(yyStart));
01277:
01278: return yyResult.createValue(yyValue, yyError);
01279: }
01280:
01281: // Alternative 4.
01282:
01283: yyResult = pKeyword(yyStart);
01284: yyError = yyResult.select(yyError);
01285: if (yyResult.hasValue()
01286: && ((Node) yyResult.semanticValue()).getTokenText()
01287: .equals("const")) {
01288: final Node v$g$1 = yyResult.semanticValue();
01289:
01290: yyValue = GNode.create("ConstantQualifier", v$g$1);
01291: yyValue.setLocation(location(yyStart));
01292:
01293: return yyResult.createValue(yyValue, yyError);
01294: }
01295:
01296: // Alternative 5.
01297:
01298: yyResult = pKeyword(yyStart);
01299: yyError = yyResult.select(yyError);
01300: if (yyResult.hasValue()
01301: && ((Node) yyResult.semanticValue()).getTokenText()
01302: .equals("__const")) {
01303: final Node v$g$2 = yyResult.semanticValue();
01304:
01305: yyValue = GNode.create("ConstantQualifier", v$g$2);
01306: yyValue.setLocation(location(yyStart));
01307:
01308: return yyResult.createValue(yyValue, yyError);
01309: }
01310:
01311: // Alternative 6.
01312:
01313: yyResult = pKeyword(yyStart);
01314: yyError = yyResult.select(yyError);
01315: if (yyResult.hasValue()
01316: && ((Node) yyResult.semanticValue()).getTokenText()
01317: .equals("__const__")) {
01318: final Node v$g$3 = yyResult.semanticValue();
01319:
01320: yyValue = GNode.create("ConstantQualifier", v$g$3);
01321: yyValue.setLocation(location(yyStart));
01322:
01323: return yyResult.createValue(yyValue, yyError);
01324: }
01325:
01326: // Alternative 7.
01327:
01328: yyResult = pKeyword(yyStart);
01329: yyError = yyResult.select(yyError);
01330: if (yyResult.hasValue()
01331: && ((Node) yyResult.semanticValue()).getTokenText()
01332: .equals("restrict")) {
01333: final Node v$g$1 = yyResult.semanticValue();
01334:
01335: yyValue = GNode.create("RestrictQualifier", v$g$1);
01336: yyValue.setLocation(location(yyStart));
01337:
01338: return yyResult.createValue(yyValue, yyError);
01339: }
01340:
01341: // Alternative 8.
01342:
01343: yyResult = pKeyword(yyStart);
01344: yyError = yyResult.select(yyError);
01345: if (yyResult.hasValue()
01346: && ((Node) yyResult.semanticValue()).getTokenText()
01347: .equals("__restrict")) {
01348: final Node v$g$2 = yyResult.semanticValue();
01349:
01350: yyValue = GNode.create("RestrictQualifier", v$g$2);
01351: yyValue.setLocation(location(yyStart));
01352:
01353: return yyResult.createValue(yyValue, yyError);
01354: }
01355:
01356: // Alternative 9.
01357:
01358: yyResult = pKeyword(yyStart);
01359: yyError = yyResult.select(yyError);
01360: if (yyResult.hasValue()
01361: && ((Node) yyResult.semanticValue()).getTokenText()
01362: .equals("__restrict__")) {
01363: final Node v$g$3 = yyResult.semanticValue();
01364:
01365: yyValue = GNode.create("RestrictQualifier", v$g$3);
01366: yyValue.setLocation(location(yyStart));
01367:
01368: return yyResult.createValue(yyValue, yyError);
01369: }
01370:
01371: // Done.
01372: yyError = yyError.select("type qualifier expected", yyStart);
01373: return yyError;
01374: }
01375:
01376: // =========================================================================
01377:
01378: /**
01379: * Parse nonterminal xtc.lang.C.TypeSpecifier.
01380: *
01381: * @param yyStart The index.
01382: * @return The result.
01383: * @throws IOException Signals an I/O error.
01384: */
01385: private Result pTypeSpecifier(final int yyStart) throws IOException {
01386: Result yyResult;
01387: int yyBase;
01388: Node yyValue;
01389: ParseError yyError = ParseError.DUMMY;
01390:
01391: // Alternative <Enumeration>.
01392:
01393: yyResult = pEnumerationTypeSpecifier(yyStart);
01394: yyError = yyResult.select(yyError);
01395: if (yyResult.hasValue()) {
01396: yyValue = yyResult.semanticValue();
01397:
01398: return yyResult.createValue(yyValue, yyError);
01399: }
01400:
01401: // Alternative <Structure>.
01402:
01403: yyResult = pStructureTypeSpecifier(yyStart);
01404: yyError = yyResult.select(yyError);
01405: if (yyResult.hasValue()) {
01406: yyValue = yyResult.semanticValue();
01407:
01408: return yyResult.createValue(yyValue, yyError);
01409: }
01410:
01411: // Alternative <Union>.
01412:
01413: yyResult = pUnionTypeSpecifier(yyStart);
01414: yyError = yyResult.select(yyError);
01415: if (yyResult.hasValue()) {
01416: yyValue = yyResult.semanticValue();
01417:
01418: return yyResult.createValue(yyValue, yyError);
01419: }
01420:
01421: // Alternative <Floating>.
01422:
01423: yyResult = pFloatingPointTypeSpecifier(yyStart);
01424: yyError = yyResult.select(yyError);
01425: if (yyResult.hasValue()) {
01426: yyValue = yyResult.semanticValue();
01427:
01428: return yyResult.createValue(yyValue, yyError);
01429: }
01430:
01431: // Alternative <Integer>.
01432:
01433: yyResult = pIntegerTypeSpecifier(yyStart);
01434: yyError = yyResult.select(yyError);
01435: if (yyResult.hasValue()) {
01436: yyValue = yyResult.semanticValue();
01437:
01438: return yyResult.createValue(yyValue, yyError);
01439: }
01440:
01441: // Alternative 6.
01442:
01443: yyResult = pIdentifier(yyStart);
01444: yyError = yyResult.select(yyError);
01445: if (yyResult.hasValue()) {
01446: final Node id = yyResult.semanticValue();
01447:
01448: if (yyState.isType(toText(id))) {
01449:
01450: yyValue = GNode.create("TypedefName", id);
01451: yyValue.setLocation(location(yyStart));
01452:
01453: return yyResult.createValue(yyValue, yyError);
01454: }
01455: }
01456:
01457: // Alternative 7.
01458:
01459: yyResult = pTypeofKeyword(yyStart);
01460: yyError = yyResult.select(yyError);
01461: if (yyResult.hasValue()) {
01462: final Node v$pt$1 = yyResult.semanticValue();
01463:
01464: yyBase = yyResult.index;
01465: yyResult = pSymbol(yyBase);
01466: yyError = yyResult.select(yyError);
01467: if (yyResult.hasValue()
01468: && ((Node) yyResult.semanticValue()).getTokenText()
01469: .equals("(")) {
01470: final Node v$pt$2 = yyResult.semanticValue();
01471:
01472: final int yyChoice1 = yyResult.index;
01473:
01474: // Nested alternative 1.
01475:
01476: yyResult = pTypeName(yyChoice1);
01477: yyError = yyResult.select(yyError);
01478: if (yyResult.hasValue()) {
01479: final Node v$pt$4 = yyResult.semanticValue();
01480:
01481: yyBase = yyResult.index;
01482: yyResult = pSymbol(yyBase);
01483: yyError = yyResult.select(yyError);
01484: if (yyResult.hasValue()
01485: && ((Node) yyResult.semanticValue())
01486: .getTokenText().equals(")")) {
01487: final Node v$pt$3 = yyResult.semanticValue();
01488: final Node v$g$1 = Formatting.variable().add(
01489: v$pt$1).add(v$pt$2).addNode(v$pt$4)
01490: .add(v$pt$3);
01491:
01492: yyValue = GNode
01493: .create("TypeofSpecifier", v$g$1);
01494: yyValue.setLocation(location(yyStart));
01495:
01496: return yyResult.createValue(yyValue, yyError);
01497: } else {
01498: yyError = yyError.select("\")\" expected",
01499: yyBase);
01500: }
01501: }
01502:
01503: // Nested alternative 2.
01504:
01505: yyResult = pCommaExpression(yyChoice1);
01506: yyError = yyResult.select(yyError);
01507: if (yyResult.hasValue()) {
01508: final Node v$pt$6 = yyResult.semanticValue();
01509:
01510: yyBase = yyResult.index;
01511: yyResult = pSymbol(yyBase);
01512: yyError = yyResult.select(yyError);
01513: if (yyResult.hasValue()
01514: && ((Node) yyResult.semanticValue())
01515: .getTokenText().equals(")")) {
01516: final Node v$pt$5 = yyResult.semanticValue();
01517: final Node v$g$2 = Formatting.variable().add(
01518: v$pt$1).add(v$pt$2).addNode(v$pt$6)
01519: .add(v$pt$5);
01520:
01521: yyValue = GNode
01522: .create("TypeofSpecifier", v$g$2);
01523: yyValue.setLocation(location(yyStart));
01524:
01525: return yyResult.createValue(yyValue, yyError);
01526: } else {
01527: yyError = yyError.select("\")\" expected",
01528: yyBase);
01529: }
01530: }
01531: } else {
01532: yyError = yyError.select("\"(\" expected", yyBase);
01533: }
01534: }
01535:
01536: // Alternative 8.
01537:
01538: yyResult = pKeyword(yyStart);
01539: yyError = yyResult.select(yyError);
01540: if (yyResult.hasValue()
01541: && ((Node) yyResult.semanticValue()).getTokenText()
01542: .equals("void")) {
01543: final Node v$pt$1 = yyResult.semanticValue();
01544:
01545: yyValue = GNode.create("VoidTypeSpecifier", false);
01546: yyValue.setLocation(location(yyStart));
01547: yyValue = Formatting.after1(yyValue, v$pt$1);
01548:
01549: return yyResult.createValue(yyValue, yyError);
01550: }
01551:
01552: // Alternative 9.
01553:
01554: yyResult = pKeyword(yyStart);
01555: yyError = yyResult.select(yyError);
01556: if (yyResult.hasValue()
01557: && ((Node) yyResult.semanticValue()).getTokenText()
01558: .equals("__builtin_va_list")) {
01559: final Node v$pt$1 = yyResult.semanticValue();
01560:
01561: yyValue = GNode.create("VarArgListSpecifier", false);
01562: yyValue.setLocation(location(yyStart));
01563: yyValue = Formatting.after1(yyValue, v$pt$1);
01564:
01565: return yyResult.createValue(yyValue, yyError);
01566: }
01567:
01568: // Done.
01569: yyError = yyError.select("type specifier expected", yyStart);
01570: return yyError;
01571: }
01572:
01573: // =========================================================================
01574:
01575: /**
01576: * Parse nonterminal xtc.lang.C.EnumerationTypeSpecifier.
01577: *
01578: * @param yyStart The index.
01579: * @return The result.
01580: * @throws IOException Signals an I/O error.
01581: */
01582: private Result pEnumerationTypeSpecifier(final int yyStart)
01583: throws IOException {
01584:
01585: Result yyResult;
01586: int yyBase;
01587: int yyOption1;
01588: Node yyOpValue1;
01589: Node yyValue;
01590: ParseError yyError = ParseError.DUMMY;
01591:
01592: // Alternative 1.
01593:
01594: yyResult = pKeyword(yyStart);
01595: yyError = yyResult.select(yyError);
01596: if (yyResult.hasValue()
01597: && ((Node) yyResult.semanticValue()).getTokenText()
01598: .equals("enum")) {
01599: final Node v$pt$1 = yyResult.semanticValue();
01600:
01601: yyOption1 = yyResult.index;
01602: yyOpValue1 = null;
01603:
01604: yyResult = pAttributeSpecifierList(yyOption1);
01605: yyError = yyResult.select(yyError);
01606: if (yyResult.hasValue()) {
01607: final Node v$el$1 = yyResult.semanticValue();
01608:
01609: yyOption1 = yyResult.index;
01610: yyOpValue1 = v$el$1;
01611: }
01612: { // Start scope for v$pt$2.
01613: final Node v$pt$2 = yyOpValue1;
01614: final Node v$g$1 = Formatting.before1(v$pt$1, v$pt$2);
01615:
01616: final int yyChoice1 = yyOption1;
01617:
01618: // Nested alternative 1.
01619:
01620: yyOption1 = yyChoice1;
01621: yyOpValue1 = null;
01622:
01623: yyResult = pIdentifier(yyOption1);
01624: yyError = yyResult.select(yyError);
01625: if (yyResult.hasValue()) {
01626: final Node v$el$2 = yyResult.semanticValue();
01627:
01628: yyOption1 = yyResult.index;
01629: yyOpValue1 = v$el$2;
01630: }
01631: { // Start scope for v$pt$4.
01632: final Node v$pt$4 = yyOpValue1;
01633:
01634: yyBase = yyOption1;
01635: yyResult = pSymbol(yyBase);
01636: yyError = yyResult.select(yyError);
01637: if (yyResult.hasValue()
01638: && ((Node) yyResult.semanticValue())
01639: .getTokenText().equals("{")) {
01640: final Node v$pt$3 = yyResult.semanticValue();
01641: final Node v$g$2 = Formatting.after1(v$pt$4,
01642: v$pt$3);
01643:
01644: yyResult = pEnumeratorList(yyResult.index);
01645: yyError = yyResult.select(yyError);
01646: if (yyResult.hasValue()) {
01647: final Node v$pt$7 = yyResult
01648: .semanticValue();
01649:
01650: yyOption1 = yyResult.index;
01651: yyOpValue1 = null;
01652:
01653: yyBase = yyOption1;
01654: yyResult = pSymbol(yyBase);
01655: yyError = yyResult.select(yyError);
01656: if (yyResult.hasValue()
01657: && ((Node) yyResult.semanticValue())
01658: .getTokenText().equals(",")) {
01659: final Node v$el$3 = yyResult
01660: .semanticValue();
01661:
01662: yyOption1 = yyResult.index;
01663: yyOpValue1 = v$el$3;
01664: } else {
01665: yyError = yyError.select(
01666: "\",\" expected", yyBase);
01667: }
01668: { // Start scope for v$pt$5.
01669: final Node v$pt$5 = yyOpValue1;
01670:
01671: yyBase = yyOption1;
01672: yyResult = pSymbol(yyBase);
01673: yyError = yyResult.select(yyError);
01674: if (yyResult.hasValue()
01675: && ((Node) yyResult
01676: .semanticValue())
01677: .getTokenText().equals(
01678: "}")) {
01679: final Node v$pt$6 = yyResult
01680: .semanticValue();
01681: final Node v$g$3 = Formatting
01682: .variable().addNode(v$pt$7)
01683: .add(v$pt$5).add(v$pt$6);
01684:
01685: yyOption1 = yyResult.index;
01686: yyOpValue1 = null;
01687:
01688: yyResult = pAttributeSpecifierList(yyOption1);
01689: yyError = yyResult.select(yyError);
01690: if (yyResult.hasValue()) {
01691: final Node v$el$4 = yyResult
01692: .semanticValue();
01693:
01694: yyOption1 = yyResult.index;
01695: yyOpValue1 = v$el$4;
01696: }
01697: { // Start scope for v$g$4.
01698: final Node v$g$4 = yyOpValue1;
01699:
01700: yyValue = GNode
01701: .create(
01702: "EnumerationTypeDefinition",
01703: v$g$1, v$g$2,
01704: v$g$3, v$g$4);
01705: yyValue
01706: .setLocation(location(yyStart));
01707:
01708: return new SemanticValue(
01709: yyValue, yyOption1,
01710: yyError);
01711: } // End scope for v$g$4.
01712: } else {
01713: yyError = yyError.select(
01714: "\"}\" expected", yyBase);
01715: }
01716: } // End scope for v$pt$5.
01717: }
01718: } else {
01719: yyError = yyError.select("\"{\" expected",
01720: yyBase);
01721: }
01722: } // End scope for v$pt$4.
01723:
01724: // Nested alternative 2.
01725:
01726: yyResult = pIdentifier(yyChoice1);
01727: yyError = yyResult.select(yyError);
01728: if (yyResult.hasValue()) {
01729: final Node v$g$2 = yyResult.semanticValue();
01730:
01731: yyValue = GNode.create("EnumerationTypeReference",
01732: v$g$1, v$g$2);
01733: yyValue.setLocation(location(yyStart));
01734:
01735: return yyResult.createValue(yyValue, yyError);
01736: }
01737: } // End scope for v$pt$2.
01738: }
01739:
01740: // Done.
01741: yyError = yyError.select("enumeration type specifier expected",
01742: yyStart);
01743: return yyError;
01744: }
01745:
01746: // =========================================================================
01747:
01748: /**
01749: * Parse nonterminal xtc.lang.C.EnumeratorList.
01750: *
01751: * @param yyStart The index.
01752: * @return The result.
01753: * @throws IOException Signals an I/O error.
01754: */
01755: private Result pEnumeratorList(final int yyStart)
01756: throws IOException {
01757: Result yyResult;
01758: int yyBase;
01759: int yyRepetition1;
01760: Pair<Node> yyRepValue1;
01761: Node yyValue;
01762: ParseError yyError = ParseError.DUMMY;
01763:
01764: // Alternative <List>.
01765:
01766: yyResult = pEnumerator(yyStart);
01767: yyError = yyResult.select(yyError);
01768: if (yyResult.hasValue()) {
01769: final Node v$g$1 = yyResult.semanticValue();
01770:
01771: yyRepetition1 = yyResult.index;
01772: yyRepValue1 = Pair.empty();
01773: while (true) {
01774:
01775: yyBase = yyRepetition1;
01776: yyResult = pSymbol(yyBase);
01777: yyError = yyResult.select(yyError);
01778: if (yyResult.hasValue()
01779: && ((Node) yyResult.semanticValue())
01780: .getTokenText().equals(",")) {
01781: final Node v$pt$1 = yyResult.semanticValue();
01782:
01783: yyResult = pEnumerator(yyResult.index);
01784: yyError = yyResult.select(yyError);
01785: if (yyResult.hasValue()) {
01786: final Node v$pt$2 = yyResult.semanticValue();
01787: final Node v$el$1 = Formatting.before1(v$pt$1,
01788: v$pt$2);
01789:
01790: yyRepetition1 = yyResult.index;
01791: yyRepValue1 = new Pair<Node>(v$el$1,
01792: yyRepValue1);
01793: continue;
01794: }
01795: } else {
01796: yyError = yyError.select("\",\" expected", yyBase);
01797: }
01798: break;
01799: }
01800: { // Start scope for v$g$2.
01801: final Pair<Node> v$g$2 = yyRepValue1.reverse();
01802:
01803: yyValue = GNode.createFromPair("EnumeratorList", v$g$1,
01804: v$g$2);
01805: yyValue.setLocation(location(yyStart));
01806:
01807: return new SemanticValue(yyValue, yyRepetition1,
01808: yyError);
01809: } // End scope for v$g$2.
01810: }
01811:
01812: // Done.
01813: return yyError;
01814: }
01815:
01816: // =========================================================================
01817:
01818: /**
01819: * Parse nonterminal xtc.lang.C.Enumerator.
01820: *
01821: * @param yyStart The index.
01822: * @return The result.
01823: * @throws IOException Signals an I/O error.
01824: */
01825: private Result pEnumerator(final int yyStart) throws IOException {
01826: Result yyResult;
01827: int yyBase;
01828: int yyOption1;
01829: Node yyOpValue1;
01830: Node yyValue;
01831: ParseError yyError = ParseError.DUMMY;
01832:
01833: // Alternative <Enumerator>.
01834:
01835: yyResult = pIdentifier(yyStart);
01836: yyError = yyResult.select(yyError);
01837: if (yyResult.hasValue()) {
01838: final Node id = yyResult.semanticValue();
01839:
01840: yyState.bind(toText(id), false);
01841:
01842: yyOption1 = yyResult.index;
01843: yyOpValue1 = null;
01844:
01845: yyBase = yyOption1;
01846: yyResult = pSymbol(yyBase);
01847: yyError = yyResult.select(yyError);
01848: if (yyResult.hasValue()
01849: && ((Node) yyResult.semanticValue()).getTokenText()
01850: .equals("=")) {
01851: final Node v$pt$1 = yyResult.semanticValue();
01852:
01853: yyResult = pConditionalExpression(yyResult.index);
01854: yyError = yyResult.select(yyError);
01855: if (yyResult.hasValue()) {
01856: final Node v$pt$2 = yyResult.semanticValue();
01857: final Node v$el$1 = Formatting.before1(v$pt$1,
01858: v$pt$2);
01859:
01860: yyOption1 = yyResult.index;
01861: yyOpValue1 = v$el$1;
01862: }
01863: } else {
01864: yyError = yyError.select("\"=\" expected", yyBase);
01865: }
01866: { // Start scope for v$g$1.
01867: final Node v$g$1 = yyOpValue1;
01868:
01869: yyValue = GNode.create("Enumerator", id, v$g$1);
01870: yyValue.setLocation(location(yyStart));
01871:
01872: return new SemanticValue(yyValue, yyOption1, yyError);
01873: } // End scope for v$g$1.
01874: }
01875:
01876: // Done.
01877: return yyError;
01878: }
01879:
01880: // =========================================================================
01881:
01882: /**
01883: * Parse nonterminal xtc.lang.C.StructureTypeSpecifier.
01884: *
01885: * @param yyStart The index.
01886: * @return The result.
01887: * @throws IOException Signals an I/O error.
01888: */
01889: private Result pStructureTypeSpecifier(final int yyStart)
01890: throws IOException {
01891:
01892: Result yyResult;
01893: int yyBase;
01894: int yyOption1;
01895: Node yyOpValue1;
01896: Node yyValue;
01897: ParseError yyError = ParseError.DUMMY;
01898:
01899: // Alternative 1.
01900:
01901: yyResult = pKeyword(yyStart);
01902: yyError = yyResult.select(yyError);
01903: if (yyResult.hasValue()
01904: && ((Node) yyResult.semanticValue()).getTokenText()
01905: .equals("struct")) {
01906: final Node v$pt$1 = yyResult.semanticValue();
01907:
01908: yyOption1 = yyResult.index;
01909: yyOpValue1 = null;
01910:
01911: yyResult = pAttributeSpecifierList(yyOption1);
01912: yyError = yyResult.select(yyError);
01913: if (yyResult.hasValue()) {
01914: final Node v$el$1 = yyResult.semanticValue();
01915:
01916: yyOption1 = yyResult.index;
01917: yyOpValue1 = v$el$1;
01918: }
01919: { // Start scope for v$pt$2.
01920: final Node v$pt$2 = yyOpValue1;
01921: final Node v$g$1 = Formatting.before1(v$pt$1, v$pt$2);
01922:
01923: final int yyChoice1 = yyOption1;
01924:
01925: // Nested alternative 1.
01926:
01927: yyOption1 = yyChoice1;
01928: yyOpValue1 = null;
01929:
01930: yyResult = pIdentifier(yyOption1);
01931: yyError = yyResult.select(yyError);
01932: if (yyResult.hasValue()) {
01933: final Node v$el$2 = yyResult.semanticValue();
01934:
01935: yyOption1 = yyResult.index;
01936: yyOpValue1 = v$el$2;
01937: }
01938: { // Start scope for v$pt$4.
01939: final Node v$pt$4 = yyOpValue1;
01940:
01941: yyBase = yyOption1;
01942: yyResult = pSymbol(yyBase);
01943: yyError = yyResult.select(yyError);
01944: if (yyResult.hasValue()
01945: && ((Node) yyResult.semanticValue())
01946: .getTokenText().equals("{")) {
01947: final Node v$pt$3 = yyResult.semanticValue();
01948:
01949: yyResult = pPushScope(yyResult.index);
01950: yyError = yyResult.select(yyError);
01951: if (yyResult.hasValue()) {
01952:
01953: yyResult = pEnterStructure(yyResult.index);
01954: yyError = yyResult.select(yyError);
01955: if (yyResult.hasValue()) {
01956: final Node v$g$2 = Formatting.after1(
01957: v$pt$4, v$pt$3);
01958:
01959: yyResult = pStructureDeclarationList(yyResult.index);
01960: yyError = yyResult.select(yyError);
01961: if (yyResult.hasValue()) {
01962: final Node v$pt$6 = yyResult
01963: .semanticValue();
01964:
01965: yyBase = yyResult.index;
01966: yyResult = pSymbol(yyBase);
01967: yyError = yyResult.select(yyError);
01968: if (yyResult.hasValue()
01969: && ((Node) yyResult
01970: .semanticValue())
01971: .getTokenText()
01972: .equals("}")) {
01973: final Node v$pt$5 = yyResult
01974: .semanticValue();
01975:
01976: yyResult = pExitStructure(yyResult.index);
01977: yyError = yyResult
01978: .select(yyError);
01979: if (yyResult.hasValue()) {
01980:
01981: yyResult = pPopScope(yyResult.index);
01982: yyError = yyResult
01983: .select(yyError);
01984: if (yyResult.hasValue()) {
01985: final Node v$g$3 = Formatting
01986: .after1(v$pt$6,
01987: v$pt$5);
01988:
01989: yyOption1 = yyResult.index;
01990: yyOpValue1 = null;
01991:
01992: yyResult = pAttributeSpecifierList(yyOption1);
01993: yyError = yyResult
01994: .select(yyError);
01995: if (yyResult.hasValue()) {
01996: final Node v$el$3 = yyResult
01997: .semanticValue();
01998:
01999: yyOption1 = yyResult.index;
02000: yyOpValue1 = v$el$3;
02001: }
02002: { // Start scope for v$g$4.
02003: final Node v$g$4 = yyOpValue1;
02004:
02005: yyValue = GNode
02006: .create(
02007: "StructureTypeDefinition",
02008: v$g$1,
02009: v$g$2,
02010: v$g$3,
02011: v$g$4);
02012: yyValue
02013: .setLocation(location(yyStart));
02014:
02015: return new SemanticValue(
02016: yyValue,
02017: yyOption1,
02018: yyError);
02019: } // End scope for v$g$4.
02020: }
02021: }
02022: } else {
02023: yyError = yyError.select(
02024: "\"}\" expected",
02025: yyBase);
02026: }
02027: }
02028: }
02029: }
02030: } else {
02031: yyError = yyError.select("\"{\" expected",
02032: yyBase);
02033: }
02034: } // End scope for v$pt$4.
02035:
02036: // Nested alternative 2.
02037:
02038: yyResult = pIdentifier(yyChoice1);
02039: yyError = yyResult.select(yyError);
02040: if (yyResult.hasValue()) {
02041: final Node v$g$2 = yyResult.semanticValue();
02042:
02043: yyValue = GNode.create("StructureTypeReference",
02044: v$g$1, v$g$2);
02045: yyValue.setLocation(location(yyStart));
02046:
02047: return yyResult.createValue(yyValue, yyError);
02048: }
02049: } // End scope for v$pt$2.
02050: }
02051:
02052: // Done.
02053: yyError = yyError.select("structure type specifier expected",
02054: yyStart);
02055: return yyError;
02056: }
02057:
02058: // =========================================================================
02059:
02060: /**
02061: * Parse nonterminal xtc.lang.C.UnionTypeSpecifier.
02062: *
02063: * @param yyStart The index.
02064: * @return The result.
02065: * @throws IOException Signals an I/O error.
02066: */
02067: private Result pUnionTypeSpecifier(final int yyStart)
02068: throws IOException {
02069: Result yyResult;
02070: int yyBase;
02071: int yyOption1;
02072: Node yyOpValue1;
02073: Node yyValue;
02074: ParseError yyError = ParseError.DUMMY;
02075:
02076: // Alternative 1.
02077:
02078: yyResult = pKeyword(yyStart);
02079: yyError = yyResult.select(yyError);
02080: if (yyResult.hasValue()
02081: && ((Node) yyResult.semanticValue()).getTokenText()
02082: .equals("union")) {
02083: final Node v$pt$1 = yyResult.semanticValue();
02084:
02085: yyOption1 = yyResult.index;
02086: yyOpValue1 = null;
02087:
02088: yyResult = pAttributeSpecifierList(yyOption1);
02089: yyError = yyResult.select(yyError);
02090: if (yyResult.hasValue()) {
02091: final Node v$el$1 = yyResult.semanticValue();
02092:
02093: yyOption1 = yyResult.index;
02094: yyOpValue1 = v$el$1;
02095: }
02096: { // Start scope for v$pt$2.
02097: final Node v$pt$2 = yyOpValue1;
02098: final Node v$g$1 = Formatting.before1(v$pt$1, v$pt$2);
02099:
02100: final int yyChoice1 = yyOption1;
02101:
02102: // Nested alternative 1.
02103:
02104: yyOption1 = yyChoice1;
02105: yyOpValue1 = null;
02106:
02107: yyResult = pIdentifier(yyOption1);
02108: yyError = yyResult.select(yyError);
02109: if (yyResult.hasValue()) {
02110: final Node v$el$2 = yyResult.semanticValue();
02111:
02112: yyOption1 = yyResult.index;
02113: yyOpValue1 = v$el$2;
02114: }
02115: { // Start scope for v$pt$4.
02116: final Node v$pt$4 = yyOpValue1;
02117:
02118: yyBase = yyOption1;
02119: yyResult = pSymbol(yyBase);
02120: yyError = yyResult.select(yyError);
02121: if (yyResult.hasValue()
02122: && ((Node) yyResult.semanticValue())
02123: .getTokenText().equals("{")) {
02124: final Node v$pt$3 = yyResult.semanticValue();
02125:
02126: yyResult = pPushScope(yyResult.index);
02127: yyError = yyResult.select(yyError);
02128: if (yyResult.hasValue()) {
02129:
02130: yyResult = pEnterStructure(yyResult.index);
02131: yyError = yyResult.select(yyError);
02132: if (yyResult.hasValue()) {
02133: final Node v$g$2 = Formatting.after1(
02134: v$pt$4, v$pt$3);
02135:
02136: yyResult = pStructureDeclarationList(yyResult.index);
02137: yyError = yyResult.select(yyError);
02138: if (yyResult.hasValue()) {
02139: final Node v$pt$6 = yyResult
02140: .semanticValue();
02141:
02142: yyBase = yyResult.index;
02143: yyResult = pSymbol(yyBase);
02144: yyError = yyResult.select(yyError);
02145: if (yyResult.hasValue()
02146: && ((Node) yyResult
02147: .semanticValue())
02148: .getTokenText()
02149: .equals("}")) {
02150: final Node v$pt$5 = yyResult
02151: .semanticValue();
02152:
02153: yyResult = pExitStructure(yyResult.index);
02154: yyError = yyResult
02155: .select(yyError);
02156: if (yyResult.hasValue()) {
02157:
02158: yyResult = pPopScope(yyResult.index);
02159: yyError = yyResult
02160: .select(yyError);
02161: if (yyResult.hasValue()) {
02162: final Node v$g$3 = Formatting
02163: .after1(v$pt$6,
02164: v$pt$5);
02165:
02166: yyOption1 = yyResult.index;
02167: yyOpValue1 = null;
02168:
02169: yyResult = pAttributeSpecifierList(yyOption1);
02170: yyError = yyResult
02171: .select(yyError);
02172: if (yyResult.hasValue()) {
02173: final Node v$el$3 = yyResult
02174: .semanticValue();
02175:
02176: yyOption1 = yyResult.index;
02177: yyOpValue1 = v$el$3;
02178: }
02179: { // Start scope for v$g$4.
02180: final Node v$g$4 = yyOpValue1;
02181:
02182: yyValue = GNode
02183: .create(
02184: "UnionTypeDefinition",
02185: v$g$1,
02186: v$g$2,
02187: v$g$3,
02188: v$g$4);
02189: yyValue
02190: .setLocation(location(yyStart));
02191:
02192: return new SemanticValue(
02193: yyValue,
02194: yyOption1,
02195: yyError);
02196: } // End scope for v$g$4.
02197: }
02198: }
02199: } else {
02200: yyError = yyError.select(
02201: "\"}\" expected",
02202: yyBase);
02203: }
02204: }
02205: }
02206: }
02207: } else {
02208: yyError = yyError.select("\"{\" expected",
02209: yyBase);
02210: }
02211: } // End scope for v$pt$4.
02212:
02213: // Nested alternative 2.
02214:
02215: yyResult = pIdentifier(yyChoice1);
02216: yyError = yyResult.select(yyError);
02217: if (yyResult.hasValue()) {
02218: final Node v$g$2 = yyResult.semanticValue();
02219:
02220: yyValue = GNode.create("UnionTypeReference", v$g$1,
02221: v$g$2);
02222: yyValue.setLocation(location(yyStart));
02223:
02224: return yyResult.createValue(yyValue, yyError);
02225: }
02226: } // End scope for v$pt$2.
02227: }
02228:
02229: // Done.
02230: yyError = yyError.select("union type specifier expected",
02231: yyStart);
02232: return yyError;
02233: }
02234:
02235: // =========================================================================
02236:
02237: /**
02238: * Parse nonterminal xtc.lang.C.StructureDeclarationList.
02239: *
02240: * @param yyStart The index.
02241: * @return The result.
02242: * @throws IOException Signals an I/O error.
02243: */
02244: private Result pStructureDeclarationList(final int yyStart)
02245: throws IOException {
02246:
02247: Result yyResult;
02248: int yyRepetition1;
02249: boolean yyRepeated1;
02250: Pair<Node> yyRepValue1;
02251: Node yyValue;
02252: ParseError yyError = ParseError.DUMMY;
02253:
02254: // Alternative <Regular>.
02255:
02256: yyRepetition1 = yyStart;
02257: yyRepeated1 = false;
02258: yyRepValue1 = Pair.empty();
02259: while (true) {
02260:
02261: yyResult = pAnnotatedStructureDeclaration(yyRepetition1);
02262: yyError = yyResult.select(yyError);
02263: if (yyResult.hasValue()) {
02264: final Node v$el$1 = yyResult.semanticValue();
02265:
02266: yyRepetition1 = yyResult.index;
02267: yyRepeated1 = true;
02268: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
02269: continue;
02270: }
02271: break;
02272: }
02273:
02274: if (yyRepeated1) {
02275: final Pair<Node> v$g$1 = yyRepValue1.reverse();
02276:
02277: yyResult = pAnnotations(yyRepetition1);
02278: yyError = yyResult.select(yyError);
02279: if (yyResult.hasValue()) {
02280: final Node v$g$2 = yyResult.semanticValue();
02281:
02282: yyValue = GNode.create("StructureDeclarationList",
02283: v$g$1.size() + 1).addAll(v$g$1).add(v$g$2);
02284: yyValue.setLocation(location(yyStart));
02285:
02286: return yyResult.createValue(yyValue, yyError);
02287: }
02288: }
02289:
02290: // Alternative <Empty>.
02291:
02292: if (GCC) {
02293:
02294: yyResult = pAnnotations(yyStart);
02295: yyError = yyResult.select(yyError);
02296: if (yyResult.hasValue()) {
02297: final Node v$g$3 = yyResult.semanticValue();
02298:
02299: yyValue = GNode.create("StructureDeclarationList",
02300: v$g$3);
02301: yyValue.setLocation(location(yyStart));
02302:
02303: return yyResult.createValue(yyValue, yyError);
02304: }
02305: }
02306:
02307: // Done.
02308: yyError = yyError.select("structure declaration list expected",
02309: yyStart);
02310: return yyError;
02311: }
02312:
02313: // =========================================================================
02314:
02315: /**
02316: * Parse nonterminal xtc.lang.C.AnnotatedStructureDeclaration.
02317: *
02318: * @param yyStart The index.
02319: * @return The result.
02320: * @throws IOException Signals an I/O error.
02321: */
02322: private Result pAnnotatedStructureDeclaration(final int yyStart)
02323: throws IOException {
02324:
02325: Result yyResult;
02326: Node yyValue;
02327: ParseError yyError = ParseError.DUMMY;
02328:
02329: // Start a state modification.
02330: yyState.start();
02331:
02332: // Alternative 1.
02333:
02334: yyState.mark();
02335:
02336: yyResult = pStructureDeclaration(yyStart);
02337: yyError = yyResult.select(yyError);
02338: if (yyResult.hasValue()) {
02339: final Node d = yyResult.semanticValue();
02340:
02341: yyValue = yyState.annotate(d);
02342:
02343: // Commit the state modification.
02344: yyState.commit();
02345:
02346: setLocation(yyValue, yyStart);
02347: return yyResult.createValue(yyValue, yyError);
02348: }
02349:
02350: // Abort the state modification.
02351: yyState.abort();
02352:
02353: // Done.
02354: return yyError;
02355: }
02356:
02357: // =========================================================================
02358:
02359: /**
02360: * Parse nonterminal xtc.lang.C.StructureDeclaration.
02361: *
02362: * @param yyStart The index.
02363: * @return The result.
02364: * @throws IOException Signals an I/O error.
02365: */
02366: private Result pStructureDeclaration(final int yyStart)
02367: throws IOException {
02368: Result yyResult;
02369: int yyBase;
02370: int yyRepetition1;
02371: boolean yyRepeated1;
02372: Pair<Node> yyRepValue1;
02373: int yyOption1;
02374: Node yyOpValue1;
02375: Node yyValue;
02376: ParseError yyError = ParseError.DUMMY;
02377:
02378: // Alternative <Declaration>.
02379:
02380: yyOption1 = yyStart;
02381: yyOpValue1 = null;
02382:
02383: yyBase = yyOption1;
02384: yyResult = pKeyword(yyBase);
02385: yyError = yyResult.select(yyError);
02386: if (yyResult.hasValue()
02387: && ((Node) yyResult.semanticValue()).getTokenText()
02388: .equals("__extension__")) {
02389: final Node v$el$1 = yyResult.semanticValue();
02390:
02391: yyOption1 = yyResult.index;
02392: yyOpValue1 = v$el$1;
02393: } else {
02394: yyError = yyError.select("\"__extension__\" expected",
02395: yyBase);
02396: }
02397: { // Start scope for v$g$1.
02398: final Node v$g$1 = yyOpValue1;
02399:
02400: yyResult = pSpecifierQualifierList(yyOption1);
02401: yyError = yyResult.select(yyError);
02402: if (yyResult.hasValue()) {
02403: final Node v$g$2 = yyResult.semanticValue();
02404:
02405: yyResult = pOptionalStructureDeclaratorList(yyResult.index);
02406: yyError = yyResult.select(yyError);
02407: if (yyResult.hasValue()) {
02408: final Node v$pt$4 = yyResult.semanticValue();
02409:
02410: yyBase = yyResult.index;
02411: yyResult = pSymbol(yyBase);
02412: yyError = yyResult.select(yyError);
02413: if (yyResult.hasValue()
02414: && ((Node) yyResult.semanticValue())
02415: .getTokenText().equals(";")) {
02416: final Node v$pt$2 = yyResult.semanticValue();
02417:
02418: yyOption1 = yyResult.index;
02419: yyOpValue1 = null;
02420:
02421: if (GCC) {
02422:
02423: yyRepetition1 = yyOption1;
02424: yyRepeated1 = false;
02425: yyRepValue1 = Pair.empty();
02426: while (true) {
02427:
02428: yyBase = yyRepetition1;
02429: yyResult = pSymbol(yyBase);
02430: yyError = yyResult.select(yyError);
02431: if (yyResult.hasValue()
02432: && ((Node) yyResult
02433: .semanticValue())
02434: .getTokenText().equals(
02435: ";")) {
02436: final Node v$el$3 = yyResult
02437: .semanticValue();
02438:
02439: yyRepetition1 = yyResult.index;
02440: yyRepeated1 = true;
02441: yyRepValue1 = new Pair<Node>(
02442: v$el$3, yyRepValue1);
02443: continue;
02444: } else {
02445: yyError = yyError.select(
02446: "\";\" expected", yyBase);
02447: }
02448: break;
02449: }
02450:
02451: if (yyRepeated1) {
02452: final Pair<Node> v$pt$1 = yyRepValue1
02453: .reverse();
02454: final Node v$el$2 = Formatting.before1(
02455: v$pt$1, null);
02456:
02457: yyOption1 = yyRepetition1;
02458: yyOpValue1 = v$el$2;
02459: }
02460: }
02461: { // Start scope for v$pt$3.
02462: final Node v$pt$3 = yyOpValue1;
02463: final Node v$g$3 = Formatting.variable()
02464: .addNode(v$pt$4).add(v$pt$2).add(
02465: v$pt$3);
02466:
02467: yyValue = GNode.create(
02468: "StructureDeclaration", v$g$1,
02469: v$g$2, v$g$3);
02470: yyValue.setLocation(location(yyStart));
02471:
02472: return new SemanticValue(yyValue,
02473: yyOption1, yyError);
02474: } // End scope for v$pt$3.
02475: } else {
02476: yyError = yyError.select("\";\" expected",
02477: yyBase);
02478: }
02479: }
02480: }
02481: } // End scope for v$g$1.
02482:
02483: // Done.
02484: yyError = yyError.select("structure declaration expected",
02485: yyStart);
02486: return yyError;
02487: }
02488:
02489: // =========================================================================
02490:
02491: /**
02492: * Parse nonterminal xtc.lang.C.SpecifierQualifierList.
02493: *
02494: * @param yyStart The index.
02495: * @return The result.
02496: * @throws IOException Signals an I/O error.
02497: */
02498: private Result pSpecifierQualifierList(final int yyStart)
02499: throws IOException {
02500:
02501: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
02502: if (null == yyColumn.chunk1)
02503: yyColumn.chunk1 = new Chunk1();
02504: if (null == yyColumn.chunk1.fSpecifierQualifierList)
02505: yyColumn.chunk1.fSpecifierQualifierList = pSpecifierQualifierList$1(yyStart);
02506: return yyColumn.chunk1.fSpecifierQualifierList;
02507: }
02508:
02509: /** Actually parse xtc.lang.C.SpecifierQualifierList. */
02510: private Result pSpecifierQualifierList$1(final int yyStart)
02511: throws IOException {
02512:
02513: Result yyResult;
02514: Node yyValue;
02515: ParseError yyError = ParseError.DUMMY;
02516:
02517: // Alternative 1.
02518:
02519: yyResult = pSpecifierQualifierPlus(yyStart);
02520: yyError = yyResult.select(yyError);
02521: if (yyResult.hasValue()) {
02522: final Pair<Node> v$g$1 = yyResult.semanticValue();
02523:
02524: yyValue = GNode.createFromPair("SpecifierQualifierList",
02525: v$g$1);
02526: yyValue.setLocation(location(yyStart));
02527:
02528: return yyResult.createValue(yyValue, yyError);
02529: }
02530:
02531: // Done.
02532: return yyError;
02533: }
02534:
02535: // =========================================================================
02536:
02537: /**
02538: * Parse nonterminal xtc.lang.C.SpecifierQualifierPlus.
02539: *
02540: * @param yyStart The index.
02541: * @return The result.
02542: * @throws IOException Signals an I/O error.
02543: */
02544: private Result pSpecifierQualifierPlus(final int yyStart)
02545: throws IOException {
02546:
02547: Result yyResult;
02548: int yyRepetition1;
02549: boolean yyRepeated1;
02550: Pair<Node> yyRepValue1;
02551: Pair<Node> yyValue;
02552: ParseError yyError = ParseError.DUMMY;
02553:
02554: // Alternative 1.
02555:
02556: yyRepetition1 = yyStart;
02557: yyRepeated1 = false;
02558: yyRepValue1 = Pair.empty();
02559: while (true) {
02560:
02561: yyResult = pSpecifierQualifier(yyRepetition1);
02562: yyError = yyResult.select(yyError);
02563: if (yyResult.hasValue()) {
02564: final Node v$el$1 = yyResult.semanticValue();
02565:
02566: yyRepetition1 = yyResult.index;
02567: yyRepeated1 = true;
02568: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
02569: continue;
02570: }
02571: break;
02572: }
02573:
02574: if (yyRepeated1) {
02575: yyValue = yyRepValue1.reverse();
02576:
02577: return new SemanticValue(yyValue, yyRepetition1, yyError);
02578: }
02579:
02580: // Done.
02581: return yyError;
02582: }
02583:
02584: // =========================================================================
02585:
02586: /**
02587: * Parse nonterminal xtc.lang.C.SpecifierQualifier.
02588: *
02589: * @param yyStart The index.
02590: * @return The result.
02591: * @throws IOException Signals an I/O error.
02592: */
02593: private Result pSpecifierQualifier(final int yyStart)
02594: throws IOException {
02595: Result yyResult;
02596: Node yyValue;
02597: ParseError yyError = ParseError.DUMMY;
02598:
02599: // Alternative <TypeSpecifier>.
02600:
02601: yyResult = pTypeSpecifier(yyStart);
02602: yyError = yyResult.select(yyError);
02603: if (yyResult.hasValue()) {
02604: yyValue = yyResult.semanticValue();
02605:
02606: yyResult = pTypeSpecContext(yyResult.index);
02607: yyError = yyResult.select(yyError);
02608: if (yyResult.hasValue()) {
02609:
02610: return yyResult.createValue(yyValue, yyError);
02611: }
02612: }
02613:
02614: // Alternative <TypeQualifier>.
02615:
02616: yyResult = pTypeQualifier(yyStart);
02617: yyError = yyResult.select(yyError);
02618: if (yyResult.hasValue()) {
02619: yyValue = yyResult.semanticValue();
02620:
02621: return yyResult.createValue(yyValue, yyError);
02622: }
02623:
02624: // Alternative <Attribute>.
02625:
02626: yyResult = pAttributeSpecifier(yyStart);
02627: yyError = yyResult.select(yyError);
02628: if (yyResult.hasValue()) {
02629: yyValue = yyResult.semanticValue();
02630:
02631: return yyResult.createValue(yyValue, yyError);
02632: }
02633:
02634: // Done.
02635: return yyError;
02636: }
02637:
02638: // =========================================================================
02639:
02640: /**
02641: * Parse nonterminal xtc.lang.C.OptionalStructureDeclaratorList.
02642: *
02643: * @param yyStart The index.
02644: * @return The result.
02645: * @throws IOException Signals an I/O error.
02646: */
02647: private Result pOptionalStructureDeclaratorList(final int yyStart)
02648: throws IOException {
02649:
02650: Result yyResult;
02651: Node yyValue;
02652: ParseError yyError = ParseError.DUMMY;
02653:
02654: // Alternative <List>.
02655:
02656: yyResult = pStructureDeclaratorList(yyStart);
02657: yyError = yyResult.select(yyError);
02658: if (yyResult.hasValue()) {
02659: yyValue = yyResult.semanticValue();
02660:
02661: return yyResult.createValue(yyValue, yyError);
02662: }
02663:
02664: // Alternative <Null>.
02665:
02666: if (GCC) {
02667: { // Start scope for yyValue.
02668: yyValue = null;
02669:
02670: return new SemanticValue(yyValue, yyStart, yyError);
02671: } // End scope for yyValue.
02672: }
02673:
02674: // Done.
02675: yyError = yyError.select(
02676: "optional structure declarator list expected", yyStart);
02677: return yyError;
02678: }
02679:
02680: // =========================================================================
02681:
02682: /**
02683: * Parse nonterminal xtc.lang.C.StructureDeclaratorList.
02684: *
02685: * @param yyStart The index.
02686: * @return The result.
02687: * @throws IOException Signals an I/O error.
02688: */
02689: private Result pStructureDeclaratorList(final int yyStart)
02690: throws IOException {
02691:
02692: Result yyResult;
02693: int yyBase;
02694: int yyRepetition1;
02695: Pair<Node> yyRepValue1;
02696: Node yyValue;
02697: ParseError yyError = ParseError.DUMMY;
02698:
02699: // Alternative <List>.
02700:
02701: yyResult = pStructureDeclarator(yyStart);
02702: yyError = yyResult.select(yyError);
02703: if (yyResult.hasValue()) {
02704: final Node v$g$1 = yyResult.semanticValue();
02705:
02706: yyRepetition1 = yyResult.index;
02707: yyRepValue1 = Pair.empty();
02708: while (true) {
02709:
02710: yyBase = yyRepetition1;
02711: yyResult = pSymbol(yyBase);
02712: yyError = yyResult.select(yyError);
02713: if (yyResult.hasValue()
02714: && ((Node) yyResult.semanticValue())
02715: .getTokenText().equals(",")) {
02716: final Node v$pt$1 = yyResult.semanticValue();
02717:
02718: yyResult = pStructureDeclarator(yyResult.index);
02719: yyError = yyResult.select(yyError);
02720: if (yyResult.hasValue()) {
02721: final Node v$pt$2 = yyResult.semanticValue();
02722: final Node v$el$1 = Formatting.before1(v$pt$1,
02723: v$pt$2);
02724:
02725: yyRepetition1 = yyResult.index;
02726: yyRepValue1 = new Pair<Node>(v$el$1,
02727: yyRepValue1);
02728: continue;
02729: }
02730: } else {
02731: yyError = yyError.select("\",\" expected", yyBase);
02732: }
02733: break;
02734: }
02735: { // Start scope for v$g$2.
02736: final Pair<Node> v$g$2 = yyRepValue1.reverse();
02737:
02738: yyValue = GNode.createFromPair(
02739: "StructureDeclaratorList", v$g$1, v$g$2);
02740: yyValue.setLocation(location(yyStart));
02741:
02742: return new SemanticValue(yyValue, yyRepetition1,
02743: yyError);
02744: } // End scope for v$g$2.
02745: }
02746:
02747: // Done.
02748: return yyError;
02749: }
02750:
02751: // =========================================================================
02752:
02753: /**
02754: * Parse nonterminal xtc.lang.C.StructureDeclarator.
02755: *
02756: * @param yyStart The index.
02757: * @return The result.
02758: * @throws IOException Signals an I/O error.
02759: */
02760: private Result pStructureDeclarator(final int yyStart)
02761: throws IOException {
02762: Result yyResult;
02763: int yyBase;
02764: int yyOption1;
02765: Node yyOpValue1;
02766: Node yyValue;
02767: ParseError yyError = ParseError.DUMMY;
02768:
02769: // Alternative 1.
02770:
02771: yyOption1 = yyStart;
02772: yyOpValue1 = null;
02773:
02774: yyResult = pAttributeSpecifierList(yyOption1);
02775: yyError = yyResult.select(yyError);
02776: if (yyResult.hasValue()) {
02777: final Node v$el$1 = yyResult.semanticValue();
02778:
02779: yyOption1 = yyResult.index;
02780: yyOpValue1 = v$el$1;
02781: }
02782: { // Start scope for v$g$1.
02783: final Node v$g$1 = yyOpValue1;
02784:
02785: yyOpValue1 = null;
02786:
02787: yyResult = pDeclarator(yyOption1);
02788: yyError = yyResult.select(yyError);
02789: if (yyResult.hasValue()) {
02790: final Node v$el$2 = yyResult.semanticValue();
02791:
02792: yyOption1 = yyResult.index;
02793: yyOpValue1 = v$el$2;
02794: }
02795: { // Start scope for v$pt$2.
02796: final Node v$pt$2 = yyOpValue1;
02797:
02798: yyBase = yyOption1;
02799: yyResult = pSymbol(yyBase);
02800: yyError = yyResult.select(yyError);
02801: if (yyResult.hasValue()
02802: && ((Node) yyResult.semanticValue())
02803: .getTokenText().equals(":")) {
02804: final Node v$pt$1 = yyResult.semanticValue();
02805: final Node v$g$2 = Formatting
02806: .after1(v$pt$2, v$pt$1);
02807:
02808: yyResult = pConditionalExpression(yyResult.index);
02809: yyError = yyResult.select(yyError);
02810: if (yyResult.hasValue()) {
02811: final Node v$g$3 = yyResult.semanticValue();
02812:
02813: yyOption1 = yyResult.index;
02814: yyOpValue1 = null;
02815:
02816: yyResult = pAttributeSpecifierList(yyOption1);
02817: yyError = yyResult.select(yyError);
02818: if (yyResult.hasValue()) {
02819: final Node v$el$3 = yyResult
02820: .semanticValue();
02821:
02822: yyOption1 = yyResult.index;
02823: yyOpValue1 = v$el$3;
02824: }
02825: { // Start scope for v$g$4.
02826: final Node v$g$4 = yyOpValue1;
02827:
02828: yyValue = GNode.create("BitField", v$g$1,
02829: v$g$2, v$g$3, v$g$4);
02830: yyValue.setLocation(location(yyStart));
02831:
02832: return new SemanticValue(yyValue,
02833: yyOption1, yyError);
02834: } // End scope for v$g$4.
02835: }
02836: } else {
02837: yyError = yyError.select("\":\" expected", yyBase);
02838: }
02839: } // End scope for v$pt$2.
02840: } // End scope for v$g$1.
02841:
02842: // Alternative <Simple>.
02843:
02844: yyResult = pAttributedDeclarator(yyStart);
02845: yyError = yyResult.select(yyError);
02846: if (yyResult.hasValue()) {
02847: yyValue = yyResult.semanticValue();
02848:
02849: return yyResult.createValue(yyValue, yyError);
02850: }
02851:
02852: // Done.
02853: return yyError;
02854: }
02855:
02856: // =========================================================================
02857:
02858: /**
02859: * Parse nonterminal xtc.lang.C.AttributedDeclarator.
02860: *
02861: * @param yyStart The index.
02862: * @return The result.
02863: * @throws IOException Signals an I/O error.
02864: */
02865: private Result pAttributedDeclarator(final int yyStart)
02866: throws IOException {
02867: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
02868: if (null == yyColumn.chunk1)
02869: yyColumn.chunk1 = new Chunk1();
02870: if (null == yyColumn.chunk1.fAttributedDeclarator)
02871: yyColumn.chunk1.fAttributedDeclarator = pAttributedDeclarator$1(yyStart);
02872: return yyColumn.chunk1.fAttributedDeclarator;
02873: }
02874:
02875: /** Actually parse xtc.lang.C.AttributedDeclarator. */
02876: private Result pAttributedDeclarator$1(final int yyStart)
02877: throws IOException {
02878:
02879: Result yyResult;
02880: int yyOption1;
02881: Node yyOpValue1;
02882: Node yyValue;
02883: ParseError yyError = ParseError.DUMMY;
02884:
02885: // Alternative 1.
02886:
02887: yyOption1 = yyStart;
02888: yyOpValue1 = null;
02889:
02890: yyResult = pAttributeSpecifierList(yyOption1);
02891: yyError = yyResult.select(yyError);
02892: if (yyResult.hasValue()) {
02893: final Node v$el$1 = yyResult.semanticValue();
02894:
02895: yyOption1 = yyResult.index;
02896: yyOpValue1 = v$el$1;
02897: }
02898: { // Start scope for v$g$1.
02899: final Node v$g$1 = yyOpValue1;
02900:
02901: yyResult = pDeclarator(yyOption1);
02902: yyError = yyResult.select(yyError);
02903: if (yyResult.hasValue()) {
02904: final Node v$g$2 = yyResult.semanticValue();
02905:
02906: yyOption1 = yyResult.index;
02907: yyOpValue1 = null;
02908:
02909: yyResult = pAttributeSpecifierList(yyOption1);
02910: yyError = yyResult.select(yyError);
02911: if (yyResult.hasValue()) {
02912: final Node v$el$2 = yyResult.semanticValue();
02913:
02914: yyOption1 = yyResult.index;
02915: yyOpValue1 = v$el$2;
02916: }
02917: { // Start scope for v$g$3.
02918: final Node v$g$3 = yyOpValue1;
02919:
02920: yyValue = GNode.create("AttributedDeclarator",
02921: v$g$1, v$g$2, v$g$3);
02922: yyValue.setLocation(location(yyStart));
02923:
02924: return new SemanticValue(yyValue, yyOption1,
02925: yyError);
02926: } // End scope for v$g$3.
02927: }
02928: } // End scope for v$g$1.
02929:
02930: // Done.
02931: return yyError;
02932: }
02933:
02934: // =========================================================================
02935:
02936: /**
02937: * Parse nonterminal xtc.lang.C.Declarator.
02938: *
02939: * @param yyStart The index.
02940: * @return The result.
02941: * @throws IOException Signals an I/O error.
02942: */
02943: private Result pDeclarator(final int yyStart) throws IOException {
02944: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
02945: if (null == yyColumn.chunk1)
02946: yyColumn.chunk1 = new Chunk1();
02947: if (null == yyColumn.chunk1.fDeclarator)
02948: yyColumn.chunk1.fDeclarator = pDeclarator$1(yyStart);
02949: return yyColumn.chunk1.fDeclarator;
02950: }
02951:
02952: /** Actually parse xtc.lang.C.Declarator. */
02953: private Result pDeclarator$1(final int yyStart) throws IOException {
02954: Result yyResult;
02955: Node yyValue;
02956: ParseError yyError = ParseError.DUMMY;
02957:
02958: // Alternative <Pointer>.
02959:
02960: yyResult = pPointerDeclarator(yyStart);
02961: yyError = yyResult.select(yyError);
02962: if (yyResult.hasValue()) {
02963: yyValue = yyResult.semanticValue();
02964:
02965: return yyResult.createValue(yyValue, yyError);
02966: }
02967:
02968: // Alternative <Direct>.
02969:
02970: yyResult = pDirectDeclarator(yyStart);
02971: yyError = yyResult.select(yyError);
02972: if (yyResult.hasValue()) {
02973: yyValue = yyResult.semanticValue();
02974:
02975: return yyResult.createValue(yyValue, yyError);
02976: }
02977:
02978: // Done.
02979: return yyError;
02980: }
02981:
02982: // =========================================================================
02983:
02984: /**
02985: * Parse nonterminal xtc.lang.C.PointerDeclarator.
02986: *
02987: * @param yyStart The index.
02988: * @return The result.
02989: * @throws IOException Signals an I/O error.
02990: */
02991: private Result pPointerDeclarator(final int yyStart)
02992: throws IOException {
02993: Result yyResult;
02994: Node yyValue;
02995: ParseError yyError = ParseError.DUMMY;
02996:
02997: // Alternative 1.
02998:
02999: yyResult = pPointer(yyStart);
03000: yyError = yyResult.select(yyError);
03001: if (yyResult.hasValue()) {
03002: final Node v$g$1 = yyResult.semanticValue();
03003:
03004: yyResult = pDirectDeclarator(yyResult.index);
03005: yyError = yyResult.select(yyError);
03006: if (yyResult.hasValue()) {
03007: final Node v$g$2 = yyResult.semanticValue();
03008:
03009: yyValue = GNode.create("PointerDeclarator", v$g$1,
03010: v$g$2);
03011: yyValue.setLocation(location(yyStart));
03012:
03013: return yyResult.createValue(yyValue, yyError);
03014: }
03015: }
03016:
03017: // Done.
03018: return yyError;
03019: }
03020:
03021: // =========================================================================
03022:
03023: /**
03024: * Parse nonterminal xtc.lang.C.Pointer.
03025: *
03026: * @param yyStart The index.
03027: * @return The result.
03028: * @throws IOException Signals an I/O error.
03029: */
03030: private Result pPointer(final int yyStart) throws IOException {
03031: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
03032: if (null == yyColumn.chunk1)
03033: yyColumn.chunk1 = new Chunk1();
03034: if (null == yyColumn.chunk1.fPointer)
03035: yyColumn.chunk1.fPointer = pPointer$1(yyStart);
03036: return yyColumn.chunk1.fPointer;
03037: }
03038:
03039: /** Actually parse xtc.lang.C.Pointer. */
03040: private Result pPointer$1(final int yyStart) throws IOException {
03041: Result yyResult;
03042: int yyOption1;
03043: Node yyOpValue1;
03044: Node yyValue;
03045: ParseError yyError = ParseError.DUMMY;
03046:
03047: // Alternative 1.
03048:
03049: yyResult = pSymbol(yyStart);
03050: yyError = yyResult.select(yyError);
03051: if (yyResult.hasValue()
03052: && ((Node) yyResult.semanticValue()).getTokenText()
03053: .equals("*")) {
03054: final Node v$pt$1 = yyResult.semanticValue();
03055:
03056: yyResult = pTypeQualifierList(yyResult.index);
03057: yyError = yyResult.select(yyError);
03058: if (yyResult.hasValue()) {
03059: final Node v$pt$2 = yyResult.semanticValue();
03060: final Node v$g$1 = Formatting.before1(v$pt$1, v$pt$2);
03061:
03062: yyOption1 = yyResult.index;
03063: yyOpValue1 = null;
03064:
03065: yyResult = pPointer(yyOption1);
03066: yyError = yyResult.select(yyError);
03067: if (yyResult.hasValue()) {
03068: final Node v$el$1 = yyResult.semanticValue();
03069:
03070: yyOption1 = yyResult.index;
03071: yyOpValue1 = v$el$1;
03072: }
03073: { // Start scope for v$g$2.
03074: final Node v$g$2 = yyOpValue1;
03075:
03076: yyValue = GNode.create("Pointer", v$g$1, v$g$2);
03077: yyValue.setLocation(location(yyStart));
03078:
03079: return new SemanticValue(yyValue, yyOption1,
03080: yyError);
03081: } // End scope for v$g$2.
03082: }
03083: }
03084:
03085: // Done.
03086: yyError = yyError.select("pointer expected", yyStart);
03087: return yyError;
03088: }
03089:
03090: // =========================================================================
03091:
03092: /**
03093: * Parse nonterminal xtc.lang.C.TypeQualifierList.
03094: *
03095: * @param yyStart The index.
03096: * @return The result.
03097: * @throws IOException Signals an I/O error.
03098: */
03099: private Result pTypeQualifierList(final int yyStart)
03100: throws IOException {
03101: Result yyResult;
03102: int yyRepetition1;
03103: Pair<Node> yyRepValue1;
03104: Node yyValue;
03105: ParseError yyError = ParseError.DUMMY;
03106:
03107: // Alternative 1.
03108:
03109: yyRepetition1 = yyStart;
03110: yyRepValue1 = Pair.empty();
03111: while (true) {
03112:
03113: yyResult = pTypeQualifierList$$Choice1(yyRepetition1);
03114: yyError = yyResult.select(yyError);
03115: if (yyResult.hasValue()) {
03116: final Node v$el$1 = yyResult.semanticValue();
03117:
03118: yyRepetition1 = yyResult.index;
03119: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
03120: continue;
03121: }
03122: break;
03123: }
03124: { // Start scope for v$g$1.
03125: final Pair<Node> v$g$1 = yyRepValue1.reverse();
03126:
03127: yyValue = GNode.createFromPair("TypeQualifierList", v$g$1);
03128: yyValue.setLocation(location(yyStart));
03129:
03130: return new SemanticValue(yyValue, yyRepetition1, yyError);
03131: } // End scope for v$g$1.
03132: }
03133:
03134: // =========================================================================
03135:
03136: /**
03137: * Parse synthetic nonterminal xtc.lang.C.TypeQualifierList$$Choice1.
03138: *
03139: * @param yyStart The index.
03140: * @return The result.
03141: * @throws IOException Signals an I/O error.
03142: */
03143: private Result pTypeQualifierList$$Choice1(final int yyStart)
03144: throws IOException {
03145:
03146: Result yyResult;
03147: Node yyValue;
03148: ParseError yyError = ParseError.DUMMY;
03149:
03150: // Alternative 1.
03151:
03152: yyResult = pTypeQualifier(yyStart);
03153: yyError = yyResult.select(yyError);
03154: if (yyResult.hasValue()) {
03155: yyValue = yyResult.semanticValue();
03156:
03157: return yyResult.createValue(yyValue, yyError);
03158: }
03159:
03160: // Alternative 2.
03161:
03162: yyResult = pAttributeSpecifier(yyStart);
03163: yyError = yyResult.select(yyError);
03164: if (yyResult.hasValue()) {
03165: yyValue = yyResult.semanticValue();
03166:
03167: return yyResult.createValue(yyValue, yyError);
03168: }
03169:
03170: // Done.
03171: return yyError;
03172: }
03173:
03174: // =========================================================================
03175:
03176: /**
03177: * Parse nonterminal xtc.lang.C.DirectDeclarator.
03178: *
03179: * @param yyStart The index.
03180: * @return The result.
03181: * @throws IOException Signals an I/O error.
03182: */
03183: private Result pDirectDeclarator(final int yyStart)
03184: throws IOException {
03185: Result yyResult;
03186: int yyBase;
03187: int yyRepetition1;
03188: Pair<Action<Node>> yyRepValue1;
03189: Node yyValue;
03190: ParseError yyError = ParseError.DUMMY;
03191:
03192: // Alternative <FullBase>.
03193:
03194: yyResult = pSymbol(yyStart);
03195: yyError = yyResult.select(yyError);
03196: if (yyResult.hasValue()
03197: && ((Node) yyResult.semanticValue()).getTokenText()
03198: .equals("(")) {
03199: final Node v$pt$12 = yyResult.semanticValue();
03200:
03201: yyResult = pAttributedDeclarator(yyResult.index);
03202: yyError = yyResult.select(yyError);
03203: if (yyResult.hasValue()) {
03204: final Node v$pt$14 = yyResult.semanticValue();
03205:
03206: yyBase = yyResult.index;
03207: yyResult = pSymbol(yyBase);
03208: yyError = yyResult.select(yyError);
03209: if (yyResult.hasValue()
03210: && ((Node) yyResult.semanticValue())
03211: .getTokenText().equals(")")) {
03212: final Node v$pt$13 = yyResult.semanticValue();
03213: final Node v$g$7 = Formatting.round1(v$pt$12,
03214: v$pt$14, v$pt$13);
03215:
03216: yyRepetition1 = yyResult.index;
03217: yyRepValue1 = Pair.empty();
03218: while (true) {
03219:
03220: yyResult = pDirectDeclarator$$Tail1(yyRepetition1);
03221: yyError = yyResult.select(yyError);
03222: if (yyResult.hasValue()) {
03223: final Action<Node> v$8 = yyResult
03224: .semanticValue();
03225:
03226: yyRepetition1 = yyResult.index;
03227: yyRepValue1 = new Pair<Action<Node>>(v$8,
03228: yyRepValue1);
03229: continue;
03230: }
03231: break;
03232: }
03233: { // Start scope for v$9.
03234: final Pair<Action<Node>> v$9 = yyRepValue1
03235: .reverse();
03236:
03237: yyValue = apply(v$9, v$g$7, yyStart);
03238:
03239: return new SemanticValue(yyValue,
03240: yyRepetition1, yyError);
03241: } // End scope for v$9.
03242: } else {
03243: yyError = yyError.select("\")\" expected", yyBase);
03244: }
03245: }
03246: }
03247:
03248: // Alternative <SimpleBase>.
03249:
03250: yyResult = pSimpleDeclarator(yyStart);
03251: yyError = yyResult.select(yyError);
03252: if (yyResult.hasValue()) {
03253: final Node v$g$10 = yyResult.semanticValue();
03254:
03255: yyRepetition1 = yyResult.index;
03256: yyRepValue1 = Pair.empty();
03257: while (true) {
03258:
03259: yyResult = pDirectDeclarator$$Tail1(yyRepetition1);
03260: yyError = yyResult.select(yyError);
03261: if (yyResult.hasValue()) {
03262: final Action<Node> v$11 = yyResult.semanticValue();
03263:
03264: yyRepetition1 = yyResult.index;
03265: yyRepValue1 = new Pair<Action<Node>>(v$11,
03266: yyRepValue1);
03267: continue;
03268: }
03269: break;
03270: }
03271: { // Start scope for v$12.
03272: final Pair<Action<Node>> v$12 = yyRepValue1.reverse();
03273:
03274: yyValue = apply(v$12, v$g$10, yyStart);
03275:
03276: return new SemanticValue(yyValue, yyRepetition1,
03277: yyError);
03278: } // End scope for v$12.
03279: }
03280:
03281: // Done.
03282: yyError = yyError.select("direct declarator expected", yyStart);
03283: return yyError;
03284: }
03285:
03286: // =========================================================================
03287:
03288: /**
03289: * Parse synthetic nonterminal xtc.lang.C.DirectDeclarator$$Tail1.
03290: *
03291: * @param yyStart The index.
03292: * @return The result.
03293: * @throws IOException Signals an I/O error.
03294: */
03295: private Result pDirectDeclarator$$Tail1(final int yyStart)
03296: throws IOException {
03297:
03298: Result yyResult;
03299: int yyBase;
03300: int yyOption1;
03301: Node yyOpValue1;
03302: Action<Node> yyValue;
03303: ParseError yyError = ParseError.DUMMY;
03304:
03305: // Alternative 1.
03306:
03307: yyResult = pSymbol(yyStart);
03308: yyError = yyResult.select(yyError);
03309: if (yyResult.hasValue()
03310: && ((Node) yyResult.semanticValue()).getTokenText()
03311: .equals("(")) {
03312: final Node v$pt$1 = yyResult.semanticValue();
03313:
03314: yyResult = pPushScope(yyResult.index);
03315: yyError = yyResult.select(yyError);
03316: if (yyResult.hasValue()) {
03317:
03318: final int yyChoice1 = yyResult.index;
03319:
03320: // Nested alternative 1.
03321:
03322: yyResult = pParameterTypeList(yyChoice1);
03323: yyError = yyResult.select(yyError);
03324: if (yyResult.hasValue()) {
03325: final Node v$pt$3 = yyResult.semanticValue();
03326:
03327: yyBase = yyResult.index;
03328: yyResult = pSymbol(yyBase);
03329: yyError = yyResult.select(yyError);
03330: if (yyResult.hasValue()
03331: && ((Node) yyResult.semanticValue())
03332: .getTokenText().equals(")")) {
03333: final Node v$pt$2 = yyResult.semanticValue();
03334:
03335: yyResult = pParameterContext(yyResult.index);
03336: yyError = yyResult.select(yyError);
03337: if (yyResult.hasValue()) {
03338: final Node v$g$2 = Formatting.round1(
03339: v$pt$1, v$pt$3, v$pt$2);
03340:
03341: yyValue = new Action<Node>() {
03342: public Node run(Node v$1) {
03343: return GNode.create(
03344: "FunctionDeclarator", v$1,
03345: v$g$2);
03346: }
03347: };
03348:
03349: return yyResult.createValue(yyValue,
03350: yyError);
03351: }
03352: } else {
03353: yyError = yyError.select("\")\" expected",
03354: yyBase);
03355: }
03356: }
03357:
03358: // Nested alternative 2.
03359:
03360: yyOption1 = yyChoice1;
03361: yyOpValue1 = null;
03362:
03363: yyResult = pIdentifierList(yyOption1);
03364: yyError = yyResult.select(yyError);
03365: if (yyResult.hasValue()) {
03366: final Node v$el$1 = yyResult.semanticValue();
03367:
03368: yyOption1 = yyResult.index;
03369: yyOpValue1 = v$el$1;
03370: }
03371: { // Start scope for v$pt$5.
03372: final Node v$pt$5 = yyOpValue1;
03373:
03374: yyBase = yyOption1;
03375: yyResult = pSymbol(yyBase);
03376: yyError = yyResult.select(yyError);
03377: if (yyResult.hasValue()
03378: && ((Node) yyResult.semanticValue())
03379: .getTokenText().equals(")")) {
03380: final Node v$pt$4 = yyResult.semanticValue();
03381:
03382: yyResult = pParameterContext(yyResult.index);
03383: yyError = yyResult.select(yyError);
03384: if (yyResult.hasValue()) {
03385: final Node v$g$3 = Formatting.round1(
03386: v$pt$1, v$pt$5, v$pt$4);
03387:
03388: yyValue = new Action<Node>() {
03389: public Node run(Node v$1) {
03390: return GNode.create(
03391: "FunctionDeclarator", v$1,
03392: v$g$3);
03393: }
03394: };
03395:
03396: return yyResult.createValue(yyValue,
03397: yyError);
03398: }
03399: } else {
03400: yyError = yyError.select("\")\" expected",
03401: yyBase);
03402: }
03403: } // End scope for v$pt$5.
03404: }
03405: }
03406:
03407: // Alternative 2.
03408:
03409: yyResult = pSymbol(yyStart);
03410: yyError = yyResult.select(yyError);
03411: if (yyResult.hasValue()
03412: && ((Node) yyResult.semanticValue()).getTokenText()
03413: .equals("[")) {
03414: final Node v$pt$6 = yyResult.semanticValue();
03415:
03416: yyResult = pArrayQualifierList(yyResult.index);
03417: yyError = yyResult.select(yyError);
03418: if (yyResult.hasValue()) {
03419: final Node v$pt$7 = yyResult.semanticValue();
03420: final Node v$g$4 = Formatting.before1(v$pt$6, v$pt$7);
03421:
03422: final int yyChoice1 = yyResult.index;
03423:
03424: // Nested alternative 1.
03425:
03426: yyOption1 = yyChoice1;
03427: yyOpValue1 = null;
03428:
03429: yyResult = pAssignmentExpression(yyOption1);
03430: yyError = yyResult.select(yyError);
03431: if (yyResult.hasValue()) {
03432: final Node v$el$2 = yyResult.semanticValue();
03433:
03434: yyOption1 = yyResult.index;
03435: yyOpValue1 = v$el$2;
03436: }
03437: { // Start scope for v$pt$9.
03438: final Node v$pt$9 = yyOpValue1;
03439:
03440: yyBase = yyOption1;
03441: yyResult = pSymbol(yyBase);
03442: yyError = yyResult.select(yyError);
03443: if (yyResult.hasValue()
03444: && ((Node) yyResult.semanticValue())
03445: .getTokenText().equals("]")) {
03446: final Node v$pt$8 = yyResult.semanticValue();
03447: final Node v$g$5 = Formatting.after1(v$pt$9,
03448: v$pt$8);
03449:
03450: yyValue = new Action<Node>() {
03451: public Node run(Node v$1) {
03452: return GNode.create("ArrayDeclarator",
03453: v$1, v$g$4, v$g$5);
03454: }
03455: };
03456:
03457: return yyResult.createValue(yyValue, yyError);
03458: } else {
03459: yyError = yyError.select("\"]\" expected",
03460: yyBase);
03461: }
03462: } // End scope for v$pt$9.
03463:
03464: // Nested alternative 2.
03465:
03466: yyResult = pVariableLength(yyChoice1);
03467: yyError = yyResult.select(yyError);
03468: if (yyResult.hasValue()) {
03469: final Node v$pt$11 = yyResult.semanticValue();
03470:
03471: yyBase = yyResult.index;
03472: yyResult = pSymbol(yyBase);
03473: yyError = yyResult.select(yyError);
03474: if (yyResult.hasValue()
03475: && ((Node) yyResult.semanticValue())
03476: .getTokenText().equals("]")) {
03477: final Node v$pt$10 = yyResult.semanticValue();
03478: final Node v$g$6 = Formatting.after1(v$pt$11,
03479: v$pt$10);
03480:
03481: yyValue = new Action<Node>() {
03482: public Node run(Node v$1) {
03483: return GNode.create("ArrayDeclarator",
03484: v$1, v$g$4, v$g$6);
03485: }
03486: };
03487:
03488: return yyResult.createValue(yyValue, yyError);
03489: } else {
03490: yyError = yyError.select("\"]\" expected",
03491: yyBase);
03492: }
03493: }
03494: }
03495: }
03496:
03497: // Done.
03498: yyError = yyError.select("direct declarator expected", yyStart);
03499: return yyError;
03500: }
03501:
03502: // =========================================================================
03503:
03504: /**
03505: * Parse nonterminal xtc.lang.C.VariableLength.
03506: *
03507: * @param yyStart The index.
03508: * @return The result.
03509: * @throws IOException Signals an I/O error.
03510: */
03511: private Result pVariableLength(final int yyStart)
03512: throws IOException {
03513: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
03514: if (null == yyColumn.chunk1)
03515: yyColumn.chunk1 = new Chunk1();
03516: if (null == yyColumn.chunk1.fVariableLength)
03517: yyColumn.chunk1.fVariableLength = pVariableLength$1(yyStart);
03518: return yyColumn.chunk1.fVariableLength;
03519: }
03520:
03521: /** Actually parse xtc.lang.C.VariableLength. */
03522: private Result pVariableLength$1(final int yyStart)
03523: throws IOException {
03524: Result yyResult;
03525: Node yyValue;
03526: ParseError yyError = ParseError.DUMMY;
03527:
03528: // Alternative 1.
03529:
03530: yyResult = pSymbol(yyStart);
03531: yyError = yyResult.select(yyError);
03532: if (yyResult.hasValue()
03533: && ((Node) yyResult.semanticValue()).getTokenText()
03534: .equals("*")) {
03535: final Node v$pt$1 = yyResult.semanticValue();
03536:
03537: yyValue = GNode.create("VariableLength", false);
03538: yyValue.setLocation(location(yyStart));
03539: yyValue = Formatting.after1(yyValue, v$pt$1);
03540:
03541: return yyResult.createValue(yyValue, yyError);
03542: }
03543:
03544: // Done.
03545: yyError = yyError.select("variable length expected", yyStart);
03546: return yyError;
03547: }
03548:
03549: // =========================================================================
03550:
03551: /**
03552: * Parse nonterminal xtc.lang.C.SimpleDeclarator.
03553: *
03554: * @param yyStart The index.
03555: * @return The result.
03556: * @throws IOException Signals an I/O error.
03557: */
03558: private Result pSimpleDeclarator(final int yyStart)
03559: throws IOException {
03560: Result yyResult;
03561: Node yyValue;
03562: ParseError yyError = ParseError.DUMMY;
03563:
03564: // Alternative <Declarator>.
03565:
03566: yyResult = pIdentifier(yyStart);
03567: yyError = yyResult.select(yyError);
03568: if (yyResult.hasValue()) {
03569: final Node id = yyResult.semanticValue();
03570:
03571: yyState.bind(toText(id));
03572:
03573: yyValue = GNode.create("SimpleDeclarator", id);
03574: yyValue.setLocation(location(yyStart));
03575:
03576: return yyResult.createValue(yyValue, yyError);
03577: }
03578:
03579: // Done.
03580: return yyError;
03581: }
03582:
03583: // =========================================================================
03584:
03585: /**
03586: * Parse nonterminal xtc.lang.C.ParameterTypeList.
03587: *
03588: * @param yyStart The index.
03589: * @return The result.
03590: * @throws IOException Signals an I/O error.
03591: */
03592: private Result pParameterTypeList(final int yyStart)
03593: throws IOException {
03594: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
03595: if (null == yyColumn.chunk1)
03596: yyColumn.chunk1 = new Chunk1();
03597: if (null == yyColumn.chunk1.fParameterTypeList)
03598: yyColumn.chunk1.fParameterTypeList = pParameterTypeList$1(yyStart);
03599: return yyColumn.chunk1.fParameterTypeList;
03600: }
03601:
03602: /** Actually parse xtc.lang.C.ParameterTypeList. */
03603: private Result pParameterTypeList$1(final int yyStart)
03604: throws IOException {
03605: Result yyResult;
03606: int yyBase;
03607: int yyOption1;
03608: Node yyOpValue1;
03609: Node yyValue;
03610: ParseError yyError = ParseError.DUMMY;
03611:
03612: // Alternative 1.
03613:
03614: yyResult = pParameterList(yyStart);
03615: yyError = yyResult.select(yyError);
03616: if (yyResult.hasValue()) {
03617: final Node v$g$1 = yyResult.semanticValue();
03618:
03619: yyOption1 = yyResult.index;
03620: yyOpValue1 = null;
03621:
03622: yyBase = yyOption1;
03623: yyResult = pSymbol(yyBase);
03624: yyError = yyResult.select(yyError);
03625: if (yyResult.hasValue()
03626: && ((Node) yyResult.semanticValue()).getTokenText()
03627: .equals(",")) {
03628: final Node v$pt$1 = yyResult.semanticValue();
03629:
03630: yyBase = yyResult.index;
03631: yyResult = pSymbol(yyBase);
03632: yyError = yyResult.select(yyError);
03633: if (yyResult.hasValue()
03634: && ((Node) yyResult.semanticValue())
03635: .getTokenText().equals("...")) {
03636: final Node v$pt$2 = yyResult.semanticValue();
03637: final Node v$el$1 = Formatting.before1(v$pt$1,
03638: v$pt$2);
03639:
03640: yyOption1 = yyResult.index;
03641: yyOpValue1 = v$el$1;
03642: } else {
03643: yyError = yyError
03644: .select("\"...\" expected", yyBase);
03645: }
03646: } else {
03647: yyError = yyError.select("\",\" expected", yyBase);
03648: }
03649: { // Start scope for v$g$2.
03650: final Node v$g$2 = yyOpValue1;
03651:
03652: yyValue = GNode.create("ParameterTypeList", v$g$1,
03653: v$g$2);
03654: yyValue.setLocation(location(yyStart));
03655:
03656: return new SemanticValue(yyValue, yyOption1, yyError);
03657: } // End scope for v$g$2.
03658: }
03659:
03660: // Done.
03661: return yyError;
03662: }
03663:
03664: // =========================================================================
03665:
03666: /**
03667: * Parse nonterminal xtc.lang.C.ParameterList.
03668: *
03669: * @param yyStart The index.
03670: * @return The result.
03671: * @throws IOException Signals an I/O error.
03672: */
03673: private Result pParameterList(final int yyStart) throws IOException {
03674: Result yyResult;
03675: int yyBase;
03676: int yyRepetition1;
03677: Pair<Node> yyRepValue1;
03678: Node yyValue;
03679: ParseError yyError = ParseError.DUMMY;
03680:
03681: // Alternative 1.
03682:
03683: yyResult = pParameterDeclaration(yyStart);
03684: yyError = yyResult.select(yyError);
03685: if (yyResult.hasValue()) {
03686: final Node v$g$1 = yyResult.semanticValue();
03687:
03688: yyRepetition1 = yyResult.index;
03689: yyRepValue1 = Pair.empty();
03690: while (true) {
03691:
03692: yyBase = yyRepetition1;
03693: yyResult = pSymbol(yyBase);
03694: yyError = yyResult.select(yyError);
03695: if (yyResult.hasValue()
03696: && ((Node) yyResult.semanticValue())
03697: .getTokenText().equals(",")) {
03698: final Node v$pt$1 = yyResult.semanticValue();
03699:
03700: yyResult = pParameterDeclaration(yyResult.index);
03701: yyError = yyResult.select(yyError);
03702: if (yyResult.hasValue()) {
03703: final Node v$pt$2 = yyResult.semanticValue();
03704: final Node v$el$1 = Formatting.before1(v$pt$1,
03705: v$pt$2);
03706:
03707: yyRepetition1 = yyResult.index;
03708: yyRepValue1 = new Pair<Node>(v$el$1,
03709: yyRepValue1);
03710: continue;
03711: }
03712: } else {
03713: yyError = yyError.select("\",\" expected", yyBase);
03714: }
03715: break;
03716: }
03717: { // Start scope for v$g$2.
03718: final Pair<Node> v$g$2 = yyRepValue1.reverse();
03719:
03720: yyValue = GNode.createFromPair("ParameterList", v$g$1,
03721: v$g$2);
03722: yyValue.setLocation(location(yyStart));
03723:
03724: return new SemanticValue(yyValue, yyRepetition1,
03725: yyError);
03726: } // End scope for v$g$2.
03727: }
03728:
03729: // Done.
03730: return yyError;
03731: }
03732:
03733: // =========================================================================
03734:
03735: /**
03736: * Parse nonterminal xtc.lang.C.ParameterDeclaration.
03737: *
03738: * @param yyStart The index.
03739: * @return The result.
03740: * @throws IOException Signals an I/O error.
03741: */
03742: private Result pParameterDeclaration(final int yyStart)
03743: throws IOException {
03744: Result yyResult;
03745: int yyOption1;
03746: Node yyOpValue1;
03747: Node yyValue;
03748: ParseError yyError = ParseError.DUMMY;
03749:
03750: // Start a state modification.
03751: yyState.start();
03752:
03753: // Alternative 1.
03754:
03755: yyResult = pDeclarationSpecifiers(yyStart);
03756: yyError = yyResult.select(yyError);
03757: if (yyResult.hasValue()) {
03758: final Node v$g$1 = yyResult.semanticValue();
03759:
03760: final int yyChoice1 = yyResult.index;
03761:
03762: // Nested alternative 1.
03763:
03764: yyResult = pDeclarator(yyChoice1);
03765: yyError = yyResult.select(yyError);
03766: if (yyResult.hasValue()) {
03767: final Node v$g$2 = yyResult.semanticValue();
03768:
03769: yyOption1 = yyResult.index;
03770: yyOpValue1 = null;
03771:
03772: yyResult = pAttributeSpecifierList(yyOption1);
03773: yyError = yyResult.select(yyError);
03774: if (yyResult.hasValue()) {
03775: final Node v$el$1 = yyResult.semanticValue();
03776:
03777: yyOption1 = yyResult.index;
03778: yyOpValue1 = v$el$1;
03779: }
03780: { // Start scope for v$g$3.
03781: final Node v$g$3 = yyOpValue1;
03782:
03783: yyValue = GNode.create("ParameterDeclaration",
03784: v$g$1, v$g$2, v$g$3);
03785: yyValue.setLocation(location(yyStart));
03786:
03787: // Commit the state modification.
03788: yyState.commit();
03789:
03790: return new SemanticValue(yyValue, yyOption1,
03791: yyError);
03792: } // End scope for v$g$3.
03793: }
03794:
03795: // Nested alternative 2.
03796:
03797: yyOption1 = yyChoice1;
03798: yyOpValue1 = null;
03799:
03800: yyResult = pAbstractDeclarator(yyOption1);
03801: yyError = yyResult.select(yyError);
03802: if (yyResult.hasValue()) {
03803: final Node v$el$2 = yyResult.semanticValue();
03804:
03805: yyOption1 = yyResult.index;
03806: yyOpValue1 = v$el$2;
03807: }
03808: { // Start scope for v$g$4.
03809: final Node v$g$4 = yyOpValue1;
03810:
03811: yyOpValue1 = null;
03812:
03813: yyResult = pAttributeSpecifierList(yyOption1);
03814: yyError = yyResult.select(yyError);
03815: if (yyResult.hasValue()) {
03816: final Node v$el$3 = yyResult.semanticValue();
03817:
03818: yyOption1 = yyResult.index;
03819: yyOpValue1 = v$el$3;
03820: }
03821: { // Start scope for v$g$5.
03822: final Node v$g$5 = yyOpValue1;
03823:
03824: yyValue = GNode.create("ParameterDeclaration",
03825: v$g$1, v$g$4, v$g$5);
03826: yyValue.setLocation(location(yyStart));
03827:
03828: // Commit the state modification.
03829: yyState.commit();
03830:
03831: return new SemanticValue(yyValue, yyOption1,
03832: yyError);
03833: } // End scope for v$g$5.
03834: } // End scope for v$g$4.
03835: }
03836:
03837: // Abort the state modification.
03838: yyState.abort();
03839:
03840: // Done.
03841: return yyError;
03842: }
03843:
03844: // =========================================================================
03845:
03846: /**
03847: * Parse nonterminal xtc.lang.C.AttributedAbstractDeclarator.
03848: *
03849: * @param yyStart The index.
03850: * @return The result.
03851: * @throws IOException Signals an I/O error.
03852: */
03853: private Result pAttributedAbstractDeclarator(final int yyStart)
03854: throws IOException {
03855:
03856: Result yyResult;
03857: int yyOption1;
03858: Node yyOpValue1;
03859: Node yyValue;
03860: ParseError yyError = ParseError.DUMMY;
03861:
03862: // Alternative 1.
03863:
03864: yyOption1 = yyStart;
03865: yyOpValue1 = null;
03866:
03867: yyResult = pAttributeSpecifierList(yyOption1);
03868: yyError = yyResult.select(yyError);
03869: if (yyResult.hasValue()) {
03870: final Node v$el$1 = yyResult.semanticValue();
03871:
03872: yyOption1 = yyResult.index;
03873: yyOpValue1 = v$el$1;
03874: }
03875: { // Start scope for v$g$1.
03876: final Node v$g$1 = yyOpValue1;
03877:
03878: yyResult = pAbstractDeclarator(yyOption1);
03879: yyError = yyResult.select(yyError);
03880: if (yyResult.hasValue()) {
03881: final Node v$g$2 = yyResult.semanticValue();
03882:
03883: yyValue = GNode.create("AttributedAbstractDeclarator",
03884: v$g$1, v$g$2);
03885: yyValue.setLocation(location(yyStart));
03886:
03887: return yyResult.createValue(yyValue, yyError);
03888: }
03889: } // End scope for v$g$1.
03890:
03891: // Done.
03892: return yyError;
03893: }
03894:
03895: // =========================================================================
03896:
03897: /**
03898: * Parse nonterminal xtc.lang.C.AbstractDeclarator.
03899: *
03900: * @param yyStart The index.
03901: * @return The result.
03902: * @throws IOException Signals an I/O error.
03903: */
03904: private Result pAbstractDeclarator(final int yyStart)
03905: throws IOException {
03906: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
03907: if (null == yyColumn.chunk1)
03908: yyColumn.chunk1 = new Chunk1();
03909: if (null == yyColumn.chunk1.fAbstractDeclarator)
03910: yyColumn.chunk1.fAbstractDeclarator = pAbstractDeclarator$1(yyStart);
03911: return yyColumn.chunk1.fAbstractDeclarator;
03912: }
03913:
03914: /** Actually parse xtc.lang.C.AbstractDeclarator. */
03915: private Result pAbstractDeclarator$1(final int yyStart)
03916: throws IOException {
03917: Result yyResult;
03918: int yyOption1;
03919: Node yyOpValue1;
03920: Node yyValue;
03921: ParseError yyError = ParseError.DUMMY;
03922:
03923: // Alternative 1.
03924:
03925: yyOption1 = yyStart;
03926: yyOpValue1 = null;
03927:
03928: yyResult = pPointer(yyOption1);
03929: yyError = yyResult.select(yyError);
03930: if (yyResult.hasValue()) {
03931: final Node v$el$1 = yyResult.semanticValue();
03932:
03933: yyOption1 = yyResult.index;
03934: yyOpValue1 = v$el$1;
03935: }
03936: { // Start scope for p.
03937: final Node p = yyOpValue1;
03938:
03939: yyResult = pDirectAbstractDeclarator(yyOption1);
03940: yyError = yyResult.select(yyError);
03941: if (yyResult.hasValue()) {
03942: final Node d = yyResult.semanticValue();
03943:
03944: if ((null != p) || (null != d)) {
03945:
03946: yyValue = GNode.create("AbstractDeclarator", p, d);
03947: yyValue.setLocation(location(yyStart));
03948:
03949: return yyResult.createValue(yyValue, yyError);
03950: }
03951: }
03952: } // End scope for p.
03953:
03954: // Done.
03955: yyError = yyError.select("abstract declarator expected",
03956: yyStart);
03957: return yyError;
03958: }
03959:
03960: // =========================================================================
03961:
03962: /**
03963: * Parse nonterminal xtc.lang.C.DirectAbstractDeclarator.
03964: *
03965: * @param yyStart The index.
03966: * @return The result.
03967: * @throws IOException Signals an I/O error.
03968: */
03969: private Result pDirectAbstractDeclarator(final int yyStart)
03970: throws IOException {
03971:
03972: Result yyResult;
03973: int yyBase;
03974: int yyRepetition1;
03975: Pair<Action<Node>> yyRepValue1;
03976: Node yyValue;
03977: ParseError yyError = ParseError.DUMMY;
03978:
03979: // Alternative <Parenthesized>.
03980:
03981: yyResult = pSymbol(yyStart);
03982: yyError = yyResult.select(yyError);
03983: if (yyResult.hasValue()
03984: && ((Node) yyResult.semanticValue()).getTokenText()
03985: .equals("(")) {
03986: final Node v$pt$7 = yyResult.semanticValue();
03987:
03988: yyResult = pAttributedAbstractDeclarator(yyResult.index);
03989: yyError = yyResult.select(yyError);
03990: if (yyResult.hasValue()) {
03991: final Node v$pt$9 = yyResult.semanticValue();
03992:
03993: yyBase = yyResult.index;
03994: yyResult = pSymbol(yyBase);
03995: yyError = yyResult.select(yyError);
03996: if (yyResult.hasValue()
03997: && ((Node) yyResult.semanticValue())
03998: .getTokenText().equals(")")) {
03999: final Node v$pt$8 = yyResult.semanticValue();
04000: final Node v$g$7 = Formatting.round1(v$pt$7,
04001: v$pt$9, v$pt$8);
04002:
04003: yyRepetition1 = yyResult.index;
04004: yyRepValue1 = Pair.empty();
04005: while (true) {
04006:
04007: yyResult = pDirectAbstractDeclarator$$Tail1(yyRepetition1);
04008: yyError = yyResult.select(yyError);
04009: if (yyResult.hasValue()) {
04010: final Action<Node> v$8 = yyResult
04011: .semanticValue();
04012:
04013: yyRepetition1 = yyResult.index;
04014: yyRepValue1 = new Pair<Action<Node>>(v$8,
04015: yyRepValue1);
04016: continue;
04017: }
04018: break;
04019: }
04020: { // Start scope for v$9.
04021: final Pair<Action<Node>> v$9 = yyRepValue1
04022: .reverse();
04023:
04024: yyValue = apply(v$9, v$g$7, yyStart);
04025:
04026: return new SemanticValue(yyValue,
04027: yyRepetition1, yyError);
04028: } // End scope for v$9.
04029: } else {
04030: yyError = yyError.select("\")\" expected", yyBase);
04031: }
04032: }
04033: }
04034:
04035: // Alternative <Empty>.
04036:
04037: yyRepetition1 = yyStart;
04038: yyRepValue1 = Pair.empty();
04039: while (true) {
04040:
04041: yyResult = pDirectAbstractDeclarator$$Tail1(yyRepetition1);
04042: yyError = yyResult.select(yyError);
04043: if (yyResult.hasValue()) {
04044: final Action<Node> v$11 = yyResult.semanticValue();
04045:
04046: yyRepetition1 = yyResult.index;
04047: yyRepValue1 = new Pair<Action<Node>>(v$11, yyRepValue1);
04048: continue;
04049: }
04050: break;
04051: }
04052: { // Start scope for v$12.
04053: final Pair<Action<Node>> v$12 = yyRepValue1.reverse();
04054:
04055: yyValue = apply(v$12, null, yyStart);
04056:
04057: return new SemanticValue(yyValue, yyRepetition1, yyError);
04058: } // End scope for v$12.
04059: }
04060:
04061: // =========================================================================
04062:
04063: /**
04064: * Parse synthetic nonterminal xtc.lang.C.DirectAbstractDeclarator$$Tail1.
04065: *
04066: * @param yyStart The index.
04067: * @return The result.
04068: * @throws IOException Signals an I/O error.
04069: */
04070: private Result pDirectAbstractDeclarator$$Tail1(final int yyStart)
04071: throws IOException {
04072:
04073: Result yyResult;
04074: int yyBase;
04075: int yyOption1;
04076: Node yyOpValue1;
04077: Action<Node> yyValue;
04078: ParseError yyError = ParseError.DUMMY;
04079:
04080: // Alternative 1.
04081:
04082: yyResult = pSymbol(yyStart);
04083: yyError = yyResult.select(yyError);
04084: if (yyResult.hasValue()
04085: && ((Node) yyResult.semanticValue()).getTokenText()
04086: .equals("[")) {
04087: final Node v$g$2 = yyResult.semanticValue();
04088:
04089: final int yyChoice1 = yyResult.index;
04090:
04091: // Nested alternative 1.
04092:
04093: yyOption1 = yyChoice1;
04094: yyOpValue1 = null;
04095:
04096: yyResult = pAssignmentExpression(yyOption1);
04097: yyError = yyResult.select(yyError);
04098: if (yyResult.hasValue()) {
04099: final Node v$el$1 = yyResult.semanticValue();
04100:
04101: yyOption1 = yyResult.index;
04102: yyOpValue1 = v$el$1;
04103: }
04104: { // Start scope for v$pt$2.
04105: final Node v$pt$2 = yyOpValue1;
04106:
04107: yyBase = yyOption1;
04108: yyResult = pSymbol(yyBase);
04109: yyError = yyResult.select(yyError);
04110: if (yyResult.hasValue()
04111: && ((Node) yyResult.semanticValue())
04112: .getTokenText().equals("]")) {
04113: final Node v$pt$1 = yyResult.semanticValue();
04114: final Node v$g$3 = Formatting
04115: .after1(v$pt$2, v$pt$1);
04116:
04117: yyValue = new Action<Node>() {
04118: public Node run(Node v$1) {
04119: return GNode.create(
04120: "DirectAbstractDeclarator", v$1,
04121: v$g$2, v$g$3);
04122: }
04123: };
04124:
04125: return yyResult.createValue(yyValue, yyError);
04126: } else {
04127: yyError = yyError.select("\"]\" expected", yyBase);
04128: }
04129: } // End scope for v$pt$2.
04130:
04131: // Nested alternative 2.
04132:
04133: yyResult = pVariableLength(yyChoice1);
04134: yyError = yyResult.select(yyError);
04135: if (yyResult.hasValue()) {
04136: final Node v$pt$4 = yyResult.semanticValue();
04137:
04138: yyBase = yyResult.index;
04139: yyResult = pSymbol(yyBase);
04140: yyError = yyResult.select(yyError);
04141: if (yyResult.hasValue()
04142: && ((Node) yyResult.semanticValue())
04143: .getTokenText().equals("]")) {
04144: final Node v$pt$3 = yyResult.semanticValue();
04145: final Node v$g$4 = Formatting
04146: .after1(v$pt$4, v$pt$3);
04147:
04148: yyValue = new Action<Node>() {
04149: public Node run(Node v$1) {
04150: return GNode.create(
04151: "DirectAbstractDeclarator", v$1,
04152: v$g$2, v$g$4);
04153: }
04154: };
04155:
04156: return yyResult.createValue(yyValue, yyError);
04157: } else {
04158: yyError = yyError.select("\"]\" expected", yyBase);
04159: }
04160: }
04161: }
04162:
04163: // Alternative 2.
04164:
04165: yyResult = pSymbol(yyStart);
04166: yyError = yyResult.select(yyError);
04167: if (yyResult.hasValue()
04168: && ((Node) yyResult.semanticValue()).getTokenText()
04169: .equals("(")) {
04170: final Node v$g$5 = yyResult.semanticValue();
04171:
04172: yyOption1 = yyResult.index;
04173: yyOpValue1 = null;
04174:
04175: yyResult = pParameterTypeList(yyOption1);
04176: yyError = yyResult.select(yyError);
04177: if (yyResult.hasValue()) {
04178: final Node v$el$2 = yyResult.semanticValue();
04179:
04180: yyOption1 = yyResult.index;
04181: yyOpValue1 = v$el$2;
04182: }
04183: { // Start scope for v$pt$6.
04184: final Node v$pt$6 = yyOpValue1;
04185:
04186: yyBase = yyOption1;
04187: yyResult = pSymbol(yyBase);
04188: yyError = yyResult.select(yyError);
04189: if (yyResult.hasValue()
04190: && ((Node) yyResult.semanticValue())
04191: .getTokenText().equals(")")) {
04192: final Node v$pt$5 = yyResult.semanticValue();
04193: final Node v$g$6 = Formatting
04194: .after1(v$pt$6, v$pt$5);
04195:
04196: yyValue = new Action<Node>() {
04197: public Node run(Node v$1) {
04198: return GNode.create(
04199: "DirectAbstractDeclarator", v$1,
04200: v$g$5, v$g$6);
04201: }
04202: };
04203:
04204: return yyResult.createValue(yyValue, yyError);
04205: } else {
04206: yyError = yyError.select("\")\" expected", yyBase);
04207: }
04208: } // End scope for v$pt$6.
04209: }
04210:
04211: // Done.
04212: yyError = yyError.select("direct abstract declarator expected",
04213: yyStart);
04214: return yyError;
04215: }
04216:
04217: // =========================================================================
04218:
04219: /**
04220: * Parse nonterminal xtc.lang.C.IdentifierList.
04221: *
04222: * @param yyStart The index.
04223: * @return The result.
04224: * @throws IOException Signals an I/O error.
04225: */
04226: private Result pIdentifierList(final int yyStart)
04227: throws IOException {
04228: Result yyResult;
04229: int yyBase;
04230: int yyRepetition1;
04231: Pair<Node> yyRepValue1;
04232: Node yyValue;
04233: ParseError yyError = ParseError.DUMMY;
04234:
04235: // Alternative 1.
04236:
04237: yyResult = pIdentifier(yyStart);
04238: yyError = yyResult.select(yyError);
04239: if (yyResult.hasValue()) {
04240: final Node id1 = yyResult.semanticValue();
04241:
04242: yyState.bind(toText(id1));
04243:
04244: yyRepetition1 = yyResult.index;
04245: yyRepValue1 = Pair.empty();
04246: while (true) {
04247:
04248: yyBase = yyRepetition1;
04249: yyResult = pSymbol(yyBase);
04250: yyError = yyResult.select(yyError);
04251: if (yyResult.hasValue()
04252: && ((Node) yyResult.semanticValue())
04253: .getTokenText().equals(",")) {
04254: final Node v$pt$1 = yyResult.semanticValue();
04255:
04256: yyResult = pIdentifier(yyResult.index);
04257: yyError = yyResult.select(yyError);
04258: if (yyResult.hasValue()) {
04259: final Node id2 = yyResult.semanticValue();
04260:
04261: yyState.bind(toText(id2));
04262: final Node v$el$1 = Formatting.before1(v$pt$1,
04263: id2);
04264:
04265: yyRepetition1 = yyResult.index;
04266: yyRepValue1 = new Pair<Node>(v$el$1,
04267: yyRepValue1);
04268: continue;
04269: }
04270: } else {
04271: yyError = yyError.select("\",\" expected", yyBase);
04272: }
04273: break;
04274: }
04275: { // Start scope for v$g$1.
04276: final Pair<Node> v$g$1 = yyRepValue1.reverse();
04277:
04278: yyValue = GNode.createFromPair("IdentifierList", id1,
04279: v$g$1);
04280: yyValue.setLocation(location(yyStart));
04281:
04282: return new SemanticValue(yyValue, yyRepetition1,
04283: yyError);
04284: } // End scope for v$g$1.
04285: }
04286:
04287: // Done.
04288: return yyError;
04289: }
04290:
04291: // =========================================================================
04292:
04293: /**
04294: * Parse nonterminal xtc.lang.C.ArrayQualifierList.
04295: *
04296: * @param yyStart The index.
04297: * @return The result.
04298: * @throws IOException Signals an I/O error.
04299: */
04300: private Result pArrayQualifierList(final int yyStart)
04301: throws IOException {
04302: Result yyResult;
04303: int yyRepetition1;
04304: Pair<Node> yyRepValue1;
04305: Node yyValue;
04306: ParseError yyError = ParseError.DUMMY;
04307:
04308: // Alternative 1.
04309:
04310: yyRepetition1 = yyStart;
04311: yyRepValue1 = Pair.empty();
04312: while (true) {
04313:
04314: yyResult = pArrayQualifierList$$Choice1(yyRepetition1);
04315: yyError = yyResult.select(yyError);
04316: if (yyResult.hasValue()) {
04317: final Node v$el$1 = yyResult.semanticValue();
04318:
04319: yyRepetition1 = yyResult.index;
04320: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
04321: continue;
04322: }
04323: break;
04324: }
04325: { // Start scope for v$g$1.
04326: final Pair<Node> v$g$1 = yyRepValue1.reverse();
04327:
04328: yyValue = GNode.createFromPair("ArrayQualifierList", v$g$1);
04329: yyValue.setLocation(location(yyStart));
04330:
04331: return new SemanticValue(yyValue, yyRepetition1, yyError);
04332: } // End scope for v$g$1.
04333: }
04334:
04335: // =========================================================================
04336:
04337: /**
04338: * Parse synthetic nonterminal xtc.lang.C.ArrayQualifierList$$Choice1.
04339: *
04340: * @param yyStart The index.
04341: * @return The result.
04342: * @throws IOException Signals an I/O error.
04343: */
04344: private Result pArrayQualifierList$$Choice1(final int yyStart)
04345: throws IOException {
04346:
04347: Result yyResult;
04348: Node yyValue;
04349: ParseError yyError = ParseError.DUMMY;
04350:
04351: // Alternative 1.
04352:
04353: yyResult = pKeyword(yyStart);
04354: yyError = yyResult.select(yyError);
04355: if (yyResult.hasValue()
04356: && ((Node) yyResult.semanticValue()).getTokenText()
04357: .equals("static")) {
04358: final Node v$pt$1 = yyResult.semanticValue();
04359:
04360: yyValue = GNode.create("StaticSpecifier", false);
04361: yyValue.setLocation(location(yyStart));
04362: yyValue = Formatting.after1(yyValue, v$pt$1);
04363:
04364: return yyResult.createValue(yyValue, yyError);
04365: }
04366:
04367: // Alternative 2.
04368:
04369: yyResult = pKeyword(yyStart);
04370: yyError = yyResult.select(yyError);
04371: if (yyResult.hasValue()
04372: && ((Node) yyResult.semanticValue()).getTokenText()
04373: .equals("volatile")) {
04374: final Node v$g$1 = yyResult.semanticValue();
04375:
04376: yyValue = GNode.create("VolatileQualifier", v$g$1);
04377: yyValue.setLocation(location(yyStart));
04378:
04379: return yyResult.createValue(yyValue, yyError);
04380: }
04381:
04382: // Alternative 3.
04383:
04384: yyResult = pKeyword(yyStart);
04385: yyError = yyResult.select(yyError);
04386: if (yyResult.hasValue()
04387: && ((Node) yyResult.semanticValue()).getTokenText()
04388: .equals("__volatile")) {
04389: final Node v$g$2 = yyResult.semanticValue();
04390:
04391: yyValue = GNode.create("VolatileQualifier", v$g$2);
04392: yyValue.setLocation(location(yyStart));
04393:
04394: return yyResult.createValue(yyValue, yyError);
04395: }
04396:
04397: // Alternative 4.
04398:
04399: yyResult = pKeyword(yyStart);
04400: yyError = yyResult.select(yyError);
04401: if (yyResult.hasValue()
04402: && ((Node) yyResult.semanticValue()).getTokenText()
04403: .equals("__volatile__")) {
04404: final Node v$g$3 = yyResult.semanticValue();
04405:
04406: yyValue = GNode.create("VolatileQualifier", v$g$3);
04407: yyValue.setLocation(location(yyStart));
04408:
04409: return yyResult.createValue(yyValue, yyError);
04410: }
04411:
04412: // Alternative 5.
04413:
04414: yyResult = pKeyword(yyStart);
04415: yyError = yyResult.select(yyError);
04416: if (yyResult.hasValue()
04417: && ((Node) yyResult.semanticValue()).getTokenText()
04418: .equals("restrict")) {
04419: final Node v$g$1 = yyResult.semanticValue();
04420:
04421: yyValue = GNode.create("RestrictQualifier", v$g$1);
04422: yyValue.setLocation(location(yyStart));
04423:
04424: return yyResult.createValue(yyValue, yyError);
04425: }
04426:
04427: // Alternative 6.
04428:
04429: yyResult = pKeyword(yyStart);
04430: yyError = yyResult.select(yyError);
04431: if (yyResult.hasValue()
04432: && ((Node) yyResult.semanticValue()).getTokenText()
04433: .equals("__restrict")) {
04434: final Node v$g$2 = yyResult.semanticValue();
04435:
04436: yyValue = GNode.create("RestrictQualifier", v$g$2);
04437: yyValue.setLocation(location(yyStart));
04438:
04439: return yyResult.createValue(yyValue, yyError);
04440: }
04441:
04442: // Alternative 7.
04443:
04444: yyResult = pKeyword(yyStart);
04445: yyError = yyResult.select(yyError);
04446: if (yyResult.hasValue()
04447: && ((Node) yyResult.semanticValue()).getTokenText()
04448: .equals("__restrict__")) {
04449: final Node v$g$3 = yyResult.semanticValue();
04450:
04451: yyValue = GNode.create("RestrictQualifier", v$g$3);
04452: yyValue.setLocation(location(yyStart));
04453:
04454: return yyResult.createValue(yyValue, yyError);
04455: }
04456:
04457: // Alternative 8.
04458:
04459: yyResult = pKeyword(yyStart);
04460: yyError = yyResult.select(yyError);
04461: if (yyResult.hasValue()
04462: && ((Node) yyResult.semanticValue()).getTokenText()
04463: .equals("const")) {
04464: final Node v$g$1 = yyResult.semanticValue();
04465:
04466: yyValue = GNode.create("ConstantQualifier", v$g$1);
04467: yyValue.setLocation(location(yyStart));
04468:
04469: return yyResult.createValue(yyValue, yyError);
04470: }
04471:
04472: // Alternative 9.
04473:
04474: yyResult = pKeyword(yyStart);
04475: yyError = yyResult.select(yyError);
04476: if (yyResult.hasValue()
04477: && ((Node) yyResult.semanticValue()).getTokenText()
04478: .equals("__const")) {
04479: final Node v$g$2 = yyResult.semanticValue();
04480:
04481: yyValue = GNode.create("ConstantQualifier", v$g$2);
04482: yyValue.setLocation(location(yyStart));
04483:
04484: return yyResult.createValue(yyValue, yyError);
04485: }
04486:
04487: // Alternative 10.
04488:
04489: yyResult = pKeyword(yyStart);
04490: yyError = yyResult.select(yyError);
04491: if (yyResult.hasValue()
04492: && ((Node) yyResult.semanticValue()).getTokenText()
04493: .equals("__const__")) {
04494: final Node v$g$3 = yyResult.semanticValue();
04495:
04496: yyValue = GNode.create("ConstantQualifier", v$g$3);
04497: yyValue.setLocation(location(yyStart));
04498:
04499: return yyResult.createValue(yyValue, yyError);
04500: }
04501:
04502: // Alternative 11.
04503:
04504: yyResult = pAttributeSpecifier(yyStart);
04505: yyError = yyResult.select(yyError);
04506: if (yyResult.hasValue()) {
04507: yyValue = yyResult.semanticValue();
04508:
04509: return yyResult.createValue(yyValue, yyError);
04510: }
04511:
04512: // Done.
04513: yyError = yyError.select("array qualifier list expected",
04514: yyStart);
04515: return yyError;
04516: }
04517:
04518: // =========================================================================
04519:
04520: /**
04521: * Parse nonterminal xtc.lang.C.FloatingPointTypeSpecifier.
04522: *
04523: * @param yyStart The index.
04524: * @return The result.
04525: * @throws IOException Signals an I/O error.
04526: */
04527: private Result pFloatingPointTypeSpecifier(final int yyStart)
04528: throws IOException {
04529:
04530: Result yyResult;
04531: Node yyValue;
04532: ParseError yyError = ParseError.DUMMY;
04533:
04534: // Alternative 1.
04535:
04536: yyResult = pKeyword(yyStart);
04537: yyError = yyResult.select(yyError);
04538: if (yyResult.hasValue()
04539: && ((Node) yyResult.semanticValue()).getTokenText()
04540: .equals("_Complex")) {
04541: final Node v$g$1 = yyResult.semanticValue();
04542:
04543: yyValue = GNode.create("Complex", v$g$1);
04544: yyValue.setLocation(location(yyStart));
04545:
04546: return yyResult.createValue(yyValue, yyError);
04547: }
04548:
04549: // Alternative 2.
04550:
04551: yyResult = pKeyword(yyStart);
04552: yyError = yyResult.select(yyError);
04553: if (yyResult.hasValue()
04554: && ((Node) yyResult.semanticValue()).getTokenText()
04555: .equals("__complex__")) {
04556: final Node v$g$2 = yyResult.semanticValue();
04557:
04558: yyValue = GNode.create("Complex", v$g$2);
04559: yyValue.setLocation(location(yyStart));
04560:
04561: return yyResult.createValue(yyValue, yyError);
04562: }
04563:
04564: // Alternative 3.
04565:
04566: yyResult = pKeyword(yyStart);
04567: yyError = yyResult.select(yyError);
04568: if (yyResult.hasValue()
04569: && ((Node) yyResult.semanticValue()).getTokenText()
04570: .equals("double")) {
04571: final Node v$pt$1 = yyResult.semanticValue();
04572:
04573: yyValue = GNode.create("Double", false);
04574: yyValue.setLocation(location(yyStart));
04575: yyValue = Formatting.after1(yyValue, v$pt$1);
04576:
04577: return yyResult.createValue(yyValue, yyError);
04578: }
04579:
04580: // Alternative 4.
04581:
04582: yyResult = pKeyword(yyStart);
04583: yyError = yyResult.select(yyError);
04584: if (yyResult.hasValue()
04585: && ((Node) yyResult.semanticValue()).getTokenText()
04586: .equals("float")) {
04587: final Node v$pt$1 = yyResult.semanticValue();
04588:
04589: yyValue = GNode.create("Float", false);
04590: yyValue.setLocation(location(yyStart));
04591: yyValue = Formatting.after1(yyValue, v$pt$1);
04592:
04593: return yyResult.createValue(yyValue, yyError);
04594: }
04595:
04596: // Done.
04597: yyError = yyError.select(
04598: "floating point type specifier expected", yyStart);
04599: return yyError;
04600: }
04601:
04602: // =========================================================================
04603:
04604: /**
04605: * Parse nonterminal xtc.lang.C.IntegerTypeSpecifier.
04606: *
04607: * @param yyStart The index.
04608: * @return The result.
04609: * @throws IOException Signals an I/O error.
04610: */
04611: private Result pIntegerTypeSpecifier(final int yyStart)
04612: throws IOException {
04613: Result yyResult;
04614: Node yyValue;
04615: ParseError yyError = ParseError.DUMMY;
04616:
04617: // Alternative 1.
04618:
04619: yyResult = pKeyword(yyStart);
04620: yyError = yyResult.select(yyError);
04621: if (yyResult.hasValue()
04622: && ((Node) yyResult.semanticValue()).getTokenText()
04623: .equals("long")) {
04624: final Node v$pt$1 = yyResult.semanticValue();
04625:
04626: yyValue = GNode.create("Long", false);
04627: yyValue.setLocation(location(yyStart));
04628: yyValue = Formatting.after1(yyValue, v$pt$1);
04629:
04630: return yyResult.createValue(yyValue, yyError);
04631: }
04632:
04633: // Alternative 2.
04634:
04635: yyResult = pKeyword(yyStart);
04636: yyError = yyResult.select(yyError);
04637: if (yyResult.hasValue()
04638: && ((Node) yyResult.semanticValue()).getTokenText()
04639: .equals("int")) {
04640: final Node v$pt$1 = yyResult.semanticValue();
04641:
04642: yyValue = GNode.create("Int", false);
04643: yyValue.setLocation(location(yyStart));
04644: yyValue = Formatting.after1(yyValue, v$pt$1);
04645:
04646: return yyResult.createValue(yyValue, yyError);
04647: }
04648:
04649: // Alternative 3.
04650:
04651: yyResult = pKeyword(yyStart);
04652: yyError = yyResult.select(yyError);
04653: if (yyResult.hasValue()
04654: && ((Node) yyResult.semanticValue()).getTokenText()
04655: .equals("short")) {
04656: final Node v$pt$1 = yyResult.semanticValue();
04657:
04658: yyValue = GNode.create("Short", false);
04659: yyValue.setLocation(location(yyStart));
04660: yyValue = Formatting.after1(yyValue, v$pt$1);
04661:
04662: return yyResult.createValue(yyValue, yyError);
04663: }
04664:
04665: // Alternative 4.
04666:
04667: yyResult = pKeyword(yyStart);
04668: yyError = yyResult.select(yyError);
04669: if (yyResult.hasValue()
04670: && ((Node) yyResult.semanticValue()).getTokenText()
04671: .equals("char")) {
04672: final Node v$pt$1 = yyResult.semanticValue();
04673:
04674: yyValue = GNode.create("Char", false);
04675: yyValue.setLocation(location(yyStart));
04676: yyValue = Formatting.after1(yyValue, v$pt$1);
04677:
04678: return yyResult.createValue(yyValue, yyError);
04679: }
04680:
04681: // Alternative 5.
04682:
04683: yyResult = pKeyword(yyStart);
04684: yyError = yyResult.select(yyError);
04685: if (yyResult.hasValue()
04686: && ((Node) yyResult.semanticValue()).getTokenText()
04687: .equals("_Bool")) {
04688: final Node v$pt$1 = yyResult.semanticValue();
04689:
04690: yyValue = GNode.create("Bool", false);
04691: yyValue.setLocation(location(yyStart));
04692: yyValue = Formatting.after1(yyValue, v$pt$1);
04693:
04694: return yyResult.createValue(yyValue, yyError);
04695: }
04696:
04697: // Alternative 6.
04698:
04699: yyResult = pKeyword(yyStart);
04700: yyError = yyResult.select(yyError);
04701: if (yyResult.hasValue()
04702: && ((Node) yyResult.semanticValue()).getTokenText()
04703: .equals("unsigned")) {
04704: final Node v$pt$1 = yyResult.semanticValue();
04705:
04706: yyValue = GNode.create("Unsigned", false);
04707: yyValue.setLocation(location(yyStart));
04708: yyValue = Formatting.after1(yyValue, v$pt$1);
04709:
04710: return yyResult.createValue(yyValue, yyError);
04711: }
04712:
04713: // Alternative 7.
04714:
04715: yyResult = pKeyword(yyStart);
04716: yyError = yyResult.select(yyError);
04717: if (yyResult.hasValue()
04718: && ((Node) yyResult.semanticValue()).getTokenText()
04719: .equals("signed")) {
04720: final Node v$g$1 = yyResult.semanticValue();
04721:
04722: yyValue = GNode.create("Signed", v$g$1);
04723: yyValue.setLocation(location(yyStart));
04724:
04725: return yyResult.createValue(yyValue, yyError);
04726: }
04727:
04728: // Alternative 8.
04729:
04730: yyResult = pKeyword(yyStart);
04731: yyError = yyResult.select(yyError);
04732: if (yyResult.hasValue()
04733: && ((Node) yyResult.semanticValue()).getTokenText()
04734: .equals("__signed")) {
04735: final Node v$g$2 = yyResult.semanticValue();
04736:
04737: yyValue = GNode.create("Signed", v$g$2);
04738: yyValue.setLocation(location(yyStart));
04739:
04740: return yyResult.createValue(yyValue, yyError);
04741: }
04742:
04743: // Alternative 9.
04744:
04745: yyResult = pKeyword(yyStart);
04746: yyError = yyResult.select(yyError);
04747: if (yyResult.hasValue()
04748: && ((Node) yyResult.semanticValue()).getTokenText()
04749: .equals("__signed__")) {
04750: final Node v$g$3 = yyResult.semanticValue();
04751:
04752: yyValue = GNode.create("Signed", v$g$3);
04753: yyValue.setLocation(location(yyStart));
04754:
04755: return yyResult.createValue(yyValue, yyError);
04756: }
04757:
04758: // Done.
04759: yyError = yyError.select("integer type specifier expected",
04760: yyStart);
04761: return yyError;
04762: }
04763:
04764: // =========================================================================
04765:
04766: /**
04767: * Parse nonterminal xtc.lang.C.TypeofKeyword.
04768: *
04769: * @param yyStart The index.
04770: * @return The result.
04771: * @throws IOException Signals an I/O error.
04772: */
04773: private Result pTypeofKeyword(final int yyStart) throws IOException {
04774: Result yyResult;
04775: Node yyValue;
04776: ParseError yyError = ParseError.DUMMY;
04777:
04778: // Alternative 1.
04779:
04780: yyResult = pKeyword(yyStart);
04781: yyError = yyResult.select(yyError);
04782: if (yyResult.hasValue()
04783: && ((Node) yyResult.semanticValue()).getTokenText()
04784: .equals("typeof")) {
04785: final Node v$g$1 = yyResult.semanticValue();
04786:
04787: yyValue = GNode.create("TypeofKeyword", v$g$1);
04788: yyValue.setLocation(location(yyStart));
04789:
04790: return yyResult.createValue(yyValue, yyError);
04791: }
04792:
04793: // Alternative 2.
04794:
04795: yyResult = pKeyword(yyStart);
04796: yyError = yyResult.select(yyError);
04797: if (yyResult.hasValue()
04798: && ((Node) yyResult.semanticValue()).getTokenText()
04799: .equals("__typeof")) {
04800: final Node v$g$2 = yyResult.semanticValue();
04801:
04802: yyValue = GNode.create("TypeofKeyword", v$g$2);
04803: yyValue.setLocation(location(yyStart));
04804:
04805: return yyResult.createValue(yyValue, yyError);
04806: }
04807:
04808: // Alternative 3.
04809:
04810: yyResult = pKeyword(yyStart);
04811: yyError = yyResult.select(yyError);
04812: if (yyResult.hasValue()
04813: && ((Node) yyResult.semanticValue()).getTokenText()
04814: .equals("__typeof__")) {
04815: final Node v$g$3 = yyResult.semanticValue();
04816:
04817: yyValue = GNode.create("TypeofKeyword", v$g$3);
04818: yyValue.setLocation(location(yyStart));
04819:
04820: return yyResult.createValue(yyValue, yyError);
04821: }
04822:
04823: // Done.
04824: yyError = yyError.select("typeof keyword expected", yyStart);
04825: return yyError;
04826: }
04827:
04828: // =========================================================================
04829:
04830: /**
04831: * Parse nonterminal xtc.lang.C.Initializer.
04832: *
04833: * @param yyStart The index.
04834: * @return The result.
04835: * @throws IOException Signals an I/O error.
04836: */
04837: private Result pInitializer(final int yyStart) throws IOException {
04838: Result yyResult;
04839: int yyBase;
04840: int yyOption1;
04841: Node yyOpValue1;
04842: Node yyValue;
04843: ParseError yyError = ParseError.DUMMY;
04844:
04845: // Alternative <Complex>.
04846:
04847: yyResult = pSymbol(yyStart);
04848: yyError = yyResult.select(yyError);
04849: if (yyResult.hasValue()
04850: && ((Node) yyResult.semanticValue()).getTokenText()
04851: .equals("{")) {
04852: final Node v$pt$1 = yyResult.semanticValue();
04853:
04854: yyResult = pInitializerList(yyResult.index);
04855: yyError = yyResult.select(yyError);
04856: if (yyResult.hasValue()) {
04857: final Node v$pt$4 = yyResult.semanticValue();
04858:
04859: yyOption1 = yyResult.index;
04860: yyOpValue1 = null;
04861:
04862: yyBase = yyOption1;
04863: yyResult = pSymbol(yyBase);
04864: yyError = yyResult.select(yyError);
04865: if (yyResult.hasValue()
04866: && ((Node) yyResult.semanticValue())
04867: .getTokenText().equals(",")) {
04868: final Node v$el$3 = yyResult.semanticValue();
04869:
04870: yyOption1 = yyResult.index;
04871: yyOpValue1 = v$el$3;
04872: } else {
04873: yyError = yyError.select("\",\" expected", yyBase);
04874: }
04875: { // Start scope for v$pt$2.
04876: final Node v$pt$2 = yyOpValue1;
04877:
04878: yyBase = yyOption1;
04879: yyResult = pSymbol(yyBase);
04880: yyError = yyResult.select(yyError);
04881: if (yyResult.hasValue()
04882: && ((Node) yyResult.semanticValue())
04883: .getTokenText().equals("}")) {
04884: final Node v$pt$3 = yyResult.semanticValue();
04885: yyValue = Formatting.variable().add(v$pt$1)
04886: .addNode(v$pt$4).add(v$pt$2)
04887: .add(v$pt$3);
04888:
04889: return yyResult.createValue(yyValue, yyError);
04890: } else {
04891: yyError = yyError.select("\"}\" expected",
04892: yyBase);
04893: }
04894: } // End scope for v$pt$2.
04895: }
04896: }
04897:
04898: // Alternative <Simple>.
04899:
04900: yyResult = pAssignmentExpression(yyStart);
04901: yyError = yyResult.select(yyError);
04902: if (yyResult.hasValue()) {
04903: yyValue = yyResult.semanticValue();
04904:
04905: return yyResult.createValue(yyValue, yyError);
04906: }
04907:
04908: // Done.
04909: yyError = yyError.select("initializer expected", yyStart);
04910: return yyError;
04911: }
04912:
04913: // =========================================================================
04914:
04915: /**
04916: * Parse nonterminal xtc.lang.C.InitializerList.
04917: *
04918: * @param yyStart The index.
04919: * @return The result.
04920: * @throws IOException Signals an I/O error.
04921: */
04922: private Result pInitializerList(final int yyStart)
04923: throws IOException {
04924: Result yyResult;
04925: int yyBase;
04926: int yyRepetition1;
04927: Pair<Node> yyRepValue1;
04928: Node yyValue;
04929: ParseError yyError = ParseError.DUMMY;
04930:
04931: // Alternative 1.
04932:
04933: yyResult = pInitializerListEntry(yyStart);
04934: yyError = yyResult.select(yyError);
04935: if (yyResult.hasValue()) {
04936: final Node v$g$1 = yyResult.semanticValue();
04937:
04938: yyRepetition1 = yyResult.index;
04939: yyRepValue1 = Pair.empty();
04940: while (true) {
04941:
04942: yyBase = yyRepetition1;
04943: yyResult = pSymbol(yyBase);
04944: yyError = yyResult.select(yyError);
04945: if (yyResult.hasValue()
04946: && ((Node) yyResult.semanticValue())
04947: .getTokenText().equals(",")) {
04948: final Node v$pt$1 = yyResult.semanticValue();
04949:
04950: yyResult = pInitializerListEntry(yyResult.index);
04951: yyError = yyResult.select(yyError);
04952: if (yyResult.hasValue()) {
04953: final Node v$pt$2 = yyResult.semanticValue();
04954: final Node v$el$1 = Formatting.before1(v$pt$1,
04955: v$pt$2);
04956:
04957: yyRepetition1 = yyResult.index;
04958: yyRepValue1 = new Pair<Node>(v$el$1,
04959: yyRepValue1);
04960: continue;
04961: }
04962: } else {
04963: yyError = yyError.select("\",\" expected", yyBase);
04964: }
04965: break;
04966: }
04967: { // Start scope for v$g$2.
04968: final Pair<Node> v$g$2 = yyRepValue1.reverse();
04969:
04970: yyValue = GNode.createFromPair("InitializerList",
04971: v$g$1, v$g$2);
04972: yyValue.setLocation(location(yyStart));
04973:
04974: return new SemanticValue(yyValue, yyRepetition1,
04975: yyError);
04976: } // End scope for v$g$2.
04977: }
04978:
04979: // Alternative 2.
04980:
04981: if (GCC) {
04982:
04983: yyValue = GNode.create("InitializerList", false);
04984: yyValue.setLocation(location(yyStart));
04985:
04986: return new SemanticValue(yyValue, yyStart, yyError);
04987: }
04988:
04989: // Done.
04990: yyError = yyError.select("initializer list expected", yyStart);
04991: return yyError;
04992: }
04993:
04994: // =========================================================================
04995:
04996: /**
04997: * Parse nonterminal xtc.lang.C.InitializerListEntry.
04998: *
04999: * @param yyStart The index.
05000: * @return The result.
05001: * @throws IOException Signals an I/O error.
05002: */
05003: private Result pInitializerListEntry(final int yyStart)
05004: throws IOException {
05005: Result yyResult;
05006: int yyOption1;
05007: Node yyOpValue1;
05008: Node yyValue;
05009: ParseError yyError = ParseError.DUMMY;
05010:
05011: // Alternative 1.
05012:
05013: yyOption1 = yyStart;
05014: yyOpValue1 = null;
05015:
05016: yyResult = pDesignation(yyOption1);
05017: yyError = yyResult.select(yyError);
05018: if (yyResult.hasValue()) {
05019: final Node v$el$1 = yyResult.semanticValue();
05020:
05021: yyOption1 = yyResult.index;
05022: yyOpValue1 = v$el$1;
05023: }
05024: { // Start scope for v$g$1.
05025: final Node v$g$1 = yyOpValue1;
05026:
05027: yyResult = pInitializer(yyOption1);
05028: yyError = yyResult.select(yyError);
05029: if (yyResult.hasValue()) {
05030: final Node v$g$2 = yyResult.semanticValue();
05031:
05032: yyValue = GNode.create("InitializerListEntry", v$g$1,
05033: v$g$2);
05034: yyValue.setLocation(location(yyStart));
05035:
05036: return yyResult.createValue(yyValue, yyError);
05037: }
05038: } // End scope for v$g$1.
05039:
05040: // Done.
05041: return yyError;
05042: }
05043:
05044: // =========================================================================
05045:
05046: /**
05047: * Parse nonterminal xtc.lang.C.Designation.
05048: *
05049: * @param yyStart The index.
05050: * @return The result.
05051: * @throws IOException Signals an I/O error.
05052: */
05053: private Result pDesignation(final int yyStart) throws IOException {
05054: Result yyResult;
05055: int yyBase;
05056: Node yyValue;
05057: ParseError yyError = ParseError.DUMMY;
05058:
05059: // Alternative <Standard>.
05060:
05061: yyResult = pDesignation$$Split1(yyStart);
05062: yyError = yyResult.select(yyError);
05063: if (yyResult.hasValue()) {
05064: final Node v$pt$1 = yyResult.semanticValue();
05065:
05066: yyBase = yyResult.index;
05067: yyResult = pSymbol(yyBase);
05068: yyError = yyResult.select(yyError);
05069: if (yyResult.hasValue()
05070: && ((Node) yyResult.semanticValue()).getTokenText()
05071: .equals("=")) {
05072: final Node v$pt$2 = yyResult.semanticValue();
05073: yyValue = Formatting.after1(v$pt$1, v$pt$2);
05074:
05075: return yyResult.createValue(yyValue, yyError);
05076: } else {
05077: yyError = yyError.select("\"=\" expected", yyBase);
05078: }
05079: }
05080:
05081: // Alternative 2.
05082:
05083: if (GCC) {
05084:
05085: final int yyChoice1 = yyStart;
05086:
05087: // Nested alternative 1.
05088:
05089: yyResult = pObsoleteArrayDesignation(yyChoice1);
05090: yyError = yyResult.select(yyError);
05091: if (yyResult.hasValue()) {
05092: yyValue = yyResult.semanticValue();
05093:
05094: return yyResult.createValue(yyValue, yyError);
05095: }
05096:
05097: // Nested alternative 2.
05098:
05099: yyResult = pObsoleteFieldDesignation(yyChoice1);
05100: yyError = yyResult.select(yyError);
05101: if (yyResult.hasValue()) {
05102: yyValue = yyResult.semanticValue();
05103:
05104: return yyResult.createValue(yyValue, yyError);
05105: }
05106: }
05107:
05108: // Done.
05109: yyError = yyError.select("designation expected", yyStart);
05110: return yyError;
05111: }
05112:
05113: // =========================================================================
05114:
05115: /**
05116: * Parse synthetic nonterminal xtc.lang.C.Designation$$Split1.
05117: *
05118: * @param yyStart The index.
05119: * @return The result.
05120: * @throws IOException Signals an I/O error.
05121: */
05122: private Result pDesignation$$Split1(final int yyStart)
05123: throws IOException {
05124: Result yyResult;
05125: int yyRepetition1;
05126: boolean yyRepeated1;
05127: Pair<Node> yyRepValue1;
05128: Node yyValue;
05129: ParseError yyError = ParseError.DUMMY;
05130:
05131: // Alternative <Standard>.
05132:
05133: yyRepetition1 = yyStart;
05134: yyRepeated1 = false;
05135: yyRepValue1 = Pair.empty();
05136: while (true) {
05137:
05138: yyResult = pDesignator(yyRepetition1);
05139: yyError = yyResult.select(yyError);
05140: if (yyResult.hasValue()) {
05141: final Node v$el$1 = yyResult.semanticValue();
05142:
05143: yyRepetition1 = yyResult.index;
05144: yyRepeated1 = true;
05145: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
05146: continue;
05147: }
05148: break;
05149: }
05150:
05151: if (yyRepeated1) {
05152: final Pair<Node> v$g$1 = yyRepValue1.reverse();
05153:
05154: yyValue = GNode.createFromPair("Designation", v$g$1);
05155: yyValue.setLocation(location(yyStart));
05156:
05157: return new SemanticValue(yyValue, yyRepetition1, yyError);
05158: }
05159:
05160: // Done.
05161: return yyError;
05162: }
05163:
05164: // =========================================================================
05165:
05166: /**
05167: * Parse nonterminal xtc.lang.C.Designator.
05168: *
05169: * @param yyStart The index.
05170: * @return The result.
05171: * @throws IOException Signals an I/O error.
05172: */
05173: private Result pDesignator(final int yyStart) throws IOException {
05174: Result yyResult;
05175: int yyBase;
05176: Node yyValue;
05177: ParseError yyError = ParseError.DUMMY;
05178:
05179: // Alternative <Array>.
05180:
05181: yyResult = pSymbol(yyStart);
05182: yyError = yyResult.select(yyError);
05183: if (yyResult.hasValue()
05184: && ((Node) yyResult.semanticValue()).getTokenText()
05185: .equals("[")) {
05186: final Node v$g$1 = yyResult.semanticValue();
05187:
05188: yyResult = pConditionalExpression(yyResult.index);
05189: yyError = yyResult.select(yyError);
05190: if (yyResult.hasValue()) {
05191: final Node v$pt$2 = yyResult.semanticValue();
05192:
05193: yyBase = yyResult.index;
05194: yyResult = pSymbol(yyBase);
05195: yyError = yyResult.select(yyError);
05196: if (yyResult.hasValue()
05197: && ((Node) yyResult.semanticValue())
05198: .getTokenText().equals("]")) {
05199: final Node v$pt$1 = yyResult.semanticValue();
05200: final Node v$g$2 = Formatting
05201: .after1(v$pt$2, v$pt$1);
05202:
05203: yyValue = GNode.create("Designator", v$g$1, v$g$2);
05204: yyValue.setLocation(location(yyStart));
05205:
05206: return yyResult.createValue(yyValue, yyError);
05207: } else {
05208: yyError = yyError.select("\"]\" expected", yyBase);
05209: }
05210: }
05211: }
05212:
05213: // Alternative <ArrayRange>.
05214:
05215: if (GCC) {
05216:
05217: yyResult = pSymbol(yyStart);
05218: yyError = yyResult.select(yyError);
05219: if (yyResult.hasValue()
05220: && ((Node) yyResult.semanticValue()).getTokenText()
05221: .equals("[")) {
05222: final Node v$g$3 = yyResult.semanticValue();
05223:
05224: yyResult = pConditionalExpression(yyResult.index);
05225: yyError = yyResult.select(yyError);
05226: if (yyResult.hasValue()) {
05227: final Node v$pt$4 = yyResult.semanticValue();
05228:
05229: yyBase = yyResult.index;
05230: yyResult = pSymbol(yyBase);
05231: yyError = yyResult.select(yyError);
05232: if (yyResult.hasValue()
05233: && ((Node) yyResult.semanticValue())
05234: .getTokenText().equals("...")) {
05235: final Node v$pt$3 = yyResult.semanticValue();
05236: final Node v$g$4 = Formatting.after1(v$pt$4,
05237: v$pt$3);
05238:
05239: yyResult = pConditionalExpression(yyResult.index);
05240: yyError = yyResult.select(yyError);
05241: if (yyResult.hasValue()) {
05242: final Node v$pt$6 = yyResult
05243: .semanticValue();
05244:
05245: yyBase = yyResult.index;
05246: yyResult = pSymbol(yyBase);
05247: yyError = yyResult.select(yyError);
05248: if (yyResult.hasValue()
05249: && ((Node) yyResult.semanticValue())
05250: .getTokenText().equals("]")) {
05251: final Node v$pt$5 = yyResult
05252: .semanticValue();
05253: final Node v$g$5 = Formatting.after1(
05254: v$pt$6, v$pt$5);
05255:
05256: yyValue = GNode.create("Designator",
05257: v$g$3, v$g$4, v$g$5);
05258: yyValue.setLocation(location(yyStart));
05259:
05260: return yyResult.createValue(yyValue,
05261: yyError);
05262: } else {
05263: yyError = yyError.select(
05264: "\"]\" expected", yyBase);
05265: }
05266: }
05267: } else {
05268: yyError = yyError.select("\"...\" expected",
05269: yyBase);
05270: }
05271: }
05272: }
05273: }
05274:
05275: // Alternative <Structure>.
05276:
05277: yyResult = pSymbol(yyStart);
05278: yyError = yyResult.select(yyError);
05279: if (yyResult.hasValue()
05280: && ((Node) yyResult.semanticValue()).getTokenText()
05281: .equals(".")) {
05282: final Node v$g$6 = yyResult.semanticValue();
05283:
05284: yyResult = pPrimaryIdentifier(yyResult.index);
05285: yyError = yyResult.select(yyError);
05286: if (yyResult.hasValue()) {
05287: final Node v$g$7 = yyResult.semanticValue();
05288:
05289: yyValue = GNode.create("Designator", v$g$6, v$g$7);
05290: yyValue.setLocation(location(yyStart));
05291:
05292: return yyResult.createValue(yyValue, yyError);
05293: }
05294: }
05295:
05296: // Done.
05297: yyError = yyError.select("designator expected", yyStart);
05298: return yyError;
05299: }
05300:
05301: // =========================================================================
05302:
05303: /**
05304: * Parse nonterminal xtc.lang.C.ObsoleteArrayDesignation.
05305: *
05306: * @param yyStart The index.
05307: * @return The result.
05308: * @throws IOException Signals an I/O error.
05309: */
05310: private Result pObsoleteArrayDesignation(final int yyStart)
05311: throws IOException {
05312:
05313: Result yyResult;
05314: int yyBase;
05315: Node yyValue;
05316: ParseError yyError = ParseError.DUMMY;
05317:
05318: // Alternative 1.
05319:
05320: yyResult = pSymbol(yyStart);
05321: yyError = yyResult.select(yyError);
05322: if (yyResult.hasValue()
05323: && ((Node) yyResult.semanticValue()).getTokenText()
05324: .equals("[")) {
05325: final Node v$g$1 = yyResult.semanticValue();
05326:
05327: yyResult = pConditionalExpression(yyResult.index);
05328: yyError = yyResult.select(yyError);
05329: if (yyResult.hasValue()) {
05330: final Node v$g$2 = yyResult.semanticValue();
05331:
05332: final int yyChoice1 = yyResult.index;
05333:
05334: // Nested alternative 1.
05335:
05336: yyBase = yyChoice1;
05337: yyResult = pSymbol(yyBase);
05338: yyError = yyResult.select(yyError);
05339: if (yyResult.hasValue()
05340: && ((Node) yyResult.semanticValue())
05341: .getTokenText().equals("]")) {
05342: final Node v$pt$1 = yyResult.semanticValue();
05343:
05344: yyValue = GNode.create("ObsoleteArrayDesignation",
05345: v$g$1, v$g$2);
05346: yyValue.setLocation(location(yyStart));
05347: yyValue = Formatting.after1(yyValue, v$pt$1);
05348:
05349: return yyResult.createValue(yyValue, yyError);
05350: } else {
05351: yyError = yyError.select("\"]\" expected", yyBase);
05352: }
05353:
05354: // Nested alternative 2.
05355:
05356: yyBase = yyChoice1;
05357: yyResult = pSymbol(yyBase);
05358: yyError = yyResult.select(yyError);
05359: if (yyResult.hasValue()
05360: && ((Node) yyResult.semanticValue())
05361: .getTokenText().equals("...")) {
05362: final Node v$pt$2 = yyResult.semanticValue();
05363:
05364: yyResult = pConditionalExpression(yyResult.index);
05365: yyError = yyResult.select(yyError);
05366: if (yyResult.hasValue()) {
05367: final Node v$pt$4 = yyResult.semanticValue();
05368:
05369: yyBase = yyResult.index;
05370: yyResult = pSymbol(yyBase);
05371: yyError = yyResult.select(yyError);
05372: if (yyResult.hasValue()
05373: && ((Node) yyResult.semanticValue())
05374: .getTokenText().equals("]")) {
05375: final Node v$pt$3 = yyResult
05376: .semanticValue();
05377: final Node v$g$3 = Formatting.round1(
05378: v$pt$2, v$pt$4, v$pt$3);
05379:
05380: yyValue = GNode.create(
05381: "ObsoleteArrayDesignation", v$g$1,
05382: v$g$2, v$g$3);
05383: yyValue.setLocation(location(yyStart));
05384:
05385: return yyResult.createValue(yyValue,
05386: yyError);
05387: } else {
05388: yyError = yyError.select("\"]\" expected",
05389: yyBase);
05390: }
05391: }
05392: } else {
05393: yyError = yyError
05394: .select("\"...\" expected", yyBase);
05395: }
05396: }
05397: }
05398:
05399: // Done.
05400: yyError = yyError.select("obsolete array designation expected",
05401: yyStart);
05402: return yyError;
05403: }
05404:
05405: // =========================================================================
05406:
05407: /**
05408: * Parse nonterminal xtc.lang.C.ObsoleteFieldDesignation.
05409: *
05410: * @param yyStart The index.
05411: * @return The result.
05412: * @throws IOException Signals an I/O error.
05413: */
05414: private Result pObsoleteFieldDesignation(final int yyStart)
05415: throws IOException {
05416:
05417: Result yyResult;
05418: int yyBase;
05419: Node yyValue;
05420: ParseError yyError = ParseError.DUMMY;
05421:
05422: // Alternative 1.
05423:
05424: yyResult = pIdentifier(yyStart);
05425: yyError = yyResult.select(yyError);
05426: if (yyResult.hasValue()) {
05427: final Node v$pt$2 = yyResult.semanticValue();
05428:
05429: yyBase = yyResult.index;
05430: yyResult = pSymbol(yyBase);
05431: yyError = yyResult.select(yyError);
05432: if (yyResult.hasValue()
05433: && ((Node) yyResult.semanticValue()).getTokenText()
05434: .equals(":")) {
05435: final Node v$pt$1 = yyResult.semanticValue();
05436: final Node v$g$1 = Formatting.after1(v$pt$2, v$pt$1);
05437:
05438: yyValue = GNode.create("ObsoleteFieldDesignation",
05439: v$g$1);
05440: yyValue.setLocation(location(yyStart));
05441:
05442: return yyResult.createValue(yyValue, yyError);
05443: } else {
05444: yyError = yyError.select("\":\" expected", yyBase);
05445: }
05446: }
05447:
05448: // Done.
05449: return yyError;
05450: }
05451:
05452: // =========================================================================
05453:
05454: /**
05455: * Parse nonterminal xtc.lang.C.TypeName.
05456: *
05457: * @param yyStart The index.
05458: * @return The result.
05459: * @throws IOException Signals an I/O error.
05460: */
05461: private Result pTypeName(final int yyStart) throws IOException {
05462: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
05463: if (null == yyColumn.chunk1)
05464: yyColumn.chunk1 = new Chunk1();
05465: if (null == yyColumn.chunk1.fTypeName)
05466: yyColumn.chunk1.fTypeName = pTypeName$1(yyStart);
05467: return yyColumn.chunk1.fTypeName;
05468: }
05469:
05470: /** Actually parse xtc.lang.C.TypeName. */
05471: private Result pTypeName$1(final int yyStart) throws IOException {
05472: Result yyResult;
05473: int yyOption1;
05474: Node yyOpValue1;
05475: Node yyValue;
05476: ParseError yyError = ParseError.DUMMY;
05477:
05478: // Start a state modification.
05479: yyState.start();
05480:
05481: // Alternative 1.
05482:
05483: yyResult = pSpecifierQualifierList(yyStart);
05484: yyError = yyResult.select(yyError);
05485: if (yyResult.hasValue()) {
05486: final Node v$g$1 = yyResult.semanticValue();
05487:
05488: yyOption1 = yyResult.index;
05489: yyOpValue1 = null;
05490:
05491: yyResult = pAbstractDeclarator(yyOption1);
05492: yyError = yyResult.select(yyError);
05493: if (yyResult.hasValue()) {
05494: final Node v$el$1 = yyResult.semanticValue();
05495:
05496: yyOption1 = yyResult.index;
05497: yyOpValue1 = v$el$1;
05498: }
05499: { // Start scope for v$g$2.
05500: final Node v$g$2 = yyOpValue1;
05501:
05502: yyValue = GNode.create("TypeName", v$g$1, v$g$2);
05503: yyValue.setLocation(location(yyStart));
05504:
05505: // Commit the state modification.
05506: yyState.commit();
05507:
05508: return new SemanticValue(yyValue, yyOption1, yyError);
05509: } // End scope for v$g$2.
05510: }
05511:
05512: // Abort the state modification.
05513: yyState.abort();
05514:
05515: // Done.
05516: return yyError;
05517: }
05518:
05519: // =========================================================================
05520:
05521: /**
05522: * Parse nonterminal xtc.lang.C.AttributeSpecifierList.
05523: *
05524: * @param yyStart The index.
05525: * @return The result.
05526: * @throws IOException Signals an I/O error.
05527: */
05528: private Result pAttributeSpecifierList(final int yyStart)
05529: throws IOException {
05530:
05531: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
05532: if (null == yyColumn.chunk1)
05533: yyColumn.chunk1 = new Chunk1();
05534: if (null == yyColumn.chunk1.fAttributeSpecifierList)
05535: yyColumn.chunk1.fAttributeSpecifierList = pAttributeSpecifierList$1(yyStart);
05536: return yyColumn.chunk1.fAttributeSpecifierList;
05537: }
05538:
05539: /** Actually parse xtc.lang.C.AttributeSpecifierList. */
05540: private Result pAttributeSpecifierList$1(final int yyStart)
05541: throws IOException {
05542:
05543: Result yyResult;
05544: Node yyValue;
05545: ParseError yyError = ParseError.DUMMY;
05546:
05547: // Alternative 1.
05548:
05549: yyResult = pAttributeSpecifierPlus(yyStart);
05550: yyError = yyResult.select(yyError);
05551: if (yyResult.hasValue()) {
05552: final Pair<Node> v$g$1 = yyResult.semanticValue();
05553:
05554: yyValue = GNode.createFromPair("AttributeSpecifierList",
05555: v$g$1);
05556: yyValue.setLocation(location(yyStart));
05557:
05558: return yyResult.createValue(yyValue, yyError);
05559: }
05560:
05561: // Done.
05562: return yyError;
05563: }
05564:
05565: // =========================================================================
05566:
05567: /**
05568: * Parse nonterminal xtc.lang.C.AttributeSpecifierPlus.
05569: *
05570: * @param yyStart The index.
05571: * @return The result.
05572: * @throws IOException Signals an I/O error.
05573: */
05574: private Result pAttributeSpecifierPlus(final int yyStart)
05575: throws IOException {
05576:
05577: Result yyResult;
05578: int yyRepetition1;
05579: boolean yyRepeated1;
05580: Pair<Node> yyRepValue1;
05581: Pair<Node> yyValue;
05582: ParseError yyError = ParseError.DUMMY;
05583:
05584: // Alternative 1.
05585:
05586: yyRepetition1 = yyStart;
05587: yyRepeated1 = false;
05588: yyRepValue1 = Pair.empty();
05589: while (true) {
05590:
05591: yyResult = pAttributeSpecifier(yyRepetition1);
05592: yyError = yyResult.select(yyError);
05593: if (yyResult.hasValue()) {
05594: final Node v$el$1 = yyResult.semanticValue();
05595:
05596: yyRepetition1 = yyResult.index;
05597: yyRepeated1 = true;
05598: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
05599: continue;
05600: }
05601: break;
05602: }
05603:
05604: if (yyRepeated1) {
05605: yyValue = yyRepValue1.reverse();
05606:
05607: return new SemanticValue(yyValue, yyRepetition1, yyError);
05608: }
05609:
05610: // Done.
05611: return yyError;
05612: }
05613:
05614: // =========================================================================
05615:
05616: /**
05617: * Parse nonterminal xtc.lang.C.AttributeSpecifier.
05618: *
05619: * @param yyStart The index.
05620: * @return The result.
05621: * @throws IOException Signals an I/O error.
05622: */
05623: private Result pAttributeSpecifier(final int yyStart)
05624: throws IOException {
05625: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
05626: if (null == yyColumn.chunk2)
05627: yyColumn.chunk2 = new Chunk2();
05628: if (null == yyColumn.chunk2.fAttributeSpecifier)
05629: yyColumn.chunk2.fAttributeSpecifier = pAttributeSpecifier$1(yyStart);
05630: return yyColumn.chunk2.fAttributeSpecifier;
05631: }
05632:
05633: /** Actually parse xtc.lang.C.AttributeSpecifier. */
05634: private Result pAttributeSpecifier$1(final int yyStart)
05635: throws IOException {
05636: Result yyResult;
05637: int yyBase;
05638: int yyOption1;
05639: Node yyOpValue1;
05640: Node yyValue;
05641: ParseError yyError = ParseError.DUMMY;
05642:
05643: // Alternative 1.
05644:
05645: yyResult = pAttributeKeyword(yyStart);
05646: yyError = yyResult.select(yyError);
05647: if (yyResult.hasValue()) {
05648: final Node v$pt$1 = yyResult.semanticValue();
05649:
05650: yyBase = yyResult.index;
05651: yyResult = pSymbol(yyBase);
05652: yyError = yyResult.select(yyError);
05653: if (yyResult.hasValue()
05654: && ((Node) yyResult.semanticValue()).getTokenText()
05655: .equals("(")) {
05656: final Node v$pt$2 = yyResult.semanticValue();
05657:
05658: yyBase = yyResult.index;
05659: yyResult = pSymbol(yyBase);
05660: yyError = yyResult.select(yyError);
05661: if (yyResult.hasValue()
05662: && ((Node) yyResult.semanticValue())
05663: .getTokenText().equals("(")) {
05664: final Node v$pt$3 = yyResult.semanticValue();
05665:
05666: yyOption1 = yyResult.index;
05667: yyOpValue1 = null;
05668:
05669: yyResult = pAttributeList(yyOption1);
05670: yyError = yyResult.select(yyError);
05671: if (yyResult.hasValue()) {
05672: final Node v$el$1 = yyResult.semanticValue();
05673:
05674: yyOption1 = yyResult.index;
05675: yyOpValue1 = v$el$1;
05676: }
05677: { // Start scope for v$pt$6.
05678: final Node v$pt$6 = yyOpValue1;
05679:
05680: yyBase = yyOption1;
05681: yyResult = pSymbol(yyBase);
05682: yyError = yyResult.select(yyError);
05683: if (yyResult.hasValue()
05684: && ((Node) yyResult.semanticValue())
05685: .getTokenText().equals(")")) {
05686: final Node v$pt$4 = yyResult
05687: .semanticValue();
05688:
05689: yyBase = yyResult.index;
05690: yyResult = pSymbol(yyBase);
05691: yyError = yyResult.select(yyError);
05692: if (yyResult.hasValue()
05693: && ((Node) yyResult.semanticValue())
05694: .getTokenText().equals(")")) {
05695: final Node v$pt$5 = yyResult
05696: .semanticValue();
05697: final Node v$g$1 = Formatting
05698: .variable().add(v$pt$1).add(
05699: v$pt$2).add(v$pt$3)
05700: .addNode(v$pt$6).add(v$pt$4)
05701: .add(v$pt$5);
05702:
05703: yyValue = GNode.create(
05704: "AttributeSpecifier", v$g$1);
05705: yyValue.setLocation(location(yyStart));
05706:
05707: return yyResult.createValue(yyValue,
05708: yyError);
05709: } else {
05710: yyError = yyError.select(
05711: "\")\" expected", yyBase);
05712: }
05713: } else {
05714: yyError = yyError.select("\")\" expected",
05715: yyBase);
05716: }
05717: } // End scope for v$pt$6.
05718: } else {
05719: yyError = yyError.select("\"(\" expected", yyBase);
05720: }
05721: } else {
05722: yyError = yyError.select("\"(\" expected", yyBase);
05723: }
05724: }
05725:
05726: // Done.
05727: return yyError;
05728: }
05729:
05730: // =========================================================================
05731:
05732: /**
05733: * Parse nonterminal xtc.lang.C.AttributeKeyword.
05734: *
05735: * @param yyStart The index.
05736: * @return The result.
05737: * @throws IOException Signals an I/O error.
05738: */
05739: private Result pAttributeKeyword(final int yyStart)
05740: throws IOException {
05741: Result yyResult;
05742: Node yyValue;
05743: ParseError yyError = ParseError.DUMMY;
05744:
05745: // Alternative 1.
05746:
05747: yyResult = pKeyword(yyStart);
05748: yyError = yyResult.select(yyError);
05749: if (yyResult.hasValue()
05750: && ((Node) yyResult.semanticValue()).getTokenText()
05751: .equals("__attribute")) {
05752: final Node v$g$1 = yyResult.semanticValue();
05753:
05754: yyValue = GNode.create("AttributeKeyword", v$g$1);
05755: yyValue.setLocation(location(yyStart));
05756:
05757: return yyResult.createValue(yyValue, yyError);
05758: }
05759:
05760: // Alternative 2.
05761:
05762: yyResult = pKeyword(yyStart);
05763: yyError = yyResult.select(yyError);
05764: if (yyResult.hasValue()
05765: && ((Node) yyResult.semanticValue()).getTokenText()
05766: .equals("__attribute__")) {
05767: final Node v$g$2 = yyResult.semanticValue();
05768:
05769: yyValue = GNode.create("AttributeKeyword", v$g$2);
05770: yyValue.setLocation(location(yyStart));
05771:
05772: return yyResult.createValue(yyValue, yyError);
05773: }
05774:
05775: // Done.
05776: yyError = yyError.select("attribute keyword expected", yyStart);
05777: return yyError;
05778: }
05779:
05780: // =========================================================================
05781:
05782: /**
05783: * Parse nonterminal xtc.lang.C.AttributeList.
05784: *
05785: * @param yyStart The index.
05786: * @return The result.
05787: * @throws IOException Signals an I/O error.
05788: */
05789: private Result pAttributeList(final int yyStart) throws IOException {
05790: Result yyResult;
05791: int yyBase;
05792: int yyRepetition1;
05793: Pair<Node> yyRepValue1;
05794: Node yyValue;
05795: ParseError yyError = ParseError.DUMMY;
05796:
05797: // Alternative 1.
05798:
05799: yyResult = pAttributeListEntry(yyStart);
05800: yyError = yyResult.select(yyError);
05801: if (yyResult.hasValue()) {
05802: final Node v$g$1 = yyResult.semanticValue();
05803:
05804: yyRepetition1 = yyResult.index;
05805: yyRepValue1 = Pair.empty();
05806: while (true) {
05807:
05808: yyBase = yyRepetition1;
05809: yyResult = pSymbol(yyBase);
05810: yyError = yyResult.select(yyError);
05811: if (yyResult.hasValue()
05812: && ((Node) yyResult.semanticValue())
05813: .getTokenText().equals(",")) {
05814: final Node v$pt$1 = yyResult.semanticValue();
05815:
05816: yyResult = pAttributeListEntry(yyResult.index);
05817: yyError = yyResult.select(yyError);
05818: if (yyResult.hasValue()) {
05819: final Node v$pt$2 = yyResult.semanticValue();
05820: final Node v$el$1 = Formatting.before1(v$pt$1,
05821: v$pt$2);
05822:
05823: yyRepetition1 = yyResult.index;
05824: yyRepValue1 = new Pair<Node>(v$el$1,
05825: yyRepValue1);
05826: continue;
05827: }
05828: } else {
05829: yyError = yyError.select("\",\" expected", yyBase);
05830: }
05831: break;
05832: }
05833: { // Start scope for v$g$2.
05834: final Pair<Node> v$g$2 = yyRepValue1.reverse();
05835:
05836: yyValue = GNode.createFromPair("AttributeList", v$g$1,
05837: v$g$2);
05838: yyValue.setLocation(location(yyStart));
05839:
05840: return new SemanticValue(yyValue, yyRepetition1,
05841: yyError);
05842: } // End scope for v$g$2.
05843: }
05844:
05845: // Done.
05846: return yyError;
05847: }
05848:
05849: // =========================================================================
05850:
05851: /**
05852: * Parse nonterminal xtc.lang.C.AttributeListEntry.
05853: *
05854: * @param yyStart The index.
05855: * @return The result.
05856: * @throws IOException Signals an I/O error.
05857: */
05858: private Result pAttributeListEntry(final int yyStart)
05859: throws IOException {
05860: Result yyResult;
05861: int yyBase;
05862: int yyOption1;
05863: Node yyOpValue1;
05864: int yyOption2;
05865: Node yyOpValue2;
05866: Node yyValue;
05867: ParseError yyError = ParseError.DUMMY;
05868:
05869: // Alternative 1.
05870:
05871: yyResult = pWord(yyStart);
05872: yyError = yyResult.select(yyError);
05873: if (yyResult.hasValue()) {
05874: final Node v$g$1 = yyResult.semanticValue();
05875:
05876: yyOption1 = yyResult.index;
05877: yyOpValue1 = null;
05878:
05879: yyBase = yyOption1;
05880: yyResult = pSymbol(yyBase);
05881: yyError = yyResult.select(yyError);
05882: if (yyResult.hasValue()
05883: && ((Node) yyResult.semanticValue()).getTokenText()
05884: .equals("(")) {
05885: final Node v$pt$1 = yyResult.semanticValue();
05886:
05887: yyOption2 = yyResult.index;
05888: yyOpValue2 = null;
05889:
05890: yyResult = pExpressionList(yyOption2);
05891: yyError = yyResult.select(yyError);
05892: if (yyResult.hasValue()) {
05893: final Node v$el$2 = yyResult.semanticValue();
05894:
05895: yyOption2 = yyResult.index;
05896: yyOpValue2 = v$el$2;
05897: }
05898: { // Start scope for v$pt$3.
05899: final Node v$pt$3 = yyOpValue2;
05900:
05901: yyBase = yyOption2;
05902: yyResult = pSymbol(yyBase);
05903: yyError = yyResult.select(yyError);
05904: if (yyResult.hasValue()
05905: && ((Node) yyResult.semanticValue())
05906: .getTokenText().equals(")")) {
05907: final Node v$pt$2 = yyResult.semanticValue();
05908: final Node v$el$1 = Formatting.round1(v$pt$1,
05909: v$pt$3, v$pt$2);
05910:
05911: yyOption1 = yyResult.index;
05912: yyOpValue1 = v$el$1;
05913: } else {
05914: yyError = yyError.select("\")\" expected",
05915: yyBase);
05916: }
05917: } // End scope for v$pt$3.
05918: } else {
05919: yyError = yyError.select("\"(\" expected", yyBase);
05920: }
05921: { // Start scope for v$g$2.
05922: final Node v$g$2 = yyOpValue1;
05923:
05924: yyValue = GNode.create("AttributeListEntry", v$g$1,
05925: v$g$2);
05926: yyValue.setLocation(location(yyStart));
05927:
05928: return new SemanticValue(yyValue, yyOption1, yyError);
05929: } // End scope for v$g$2.
05930: }
05931:
05932: // Done.
05933: return yyError;
05934: }
05935:
05936: // =========================================================================
05937:
05938: /**
05939: * Parse nonterminal xtc.lang.C.Statement.
05940: *
05941: * @param yyStart The index.
05942: * @return The result.
05943: * @throws IOException Signals an I/O error.
05944: */
05945: private Result pStatement(final int yyStart) throws IOException {
05946: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
05947: if (null == yyColumn.chunk2)
05948: yyColumn.chunk2 = new Chunk2();
05949: if (null == yyColumn.chunk2.fStatement)
05950: yyColumn.chunk2.fStatement = pStatement$1(yyStart);
05951: return yyColumn.chunk2.fStatement;
05952: }
05953:
05954: /** Actually parse xtc.lang.C.Statement. */
05955: private Result pStatement$1(final int yyStart) throws IOException {
05956: Result yyResult;
05957: int yyBase;
05958: int yyOption1;
05959: Node yyOpValue1;
05960: Node yyValue;
05961: ParseError yyError = ParseError.DUMMY;
05962:
05963: // Alternative 1.
05964:
05965: yyResult = pCommaExpression(yyStart);
05966: yyError = yyResult.select(yyError);
05967: if (yyResult.hasValue()) {
05968: final Node v$pt$2 = yyResult.semanticValue();
05969:
05970: yyBase = yyResult.index;
05971: yyResult = pSymbol(yyBase);
05972: yyError = yyResult.select(yyError);
05973: if (yyResult.hasValue()
05974: && ((Node) yyResult.semanticValue()).getTokenText()
05975: .equals(";")) {
05976: final Node v$pt$1 = yyResult.semanticValue();
05977: final Node v$g$1 = Formatting.after1(v$pt$2, v$pt$1);
05978:
05979: yyValue = GNode.create("ExpressionStatement", v$g$1);
05980: yyValue.setLocation(location(yyStart));
05981:
05982: return yyResult.createValue(yyValue, yyError);
05983: } else {
05984: yyError = yyError.select("\";\" expected", yyBase);
05985: }
05986: }
05987:
05988: // Alternative <Compound>.
05989:
05990: yyResult = pCompoundStatement(yyStart);
05991: yyError = yyResult.select(yyError);
05992: if (yyResult.hasValue()) {
05993: yyValue = yyResult.semanticValue();
05994:
05995: return yyResult.createValue(yyValue, yyError);
05996: }
05997:
05998: // Alternative 3.
05999:
06000: yyResult = pKeyword(yyStart);
06001: yyError = yyResult.select(yyError);
06002: if (yyResult.hasValue()
06003: && ((Node) yyResult.semanticValue()).getTokenText()
06004: .equals("if")) {
06005: final Node v$pt$1 = yyResult.semanticValue();
06006:
06007: yyBase = yyResult.index;
06008: yyResult = pSymbol(yyBase);
06009: yyError = yyResult.select(yyError);
06010: if (yyResult.hasValue()
06011: && ((Node) yyResult.semanticValue()).getTokenText()
06012: .equals("(")) {
06013: final Node v$pt$2 = yyResult.semanticValue();
06014:
06015: yyResult = pCommaExpression(yyResult.index);
06016: yyError = yyResult.select(yyError);
06017: if (yyResult.hasValue()) {
06018: final Node v$pt$4 = yyResult.semanticValue();
06019:
06020: yyBase = yyResult.index;
06021: yyResult = pSymbol(yyBase);
06022: yyError = yyResult.select(yyError);
06023: if (yyResult.hasValue()
06024: && ((Node) yyResult.semanticValue())
06025: .getTokenText().equals(")")) {
06026: final Node v$pt$3 = yyResult.semanticValue();
06027: final Node v$g$1 = Formatting.variable().add(
06028: v$pt$1).add(v$pt$2).addNode(v$pt$4)
06029: .add(v$pt$3);
06030:
06031: final int yyChoice1 = yyResult.index;
06032:
06033: // Nested alternative 1.
06034:
06035: yyResult = pStatement(yyChoice1);
06036: yyError = yyResult.select(yyError);
06037: if (yyResult.hasValue()) {
06038: final Node v$pt$6 = yyResult
06039: .semanticValue();
06040:
06041: yyBase = yyResult.index;
06042: yyResult = pKeyword(yyBase);
06043: yyError = yyResult.select(yyError);
06044: if (yyResult.hasValue()
06045: && ((Node) yyResult.semanticValue())
06046: .getTokenText().equals(
06047: "else")) {
06048: final Node v$pt$5 = yyResult
06049: .semanticValue();
06050: final Node v$g$2 = Formatting.after1(
06051: v$pt$6, v$pt$5);
06052:
06053: yyResult = pStatement(yyResult.index);
06054: yyError = yyResult.select(yyError);
06055: if (yyResult.hasValue()) {
06056: final Node v$g$3 = yyResult
06057: .semanticValue();
06058:
06059: yyValue = GNode.create(
06060: "IfElseStatement", v$g$1,
06061: v$g$2, v$g$3);
06062: yyValue
06063: .setLocation(location(yyStart));
06064:
06065: return yyResult.createValue(
06066: yyValue, yyError);
06067: }
06068: } else {
06069: yyError = yyError.select(
06070: "\"else\" expected", yyBase);
06071: }
06072: }
06073:
06074: // Nested alternative 2.
06075:
06076: yyResult = pStatement(yyChoice1);
06077: yyError = yyResult.select(yyError);
06078: if (yyResult.hasValue()) {
06079: final Node v$g$2 = yyResult.semanticValue();
06080:
06081: yyValue = GNode.create("IfStatement",
06082: v$g$1, v$g$2);
06083: yyValue.setLocation(location(yyStart));
06084:
06085: return yyResult.createValue(yyValue,
06086: yyError);
06087: }
06088: } else {
06089: yyError = yyError.select("\")\" expected",
06090: yyBase);
06091: }
06092: }
06093: } else {
06094: yyError = yyError.select("\"(\" expected", yyBase);
06095: }
06096: }
06097:
06098: // Alternative 4.
06099:
06100: yyResult = pKeyword(yyStart);
06101: yyError = yyResult.select(yyError);
06102: if (yyResult.hasValue()
06103: && ((Node) yyResult.semanticValue()).getTokenText()
06104: .equals("while")) {
06105: final Node v$pt$1 = yyResult.semanticValue();
06106:
06107: yyBase = yyResult.index;
06108: yyResult = pSymbol(yyBase);
06109: yyError = yyResult.select(yyError);
06110: if (yyResult.hasValue()
06111: && ((Node) yyResult.semanticValue()).getTokenText()
06112: .equals("(")) {
06113: final Node v$pt$2 = yyResult.semanticValue();
06114:
06115: yyResult = pCommaExpression(yyResult.index);
06116: yyError = yyResult.select(yyError);
06117: if (yyResult.hasValue()) {
06118: final Node v$pt$4 = yyResult.semanticValue();
06119:
06120: yyBase = yyResult.index;
06121: yyResult = pSymbol(yyBase);
06122: yyError = yyResult.select(yyError);
06123: if (yyResult.hasValue()
06124: && ((Node) yyResult.semanticValue())
06125: .getTokenText().equals(")")) {
06126: final Node v$pt$3 = yyResult.semanticValue();
06127: final Node v$g$1 = Formatting.variable().add(
06128: v$pt$1).add(v$pt$2).addNode(v$pt$4)
06129: .add(v$pt$3);
06130:
06131: yyResult = pStatement(yyResult.index);
06132: yyError = yyResult.select(yyError);
06133: if (yyResult.hasValue()) {
06134: final Node v$g$2 = yyResult.semanticValue();
06135:
06136: yyValue = GNode.create("WhileStatement",
06137: v$g$1, v$g$2);
06138: yyValue.setLocation(location(yyStart));
06139:
06140: return yyResult.createValue(yyValue,
06141: yyError);
06142: }
06143: } else {
06144: yyError = yyError.select("\")\" expected",
06145: yyBase);
06146: }
06147: }
06148: } else {
06149: yyError = yyError.select("\"(\" expected", yyBase);
06150: }
06151: }
06152:
06153: // Alternative 5.
06154:
06155: yyResult = pKeyword(yyStart);
06156: yyError = yyResult.select(yyError);
06157: if (yyResult.hasValue()
06158: && ((Node) yyResult.semanticValue()).getTokenText()
06159: .equals("do")) {
06160: final Node v$pt$1 = yyResult.semanticValue();
06161:
06162: yyResult = pStatement(yyResult.index);
06163: yyError = yyResult.select(yyError);
06164: if (yyResult.hasValue()) {
06165: final Node v$pt$4 = yyResult.semanticValue();
06166:
06167: yyBase = yyResult.index;
06168: yyResult = pKeyword(yyBase);
06169: yyError = yyResult.select(yyError);
06170: if (yyResult.hasValue()
06171: && ((Node) yyResult.semanticValue())
06172: .getTokenText().equals("while")) {
06173: final Node v$pt$2 = yyResult.semanticValue();
06174:
06175: yyBase = yyResult.index;
06176: yyResult = pSymbol(yyBase);
06177: yyError = yyResult.select(yyError);
06178: if (yyResult.hasValue()
06179: && ((Node) yyResult.semanticValue())
06180: .getTokenText().equals("(")) {
06181: final Node v$pt$3 = yyResult.semanticValue();
06182: final Node v$g$1 = Formatting.variable().add(
06183: v$pt$1).addNode(v$pt$4).add(v$pt$2)
06184: .add(v$pt$3);
06185:
06186: yyResult = pCommaExpression(yyResult.index);
06187: yyError = yyResult.select(yyError);
06188: if (yyResult.hasValue()) {
06189: final Node v$pt$7 = yyResult
06190: .semanticValue();
06191:
06192: yyBase = yyResult.index;
06193: yyResult = pSymbol(yyBase);
06194: yyError = yyResult.select(yyError);
06195: if (yyResult.hasValue()
06196: && ((Node) yyResult.semanticValue())
06197: .getTokenText().equals(")")) {
06198: final Node v$pt$5 = yyResult
06199: .semanticValue();
06200:
06201: yyBase = yyResult.index;
06202: yyResult = pSymbol(yyBase);
06203: yyError = yyResult.select(yyError);
06204: if (yyResult.hasValue()
06205: && ((Node) yyResult
06206: .semanticValue())
06207: .getTokenText().equals(
06208: ";")) {
06209: final Node v$pt$6 = yyResult
06210: .semanticValue();
06211: final Node v$g$2 = Formatting
06212: .variable().addNode(v$pt$7)
06213: .add(v$pt$5).add(v$pt$6);
06214:
06215: yyValue = GNode
06216: .create("DoStatement",
06217: v$g$1, v$g$2);
06218: yyValue
06219: .setLocation(location(yyStart));
06220:
06221: return yyResult.createValue(
06222: yyValue, yyError);
06223: } else {
06224: yyError = yyError.select(
06225: "\";\" expected", yyBase);
06226: }
06227: } else {
06228: yyError = yyError.select(
06229: "\")\" expected", yyBase);
06230: }
06231: }
06232: } else {
06233: yyError = yyError.select("\"(\" expected",
06234: yyBase);
06235: }
06236: } else {
06237: yyError = yyError.select("\"while\" expected",
06238: yyBase);
06239: }
06240: }
06241: }
06242:
06243: // Alternative 6.
06244:
06245: yyResult = pKeyword(yyStart);
06246: yyError = yyResult.select(yyError);
06247: if (yyResult.hasValue()
06248: && ((Node) yyResult.semanticValue()).getTokenText()
06249: .equals("for")) {
06250: final Node v$pt$1 = yyResult.semanticValue();
06251:
06252: yyResult = pPushScope(yyResult.index);
06253: yyError = yyResult.select(yyError);
06254: if (yyResult.hasValue()) {
06255:
06256: yyBase = yyResult.index;
06257: yyResult = pSymbol(yyBase);
06258: yyError = yyResult.select(yyError);
06259: if (yyResult.hasValue()
06260: && ((Node) yyResult.semanticValue())
06261: .getTokenText().equals("(")) {
06262: final Node v$pt$2 = yyResult.semanticValue();
06263:
06264: yyResult = pInitialClause(yyResult.index);
06265: yyError = yyResult.select(yyError);
06266: if (yyResult.hasValue()) {
06267: final Node v$pt$3 = yyResult.semanticValue();
06268: final Node v$g$1 = Formatting.variable().add(
06269: v$pt$1).add(v$pt$2).addNode(v$pt$3);
06270:
06271: yyOption1 = yyResult.index;
06272: yyOpValue1 = null;
06273:
06274: yyResult = pCommaExpression(yyOption1);
06275: yyError = yyResult.select(yyError);
06276: if (yyResult.hasValue()) {
06277: final Node v$el$1 = yyResult
06278: .semanticValue();
06279:
06280: yyOption1 = yyResult.index;
06281: yyOpValue1 = v$el$1;
06282: }
06283: { // Start scope for v$pt$5.
06284: final Node v$pt$5 = yyOpValue1;
06285:
06286: yyBase = yyOption1;
06287: yyResult = pSymbol(yyBase);
06288: yyError = yyResult.select(yyError);
06289: if (yyResult.hasValue()
06290: && ((Node) yyResult.semanticValue())
06291: .getTokenText().equals(";")) {
06292: final Node v$pt$4 = yyResult
06293: .semanticValue();
06294: final Node v$g$2 = Formatting.after1(
06295: v$pt$5, v$pt$4);
06296:
06297: yyOption1 = yyResult.index;
06298: yyOpValue1 = null;
06299:
06300: yyResult = pCommaExpression(yyOption1);
06301: yyError = yyResult.select(yyError);
06302: if (yyResult.hasValue()) {
06303: final Node v$el$2 = yyResult
06304: .semanticValue();
06305:
06306: yyOption1 = yyResult.index;
06307: yyOpValue1 = v$el$2;
06308: }
06309: { // Start scope for v$pt$7.
06310: final Node v$pt$7 = yyOpValue1;
06311:
06312: yyBase = yyOption1;
06313: yyResult = pSymbol(yyBase);
06314: yyError = yyResult.select(yyError);
06315: if (yyResult.hasValue()
06316: && ((Node) yyResult
06317: .semanticValue())
06318: .getTokenText()
06319: .equals(")")) {
06320: final Node v$pt$6 = yyResult
06321: .semanticValue();
06322: final Node v$g$3 = Formatting
06323: .after1(v$pt$7, v$pt$6);
06324:
06325: yyResult = pStatement(yyResult.index);
06326: yyError = yyResult
06327: .select(yyError);
06328: if (yyResult.hasValue()) {
06329: final Node v$g$4 = yyResult
06330: .semanticValue();
06331:
06332: yyResult = pPopScope(yyResult.index);
06333: yyError = yyResult
06334: .select(yyError);
06335: if (yyResult.hasValue()) {
06336:
06337: yyValue = GNode.create(
06338: "ForStatement",
06339: v$g$1, v$g$2,
06340: v$g$3, v$g$4);
06341: yyValue
06342: .setLocation(location(yyStart));
06343:
06344: return yyResult
06345: .createValue(
06346: yyValue,
06347: yyError);
06348: }
06349: }
06350: } else {
06351: yyError = yyError.select(
06352: "\")\" expected",
06353: yyBase);
06354: }
06355: } // End scope for v$pt$7.
06356: } else {
06357: yyError = yyError.select(
06358: "\";\" expected", yyBase);
06359: }
06360: } // End scope for v$pt$5.
06361: }
06362: } else {
06363: yyError = yyError.select("\"(\" expected", yyBase);
06364: }
06365: }
06366: }
06367:
06368: // Alternative 7.
06369:
06370: yyResult = pKeyword(yyStart);
06371: yyError = yyResult.select(yyError);
06372: if (yyResult.hasValue()
06373: && ((Node) yyResult.semanticValue()).getTokenText()
06374: .equals("switch")) {
06375: final Node v$pt$1 = yyResult.semanticValue();
06376:
06377: yyBase = yyResult.index;
06378: yyResult = pSymbol(yyBase);
06379: yyError = yyResult.select(yyError);
06380: if (yyResult.hasValue()
06381: && ((Node) yyResult.semanticValue()).getTokenText()
06382: .equals("(")) {
06383: final Node v$pt$2 = yyResult.semanticValue();
06384:
06385: yyResult = pCommaExpression(yyResult.index);
06386: yyError = yyResult.select(yyError);
06387: if (yyResult.hasValue()) {
06388: final Node v$pt$4 = yyResult.semanticValue();
06389:
06390: yyBase = yyResult.index;
06391: yyResult = pSymbol(yyBase);
06392: yyError = yyResult.select(yyError);
06393: if (yyResult.hasValue()
06394: && ((Node) yyResult.semanticValue())
06395: .getTokenText().equals(")")) {
06396: final Node v$pt$3 = yyResult.semanticValue();
06397: final Node v$g$1 = Formatting.variable().add(
06398: v$pt$1).add(v$pt$2).addNode(v$pt$4)
06399: .add(v$pt$3);
06400:
06401: yyResult = pStatement(yyResult.index);
06402: yyError = yyResult.select(yyError);
06403: if (yyResult.hasValue()) {
06404: final Node v$g$2 = yyResult.semanticValue();
06405:
06406: yyValue = GNode.create("SwitchStatement",
06407: v$g$1, v$g$2);
06408: yyValue.setLocation(location(yyStart));
06409:
06410: return yyResult.createValue(yyValue,
06411: yyError);
06412: }
06413: } else {
06414: yyError = yyError.select("\")\" expected",
06415: yyBase);
06416: }
06417: }
06418: } else {
06419: yyError = yyError.select("\"(\" expected", yyBase);
06420: }
06421: }
06422:
06423: // Alternative <Complete>.
06424:
06425: yyResult = pLabel(yyStart);
06426: yyError = yyResult.select(yyError);
06427: if (yyResult.hasValue()) {
06428: final Node v$g$1 = yyResult.semanticValue();
06429:
06430: yyResult = pStatement(yyResult.index);
06431: yyError = yyResult.select(yyError);
06432: if (yyResult.hasValue()) {
06433: final Node v$g$2 = yyResult.semanticValue();
06434:
06435: yyValue = GNode
06436: .create("LabeledStatement", v$g$1, v$g$2);
06437: yyValue.setLocation(location(yyStart));
06438:
06439: return yyResult.createValue(yyValue, yyError);
06440: }
06441: }
06442:
06443: // Alternative <Incomplete>.
06444:
06445: if (GCC) {
06446:
06447: yyResult = pLabel(yyStart);
06448: yyError = yyResult.select(yyError);
06449: if (yyResult.hasValue()) {
06450: final Node v$g$3 = yyResult.semanticValue();
06451:
06452: yyValue = GNode.create("LabeledStatement", v$g$3, null);
06453: yyValue.setLocation(location(yyStart));
06454:
06455: return yyResult.createValue(yyValue, yyError);
06456: }
06457: }
06458:
06459: // Alternative 10.
06460:
06461: yyResult = pKeyword(yyStart);
06462: yyError = yyResult.select(yyError);
06463: if (yyResult.hasValue()
06464: && ((Node) yyResult.semanticValue()).getTokenText()
06465: .equals("break")) {
06466: final Node v$pt$1 = yyResult.semanticValue();
06467:
06468: yyBase = yyResult.index;
06469: yyResult = pSymbol(yyBase);
06470: yyError = yyResult.select(yyError);
06471: if (yyResult.hasValue()
06472: && ((Node) yyResult.semanticValue()).getTokenText()
06473: .equals(";")) {
06474: final Node v$pt$2 = yyResult.semanticValue();
06475:
06476: yyValue = GNode.create("BreakStatement", false);
06477: yyValue.setLocation(location(yyStart));
06478: yyValue = Formatting.variable().addNode(yyValue).add(
06479: v$pt$1).add(v$pt$2);
06480:
06481: return yyResult.createValue(yyValue, yyError);
06482: } else {
06483: yyError = yyError.select("\";\" expected", yyBase);
06484: }
06485: }
06486:
06487: // Alternative 11.
06488:
06489: yyResult = pKeyword(yyStart);
06490: yyError = yyResult.select(yyError);
06491: if (yyResult.hasValue()
06492: && ((Node) yyResult.semanticValue()).getTokenText()
06493: .equals("continue")) {
06494: final Node v$pt$1 = yyResult.semanticValue();
06495:
06496: yyBase = yyResult.index;
06497: yyResult = pSymbol(yyBase);
06498: yyError = yyResult.select(yyError);
06499: if (yyResult.hasValue()
06500: && ((Node) yyResult.semanticValue()).getTokenText()
06501: .equals(";")) {
06502: final Node v$pt$2 = yyResult.semanticValue();
06503:
06504: yyValue = GNode.create("ContinueStatement", false);
06505: yyValue.setLocation(location(yyStart));
06506: yyValue = Formatting.variable().addNode(yyValue).add(
06507: v$pt$1).add(v$pt$2);
06508:
06509: return yyResult.createValue(yyValue, yyError);
06510: } else {
06511: yyError = yyError.select("\";\" expected", yyBase);
06512: }
06513: }
06514:
06515: // Alternative 12.
06516:
06517: yyResult = pKeyword(yyStart);
06518: yyError = yyResult.select(yyError);
06519: if (yyResult.hasValue()
06520: && ((Node) yyResult.semanticValue()).getTokenText()
06521: .equals("return")) {
06522: final Node v$pt$1 = yyResult.semanticValue();
06523:
06524: yyOption1 = yyResult.index;
06525: yyOpValue1 = null;
06526:
06527: yyResult = pCommaExpression(yyOption1);
06528: yyError = yyResult.select(yyError);
06529: if (yyResult.hasValue()) {
06530: final Node v$el$1 = yyResult.semanticValue();
06531:
06532: yyOption1 = yyResult.index;
06533: yyOpValue1 = v$el$1;
06534: }
06535: { // Start scope for v$pt$3.
06536: final Node v$pt$3 = yyOpValue1;
06537:
06538: yyBase = yyOption1;
06539: yyResult = pSymbol(yyBase);
06540: yyError = yyResult.select(yyError);
06541: if (yyResult.hasValue()
06542: && ((Node) yyResult.semanticValue())
06543: .getTokenText().equals(";")) {
06544: final Node v$pt$2 = yyResult.semanticValue();
06545: final Node v$g$1 = Formatting.round1(v$pt$1,
06546: v$pt$3, v$pt$2);
06547:
06548: yyValue = GNode.create("ReturnStatement", v$g$1);
06549: yyValue.setLocation(location(yyStart));
06550:
06551: return yyResult.createValue(yyValue, yyError);
06552: } else {
06553: yyError = yyError.select("\";\" expected", yyBase);
06554: }
06555: } // End scope for v$pt$3.
06556: }
06557:
06558: // Alternative <Direct>.
06559:
06560: yyResult = pKeyword(yyStart);
06561: yyError = yyResult.select(yyError);
06562: if (yyResult.hasValue()
06563: && ((Node) yyResult.semanticValue()).getTokenText()
06564: .equals("goto")) {
06565: final Node v$pt$1 = yyResult.semanticValue();
06566: final Node v$g$1 = Formatting.before1(v$pt$1, null);
06567:
06568: yyResult = pPrimaryIdentifier(yyResult.index);
06569: yyError = yyResult.select(yyError);
06570: if (yyResult.hasValue()) {
06571: final Node v$pt$4 = yyResult.semanticValue();
06572:
06573: yyBase = yyResult.index;
06574: yyResult = pSymbol(yyBase);
06575: yyError = yyResult.select(yyError);
06576: if (yyResult.hasValue()
06577: && ((Node) yyResult.semanticValue())
06578: .getTokenText().equals(";")) {
06579: final Node v$pt$3 = yyResult.semanticValue();
06580: final Node v$g$2 = Formatting
06581: .after1(v$pt$4, v$pt$3);
06582:
06583: yyValue = GNode.create("GotoStatement", v$g$1,
06584: v$g$2);
06585: yyValue.setLocation(location(yyStart));
06586:
06587: return yyResult.createValue(yyValue, yyError);
06588: } else {
06589: yyError = yyError.select("\";\" expected", yyBase);
06590: }
06591: }
06592: }
06593:
06594: // Alternative <Computed>.
06595:
06596: if (GCC) {
06597:
06598: yyResult = pKeyword(yyStart);
06599: yyError = yyResult.select(yyError);
06600: if (yyResult.hasValue()
06601: && ((Node) yyResult.semanticValue()).getTokenText()
06602: .equals("goto")) {
06603: final Node v$pt$5 = yyResult.semanticValue();
06604:
06605: yyBase = yyResult.index;
06606: yyResult = pSymbol(yyBase);
06607: yyError = yyResult.select(yyError);
06608: if (yyResult.hasValue()
06609: && ((Node) yyResult.semanticValue())
06610: .getTokenText().equals("*")) {
06611: final Node v$pt$6 = yyResult.semanticValue();
06612: final Node v$g$3 = Formatting.before1(v$pt$5,
06613: v$pt$6);
06614:
06615: yyResult = pCommaExpression(yyResult.index);
06616: yyError = yyResult.select(yyError);
06617: if (yyResult.hasValue()) {
06618: final Node v$pt$8 = yyResult.semanticValue();
06619:
06620: yyBase = yyResult.index;
06621: yyResult = pSymbol(yyBase);
06622: yyError = yyResult.select(yyError);
06623: if (yyResult.hasValue()
06624: && ((Node) yyResult.semanticValue())
06625: .getTokenText().equals(";")) {
06626: final Node v$pt$7 = yyResult
06627: .semanticValue();
06628: final Node v$g$4 = Formatting.after1(
06629: v$pt$8, v$pt$7);
06630:
06631: yyValue = GNode.create("GotoStatement",
06632: v$g$3, v$g$4);
06633: yyValue.setLocation(location(yyStart));
06634:
06635: return yyResult.createValue(yyValue,
06636: yyError);
06637: } else {
06638: yyError = yyError.select("\";\" expected",
06639: yyBase);
06640: }
06641: }
06642: } else {
06643: yyError = yyError.select("\"*\" expected", yyBase);
06644: }
06645: }
06646: }
06647:
06648: // Alternative 15.
06649:
06650: yyResult = pAsmKeyword(yyStart);
06651: yyError = yyResult.select(yyError);
06652: if (yyResult.hasValue()) {
06653: final Node v$pt$1 = yyResult.semanticValue();
06654:
06655: yyOption1 = yyResult.index;
06656: yyOpValue1 = null;
06657:
06658: yyResult = pTypeQualifier(yyOption1);
06659: yyError = yyResult.select(yyError);
06660: if (yyResult.hasValue()) {
06661: final Node v$el$1 = yyResult.semanticValue();
06662:
06663: yyOption1 = yyResult.index;
06664: yyOpValue1 = v$el$1;
06665: }
06666: { // Start scope for v$pt$3.
06667: final Node v$pt$3 = yyOpValue1;
06668:
06669: yyBase = yyOption1;
06670: yyResult = pSymbol(yyBase);
06671: yyError = yyResult.select(yyError);
06672: if (yyResult.hasValue()
06673: && ((Node) yyResult.semanticValue())
06674: .getTokenText().equals("(")) {
06675: final Node v$pt$2 = yyResult.semanticValue();
06676: final Node v$g$1 = Formatting.round1(v$pt$1,
06677: v$pt$3, v$pt$2);
06678:
06679: yyResult = pAssemblyArgument(yyResult.index);
06680: yyError = yyResult.select(yyError);
06681: if (yyResult.hasValue()) {
06682: final Node v$pt$5 = yyResult.semanticValue();
06683:
06684: yyBase = yyResult.index;
06685: yyResult = pSymbol(yyBase);
06686: yyError = yyResult.select(yyError);
06687: if (yyResult.hasValue()
06688: && ((Node) yyResult.semanticValue())
06689: .getTokenText().equals(")")) {
06690: final Node v$pt$4 = yyResult
06691: .semanticValue();
06692: final Node v$g$2 = Formatting.after1(
06693: v$pt$5, v$pt$4);
06694:
06695: yyBase = yyResult.index;
06696: yyResult = pSymbol(yyBase);
06697: yyError = yyResult.select(yyError);
06698: if (yyResult.hasValue()
06699: && ((Node) yyResult.semanticValue())
06700: .getTokenText().equals(";")) {
06701: final Node v$g$3 = yyResult
06702: .semanticValue();
06703:
06704: yyValue = GNode.create(
06705: "AssemblyStatement", v$g$1,
06706: v$g$2, v$g$3);
06707: yyValue.setLocation(location(yyStart));
06708:
06709: return yyResult.createValue(yyValue,
06710: yyError);
06711: } else {
06712: yyError = yyError.select(
06713: "\";\" expected", yyBase);
06714: }
06715: } else {
06716: yyError = yyError.select("\")\" expected",
06717: yyBase);
06718: }
06719: }
06720: } else {
06721: yyError = yyError.select("\"(\" expected", yyBase);
06722: }
06723: } // End scope for v$pt$3.
06724: }
06725:
06726: // Alternative 16.
06727:
06728: yyResult = pSymbol(yyStart);
06729: yyError = yyResult.select(yyError);
06730: if (yyResult.hasValue()
06731: && ((Node) yyResult.semanticValue()).getTokenText()
06732: .equals(";")) {
06733: final Node v$pt$1 = yyResult.semanticValue();
06734:
06735: yyValue = GNode.create("EmptyStatement", false);
06736: yyValue.setLocation(location(yyStart));
06737: yyValue = Formatting.after1(yyValue, v$pt$1);
06738:
06739: return yyResult.createValue(yyValue, yyError);
06740: }
06741:
06742: // Done.
06743: yyError = yyError.select("statement expected", yyStart);
06744: return yyError;
06745: }
06746:
06747: // =========================================================================
06748:
06749: /**
06750: * Parse nonterminal xtc.lang.C.Label.
06751: *
06752: * @param yyStart The index.
06753: * @return The result.
06754: * @throws IOException Signals an I/O error.
06755: */
06756: private Result pLabel(final int yyStart) throws IOException {
06757: Result yyResult;
06758: int yyBase;
06759: int yyOption1;
06760: Node yyOpValue1;
06761: Node yyValue;
06762: ParseError yyError = ParseError.DUMMY;
06763:
06764: // Alternative <Label>.
06765:
06766: yyResult = pIdentifier(yyStart);
06767: yyError = yyResult.select(yyError);
06768: if (yyResult.hasValue()) {
06769: final Node v$pt$2 = yyResult.semanticValue();
06770:
06771: yyBase = yyResult.index;
06772: yyResult = pSymbol(yyBase);
06773: yyError = yyResult.select(yyError);
06774: if (yyResult.hasValue()
06775: && ((Node) yyResult.semanticValue()).getTokenText()
06776: .equals(":")) {
06777: final Node v$pt$1 = yyResult.semanticValue();
06778: final Node v$g$1 = Formatting.after1(v$pt$2, v$pt$1);
06779:
06780: yyOption1 = yyResult.index;
06781: yyOpValue1 = null;
06782:
06783: yyResult = pAttributeSpecifierList(yyOption1);
06784: yyError = yyResult.select(yyError);
06785: if (yyResult.hasValue()) {
06786: final Node v$el$1 = yyResult.semanticValue();
06787:
06788: yyOption1 = yyResult.index;
06789: yyOpValue1 = v$el$1;
06790: }
06791: { // Start scope for v$g$2.
06792: final Node v$g$2 = yyOpValue1;
06793:
06794: yyValue = GNode.create("NamedLabel", v$g$1, v$g$2);
06795: yyValue.setLocation(location(yyStart));
06796:
06797: return new SemanticValue(yyValue, yyOption1,
06798: yyError);
06799: } // End scope for v$g$2.
06800: } else {
06801: yyError = yyError.select("\":\" expected", yyBase);
06802: }
06803: }
06804:
06805: // Alternative <Range>.
06806:
06807: if (GCC) {
06808:
06809: yyResult = pKeyword(yyStart);
06810: yyError = yyResult.select(yyError);
06811: if (yyResult.hasValue()
06812: && ((Node) yyResult.semanticValue()).getTokenText()
06813: .equals("case")) {
06814: final Node v$pt$1 = yyResult.semanticValue();
06815:
06816: yyResult = pConditionalExpression(yyResult.index);
06817: yyError = yyResult.select(yyError);
06818: if (yyResult.hasValue()) {
06819: final Node v$pt$3 = yyResult.semanticValue();
06820:
06821: yyBase = yyResult.index;
06822: yyResult = pSymbol(yyBase);
06823: yyError = yyResult.select(yyError);
06824: if (yyResult.hasValue()
06825: && ((Node) yyResult.semanticValue())
06826: .getTokenText().equals("...")) {
06827: final Node v$pt$2 = yyResult.semanticValue();
06828: final Node v$g$1 = Formatting.round1(v$pt$1,
06829: v$pt$3, v$pt$2);
06830:
06831: yyResult = pConditionalExpression(yyResult.index);
06832: yyError = yyResult.select(yyError);
06833: if (yyResult.hasValue()) {
06834: final Node v$pt$5 = yyResult
06835: .semanticValue();
06836:
06837: yyBase = yyResult.index;
06838: yyResult = pSymbol(yyBase);
06839: yyError = yyResult.select(yyError);
06840: if (yyResult.hasValue()
06841: && ((Node) yyResult.semanticValue())
06842: .getTokenText().equals(":")) {
06843: final Node v$pt$4 = yyResult
06844: .semanticValue();
06845: final Node v$g$2 = Formatting.after1(
06846: v$pt$5, v$pt$4);
06847:
06848: yyValue = GNode.create("CaseLabel",
06849: v$g$1, v$g$2);
06850: yyValue.setLocation(location(yyStart));
06851:
06852: return yyResult.createValue(yyValue,
06853: yyError);
06854: } else {
06855: yyError = yyError.select(
06856: "\":\" expected", yyBase);
06857: }
06858: }
06859: } else {
06860: yyError = yyError.select("\"...\" expected",
06861: yyBase);
06862: }
06863: }
06864: }
06865: }
06866:
06867: // Alternative <Simple>.
06868:
06869: yyResult = pKeyword(yyStart);
06870: yyError = yyResult.select(yyError);
06871: if (yyResult.hasValue()
06872: && ((Node) yyResult.semanticValue()).getTokenText()
06873: .equals("case")) {
06874: final Node v$pt$6 = yyResult.semanticValue();
06875:
06876: yyResult = pConditionalExpression(yyResult.index);
06877: yyError = yyResult.select(yyError);
06878: if (yyResult.hasValue()) {
06879: final Node v$pt$8 = yyResult.semanticValue();
06880:
06881: yyBase = yyResult.index;
06882: yyResult = pSymbol(yyBase);
06883: yyError = yyResult.select(yyError);
06884: if (yyResult.hasValue()
06885: && ((Node) yyResult.semanticValue())
06886: .getTokenText().equals(":")) {
06887: final Node v$pt$7 = yyResult.semanticValue();
06888: final Node v$g$3 = Formatting.round1(v$pt$6,
06889: v$pt$8, v$pt$7);
06890:
06891: yyValue = GNode.create("CaseLabel", v$g$3);
06892: yyValue.setLocation(location(yyStart));
06893:
06894: return yyResult.createValue(yyValue, yyError);
06895: } else {
06896: yyError = yyError.select("\":\" expected", yyBase);
06897: }
06898: }
06899: }
06900:
06901: // Alternative 4.
06902:
06903: yyResult = pKeyword(yyStart);
06904: yyError = yyResult.select(yyError);
06905: if (yyResult.hasValue()
06906: && ((Node) yyResult.semanticValue()).getTokenText()
06907: .equals("default")) {
06908: final Node v$pt$1 = yyResult.semanticValue();
06909:
06910: yyBase = yyResult.index;
06911: yyResult = pSymbol(yyBase);
06912: yyError = yyResult.select(yyError);
06913: if (yyResult.hasValue()
06914: && ((Node) yyResult.semanticValue()).getTokenText()
06915: .equals(":")) {
06916: final Node v$pt$2 = yyResult.semanticValue();
06917:
06918: yyValue = GNode.create("DefaultLabel", false);
06919: yyValue.setLocation(location(yyStart));
06920: yyValue = Formatting.variable().addNode(yyValue).add(
06921: v$pt$1).add(v$pt$2);
06922:
06923: return yyResult.createValue(yyValue, yyError);
06924: } else {
06925: yyError = yyError.select("\":\" expected", yyBase);
06926: }
06927: }
06928:
06929: // Done.
06930: yyError = yyError.select("label expected", yyStart);
06931: return yyError;
06932: }
06933:
06934: // =========================================================================
06935:
06936: /**
06937: * Parse nonterminal xtc.lang.C.CompoundStatement.
06938: *
06939: * @param yyStart The index.
06940: * @return The result.
06941: * @throws IOException Signals an I/O error.
06942: */
06943: private Result pCompoundStatement(final int yyStart)
06944: throws IOException {
06945: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
06946: if (null == yyColumn.chunk2)
06947: yyColumn.chunk2 = new Chunk2();
06948: if (null == yyColumn.chunk2.fCompoundStatement)
06949: yyColumn.chunk2.fCompoundStatement = pCompoundStatement$1(yyStart);
06950: return yyColumn.chunk2.fCompoundStatement;
06951: }
06952:
06953: /** Actually parse xtc.lang.C.CompoundStatement. */
06954: private Result pCompoundStatement$1(final int yyStart)
06955: throws IOException {
06956: Result yyResult;
06957: Node yyValue;
06958: ParseError yyError = ParseError.DUMMY;
06959:
06960: // Alternative <Compound>.
06961:
06962: yyResult = pSymbol(yyStart);
06963: yyError = yyResult.select(yyError);
06964: if (yyResult.hasValue()
06965: && ((Node) yyResult.semanticValue()).getTokenText()
06966: .equals("{")) {
06967: final Node v$pt$1 = yyResult.semanticValue();
06968:
06969: yyResult = pPushScope(yyResult.index);
06970: yyError = yyResult.select(yyError);
06971: if (yyResult.hasValue()) {
06972:
06973: yyResult = pCompoundStatement$$Split1(yyResult.index);
06974: yyError = yyResult.select(yyError);
06975: if (yyResult.hasValue()) {
06976: final Node v$pt$2 = yyResult.semanticValue();
06977: yyValue = Formatting.before1(v$pt$1, v$pt$2);
06978:
06979: return yyResult.createValue(yyValue, yyError);
06980: }
06981: }
06982: }
06983:
06984: // Done.
06985: yyError = yyError
06986: .select("compound statement expected", yyStart);
06987: return yyError;
06988: }
06989:
06990: // =========================================================================
06991:
06992: /**
06993: * Parse synthetic nonterminal xtc.lang.C.CompoundStatement$$Split1.
06994: *
06995: * @param yyStart The index.
06996: * @return The result.
06997: * @throws IOException Signals an I/O error.
06998: */
06999: private Result pCompoundStatement$$Split1(final int yyStart)
07000: throws IOException {
07001:
07002: Result yyResult;
07003: int yyBase;
07004: int yyRepetition1;
07005: Pair<Node> yyRepValue1;
07006: Node yyValue;
07007: ParseError yyError = ParseError.DUMMY;
07008:
07009: // Alternative <Compound>.
07010:
07011: yyRepetition1 = yyStart;
07012: yyRepValue1 = Pair.empty();
07013: while (true) {
07014:
07015: yyResult = pLocalLabelDeclaration(yyRepetition1);
07016: yyError = yyResult.select(yyError);
07017: if (yyResult.hasValue()) {
07018: final Node v$el$1 = yyResult.semanticValue();
07019:
07020: yyRepetition1 = yyResult.index;
07021: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
07022: continue;
07023: }
07024: break;
07025: }
07026: { // Start scope for v$g$1.
07027: final Pair<Node> v$g$1 = yyRepValue1.reverse();
07028:
07029: yyRepValue1 = Pair.empty();
07030: while (true) {
07031:
07032: yyResult = pDeclarationOrStatement(yyRepetition1);
07033: yyError = yyResult.select(yyError);
07034: if (yyResult.hasValue()) {
07035: final Node v$el$2 = yyResult.semanticValue();
07036:
07037: yyRepetition1 = yyResult.index;
07038: yyRepValue1 = new Pair<Node>(v$el$2, yyRepValue1);
07039: continue;
07040: }
07041: break;
07042: }
07043: { // Start scope for v$g$2.
07044: final Pair<Node> v$g$2 = yyRepValue1.reverse();
07045:
07046: yyResult = pAnnotations(yyRepetition1);
07047: yyError = yyResult.select(yyError);
07048: if (yyResult.hasValue()) {
07049: final Node v$pt$2 = yyResult.semanticValue();
07050:
07051: yyBase = yyResult.index;
07052: yyResult = pSymbol(yyBase);
07053: yyError = yyResult.select(yyError);
07054: if (yyResult.hasValue()
07055: && ((Node) yyResult.semanticValue())
07056: .getTokenText().equals("}")) {
07057: final Node v$pt$1 = yyResult.semanticValue();
07058:
07059: yyResult = pPopScope(yyResult.index);
07060: yyError = yyResult.select(yyError);
07061: if (yyResult.hasValue()) {
07062: final Node v$g$3 = Formatting.after1(
07063: v$pt$2, v$pt$1);
07064:
07065: yyValue = GNode.create("CompoundStatement",
07066: v$g$1.size() + v$g$2.size() + 1)
07067: .addAll(v$g$1).addAll(v$g$2).add(
07068: v$g$3);
07069: yyValue.setLocation(location(yyStart));
07070:
07071: return yyResult.createValue(yyValue,
07072: yyError);
07073: }
07074: } else {
07075: yyError = yyError.select("\"}\" expected",
07076: yyBase);
07077: }
07078: }
07079: } // End scope for v$g$2.
07080: } // End scope for v$g$1.
07081:
07082: // Done.
07083: return yyError;
07084: }
07085:
07086: // =========================================================================
07087:
07088: /**
07089: * Parse nonterminal xtc.lang.C.LocalLabelDeclaration.
07090: *
07091: * @param yyStart The index.
07092: * @return The result.
07093: * @throws IOException Signals an I/O error.
07094: */
07095: private Result pLocalLabelDeclaration(final int yyStart)
07096: throws IOException {
07097:
07098: Result yyResult;
07099: int yyBase;
07100: Node yyValue;
07101: ParseError yyError = ParseError.DUMMY;
07102:
07103: // Alternative 1.
07104:
07105: yyResult = pLocalLabelDeclaration$$Split1(yyStart);
07106: yyError = yyResult.select(yyError);
07107: if (yyResult.hasValue()) {
07108: final Node v$pt$1 = yyResult.semanticValue();
07109:
07110: yyBase = yyResult.index;
07111: yyResult = pSymbol(yyBase);
07112: yyError = yyResult.select(yyError);
07113: if (yyResult.hasValue()
07114: && ((Node) yyResult.semanticValue()).getTokenText()
07115: .equals(";")) {
07116: final Node v$pt$2 = yyResult.semanticValue();
07117: yyValue = Formatting.after1(v$pt$1, v$pt$2);
07118:
07119: return yyResult.createValue(yyValue, yyError);
07120: } else {
07121: yyError = yyError.select("\";\" expected", yyBase);
07122: }
07123: }
07124:
07125: // Done.
07126: return yyError;
07127: }
07128:
07129: // =========================================================================
07130:
07131: /**
07132: * Parse synthetic nonterminal xtc.lang.C.LocalLabelDeclaration$$Split1.
07133: *
07134: * @param yyStart The index.
07135: * @return The result.
07136: * @throws IOException Signals an I/O error.
07137: */
07138: private Result pLocalLabelDeclaration$$Split1(final int yyStart)
07139: throws IOException {
07140:
07141: Result yyResult;
07142: int yyBase;
07143: int yyRepetition1;
07144: Pair<Node> yyRepValue1;
07145: Node yyValue;
07146: ParseError yyError = ParseError.DUMMY;
07147:
07148: // Alternative 1.
07149:
07150: yyResult = pKeyword(yyStart);
07151: yyError = yyResult.select(yyError);
07152: if (yyResult.hasValue()
07153: && ((Node) yyResult.semanticValue()).getTokenText()
07154: .equals("__label__")) {
07155: final Node v$pt$3 = yyResult.semanticValue();
07156:
07157: yyResult = pIdentifier(yyResult.index);
07158: yyError = yyResult.select(yyError);
07159: if (yyResult.hasValue()) {
07160: final Node v$pt$4 = yyResult.semanticValue();
07161: final Node v$g$1 = Formatting.before1(v$pt$3, v$pt$4);
07162:
07163: yyRepetition1 = yyResult.index;
07164: yyRepValue1 = Pair.empty();
07165: while (true) {
07166:
07167: yyBase = yyRepetition1;
07168: yyResult = pSymbol(yyBase);
07169: yyError = yyResult.select(yyError);
07170: if (yyResult.hasValue()
07171: && ((Node) yyResult.semanticValue())
07172: .getTokenText().equals(",")) {
07173: final Node v$pt$1 = yyResult.semanticValue();
07174:
07175: yyResult = pIdentifier(yyResult.index);
07176: yyError = yyResult.select(yyError);
07177: if (yyResult.hasValue()) {
07178: final Node v$pt$2 = yyResult
07179: .semanticValue();
07180: final Node v$el$1 = Formatting.before1(
07181: v$pt$1, v$pt$2);
07182:
07183: yyRepetition1 = yyResult.index;
07184: yyRepValue1 = new Pair<Node>(v$el$1,
07185: yyRepValue1);
07186: continue;
07187: }
07188: } else {
07189: yyError = yyError.select("\",\" expected",
07190: yyBase);
07191: }
07192: break;
07193: }
07194: { // Start scope for v$g$2.
07195: final Pair<Node> v$g$2 = yyRepValue1.reverse();
07196:
07197: yyValue = GNode.createFromPair(
07198: "LocalLabelDeclaration", v$g$1, v$g$2);
07199: yyValue.setLocation(location(yyStart));
07200:
07201: return new SemanticValue(yyValue, yyRepetition1,
07202: yyError);
07203: } // End scope for v$g$2.
07204: }
07205: }
07206:
07207: // Done.
07208: yyError = yyError.select("local label declaration expected",
07209: yyStart);
07210: return yyError;
07211: }
07212:
07213: // =========================================================================
07214:
07215: /**
07216: * Parse nonterminal xtc.lang.C.DeclarationOrStatement.
07217: *
07218: * @param yyStart The index.
07219: * @return The result.
07220: * @throws IOException Signals an I/O error.
07221: */
07222: private Result pDeclarationOrStatement(final int yyStart)
07223: throws IOException {
07224:
07225: Result yyResult;
07226: Node yyValue;
07227: ParseError yyError = ParseError.DUMMY;
07228:
07229: // Start a state modification.
07230: yyState.start();
07231:
07232: // Alternative <Declaration>.
07233:
07234: yyState.mark();
07235:
07236: yyResult = pDeclaration(yyStart);
07237: yyError = yyResult.select(yyError);
07238: if (yyResult.hasValue()) {
07239: final Node d = yyResult.semanticValue();
07240:
07241: yyValue = yyState.annotate(d);
07242:
07243: // Commit the state modification.
07244: yyState.commit();
07245:
07246: setLocation(yyValue, yyStart);
07247: return yyResult.createValue(yyValue, yyError);
07248: }
07249:
07250: // Alternative <Statement>.
07251:
07252: yyResult = pStatement(yyStart);
07253: yyError = yyResult.select(yyError);
07254: if (yyResult.hasValue()) {
07255: final Node s = yyResult.semanticValue();
07256:
07257: yyValue = yyState.annotate(s);
07258:
07259: // Commit the state modification.
07260: yyState.commit();
07261:
07262: setLocation(yyValue, yyStart);
07263: return yyResult.createValue(yyValue, yyError);
07264: }
07265:
07266: // Abort the state modification.
07267: yyState.abort();
07268:
07269: // Done.
07270: return yyError;
07271: }
07272:
07273: // =========================================================================
07274:
07275: /**
07276: * Parse nonterminal xtc.lang.C.InitialClause.
07277: *
07278: * @param yyStart The index.
07279: * @return The result.
07280: * @throws IOException Signals an I/O error.
07281: */
07282: private Result pInitialClause(final int yyStart) throws IOException {
07283: Result yyResult;
07284: int yyBase;
07285: int yyOption1;
07286: Node yyOpValue1;
07287: Node yyValue;
07288: ParseError yyError = ParseError.DUMMY;
07289:
07290: // Start a state modification.
07291: yyState.start();
07292:
07293: // Alternative <Declaration>.
07294:
07295: yyResult = pDeclaration(yyStart);
07296: yyError = yyResult.select(yyError);
07297: if (yyResult.hasValue()) {
07298: yyValue = yyResult.semanticValue();
07299:
07300: // Commit the state modification.
07301: yyState.commit();
07302:
07303: return yyResult.createValue(yyValue, yyError);
07304: }
07305:
07306: // Alternative <Expression>.
07307:
07308: yyOption1 = yyStart;
07309: yyOpValue1 = null;
07310:
07311: yyResult = pCommaExpression(yyOption1);
07312: yyError = yyResult.select(yyError);
07313: if (yyResult.hasValue()) {
07314: final Node v$el$3 = yyResult.semanticValue();
07315:
07316: yyOption1 = yyResult.index;
07317: yyOpValue1 = v$el$3;
07318: }
07319: { // Start scope for v$pt$2.
07320: final Node v$pt$2 = yyOpValue1;
07321:
07322: yyBase = yyOption1;
07323: yyResult = pSymbol(yyBase);
07324: yyError = yyResult.select(yyError);
07325: if (yyResult.hasValue()
07326: && ((Node) yyResult.semanticValue()).getTokenText()
07327: .equals(";")) {
07328: final Node v$pt$1 = yyResult.semanticValue();
07329: yyValue = Formatting.after1(v$pt$2, v$pt$1);
07330:
07331: // Commit the state modification.
07332: yyState.commit();
07333:
07334: return yyResult.createValue(yyValue, yyError);
07335: } else {
07336: yyError = yyError.select("\";\" expected", yyBase);
07337: }
07338: } // End scope for v$pt$2.
07339:
07340: // Abort the state modification.
07341: yyState.abort();
07342:
07343: // Done.
07344: return yyError;
07345: }
07346:
07347: // =========================================================================
07348:
07349: /**
07350: * Parse nonterminal xtc.lang.C.CommaExpression.
07351: *
07352: * @param yyStart The index.
07353: * @return The result.
07354: * @throws IOException Signals an I/O error.
07355: */
07356: private Result pCommaExpression(final int yyStart)
07357: throws IOException {
07358: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
07359: if (null == yyColumn.chunk2)
07360: yyColumn.chunk2 = new Chunk2();
07361: if (null == yyColumn.chunk2.fCommaExpression)
07362: yyColumn.chunk2.fCommaExpression = pCommaExpression$1(yyStart);
07363: return yyColumn.chunk2.fCommaExpression;
07364: }
07365:
07366: /** Actually parse xtc.lang.C.CommaExpression. */
07367: private Result pCommaExpression$1(final int yyStart)
07368: throws IOException {
07369: Result yyResult;
07370: int yyRepetition1;
07371: Pair<Action<Node>> yyRepValue1;
07372: Node yyValue;
07373: ParseError yyError = ParseError.DUMMY;
07374:
07375: // Alternative <Base>.
07376:
07377: yyResult = pAssignmentExpression(yyStart);
07378: yyError = yyResult.select(yyError);
07379: if (yyResult.hasValue()) {
07380: final Node v$3 = yyResult.semanticValue();
07381:
07382: yyRepetition1 = yyResult.index;
07383: yyRepValue1 = Pair.empty();
07384: while (true) {
07385:
07386: yyResult = pCommaExpression$$Tail1(yyRepetition1);
07387: yyError = yyResult.select(yyError);
07388: if (yyResult.hasValue()) {
07389: final Action<Node> v$4 = yyResult.semanticValue();
07390:
07391: yyRepetition1 = yyResult.index;
07392: yyRepValue1 = new Pair<Action<Node>>(v$4,
07393: yyRepValue1);
07394: continue;
07395: }
07396: break;
07397: }
07398: { // Start scope for v$5.
07399: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07400:
07401: yyValue = apply(v$5, v$3, yyStart);
07402:
07403: return new SemanticValue(yyValue, yyRepetition1,
07404: yyError);
07405: } // End scope for v$5.
07406: }
07407:
07408: // Done.
07409: return yyError;
07410: }
07411:
07412: // =========================================================================
07413:
07414: /**
07415: * Parse synthetic nonterminal xtc.lang.C.CommaExpression$$Tail1.
07416: *
07417: * @param yyStart The index.
07418: * @return The result.
07419: * @throws IOException Signals an I/O error.
07420: */
07421: private Result pCommaExpression$$Tail1(final int yyStart)
07422: throws IOException {
07423:
07424: Result yyResult;
07425: Action<Node> yyValue;
07426: ParseError yyError = ParseError.DUMMY;
07427:
07428: // Alternative <Comma>.
07429:
07430: yyResult = pSymbol(yyStart);
07431: yyError = yyResult.select(yyError);
07432: if (yyResult.hasValue()
07433: && ((Node) yyResult.semanticValue()).getTokenText()
07434: .equals(",")) {
07435: final Node v$pt$1 = yyResult.semanticValue();
07436:
07437: yyResult = pAssignmentExpression(yyResult.index);
07438: yyError = yyResult.select(yyError);
07439: if (yyResult.hasValue()) {
07440: final Node v$pt$2 = yyResult.semanticValue();
07441: final Node v$g$2 = Formatting.before1(v$pt$1, v$pt$2);
07442:
07443: yyValue = new Action<Node>() {
07444: public Node run(Node v$1) {
07445: return GNode.create("CommaExpression", v$1,
07446: v$g$2);
07447: }
07448: };
07449:
07450: return yyResult.createValue(yyValue, yyError);
07451: }
07452: }
07453:
07454: // Done.
07455: yyError = yyError.select("comma expression expected", yyStart);
07456: return yyError;
07457: }
07458:
07459: // =========================================================================
07460:
07461: /**
07462: * Parse nonterminal xtc.lang.C.AssignmentExpression.
07463: *
07464: * @param yyStart The index.
07465: * @return The result.
07466: * @throws IOException Signals an I/O error.
07467: */
07468: private Result pAssignmentExpression(final int yyStart)
07469: throws IOException {
07470: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
07471: if (null == yyColumn.chunk2)
07472: yyColumn.chunk2 = new Chunk2();
07473: if (null == yyColumn.chunk2.fAssignmentExpression)
07474: yyColumn.chunk2.fAssignmentExpression = pAssignmentExpression$1(yyStart);
07475: return yyColumn.chunk2.fAssignmentExpression;
07476: }
07477:
07478: /** Actually parse xtc.lang.C.AssignmentExpression. */
07479: private Result pAssignmentExpression$1(final int yyStart)
07480: throws IOException {
07481:
07482: Result yyResult;
07483: Node yyValue;
07484: ParseError yyError = ParseError.DUMMY;
07485:
07486: // Alternative <Assignment>.
07487:
07488: yyResult = pUnaryExpression(yyStart);
07489: yyError = yyResult.select(yyError);
07490: if (yyResult.hasValue()) {
07491: final Node v$g$1 = yyResult.semanticValue();
07492:
07493: yyResult = pAssignmentOperator(yyResult.index);
07494: yyError = yyResult.select(yyError);
07495: if (yyResult.hasValue()) {
07496: final Node v$g$2 = yyResult.semanticValue();
07497:
07498: yyResult = pAssignmentExpression(yyResult.index);
07499: yyError = yyResult.select(yyError);
07500: if (yyResult.hasValue()) {
07501: final Node v$g$3 = yyResult.semanticValue();
07502:
07503: yyValue = GNode.create("AssignmentExpression",
07504: v$g$1, v$g$2, v$g$3);
07505: yyValue.setLocation(location(yyStart));
07506:
07507: return yyResult.createValue(yyValue, yyError);
07508: }
07509: }
07510: }
07511:
07512: // Alternative <Base>.
07513:
07514: yyResult = pConditionalExpression(yyStart);
07515: yyError = yyResult.select(yyError);
07516: if (yyResult.hasValue()) {
07517: yyValue = yyResult.semanticValue();
07518:
07519: return yyResult.createValue(yyValue, yyError);
07520: }
07521:
07522: // Done.
07523: return yyError;
07524: }
07525:
07526: // =========================================================================
07527:
07528: /**
07529: * Parse nonterminal xtc.lang.C.AssignmentOperator.
07530: *
07531: * @param yyStart The index.
07532: * @return The result.
07533: * @throws IOException Signals an I/O error.
07534: */
07535: private Result pAssignmentOperator(final int yyStart)
07536: throws IOException {
07537: Result yyResult;
07538: Node yyValue;
07539: ParseError yyError = ParseError.DUMMY;
07540:
07541: // Alternative <Equal>.
07542:
07543: yyResult = pSymbol(yyStart);
07544: yyError = yyResult.select(yyError);
07545: if (yyResult.hasValue()
07546: && ((Node) yyResult.semanticValue()).getTokenText()
07547: .equals("=")) {
07548: yyValue = yyResult.semanticValue();
07549:
07550: return yyResult.createValue(yyValue, yyError);
07551: }
07552:
07553: // Alternative <PlusEqual>.
07554:
07555: yyResult = pSymbol(yyStart);
07556: yyError = yyResult.select(yyError);
07557: if (yyResult.hasValue()
07558: && ((Node) yyResult.semanticValue()).getTokenText()
07559: .equals("+=")) {
07560: yyValue = yyResult.semanticValue();
07561:
07562: return yyResult.createValue(yyValue, yyError);
07563: }
07564:
07565: // Alternative <MinusEqual>.
07566:
07567: yyResult = pSymbol(yyStart);
07568: yyError = yyResult.select(yyError);
07569: if (yyResult.hasValue()
07570: && ((Node) yyResult.semanticValue()).getTokenText()
07571: .equals("-=")) {
07572: yyValue = yyResult.semanticValue();
07573:
07574: return yyResult.createValue(yyValue, yyError);
07575: }
07576:
07577: // Alternative <TimesEqual>.
07578:
07579: yyResult = pSymbol(yyStart);
07580: yyError = yyResult.select(yyError);
07581: if (yyResult.hasValue()
07582: && ((Node) yyResult.semanticValue()).getTokenText()
07583: .equals("*=")) {
07584: yyValue = yyResult.semanticValue();
07585:
07586: return yyResult.createValue(yyValue, yyError);
07587: }
07588:
07589: // Alternative <OverEqual>.
07590:
07591: yyResult = pSymbol(yyStart);
07592: yyError = yyResult.select(yyError);
07593: if (yyResult.hasValue()
07594: && ((Node) yyResult.semanticValue()).getTokenText()
07595: .equals("/=")) {
07596: yyValue = yyResult.semanticValue();
07597:
07598: return yyResult.createValue(yyValue, yyError);
07599: }
07600:
07601: // Alternative <ModuloEqual>.
07602:
07603: yyResult = pSymbol(yyStart);
07604: yyError = yyResult.select(yyError);
07605: if (yyResult.hasValue()
07606: && ((Node) yyResult.semanticValue()).getTokenText()
07607: .equals("%=")) {
07608: yyValue = yyResult.semanticValue();
07609:
07610: return yyResult.createValue(yyValue, yyError);
07611: }
07612:
07613: // Alternative <LeftEqual>.
07614:
07615: yyResult = pSymbol(yyStart);
07616: yyError = yyResult.select(yyError);
07617: if (yyResult.hasValue()
07618: && ((Node) yyResult.semanticValue()).getTokenText()
07619: .equals("<<=")) {
07620: yyValue = yyResult.semanticValue();
07621:
07622: return yyResult.createValue(yyValue, yyError);
07623: }
07624:
07625: // Alternative <RightEqual>.
07626:
07627: yyResult = pSymbol(yyStart);
07628: yyError = yyResult.select(yyError);
07629: if (yyResult.hasValue()
07630: && ((Node) yyResult.semanticValue()).getTokenText()
07631: .equals(">>=")) {
07632: yyValue = yyResult.semanticValue();
07633:
07634: return yyResult.createValue(yyValue, yyError);
07635: }
07636:
07637: // Alternative <AndEqual>.
07638:
07639: yyResult = pSymbol(yyStart);
07640: yyError = yyResult.select(yyError);
07641: if (yyResult.hasValue()
07642: && ((Node) yyResult.semanticValue()).getTokenText()
07643: .equals("&=")) {
07644: yyValue = yyResult.semanticValue();
07645:
07646: return yyResult.createValue(yyValue, yyError);
07647: }
07648:
07649: // Alternative <XorEqual>.
07650:
07651: yyResult = pSymbol(yyStart);
07652: yyError = yyResult.select(yyError);
07653: if (yyResult.hasValue()
07654: && ((Node) yyResult.semanticValue()).getTokenText()
07655: .equals("^=")) {
07656: yyValue = yyResult.semanticValue();
07657:
07658: return yyResult.createValue(yyValue, yyError);
07659: }
07660:
07661: // Alternative <OrEqual>.
07662:
07663: yyResult = pSymbol(yyStart);
07664: yyError = yyResult.select(yyError);
07665: if (yyResult.hasValue()
07666: && ((Node) yyResult.semanticValue()).getTokenText()
07667: .equals("|=")) {
07668: yyValue = yyResult.semanticValue();
07669:
07670: return yyResult.createValue(yyValue, yyError);
07671: }
07672:
07673: // Done.
07674: yyError = yyError.select("assignment operator expected",
07675: yyStart);
07676: return yyError;
07677: }
07678:
07679: // =========================================================================
07680:
07681: /**
07682: * Parse nonterminal xtc.lang.C.ConditionalExpression.
07683: *
07684: * @param yyStart The index.
07685: * @return The result.
07686: * @throws IOException Signals an I/O error.
07687: */
07688: private Result pConditionalExpression(final int yyStart)
07689: throws IOException {
07690:
07691: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
07692: if (null == yyColumn.chunk2)
07693: yyColumn.chunk2 = new Chunk2();
07694: if (null == yyColumn.chunk2.fConditionalExpression)
07695: yyColumn.chunk2.fConditionalExpression = pConditionalExpression$1(yyStart);
07696: return yyColumn.chunk2.fConditionalExpression;
07697: }
07698:
07699: /** Actually parse xtc.lang.C.ConditionalExpression. */
07700: private Result pConditionalExpression$1(final int yyStart)
07701: throws IOException {
07702:
07703: Result yyResult;
07704: int yyBase;
07705: Node yyValue;
07706: ParseError yyError = ParseError.DUMMY;
07707:
07708: // Alternative <Conditional>.
07709:
07710: yyResult = pLogicalOrExpression(yyStart);
07711: yyError = yyResult.select(yyError);
07712: if (yyResult.hasValue()) {
07713: final Node v$pt$2 = yyResult.semanticValue();
07714:
07715: yyBase = yyResult.index;
07716: yyResult = pSymbol(yyBase);
07717: yyError = yyResult.select(yyError);
07718: if (yyResult.hasValue()
07719: && ((Node) yyResult.semanticValue()).getTokenText()
07720: .equals("?")) {
07721: final Node v$pt$1 = yyResult.semanticValue();
07722: final Node v$g$1 = Formatting.after1(v$pt$2, v$pt$1);
07723:
07724: yyResult = pCommaExpression(yyResult.index);
07725: yyError = yyResult.select(yyError);
07726: if (yyResult.hasValue()) {
07727: final Node v$pt$4 = yyResult.semanticValue();
07728:
07729: yyBase = yyResult.index;
07730: yyResult = pSymbol(yyBase);
07731: yyError = yyResult.select(yyError);
07732: if (yyResult.hasValue()
07733: && ((Node) yyResult.semanticValue())
07734: .getTokenText().equals(":")) {
07735: final Node v$pt$3 = yyResult.semanticValue();
07736: final Node v$g$2 = Formatting.after1(v$pt$4,
07737: v$pt$3);
07738:
07739: yyResult = pConditionalExpression(yyResult.index);
07740: yyError = yyResult.select(yyError);
07741: if (yyResult.hasValue()) {
07742: final Node v$g$3 = yyResult.semanticValue();
07743:
07744: yyValue = GNode.create(
07745: "ConditionalExpression", v$g$1,
07746: v$g$2, v$g$3);
07747: yyValue.setLocation(location(yyStart));
07748:
07749: return yyResult.createValue(yyValue,
07750: yyError);
07751: }
07752: } else {
07753: yyError = yyError.select("\":\" expected",
07754: yyBase);
07755: }
07756: }
07757: } else {
07758: yyError = yyError.select("\"?\" expected", yyBase);
07759: }
07760: }
07761:
07762: // Alternative <IncompleteConditional>.
07763:
07764: if (GCC) {
07765:
07766: yyResult = pLogicalOrExpression(yyStart);
07767: yyError = yyResult.select(yyError);
07768: if (yyResult.hasValue()) {
07769: final Node v$pt$6 = yyResult.semanticValue();
07770:
07771: yyBase = yyResult.index;
07772: yyResult = pSymbol(yyBase);
07773: yyError = yyResult.select(yyError);
07774: if (yyResult.hasValue()
07775: && ((Node) yyResult.semanticValue())
07776: .getTokenText().equals("?")) {
07777: final Node v$pt$5 = yyResult.semanticValue();
07778: final Node v$g$4 = Formatting
07779: .after1(v$pt$6, v$pt$5);
07780:
07781: yyBase = yyResult.index;
07782: yyResult = pSymbol(yyBase);
07783: yyError = yyResult.select(yyError);
07784: if (yyResult.hasValue()
07785: && ((Node) yyResult.semanticValue())
07786: .getTokenText().equals(":")) {
07787: final Node v$pt$7 = yyResult.semanticValue();
07788: final Node v$g$5 = Formatting.after1(null,
07789: v$pt$7);
07790:
07791: yyResult = pConditionalExpression(yyResult.index);
07792: yyError = yyResult.select(yyError);
07793: if (yyResult.hasValue()) {
07794: final Node v$g$6 = yyResult.semanticValue();
07795:
07796: yyValue = GNode.create(
07797: "ConditionalExpression", v$g$4,
07798: v$g$5, v$g$6);
07799: yyValue.setLocation(location(yyStart));
07800:
07801: return yyResult.createValue(yyValue,
07802: yyError);
07803: }
07804: } else {
07805: yyError = yyError.select("\":\" expected",
07806: yyBase);
07807: }
07808: } else {
07809: yyError = yyError.select("\"?\" expected", yyBase);
07810: }
07811: }
07812: }
07813:
07814: // Alternative <Base>.
07815:
07816: yyResult = pLogicalOrExpression(yyStart);
07817: yyError = yyResult.select(yyError);
07818: if (yyResult.hasValue()) {
07819: yyValue = yyResult.semanticValue();
07820:
07821: return yyResult.createValue(yyValue, yyError);
07822: }
07823:
07824: // Done.
07825: yyError = yyError.select("conditional expression expected",
07826: yyStart);
07827: return yyError;
07828: }
07829:
07830: // =========================================================================
07831:
07832: /**
07833: * Parse nonterminal xtc.lang.C.LogicalOrExpression.
07834: *
07835: * @param yyStart The index.
07836: * @return The result.
07837: * @throws IOException Signals an I/O error.
07838: */
07839: private Result pLogicalOrExpression(final int yyStart)
07840: throws IOException {
07841: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
07842: if (null == yyColumn.chunk2)
07843: yyColumn.chunk2 = new Chunk2();
07844: if (null == yyColumn.chunk2.fLogicalOrExpression)
07845: yyColumn.chunk2.fLogicalOrExpression = pLogicalOrExpression$1(yyStart);
07846: return yyColumn.chunk2.fLogicalOrExpression;
07847: }
07848:
07849: /** Actually parse xtc.lang.C.LogicalOrExpression. */
07850: private Result pLogicalOrExpression$1(final int yyStart)
07851: throws IOException {
07852:
07853: Result yyResult;
07854: int yyRepetition1;
07855: Pair<Action<Node>> yyRepValue1;
07856: Node yyValue;
07857: ParseError yyError = ParseError.DUMMY;
07858:
07859: // Alternative <Base>.
07860:
07861: yyResult = pLogicalAndExpression(yyStart);
07862: yyError = yyResult.select(yyError);
07863: if (yyResult.hasValue()) {
07864: final Node v$3 = yyResult.semanticValue();
07865:
07866: yyRepetition1 = yyResult.index;
07867: yyRepValue1 = Pair.empty();
07868: while (true) {
07869:
07870: yyResult = pLogicalOrExpression$$Tail1(yyRepetition1);
07871: yyError = yyResult.select(yyError);
07872: if (yyResult.hasValue()) {
07873: final Action<Node> v$4 = yyResult.semanticValue();
07874:
07875: yyRepetition1 = yyResult.index;
07876: yyRepValue1 = new Pair<Action<Node>>(v$4,
07877: yyRepValue1);
07878: continue;
07879: }
07880: break;
07881: }
07882: { // Start scope for v$5.
07883: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07884:
07885: yyValue = apply(v$5, v$3, yyStart);
07886:
07887: return new SemanticValue(yyValue, yyRepetition1,
07888: yyError);
07889: } // End scope for v$5.
07890: }
07891:
07892: // Done.
07893: return yyError;
07894: }
07895:
07896: // =========================================================================
07897:
07898: /**
07899: * Parse synthetic nonterminal xtc.lang.C.LogicalOrExpression$$Tail1.
07900: *
07901: * @param yyStart The index.
07902: * @return The result.
07903: * @throws IOException Signals an I/O error.
07904: */
07905: private Result pLogicalOrExpression$$Tail1(final int yyStart)
07906: throws IOException {
07907:
07908: Result yyResult;
07909: Action<Node> yyValue;
07910: ParseError yyError = ParseError.DUMMY;
07911:
07912: // Alternative <Or>.
07913:
07914: yyResult = pSymbol(yyStart);
07915: yyError = yyResult.select(yyError);
07916: if (yyResult.hasValue()
07917: && ((Node) yyResult.semanticValue()).getTokenText()
07918: .equals("||")) {
07919: final Node v$pt$1 = yyResult.semanticValue();
07920:
07921: yyResult = pLogicalAndExpression(yyResult.index);
07922: yyError = yyResult.select(yyError);
07923: if (yyResult.hasValue()) {
07924: final Node v$pt$2 = yyResult.semanticValue();
07925: final Node v$g$2 = Formatting.before1(v$pt$1, v$pt$2);
07926:
07927: yyValue = new Action<Node>() {
07928: public Node run(Node v$1) {
07929: return GNode.create("LogicalOrExpression", v$1,
07930: v$g$2);
07931: }
07932: };
07933:
07934: return yyResult.createValue(yyValue, yyError);
07935: }
07936: }
07937:
07938: // Done.
07939: yyError = yyError.select("logical or expression expected",
07940: yyStart);
07941: return yyError;
07942: }
07943:
07944: // =========================================================================
07945:
07946: /**
07947: * Parse nonterminal xtc.lang.C.LogicalAndExpression.
07948: *
07949: * @param yyStart The index.
07950: * @return The result.
07951: * @throws IOException Signals an I/O error.
07952: */
07953: private Result pLogicalAndExpression(final int yyStart)
07954: throws IOException {
07955: Result yyResult;
07956: int yyRepetition1;
07957: Pair<Action<Node>> yyRepValue1;
07958: Node yyValue;
07959: ParseError yyError = ParseError.DUMMY;
07960:
07961: // Alternative <Base>.
07962:
07963: yyResult = pBitwiseOrExpression(yyStart);
07964: yyError = yyResult.select(yyError);
07965: if (yyResult.hasValue()) {
07966: final Node v$3 = yyResult.semanticValue();
07967:
07968: yyRepetition1 = yyResult.index;
07969: yyRepValue1 = Pair.empty();
07970: while (true) {
07971:
07972: yyResult = pLogicalAndExpression$$Tail1(yyRepetition1);
07973: yyError = yyResult.select(yyError);
07974: if (yyResult.hasValue()) {
07975: final Action<Node> v$4 = yyResult.semanticValue();
07976:
07977: yyRepetition1 = yyResult.index;
07978: yyRepValue1 = new Pair<Action<Node>>(v$4,
07979: yyRepValue1);
07980: continue;
07981: }
07982: break;
07983: }
07984: { // Start scope for v$5.
07985: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07986:
07987: yyValue = apply(v$5, v$3, yyStart);
07988:
07989: return new SemanticValue(yyValue, yyRepetition1,
07990: yyError);
07991: } // End scope for v$5.
07992: }
07993:
07994: // Done.
07995: return yyError;
07996: }
07997:
07998: // =========================================================================
07999:
08000: /**
08001: * Parse synthetic nonterminal xtc.lang.C.LogicalAndExpression$$Tail1.
08002: *
08003: * @param yyStart The index.
08004: * @return The result.
08005: * @throws IOException Signals an I/O error.
08006: */
08007: private Result pLogicalAndExpression$$Tail1(final int yyStart)
08008: throws IOException {
08009:
08010: Result yyResult;
08011: Action<Node> yyValue;
08012: ParseError yyError = ParseError.DUMMY;
08013:
08014: // Alternative <And>.
08015:
08016: yyResult = pSymbol(yyStart);
08017: yyError = yyResult.select(yyError);
08018: if (yyResult.hasValue()
08019: && ((Node) yyResult.semanticValue()).getTokenText()
08020: .equals("&&")) {
08021: final Node v$pt$1 = yyResult.semanticValue();
08022:
08023: yyResult = pBitwiseOrExpression(yyResult.index);
08024: yyError = yyResult.select(yyError);
08025: if (yyResult.hasValue()) {
08026: final Node v$pt$2 = yyResult.semanticValue();
08027: final Node v$g$2 = Formatting.before1(v$pt$1, v$pt$2);
08028:
08029: yyValue = new Action<Node>() {
08030: public Node run(Node v$1) {
08031: return GNode.create("LogicalAndExpression",
08032: v$1, v$g$2);
08033: }
08034: };
08035:
08036: return yyResult.createValue(yyValue, yyError);
08037: }
08038: }
08039:
08040: // Done.
08041: yyError = yyError.select("logical and expression expected",
08042: yyStart);
08043: return yyError;
08044: }
08045:
08046: // =========================================================================
08047:
08048: /**
08049: * Parse nonterminal xtc.lang.C.BitwiseOrExpression.
08050: *
08051: * @param yyStart The index.
08052: * @return The result.
08053: * @throws IOException Signals an I/O error.
08054: */
08055: private Result pBitwiseOrExpression(final int yyStart)
08056: throws IOException {
08057: Result yyResult;
08058: int yyRepetition1;
08059: Pair<Action<Node>> yyRepValue1;
08060: Node yyValue;
08061: ParseError yyError = ParseError.DUMMY;
08062:
08063: // Alternative <Base>.
08064:
08065: yyResult = pBitwiseXorExpression(yyStart);
08066: yyError = yyResult.select(yyError);
08067: if (yyResult.hasValue()) {
08068: final Node v$3 = yyResult.semanticValue();
08069:
08070: yyRepetition1 = yyResult.index;
08071: yyRepValue1 = Pair.empty();
08072: while (true) {
08073:
08074: yyResult = pBitwiseOrExpression$$Tail1(yyRepetition1);
08075: yyError = yyResult.select(yyError);
08076: if (yyResult.hasValue()) {
08077: final Action<Node> v$4 = yyResult.semanticValue();
08078:
08079: yyRepetition1 = yyResult.index;
08080: yyRepValue1 = new Pair<Action<Node>>(v$4,
08081: yyRepValue1);
08082: continue;
08083: }
08084: break;
08085: }
08086: { // Start scope for v$5.
08087: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
08088:
08089: yyValue = apply(v$5, v$3, yyStart);
08090:
08091: return new SemanticValue(yyValue, yyRepetition1,
08092: yyError);
08093: } // End scope for v$5.
08094: }
08095:
08096: // Done.
08097: return yyError;
08098: }
08099:
08100: // =========================================================================
08101:
08102: /**
08103: * Parse synthetic nonterminal xtc.lang.C.BitwiseOrExpression$$Tail1.
08104: *
08105: * @param yyStart The index.
08106: * @return The result.
08107: * @throws IOException Signals an I/O error.
08108: */
08109: private Result pBitwiseOrExpression$$Tail1(final int yyStart)
08110: throws IOException {
08111:
08112: Result yyResult;
08113: Action<Node> yyValue;
08114: ParseError yyError = ParseError.DUMMY;
08115:
08116: // Alternative <Or>.
08117:
08118: yyResult = pSymbol(yyStart);
08119: yyError = yyResult.select(yyError);
08120: if (yyResult.hasValue()
08121: && ((Node) yyResult.semanticValue()).getTokenText()
08122: .equals("|")) {
08123: final Node v$pt$1 = yyResult.semanticValue();
08124:
08125: yyResult = pBitwiseXorExpression(yyResult.index);
08126: yyError = yyResult.select(yyError);
08127: if (yyResult.hasValue()) {
08128: final Node v$pt$2 = yyResult.semanticValue();
08129: final Node v$g$2 = Formatting.before1(v$pt$1, v$pt$2);
08130:
08131: yyValue = new Action<Node>() {
08132: public Node run(Node v$1) {
08133: return GNode.create("BitwiseOrExpression", v$1,
08134: v$g$2);
08135: }
08136: };
08137:
08138: return yyResult.createValue(yyValue, yyError);
08139: }
08140: }
08141:
08142: // Done.
08143: yyError = yyError.select("bitwise or expression expected",
08144: yyStart);
08145: return yyError;
08146: }
08147:
08148: // =========================================================================
08149:
08150: /**
08151: * Parse nonterminal xtc.lang.C.BitwiseXorExpression.
08152: *
08153: * @param yyStart The index.
08154: * @return The result.
08155: * @throws IOException Signals an I/O error.
08156: */
08157: private Result pBitwiseXorExpression(final int yyStart)
08158: throws IOException {
08159: Result yyResult;
08160: int yyRepetition1;
08161: Pair<Action<Node>> yyRepValue1;
08162: Node yyValue;
08163: ParseError yyError = ParseError.DUMMY;
08164:
08165: // Alternative <Base>.
08166:
08167: yyResult = pBitwiseAndExpression(yyStart);
08168: yyError = yyResult.select(yyError);
08169: if (yyResult.hasValue()) {
08170: final Node v$3 = yyResult.semanticValue();
08171:
08172: yyRepetition1 = yyResult.index;
08173: yyRepValue1 = Pair.empty();
08174: while (true) {
08175:
08176: yyResult = pBitwiseXorExpression$$Tail1(yyRepetition1);
08177: yyError = yyResult.select(yyError);
08178: if (yyResult.hasValue()) {
08179: final Action<Node> v$4 = yyResult.semanticValue();
08180:
08181: yyRepetition1 = yyResult.index;
08182: yyRepValue1 = new Pair<Action<Node>>(v$4,
08183: yyRepValue1);
08184: continue;
08185: }
08186: break;
08187: }
08188: { // Start scope for v$5.
08189: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
08190:
08191: yyValue = apply(v$5, v$3, yyStart);
08192:
08193: return new SemanticValue(yyValue, yyRepetition1,
08194: yyError);
08195: } // End scope for v$5.
08196: }
08197:
08198: // Done.
08199: return yyError;
08200: }
08201:
08202: // =========================================================================
08203:
08204: /**
08205: * Parse synthetic nonterminal xtc.lang.C.BitwiseXorExpression$$Tail1.
08206: *
08207: * @param yyStart The index.
08208: * @return The result.
08209: * @throws IOException Signals an I/O error.
08210: */
08211: private Result pBitwiseXorExpression$$Tail1(final int yyStart)
08212: throws IOException {
08213:
08214: Result yyResult;
08215: Action<Node> yyValue;
08216: ParseError yyError = ParseError.DUMMY;
08217:
08218: // Alternative <Xor>.
08219:
08220: yyResult = pSymbol(yyStart);
08221: yyError = yyResult.select(yyError);
08222: if (yyResult.hasValue()
08223: && ((Node) yyResult.semanticValue()).getTokenText()
08224: .equals("^")) {
08225: final Node v$pt$1 = yyResult.semanticValue();
08226:
08227: yyResult = pBitwiseAndExpression(yyResult.index);
08228: yyError = yyResult.select(yyError);
08229: if (yyResult.hasValue()) {
08230: final Node v$pt$2 = yyResult.semanticValue();
08231: final Node v$g$2 = Formatting.before1(v$pt$1, v$pt$2);
08232:
08233: yyValue = new Action<Node>() {
08234: public Node run(Node v$1) {
08235: return GNode.create("BitwiseXorExpression",
08236: v$1, v$g$2);
08237: }
08238: };
08239:
08240: return yyResult.createValue(yyValue, yyError);
08241: }
08242: }
08243:
08244: // Done.
08245: yyError = yyError.select("bitwise xor expression expected",
08246: yyStart);
08247: return yyError;
08248: }
08249:
08250: // =========================================================================
08251:
08252: /**
08253: * Parse nonterminal xtc.lang.C.BitwiseAndExpression.
08254: *
08255: * @param yyStart The index.
08256: * @return The result.
08257: * @throws IOException Signals an I/O error.
08258: */
08259: private Result pBitwiseAndExpression(final int yyStart)
08260: throws IOException {
08261: Result yyResult;
08262: int yyRepetition1;
08263: Pair<Action<Node>> yyRepValue1;
08264: Node yyValue;
08265: ParseError yyError = ParseError.DUMMY;
08266:
08267: // Alternative <Base>.
08268:
08269: yyResult = pEqualityExpression(yyStart);
08270: yyError = yyResult.select(yyError);
08271: if (yyResult.hasValue()) {
08272: final Node v$3 = yyResult.semanticValue();
08273:
08274: yyRepetition1 = yyResult.index;
08275: yyRepValue1 = Pair.empty();
08276: while (true) {
08277:
08278: yyResult = pBitwiseAndExpression$$Tail1(yyRepetition1);
08279: yyError = yyResult.select(yyError);
08280: if (yyResult.hasValue()) {
08281: final Action<Node> v$4 = yyResult.semanticValue();
08282:
08283: yyRepetition1 = yyResult.index;
08284: yyRepValue1 = new Pair<Action<Node>>(v$4,
08285: yyRepValue1);
08286: continue;
08287: }
08288: break;
08289: }
08290: { // Start scope for v$5.
08291: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
08292:
08293: yyValue = apply(v$5, v$3, yyStart);
08294:
08295: return new SemanticValue(yyValue, yyRepetition1,
08296: yyError);
08297: } // End scope for v$5.
08298: }
08299:
08300: // Done.
08301: return yyError;
08302: }
08303:
08304: // =========================================================================
08305:
08306: /**
08307: * Parse synthetic nonterminal xtc.lang.C.BitwiseAndExpression$$Tail1.
08308: *
08309: * @param yyStart The index.
08310: * @return The result.
08311: * @throws IOException Signals an I/O error.
08312: */
08313: private Result pBitwiseAndExpression$$Tail1(final int yyStart)
08314: throws IOException {
08315:
08316: Result yyResult;
08317: Action<Node> yyValue;
08318: ParseError yyError = ParseError.DUMMY;
08319:
08320: // Alternative <And>.
08321:
08322: yyResult = pSymbol(yyStart);
08323: yyError = yyResult.select(yyError);
08324: if (yyResult.hasValue()
08325: && ((Node) yyResult.semanticValue()).getTokenText()
08326: .equals("&")) {
08327: final Node v$pt$1 = yyResult.semanticValue();
08328:
08329: yyResult = pEqualityExpression(yyResult.index);
08330: yyError = yyResult.select(yyError);
08331: if (yyResult.hasValue()) {
08332: final Node v$pt$2 = yyResult.semanticValue();
08333: final Node v$g$2 = Formatting.before1(v$pt$1, v$pt$2);
08334:
08335: yyValue = new Action<Node>() {
08336: public Node run(Node v$1) {
08337: return GNode.create("BitwiseAndExpression",
08338: v$1, v$g$2);
08339: }
08340: };
08341:
08342: return yyResult.createValue(yyValue, yyError);
08343: }
08344: }
08345:
08346: // Done.
08347: yyError = yyError.select("bitwise and expression expected",
08348: yyStart);
08349: return yyError;
08350: }
08351:
08352: // =========================================================================
08353:
08354: /**
08355: * Parse nonterminal xtc.lang.C.EqualityExpression.
08356: *
08357: * @param yyStart The index.
08358: * @return The result.
08359: * @throws IOException Signals an I/O error.
08360: */
08361: private Result pEqualityExpression(final int yyStart)
08362: throws IOException {
08363: Result yyResult;
08364: int yyRepetition1;
08365: Pair<Action<Node>> yyRepValue1;
08366: Node yyValue;
08367: ParseError yyError = ParseError.DUMMY;
08368:
08369: // Alternative <Base>.
08370:
08371: yyResult = pRelationalExpression(yyStart);
08372: yyError = yyResult.select(yyError);
08373: if (yyResult.hasValue()) {
08374: final Node v$4 = yyResult.semanticValue();
08375:
08376: yyRepetition1 = yyResult.index;
08377: yyRepValue1 = Pair.empty();
08378: while (true) {
08379:
08380: yyResult = pEqualityExpression$$Tail1(yyRepetition1);
08381: yyError = yyResult.select(yyError);
08382: if (yyResult.hasValue()) {
08383: final Action<Node> v$5 = yyResult.semanticValue();
08384:
08385: yyRepetition1 = yyResult.index;
08386: yyRepValue1 = new Pair<Action<Node>>(v$5,
08387: yyRepValue1);
08388: continue;
08389: }
08390: break;
08391: }
08392: { // Start scope for v$6.
08393: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
08394:
08395: yyValue = apply(v$6, v$4, yyStart);
08396:
08397: return new SemanticValue(yyValue, yyRepetition1,
08398: yyError);
08399: } // End scope for v$6.
08400: }
08401:
08402: // Done.
08403: return yyError;
08404: }
08405:
08406: // =========================================================================
08407:
08408: /**
08409: * Parse synthetic nonterminal xtc.lang.C.EqualityExpression$$Tail1.
08410: *
08411: * @param yyStart The index.
08412: * @return The result.
08413: * @throws IOException Signals an I/O error.
08414: */
08415: private Result pEqualityExpression$$Tail1(final int yyStart)
08416: throws IOException {
08417:
08418: Result yyResult;
08419: Action<Node> yyValue;
08420: ParseError yyError = ParseError.DUMMY;
08421:
08422: // Alternative <Recursion>.
08423:
08424: yyResult = pEqualityOperator(yyStart);
08425: yyError = yyResult.select(yyError);
08426: if (yyResult.hasValue()) {
08427: final Node v$g$2 = yyResult.semanticValue();
08428:
08429: yyResult = pRelationalExpression(yyResult.index);
08430: yyError = yyResult.select(yyError);
08431: if (yyResult.hasValue()) {
08432: final Node v$g$3 = yyResult.semanticValue();
08433:
08434: yyValue = new Action<Node>() {
08435: public Node run(Node v$1) {
08436: return GNode.create("EqualityExpression", v$1,
08437: v$g$2, v$g$3);
08438: }
08439: };
08440:
08441: return yyResult.createValue(yyValue, yyError);
08442: }
08443: }
08444:
08445: // Done.
08446: return yyError;
08447: }
08448:
08449: // =========================================================================
08450:
08451: /**
08452: * Parse nonterminal xtc.lang.C.EqualityOperator.
08453: *
08454: * @param yyStart The index.
08455: * @return The result.
08456: * @throws IOException Signals an I/O error.
08457: */
08458: private Result pEqualityOperator(final int yyStart)
08459: throws IOException {
08460: Result yyResult;
08461: Node yyValue;
08462: ParseError yyError = ParseError.DUMMY;
08463:
08464: // Alternative <Equal>.
08465:
08466: yyResult = pSymbol(yyStart);
08467: yyError = yyResult.select(yyError);
08468: if (yyResult.hasValue()
08469: && ((Node) yyResult.semanticValue()).getTokenText()
08470: .equals("==")) {
08471: yyValue = yyResult.semanticValue();
08472:
08473: return yyResult.createValue(yyValue, yyError);
08474: }
08475:
08476: // Alternative <NotEqual>.
08477:
08478: yyResult = pSymbol(yyStart);
08479: yyError = yyResult.select(yyError);
08480: if (yyResult.hasValue()
08481: && ((Node) yyResult.semanticValue()).getTokenText()
08482: .equals("!=")) {
08483: yyValue = yyResult.semanticValue();
08484:
08485: return yyResult.createValue(yyValue, yyError);
08486: }
08487:
08488: // Done.
08489: yyError = yyError.select("equality operator expected", yyStart);
08490: return yyError;
08491: }
08492:
08493: // =========================================================================
08494:
08495: /**
08496: * Parse nonterminal xtc.lang.C.RelationalExpression.
08497: *
08498: * @param yyStart The index.
08499: * @return The result.
08500: * @throws IOException Signals an I/O error.
08501: */
08502: private Result pRelationalExpression(final int yyStart)
08503: throws IOException {
08504: Result yyResult;
08505: int yyRepetition1;
08506: Pair<Action<Node>> yyRepValue1;
08507: Node yyValue;
08508: ParseError yyError = ParseError.DUMMY;
08509:
08510: // Alternative <Base>.
08511:
08512: yyResult = pShiftExpression(yyStart);
08513: yyError = yyResult.select(yyError);
08514: if (yyResult.hasValue()) {
08515: final Node v$4 = yyResult.semanticValue();
08516:
08517: yyRepetition1 = yyResult.index;
08518: yyRepValue1 = Pair.empty();
08519: while (true) {
08520:
08521: yyResult = pRelationalExpression$$Tail1(yyRepetition1);
08522: yyError = yyResult.select(yyError);
08523: if (yyResult.hasValue()) {
08524: final Action<Node> v$5 = yyResult.semanticValue();
08525:
08526: yyRepetition1 = yyResult.index;
08527: yyRepValue1 = new Pair<Action<Node>>(v$5,
08528: yyRepValue1);
08529: continue;
08530: }
08531: break;
08532: }
08533: { // Start scope for v$6.
08534: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
08535:
08536: yyValue = apply(v$6, v$4, yyStart);
08537:
08538: return new SemanticValue(yyValue, yyRepetition1,
08539: yyError);
08540: } // End scope for v$6.
08541: }
08542:
08543: // Done.
08544: return yyError;
08545: }
08546:
08547: // =========================================================================
08548:
08549: /**
08550: * Parse synthetic nonterminal xtc.lang.C.RelationalExpression$$Tail1.
08551: *
08552: * @param yyStart The index.
08553: * @return The result.
08554: * @throws IOException Signals an I/O error.
08555: */
08556: private Result pRelationalExpression$$Tail1(final int yyStart)
08557: throws IOException {
08558:
08559: Result yyResult;
08560: Action<Node> yyValue;
08561: ParseError yyError = ParseError.DUMMY;
08562:
08563: // Alternative <Recursion>.
08564:
08565: yyResult = pRelationalOperator(yyStart);
08566: yyError = yyResult.select(yyError);
08567: if (yyResult.hasValue()) {
08568: final Node v$g$2 = yyResult.semanticValue();
08569:
08570: yyResult = pShiftExpression(yyResult.index);
08571: yyError = yyResult.select(yyError);
08572: if (yyResult.hasValue()) {
08573: final Node v$g$3 = yyResult.semanticValue();
08574:
08575: yyValue = new Action<Node>() {
08576: public Node run(Node v$1) {
08577: return GNode.create("RelationalExpression",
08578: v$1, v$g$2, v$g$3);
08579: }
08580: };
08581:
08582: return yyResult.createValue(yyValue, yyError);
08583: }
08584: }
08585:
08586: // Done.
08587: return yyError;
08588: }
08589:
08590: // =========================================================================
08591:
08592: /**
08593: * Parse nonterminal xtc.lang.C.RelationalOperator.
08594: *
08595: * @param yyStart The index.
08596: * @return The result.
08597: * @throws IOException Signals an I/O error.
08598: */
08599: private Result pRelationalOperator(final int yyStart)
08600: throws IOException {
08601: Result yyResult;
08602: Node yyValue;
08603: ParseError yyError = ParseError.DUMMY;
08604:
08605: // Alternative <LessEqual>.
08606:
08607: yyResult = pSymbol(yyStart);
08608: yyError = yyResult.select(yyError);
08609: if (yyResult.hasValue()
08610: && ((Node) yyResult.semanticValue()).getTokenText()
08611: .equals("<=")) {
08612: yyValue = yyResult.semanticValue();
08613:
08614: return yyResult.createValue(yyValue, yyError);
08615: }
08616:
08617: // Alternative <Less>.
08618:
08619: yyResult = pSymbol(yyStart);
08620: yyError = yyResult.select(yyError);
08621: if (yyResult.hasValue()
08622: && ((Node) yyResult.semanticValue()).getTokenText()
08623: .equals("<")) {
08624: yyValue = yyResult.semanticValue();
08625:
08626: return yyResult.createValue(yyValue, yyError);
08627: }
08628:
08629: // Alternative <GreaterEqual>.
08630:
08631: yyResult = pSymbol(yyStart);
08632: yyError = yyResult.select(yyError);
08633: if (yyResult.hasValue()
08634: && ((Node) yyResult.semanticValue()).getTokenText()
08635: .equals(">=")) {
08636: yyValue = yyResult.semanticValue();
08637:
08638: return yyResult.createValue(yyValue, yyError);
08639: }
08640:
08641: // Alternative <Greater>.
08642:
08643: yyResult = pSymbol(yyStart);
08644: yyError = yyResult.select(yyError);
08645: if (yyResult.hasValue()
08646: && ((Node) yyResult.semanticValue()).getTokenText()
08647: .equals(">")) {
08648: yyValue = yyResult.semanticValue();
08649:
08650: return yyResult.createValue(yyValue, yyError);
08651: }
08652:
08653: // Done.
08654: yyError = yyError.select("relational operator expected",
08655: yyStart);
08656: return yyError;
08657: }
08658:
08659: // =========================================================================
08660:
08661: /**
08662: * Parse nonterminal xtc.lang.C.ShiftExpression.
08663: *
08664: * @param yyStart The index.
08665: * @return The result.
08666: * @throws IOException Signals an I/O error.
08667: */
08668: private Result pShiftExpression(final int yyStart)
08669: throws IOException {
08670: Result yyResult;
08671: int yyRepetition1;
08672: Pair<Action<Node>> yyRepValue1;
08673: Node yyValue;
08674: ParseError yyError = ParseError.DUMMY;
08675:
08676: // Alternative <Base>.
08677:
08678: yyResult = pAdditiveExpression(yyStart);
08679: yyError = yyResult.select(yyError);
08680: if (yyResult.hasValue()) {
08681: final Node v$4 = yyResult.semanticValue();
08682:
08683: yyRepetition1 = yyResult.index;
08684: yyRepValue1 = Pair.empty();
08685: while (true) {
08686:
08687: yyResult = pShiftExpression$$Tail1(yyRepetition1);
08688: yyError = yyResult.select(yyError);
08689: if (yyResult.hasValue()) {
08690: final Action<Node> v$5 = yyResult.semanticValue();
08691:
08692: yyRepetition1 = yyResult.index;
08693: yyRepValue1 = new Pair<Action<Node>>(v$5,
08694: yyRepValue1);
08695: continue;
08696: }
08697: break;
08698: }
08699: { // Start scope for v$6.
08700: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
08701:
08702: yyValue = apply(v$6, v$4, yyStart);
08703:
08704: return new SemanticValue(yyValue, yyRepetition1,
08705: yyError);
08706: } // End scope for v$6.
08707: }
08708:
08709: // Done.
08710: return yyError;
08711: }
08712:
08713: // =========================================================================
08714:
08715: /**
08716: * Parse synthetic nonterminal xtc.lang.C.ShiftExpression$$Tail1.
08717: *
08718: * @param yyStart The index.
08719: * @return The result.
08720: * @throws IOException Signals an I/O error.
08721: */
08722: private Result pShiftExpression$$Tail1(final int yyStart)
08723: throws IOException {
08724:
08725: Result yyResult;
08726: Action<Node> yyValue;
08727: ParseError yyError = ParseError.DUMMY;
08728:
08729: // Alternative <Recursion>.
08730:
08731: yyResult = pShiftOperator(yyStart);
08732: yyError = yyResult.select(yyError);
08733: if (yyResult.hasValue()) {
08734: final Node v$g$2 = yyResult.semanticValue();
08735:
08736: yyResult = pAdditiveExpression(yyResult.index);
08737: yyError = yyResult.select(yyError);
08738: if (yyResult.hasValue()) {
08739: final Node v$g$3 = yyResult.semanticValue();
08740:
08741: yyValue = new Action<Node>() {
08742: public Node run(Node v$1) {
08743: return GNode.create("ShiftExpression", v$1,
08744: v$g$2, v$g$3);
08745: }
08746: };
08747:
08748: return yyResult.createValue(yyValue, yyError);
08749: }
08750: }
08751:
08752: // Done.
08753: return yyError;
08754: }
08755:
08756: // =========================================================================
08757:
08758: /**
08759: * Parse nonterminal xtc.lang.C.ShiftOperator.
08760: *
08761: * @param yyStart The index.
08762: * @return The result.
08763: * @throws IOException Signals an I/O error.
08764: */
08765: private Result pShiftOperator(final int yyStart) throws IOException {
08766: Result yyResult;
08767: Node yyValue;
08768: ParseError yyError = ParseError.DUMMY;
08769:
08770: // Alternative <Left>.
08771:
08772: yyResult = pSymbol(yyStart);
08773: yyError = yyResult.select(yyError);
08774: if (yyResult.hasValue()
08775: && ((Node) yyResult.semanticValue()).getTokenText()
08776: .equals("<<")) {
08777: yyValue = yyResult.semanticValue();
08778:
08779: return yyResult.createValue(yyValue, yyError);
08780: }
08781:
08782: // Alternative <Right>.
08783:
08784: yyResult = pSymbol(yyStart);
08785: yyError = yyResult.select(yyError);
08786: if (yyResult.hasValue()
08787: && ((Node) yyResult.semanticValue()).getTokenText()
08788: .equals(">>")) {
08789: yyValue = yyResult.semanticValue();
08790:
08791: return yyResult.createValue(yyValue, yyError);
08792: }
08793:
08794: // Done.
08795: yyError = yyError.select("shift operator expected", yyStart);
08796: return yyError;
08797: }
08798:
08799: // =========================================================================
08800:
08801: /**
08802: * Parse nonterminal xtc.lang.C.AdditiveExpression.
08803: *
08804: * @param yyStart The index.
08805: * @return The result.
08806: * @throws IOException Signals an I/O error.
08807: */
08808: private Result pAdditiveExpression(final int yyStart)
08809: throws IOException {
08810: Result yyResult;
08811: int yyRepetition1;
08812: Pair<Action<Node>> yyRepValue1;
08813: Node yyValue;
08814: ParseError yyError = ParseError.DUMMY;
08815:
08816: // Alternative <Base>.
08817:
08818: yyResult = pMultiplicativeExpression(yyStart);
08819: yyError = yyResult.select(yyError);
08820: if (yyResult.hasValue()) {
08821: final Node v$4 = yyResult.semanticValue();
08822:
08823: yyRepetition1 = yyResult.index;
08824: yyRepValue1 = Pair.empty();
08825: while (true) {
08826:
08827: yyResult = pAdditiveExpression$$Tail1(yyRepetition1);
08828: yyError = yyResult.select(yyError);
08829: if (yyResult.hasValue()) {
08830: final Action<Node> v$5 = yyResult.semanticValue();
08831:
08832: yyRepetition1 = yyResult.index;
08833: yyRepValue1 = new Pair<Action<Node>>(v$5,
08834: yyRepValue1);
08835: continue;
08836: }
08837: break;
08838: }
08839: { // Start scope for v$6.
08840: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
08841:
08842: yyValue = apply(v$6, v$4, yyStart);
08843:
08844: return new SemanticValue(yyValue, yyRepetition1,
08845: yyError);
08846: } // End scope for v$6.
08847: }
08848:
08849: // Done.
08850: return yyError;
08851: }
08852:
08853: // =========================================================================
08854:
08855: /**
08856: * Parse synthetic nonterminal xtc.lang.C.AdditiveExpression$$Tail1.
08857: *
08858: * @param yyStart The index.
08859: * @return The result.
08860: * @throws IOException Signals an I/O error.
08861: */
08862: private Result pAdditiveExpression$$Tail1(final int yyStart)
08863: throws IOException {
08864:
08865: Result yyResult;
08866: Action<Node> yyValue;
08867: ParseError yyError = ParseError.DUMMY;
08868:
08869: // Alternative <Recursion>.
08870:
08871: yyResult = pAdditiveOperator(yyStart);
08872: yyError = yyResult.select(yyError);
08873: if (yyResult.hasValue()) {
08874: final Node v$g$2 = yyResult.semanticValue();
08875:
08876: yyResult = pMultiplicativeExpression(yyResult.index);
08877: yyError = yyResult.select(yyError);
08878: if (yyResult.hasValue()) {
08879: final Node v$g$3 = yyResult.semanticValue();
08880:
08881: yyValue = new Action<Node>() {
08882: public Node run(Node v$1) {
08883: return GNode.create("AdditiveExpression", v$1,
08884: v$g$2, v$g$3);
08885: }
08886: };
08887:
08888: return yyResult.createValue(yyValue, yyError);
08889: }
08890: }
08891:
08892: // Done.
08893: return yyError;
08894: }
08895:
08896: // =========================================================================
08897:
08898: /**
08899: * Parse nonterminal xtc.lang.C.AdditiveOperator.
08900: *
08901: * @param yyStart The index.
08902: * @return The result.
08903: * @throws IOException Signals an I/O error.
08904: */
08905: private Result pAdditiveOperator(final int yyStart)
08906: throws IOException {
08907: Result yyResult;
08908: Node yyValue;
08909: ParseError yyError = ParseError.DUMMY;
08910:
08911: // Alternative <Plus>.
08912:
08913: yyResult = pSymbol(yyStart);
08914: yyError = yyResult.select(yyError);
08915: if (yyResult.hasValue()
08916: && ((Node) yyResult.semanticValue()).getTokenText()
08917: .equals("+")) {
08918: yyValue = yyResult.semanticValue();
08919:
08920: return yyResult.createValue(yyValue, yyError);
08921: }
08922:
08923: // Alternative <Minus>.
08924:
08925: yyResult = pSymbol(yyStart);
08926: yyError = yyResult.select(yyError);
08927: if (yyResult.hasValue()
08928: && ((Node) yyResult.semanticValue()).getTokenText()
08929: .equals("-")) {
08930: yyValue = yyResult.semanticValue();
08931:
08932: return yyResult.createValue(yyValue, yyError);
08933: }
08934:
08935: // Done.
08936: yyError = yyError.select("additive operator expected", yyStart);
08937: return yyError;
08938: }
08939:
08940: // =========================================================================
08941:
08942: /**
08943: * Parse nonterminal xtc.lang.C.MultiplicativeExpression.
08944: *
08945: * @param yyStart The index.
08946: * @return The result.
08947: * @throws IOException Signals an I/O error.
08948: */
08949: private Result pMultiplicativeExpression(final int yyStart)
08950: throws IOException {
08951:
08952: Result yyResult;
08953: int yyRepetition1;
08954: Pair<Action<Node>> yyRepValue1;
08955: Node yyValue;
08956: ParseError yyError = ParseError.DUMMY;
08957:
08958: // Alternative <Base>.
08959:
08960: yyResult = pCastExpression(yyStart);
08961: yyError = yyResult.select(yyError);
08962: if (yyResult.hasValue()) {
08963: final Node v$4 = yyResult.semanticValue();
08964:
08965: yyRepetition1 = yyResult.index;
08966: yyRepValue1 = Pair.empty();
08967: while (true) {
08968:
08969: yyResult = pMultiplicativeExpression$$Tail1(yyRepetition1);
08970: yyError = yyResult.select(yyError);
08971: if (yyResult.hasValue()) {
08972: final Action<Node> v$5 = yyResult.semanticValue();
08973:
08974: yyRepetition1 = yyResult.index;
08975: yyRepValue1 = new Pair<Action<Node>>(v$5,
08976: yyRepValue1);
08977: continue;
08978: }
08979: break;
08980: }
08981: { // Start scope for v$6.
08982: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
08983:
08984: yyValue = apply(v$6, v$4, yyStart);
08985:
08986: return new SemanticValue(yyValue, yyRepetition1,
08987: yyError);
08988: } // End scope for v$6.
08989: }
08990:
08991: // Done.
08992: return yyError;
08993: }
08994:
08995: // =========================================================================
08996:
08997: /**
08998: * Parse synthetic nonterminal xtc.lang.C.MultiplicativeExpression$$Tail1.
08999: *
09000: * @param yyStart The index.
09001: * @return The result.
09002: * @throws IOException Signals an I/O error.
09003: */
09004: private Result pMultiplicativeExpression$$Tail1(final int yyStart)
09005: throws IOException {
09006:
09007: Result yyResult;
09008: Action<Node> yyValue;
09009: ParseError yyError = ParseError.DUMMY;
09010:
09011: // Alternative <Recursion>.
09012:
09013: yyResult = pMultiplicativeOperator(yyStart);
09014: yyError = yyResult.select(yyError);
09015: if (yyResult.hasValue()) {
09016: final Node v$g$2 = yyResult.semanticValue();
09017:
09018: yyResult = pCastExpression(yyResult.index);
09019: yyError = yyResult.select(yyError);
09020: if (yyResult.hasValue()) {
09021: final Node v$g$3 = yyResult.semanticValue();
09022:
09023: yyValue = new Action<Node>() {
09024: public Node run(Node v$1) {
09025: return GNode.create("MultiplicativeExpression",
09026: v$1, v$g$2, v$g$3);
09027: }
09028: };
09029:
09030: return yyResult.createValue(yyValue, yyError);
09031: }
09032: }
09033:
09034: // Done.
09035: return yyError;
09036: }
09037:
09038: // =========================================================================
09039:
09040: /**
09041: * Parse nonterminal xtc.lang.C.MultiplicativeOperator.
09042: *
09043: * @param yyStart The index.
09044: * @return The result.
09045: * @throws IOException Signals an I/O error.
09046: */
09047: private Result pMultiplicativeOperator(final int yyStart)
09048: throws IOException {
09049:
09050: Result yyResult;
09051: Node yyValue;
09052: ParseError yyError = ParseError.DUMMY;
09053:
09054: // Alternative <Times>.
09055:
09056: yyResult = pSymbol(yyStart);
09057: yyError = yyResult.select(yyError);
09058: if (yyResult.hasValue()
09059: && ((Node) yyResult.semanticValue()).getTokenText()
09060: .equals("*")) {
09061: yyValue = yyResult.semanticValue();
09062:
09063: return yyResult.createValue(yyValue, yyError);
09064: }
09065:
09066: // Alternative <Over>.
09067:
09068: yyResult = pSymbol(yyStart);
09069: yyError = yyResult.select(yyError);
09070: if (yyResult.hasValue()
09071: && ((Node) yyResult.semanticValue()).getTokenText()
09072: .equals("/")) {
09073: yyValue = yyResult.semanticValue();
09074:
09075: return yyResult.createValue(yyValue, yyError);
09076: }
09077:
09078: // Alternative <Modulo>.
09079:
09080: yyResult = pSymbol(yyStart);
09081: yyError = yyResult.select(yyError);
09082: if (yyResult.hasValue()
09083: && ((Node) yyResult.semanticValue()).getTokenText()
09084: .equals("%")) {
09085: yyValue = yyResult.semanticValue();
09086:
09087: return yyResult.createValue(yyValue, yyError);
09088: }
09089:
09090: // Done.
09091: yyError = yyError.select("multiplicative operator expected",
09092: yyStart);
09093: return yyError;
09094: }
09095:
09096: // =========================================================================
09097:
09098: /**
09099: * Parse nonterminal xtc.lang.C.CastExpression.
09100: *
09101: * @param yyStart The index.
09102: * @return The result.
09103: * @throws IOException Signals an I/O error.
09104: */
09105: private Result pCastExpression(final int yyStart)
09106: throws IOException {
09107: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
09108: if (null == yyColumn.chunk2)
09109: yyColumn.chunk2 = new Chunk2();
09110: if (null == yyColumn.chunk2.fCastExpression)
09111: yyColumn.chunk2.fCastExpression = pCastExpression$1(yyStart);
09112: return yyColumn.chunk2.fCastExpression;
09113: }
09114:
09115: /** Actually parse xtc.lang.C.CastExpression. */
09116: private Result pCastExpression$1(final int yyStart)
09117: throws IOException {
09118: Result yyResult;
09119: int yyBase;
09120: Node yyValue;
09121: ParseError yyError = ParseError.DUMMY;
09122:
09123: // Alternative <Cast>.
09124:
09125: yyResult = pSymbol(yyStart);
09126: yyError = yyResult.select(yyError);
09127: if (yyResult.hasValue()
09128: && ((Node) yyResult.semanticValue()).getTokenText()
09129: .equals("(")) {
09130: final Node v$pt$1 = yyResult.semanticValue();
09131:
09132: yyResult = pTypeName(yyResult.index);
09133: yyError = yyResult.select(yyError);
09134: if (yyResult.hasValue()) {
09135: final Node v$pt$3 = yyResult.semanticValue();
09136:
09137: yyBase = yyResult.index;
09138: yyResult = pSymbol(yyBase);
09139: yyError = yyResult.select(yyError);
09140: if (yyResult.hasValue()
09141: && ((Node) yyResult.semanticValue())
09142: .getTokenText().equals(")")) {
09143: final Node v$pt$2 = yyResult.semanticValue();
09144: final Node v$g$1 = Formatting.round1(v$pt$1,
09145: v$pt$3, v$pt$2);
09146:
09147: yyResult = pCastExpression(yyResult.index);
09148: yyError = yyResult.select(yyError);
09149: if (yyResult.hasValue()) {
09150: final Node v$g$2 = yyResult.semanticValue();
09151:
09152: yyValue = GNode.create("CastExpression", v$g$1,
09153: v$g$2);
09154: yyValue.setLocation(location(yyStart));
09155:
09156: return yyResult.createValue(yyValue, yyError);
09157: }
09158: } else {
09159: yyError = yyError.select("\")\" expected", yyBase);
09160: }
09161: }
09162: }
09163:
09164: // Alternative <Base>.
09165:
09166: yyResult = pUnaryExpression(yyStart);
09167: yyError = yyResult.select(yyError);
09168: if (yyResult.hasValue()) {
09169: yyValue = yyResult.semanticValue();
09170:
09171: return yyResult.createValue(yyValue, yyError);
09172: }
09173:
09174: // Done.
09175: yyError = yyError.select("cast expression expected", yyStart);
09176: return yyError;
09177: }
09178:
09179: // =========================================================================
09180:
09181: /**
09182: * Parse nonterminal xtc.lang.C.UnaryExpression.
09183: *
09184: * @param yyStart The index.
09185: * @return The result.
09186: * @throws IOException Signals an I/O error.
09187: */
09188: private Result pUnaryExpression(final int yyStart)
09189: throws IOException {
09190: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
09191: if (null == yyColumn.chunk2)
09192: yyColumn.chunk2 = new Chunk2();
09193: if (null == yyColumn.chunk2.fUnaryExpression)
09194: yyColumn.chunk2.fUnaryExpression = pUnaryExpression$1(yyStart);
09195: return yyColumn.chunk2.fUnaryExpression;
09196: }
09197:
09198: /** Actually parse xtc.lang.C.UnaryExpression. */
09199: private Result pUnaryExpression$1(final int yyStart)
09200: throws IOException {
09201: Result yyResult;
09202: Result yyPredResult;
09203: boolean yyPredMatched;
09204: int yyBase;
09205: Node yyValue;
09206: ParseError yyError = ParseError.DUMMY;
09207:
09208: // Alternative 1.
09209:
09210: yyResult = pKeyword(yyStart);
09211: yyError = yyResult.select(yyError);
09212: if (yyResult.hasValue()
09213: && ((Node) yyResult.semanticValue()).getTokenText()
09214: .equals("sizeof")) {
09215: final Node v$pt$1 = yyResult.semanticValue();
09216:
09217: final int yyChoice1 = yyResult.index;
09218:
09219: // Nested alternative 1.
09220:
09221: yyBase = yyChoice1;
09222: yyResult = pSymbol(yyBase);
09223: yyError = yyResult.select(yyError);
09224: if (yyResult.hasValue()
09225: && ((Node) yyResult.semanticValue()).getTokenText()
09226: .equals("(")) {
09227: final Node v$pt$2 = yyResult.semanticValue();
09228:
09229: yyResult = pTypeName(yyResult.index);
09230: yyError = yyResult.select(yyError);
09231: if (yyResult.hasValue()) {
09232: final Node v$pt$4 = yyResult.semanticValue();
09233:
09234: yyBase = yyResult.index;
09235: yyResult = pSymbol(yyBase);
09236: yyError = yyResult.select(yyError);
09237: if (yyResult.hasValue()
09238: && ((Node) yyResult.semanticValue())
09239: .getTokenText().equals(")")) {
09240: final Node v$pt$3 = yyResult.semanticValue();
09241:
09242: yyPredMatched = false;
09243:
09244: yyPredResult = pSymbol(yyResult.index);
09245: if (yyPredResult.hasValue()
09246: && ((Node) yyPredResult.semanticValue())
09247: .getTokenText().equals("{")) {
09248:
09249: yyPredMatched = true;
09250: }
09251:
09252: if (!yyPredMatched) {
09253: final Node v$g$1 = Formatting.variable()
09254: .add(v$pt$1).add(v$pt$2).addNode(
09255: v$pt$4).add(v$pt$3);
09256:
09257: yyValue = GNode.create("SizeofExpression",
09258: v$g$1);
09259: yyValue.setLocation(location(yyStart));
09260:
09261: return yyResult.createValue(yyValue,
09262: yyError);
09263: } else {
09264: yyError = yyError.select(
09265: "unary expression expected",
09266: yyStart);
09267: }
09268: } else {
09269: yyError = yyError.select("\")\" expected",
09270: yyBase);
09271: }
09272: }
09273: } else {
09274: yyError = yyError.select("\"(\" expected", yyBase);
09275: }
09276:
09277: // Nested alternative 2.
09278:
09279: yyResult = pUnaryExpression(yyChoice1);
09280: yyError = yyResult.select(yyError);
09281: if (yyResult.hasValue()) {
09282: final Node v$pt$5 = yyResult.semanticValue();
09283: final Node v$g$2 = Formatting.before1(v$pt$1, v$pt$5);
09284:
09285: yyValue = GNode.create("SizeofExpression", v$g$2);
09286: yyValue.setLocation(location(yyStart));
09287:
09288: return yyResult.createValue(yyValue, yyError);
09289: }
09290: }
09291:
09292: // Alternative 2.
09293:
09294: yyResult = pAlignofKeyword(yyStart);
09295: yyError = yyResult.select(yyError);
09296: if (yyResult.hasValue()) {
09297: final Node v$pt$1 = yyResult.semanticValue();
09298:
09299: final int yyChoice1 = yyResult.index;
09300:
09301: // Nested alternative 1.
09302:
09303: yyBase = yyChoice1;
09304: yyResult = pSymbol(yyBase);
09305: yyError = yyResult.select(yyError);
09306: if (yyResult.hasValue()
09307: && ((Node) yyResult.semanticValue()).getTokenText()
09308: .equals("(")) {
09309: final Node v$pt$2 = yyResult.semanticValue();
09310:
09311: yyResult = pTypeName(yyResult.index);
09312: yyError = yyResult.select(yyError);
09313: if (yyResult.hasValue()) {
09314: final Node v$pt$4 = yyResult.semanticValue();
09315:
09316: yyBase = yyResult.index;
09317: yyResult = pSymbol(yyBase);
09318: yyError = yyResult.select(yyError);
09319: if (yyResult.hasValue()
09320: && ((Node) yyResult.semanticValue())
09321: .getTokenText().equals(")")) {
09322: final Node v$pt$3 = yyResult.semanticValue();
09323:
09324: yyPredMatched = false;
09325:
09326: yyPredResult = pSymbol(yyResult.index);
09327: if (yyPredResult.hasValue()
09328: && ((Node) yyPredResult.semanticValue())
09329: .getTokenText().equals("{")) {
09330:
09331: yyPredMatched = true;
09332: }
09333:
09334: if (!yyPredMatched) {
09335: final Node v$g$1 = Formatting.variable()
09336: .add(v$pt$1).add(v$pt$2).addNode(
09337: v$pt$4).add(v$pt$3);
09338:
09339: yyValue = GNode.create("AlignofExpression",
09340: v$g$1);
09341: yyValue.setLocation(location(yyStart));
09342:
09343: return yyResult.createValue(yyValue,
09344: yyError);
09345: } else {
09346: yyError = yyError.select(
09347: "unary expression expected",
09348: yyStart);
09349: }
09350: } else {
09351: yyError = yyError.select("\")\" expected",
09352: yyBase);
09353: }
09354: }
09355: } else {
09356: yyError = yyError.select("\"(\" expected", yyBase);
09357: }
09358:
09359: // Nested alternative 2.
09360:
09361: yyResult = pUnaryExpression(yyChoice1);
09362: yyError = yyResult.select(yyError);
09363: if (yyResult.hasValue()) {
09364: final Node v$pt$5 = yyResult.semanticValue();
09365: final Node v$g$2 = Formatting.before1(v$pt$1, v$pt$5);
09366:
09367: yyValue = GNode.create("AlignofExpression", v$g$2);
09368: yyValue.setLocation(location(yyStart));
09369:
09370: return yyResult.createValue(yyValue, yyError);
09371: }
09372: }
09373:
09374: // Alternative 3.
09375:
09376: yyResult = pKeyword(yyStart);
09377: yyError = yyResult.select(yyError);
09378: if (yyResult.hasValue()
09379: && ((Node) yyResult.semanticValue()).getTokenText()
09380: .equals("__builtin_offsetof")) {
09381: final Node v$pt$1 = yyResult.semanticValue();
09382:
09383: yyBase = yyResult.index;
09384: yyResult = pSymbol(yyBase);
09385: yyError = yyResult.select(yyError);
09386: if (yyResult.hasValue()
09387: && ((Node) yyResult.semanticValue()).getTokenText()
09388: .equals("(")) {
09389: final Node v$pt$2 = yyResult.semanticValue();
09390:
09391: yyResult = pTypeName(yyResult.index);
09392: yyError = yyResult.select(yyError);
09393: if (yyResult.hasValue()) {
09394: final Node v$pt$4 = yyResult.semanticValue();
09395:
09396: yyBase = yyResult.index;
09397: yyResult = pSymbol(yyBase);
09398: yyError = yyResult.select(yyError);
09399: if (yyResult.hasValue()
09400: && ((Node) yyResult.semanticValue())
09401: .getTokenText().equals(",")) {
09402: final Node v$pt$3 = yyResult.semanticValue();
09403: final Node v$g$1 = Formatting.variable().add(
09404: v$pt$1).add(v$pt$2).addNode(v$pt$4)
09405: .add(v$pt$3);
09406:
09407: yyResult = pPostfixExpression(yyResult.index);
09408: yyError = yyResult.select(yyError);
09409: if (yyResult.hasValue()) {
09410: final Node v$pt$6 = yyResult
09411: .semanticValue();
09412:
09413: yyBase = yyResult.index;
09414: yyResult = pSymbol(yyBase);
09415: yyError = yyResult.select(yyError);
09416: if (yyResult.hasValue()
09417: && ((Node) yyResult.semanticValue())
09418: .getTokenText().equals(")")) {
09419: final Node v$pt$5 = yyResult
09420: .semanticValue();
09421: final Node v$g$2 = Formatting.after1(
09422: v$pt$6, v$pt$5);
09423:
09424: yyValue = GNode.create(
09425: "OffsetofExpression", v$g$1,
09426: v$g$2);
09427: yyValue.setLocation(location(yyStart));
09428:
09429: return yyResult.createValue(yyValue,
09430: yyError);
09431: } else {
09432: yyError = yyError.select(
09433: "\")\" expected", yyBase);
09434: }
09435: }
09436: } else {
09437: yyError = yyError.select("\",\" expected",
09438: yyBase);
09439: }
09440: }
09441: } else {
09442: yyError = yyError.select("\"(\" expected", yyBase);
09443: }
09444: }
09445:
09446: // Alternative 4.
09447:
09448: yyResult = pKeyword(yyStart);
09449: yyError = yyResult.select(yyError);
09450: if (yyResult.hasValue()
09451: && ((Node) yyResult.semanticValue()).getTokenText()
09452: .equals("__builtin_types_compatible_p")) {
09453: final Node v$pt$1 = yyResult.semanticValue();
09454:
09455: yyBase = yyResult.index;
09456: yyResult = pSymbol(yyBase);
09457: yyError = yyResult.select(yyError);
09458: if (yyResult.hasValue()
09459: && ((Node) yyResult.semanticValue()).getTokenText()
09460: .equals("(")) {
09461: final Node v$pt$2 = yyResult.semanticValue();
09462:
09463: yyResult = pTypeName(yyResult.index);
09464: yyError = yyResult.select(yyError);
09465: if (yyResult.hasValue()) {
09466: final Node v$pt$4 = yyResult.semanticValue();
09467:
09468: yyBase = yyResult.index;
09469: yyResult = pSymbol(yyBase);
09470: yyError = yyResult.select(yyError);
09471: if (yyResult.hasValue()
09472: && ((Node) yyResult.semanticValue())
09473: .getTokenText().equals(",")) {
09474: final Node v$pt$3 = yyResult.semanticValue();
09475: final Node v$g$1 = Formatting.variable().add(
09476: v$pt$1).add(v$pt$2).addNode(v$pt$4)
09477: .add(v$pt$3);
09478:
09479: yyResult = pTypeName(yyResult.index);
09480: yyError = yyResult.select(yyError);
09481: if (yyResult.hasValue()) {
09482: final Node v$pt$6 = yyResult
09483: .semanticValue();
09484:
09485: yyBase = yyResult.index;
09486: yyResult = pSymbol(yyBase);
09487: yyError = yyResult.select(yyError);
09488: if (yyResult.hasValue()
09489: && ((Node) yyResult.semanticValue())
09490: .getTokenText().equals(")")) {
09491: final Node v$pt$5 = yyResult
09492: .semanticValue();
09493: final Node v$g$2 = Formatting.after1(
09494: v$pt$6, v$pt$5);
09495:
09496: yyValue = GNode.create(
09497: "TypeCompatibilityExpression",
09498: v$g$1, v$g$2);
09499: yyValue.setLocation(location(yyStart));
09500:
09501: return yyResult.createValue(yyValue,
09502: yyError);
09503: } else {
09504: yyError = yyError.select(
09505: "\")\" expected", yyBase);
09506: }
09507: }
09508: } else {
09509: yyError = yyError.select("\",\" expected",
09510: yyBase);
09511: }
09512: }
09513: } else {
09514: yyError = yyError.select("\"(\" expected", yyBase);
09515: }
09516: }
09517:
09518: // Alternative 5.
09519:
09520: yyResult = pSymbol(yyStart);
09521: yyError = yyResult.select(yyError);
09522: if (yyResult.hasValue()
09523: && ((Node) yyResult.semanticValue()).getTokenText()
09524: .equals("-")) {
09525: final Node v$pt$1 = yyResult.semanticValue();
09526:
09527: yyResult = pCastExpression(yyResult.index);
09528: yyError = yyResult.select(yyError);
09529: if (yyResult.hasValue()) {
09530: final Node v$pt$2 = yyResult.semanticValue();
09531: final Node v$g$1 = Formatting.before1(v$pt$1, v$pt$2);
09532:
09533: yyValue = GNode.create("UnaryMinusExpression", v$g$1);
09534: yyValue.setLocation(location(yyStart));
09535:
09536: return yyResult.createValue(yyValue, yyError);
09537: }
09538: }
09539:
09540: // Alternative 6.
09541:
09542: yyResult = pSymbol(yyStart);
09543: yyError = yyResult.select(yyError);
09544: if (yyResult.hasValue()
09545: && ((Node) yyResult.semanticValue()).getTokenText()
09546: .equals("+")) {
09547: final Node v$pt$1 = yyResult.semanticValue();
09548:
09549: yyResult = pCastExpression(yyResult.index);
09550: yyError = yyResult.select(yyError);
09551: if (yyResult.hasValue()) {
09552: final Node v$pt$2 = yyResult.semanticValue();
09553: final Node v$g$1 = Formatting.before1(v$pt$1, v$pt$2);
09554:
09555: yyValue = GNode.create("UnaryPlusExpression", v$g$1);
09556: yyValue.setLocation(location(yyStart));
09557:
09558: return yyResult.createValue(yyValue, yyError);
09559: }
09560: }
09561:
09562: // Alternative 7.
09563:
09564: yyResult = pSymbol(yyStart);
09565: yyError = yyResult.select(yyError);
09566: if (yyResult.hasValue()
09567: && ((Node) yyResult.semanticValue()).getTokenText()
09568: .equals("!")) {
09569: final Node v$pt$1 = yyResult.semanticValue();
09570:
09571: yyResult = pCastExpression(yyResult.index);
09572: yyError = yyResult.select(yyError);
09573: if (yyResult.hasValue()) {
09574: final Node v$pt$2 = yyResult.semanticValue();
09575: final Node v$g$1 = Formatting.before1(v$pt$1, v$pt$2);
09576:
09577: yyValue = GNode.create("LogicalNegationExpression",
09578: v$g$1);
09579: yyValue.setLocation(location(yyStart));
09580:
09581: return yyResult.createValue(yyValue, yyError);
09582: }
09583: }
09584:
09585: // Alternative 8.
09586:
09587: yyResult = pSymbol(yyStart);
09588: yyError = yyResult.select(yyError);
09589: if (yyResult.hasValue()
09590: && ((Node) yyResult.semanticValue()).getTokenText()
09591: .equals("~")) {
09592: final Node v$pt$1 = yyResult.semanticValue();
09593:
09594: yyResult = pCastExpression(yyResult.index);
09595: yyError = yyResult.select(yyError);
09596: if (yyResult.hasValue()) {
09597: final Node v$pt$2 = yyResult.semanticValue();
09598: final Node v$g$1 = Formatting.before1(v$pt$1, v$pt$2);
09599:
09600: yyValue = GNode.create("BitwiseNegationExpression",
09601: v$g$1);
09602: yyValue.setLocation(location(yyStart));
09603:
09604: return yyResult.createValue(yyValue, yyError);
09605: }
09606: }
09607:
09608: // Alternative 9.
09609:
09610: yyResult = pSymbol(yyStart);
09611: yyError = yyResult.select(yyError);
09612: if (yyResult.hasValue()
09613: && ((Node) yyResult.semanticValue()).getTokenText()
09614: .equals("&")) {
09615: final Node v$pt$1 = yyResult.semanticValue();
09616:
09617: yyResult = pCastExpression(yyResult.index);
09618: yyError = yyResult.select(yyError);
09619: if (yyResult.hasValue()) {
09620: final Node v$pt$2 = yyResult.semanticValue();
09621: final Node v$g$1 = Formatting.before1(v$pt$1, v$pt$2);
09622:
09623: yyValue = GNode.create("AddressExpression", v$g$1);
09624: yyValue.setLocation(location(yyStart));
09625:
09626: return yyResult.createValue(yyValue, yyError);
09627: }
09628: }
09629:
09630: // Alternative 10.
09631:
09632: if (GCC) {
09633:
09634: yyResult = pSymbol(yyStart);
09635: yyError = yyResult.select(yyError);
09636: if (yyResult.hasValue()
09637: && ((Node) yyResult.semanticValue()).getTokenText()
09638: .equals("&&")) {
09639: final Node v$pt$1 = yyResult.semanticValue();
09640:
09641: yyResult = pIdentifier(yyResult.index);
09642: yyError = yyResult.select(yyError);
09643: if (yyResult.hasValue()) {
09644: final Node v$pt$2 = yyResult.semanticValue();
09645: final Node v$g$1 = Formatting.before1(v$pt$1,
09646: v$pt$2);
09647:
09648: yyValue = GNode.create("LabelAddressExpression",
09649: v$g$1);
09650: yyValue.setLocation(location(yyStart));
09651:
09652: return yyResult.createValue(yyValue, yyError);
09653: }
09654: }
09655: }
09656:
09657: // Alternative 11.
09658:
09659: yyResult = pSymbol(yyStart);
09660: yyError = yyResult.select(yyError);
09661: if (yyResult.hasValue()
09662: && ((Node) yyResult.semanticValue()).getTokenText()
09663: .equals("*")) {
09664: final Node v$pt$1 = yyResult.semanticValue();
09665:
09666: yyResult = pCastExpression(yyResult.index);
09667: yyError = yyResult.select(yyError);
09668: if (yyResult.hasValue()) {
09669: final Node v$pt$2 = yyResult.semanticValue();
09670: final Node v$g$1 = Formatting.before1(v$pt$1, v$pt$2);
09671:
09672: yyValue = GNode.create("IndirectionExpression", v$g$1);
09673: yyValue.setLocation(location(yyStart));
09674:
09675: return yyResult.createValue(yyValue, yyError);
09676: }
09677: }
09678:
09679: // Alternative 12.
09680:
09681: yyResult = pSymbol(yyStart);
09682: yyError = yyResult.select(yyError);
09683: if (yyResult.hasValue()
09684: && ((Node) yyResult.semanticValue()).getTokenText()
09685: .equals("++")) {
09686: final Node v$pt$1 = yyResult.semanticValue();
09687:
09688: yyResult = pUnaryExpression(yyResult.index);
09689: yyError = yyResult.select(yyError);
09690: if (yyResult.hasValue()) {
09691: final Node v$pt$2 = yyResult.semanticValue();
09692: final Node v$g$1 = Formatting.before1(v$pt$1, v$pt$2);
09693:
09694: yyValue = GNode.create("PreincrementExpression", v$g$1);
09695: yyValue.setLocation(location(yyStart));
09696:
09697: return yyResult.createValue(yyValue, yyError);
09698: }
09699: }
09700:
09701: // Alternative 13.
09702:
09703: yyResult = pSymbol(yyStart);
09704: yyError = yyResult.select(yyError);
09705: if (yyResult.hasValue()
09706: && ((Node) yyResult.semanticValue()).getTokenText()
09707: .equals("--")) {
09708: final Node v$pt$1 = yyResult.semanticValue();
09709:
09710: yyResult = pUnaryExpression(yyResult.index);
09711: yyError = yyResult.select(yyError);
09712: if (yyResult.hasValue()) {
09713: final Node v$pt$2 = yyResult.semanticValue();
09714: final Node v$g$1 = Formatting.before1(v$pt$1, v$pt$2);
09715:
09716: yyValue = GNode.create("PredecrementExpression", v$g$1);
09717: yyValue.setLocation(location(yyStart));
09718:
09719: return yyResult.createValue(yyValue, yyError);
09720: }
09721: }
09722:
09723: // Alternative 14.
09724:
09725: if (GCC) {
09726:
09727: yyResult = pKeyword(yyStart);
09728: yyError = yyResult.select(yyError);
09729: if (yyResult.hasValue()
09730: && ((Node) yyResult.semanticValue()).getTokenText()
09731: .equals("__extension__")) {
09732: final Node v$pt$1 = yyResult.semanticValue();
09733:
09734: yyResult = pCastExpression(yyResult.index);
09735: yyError = yyResult.select(yyError);
09736: if (yyResult.hasValue()) {
09737: final Node v$pt$2 = yyResult.semanticValue();
09738: final Node v$g$1 = Formatting.before1(v$pt$1,
09739: v$pt$2);
09740:
09741: yyValue = GNode
09742: .create("ExtensionExpression", v$g$1);
09743: yyValue.setLocation(location(yyStart));
09744:
09745: return yyResult.createValue(yyValue, yyError);
09746: }
09747: }
09748: }
09749:
09750: // Alternative <Base>.
09751:
09752: yyResult = pPostfixExpression(yyStart);
09753: yyError = yyResult.select(yyError);
09754: if (yyResult.hasValue()) {
09755: yyValue = yyResult.semanticValue();
09756:
09757: return yyResult.createValue(yyValue, yyError);
09758: }
09759:
09760: // Done.
09761: yyError = yyError.select("unary expression expected", yyStart);
09762: return yyError;
09763: }
09764:
09765: // =========================================================================
09766:
09767: /**
09768: * Parse nonterminal xtc.lang.C.AlignofKeyword.
09769: *
09770: * @param yyStart The index.
09771: * @return The result.
09772: * @throws IOException Signals an I/O error.
09773: */
09774: private Result pAlignofKeyword(final int yyStart)
09775: throws IOException {
09776: Result yyResult;
09777: Node yyValue;
09778: ParseError yyError = ParseError.DUMMY;
09779:
09780: // Alternative 1.
09781:
09782: yyResult = pKeyword(yyStart);
09783: yyError = yyResult.select(yyError);
09784: if (yyResult.hasValue()
09785: && ((Node) yyResult.semanticValue()).getTokenText()
09786: .equals("__alignof__")) {
09787: final Node v$g$1 = yyResult.semanticValue();
09788:
09789: yyValue = GNode.create("AlignofKeyword", v$g$1);
09790: yyValue.setLocation(location(yyStart));
09791:
09792: return yyResult.createValue(yyValue, yyError);
09793: }
09794:
09795: // Alternative 2.
09796:
09797: yyResult = pKeyword(yyStart);
09798: yyError = yyResult.select(yyError);
09799: if (yyResult.hasValue()
09800: && ((Node) yyResult.semanticValue()).getTokenText()
09801: .equals("__alignof")) {
09802: final Node v$g$2 = yyResult.semanticValue();
09803:
09804: yyValue = GNode.create("AlignofKeyword", v$g$2);
09805: yyValue.setLocation(location(yyStart));
09806:
09807: return yyResult.createValue(yyValue, yyError);
09808: }
09809:
09810: // Done.
09811: yyError = yyError.select("alignof keyword expected", yyStart);
09812: return yyError;
09813: }
09814:
09815: // =========================================================================
09816:
09817: /**
09818: * Parse nonterminal xtc.lang.C.PostfixExpression.
09819: *
09820: * @param yyStart The index.
09821: * @return The result.
09822: * @throws IOException Signals an I/O error.
09823: */
09824: private Result pPostfixExpression(final int yyStart)
09825: throws IOException {
09826: Result yyResult;
09827: int yyRepetition1;
09828: Pair<Action<Node>> yyRepValue1;
09829: Node yyValue;
09830: ParseError yyError = ParseError.DUMMY;
09831:
09832: // Alternative <Compound>.
09833:
09834: yyResult = pCompoundLiteral(yyStart);
09835: yyError = yyResult.select(yyError);
09836: if (yyResult.hasValue()) {
09837: final Node v$g$6 = yyResult.semanticValue();
09838:
09839: yyRepetition1 = yyResult.index;
09840: yyRepValue1 = Pair.empty();
09841: while (true) {
09842:
09843: yyResult = pPostfixExpression$$Tail1(yyRepetition1);
09844: yyError = yyResult.select(yyError);
09845: if (yyResult.hasValue()) {
09846: final Action<Node> v$7 = yyResult.semanticValue();
09847:
09848: yyRepetition1 = yyResult.index;
09849: yyRepValue1 = new Pair<Action<Node>>(v$7,
09850: yyRepValue1);
09851: continue;
09852: }
09853: break;
09854: }
09855: { // Start scope for v$8.
09856: final Pair<Action<Node>> v$8 = yyRepValue1.reverse();
09857:
09858: yyValue = apply(v$8, v$g$6, yyStart);
09859:
09860: return new SemanticValue(yyValue, yyRepetition1,
09861: yyError);
09862: } // End scope for v$8.
09863: }
09864:
09865: // Alternative <Primary>.
09866:
09867: yyResult = pPrimaryExpression(yyStart);
09868: yyError = yyResult.select(yyError);
09869: if (yyResult.hasValue()) {
09870: final Node v$g$9 = yyResult.semanticValue();
09871:
09872: yyRepetition1 = yyResult.index;
09873: yyRepValue1 = Pair.empty();
09874: while (true) {
09875:
09876: yyResult = pPostfixExpression$$Tail1(yyRepetition1);
09877: yyError = yyResult.select(yyError);
09878: if (yyResult.hasValue()) {
09879: final Action<Node> v$10 = yyResult.semanticValue();
09880:
09881: yyRepetition1 = yyResult.index;
09882: yyRepValue1 = new Pair<Action<Node>>(v$10,
09883: yyRepValue1);
09884: continue;
09885: }
09886: break;
09887: }
09888: { // Start scope for v$11.
09889: final Pair<Action<Node>> v$11 = yyRepValue1.reverse();
09890:
09891: yyValue = apply(v$11, v$g$9, yyStart);
09892:
09893: return new SemanticValue(yyValue, yyRepetition1,
09894: yyError);
09895: } // End scope for v$11.
09896: }
09897:
09898: // Done.
09899: return yyError;
09900: }
09901:
09902: // =========================================================================
09903:
09904: /**
09905: * Parse synthetic nonterminal xtc.lang.C.PostfixExpression$$Tail1.
09906: *
09907: * @param yyStart The index.
09908: * @return The result.
09909: * @throws IOException Signals an I/O error.
09910: */
09911: private Result pPostfixExpression$$Tail1(final int yyStart)
09912: throws IOException {
09913:
09914: Result yyResult;
09915: int yyBase;
09916: int yyOption1;
09917: Node yyOpValue1;
09918: Action<Node> yyValue;
09919: ParseError yyError = ParseError.DUMMY;
09920:
09921: // Alternative 1.
09922:
09923: yyResult = pSymbol(yyStart);
09924: yyError = yyResult.select(yyError);
09925: if (yyResult.hasValue()
09926: && ((Node) yyResult.semanticValue()).getTokenText()
09927: .equals("[")) {
09928: final Node v$pt$1 = yyResult.semanticValue();
09929:
09930: yyResult = pCommaExpression(yyResult.index);
09931: yyError = yyResult.select(yyError);
09932: if (yyResult.hasValue()) {
09933: final Node v$pt$3 = yyResult.semanticValue();
09934:
09935: yyBase = yyResult.index;
09936: yyResult = pSymbol(yyBase);
09937: yyError = yyResult.select(yyError);
09938: if (yyResult.hasValue()
09939: && ((Node) yyResult.semanticValue())
09940: .getTokenText().equals("]")) {
09941: final Node v$pt$2 = yyResult.semanticValue();
09942: final Node v$g$2 = Formatting.round1(v$pt$1,
09943: v$pt$3, v$pt$2);
09944:
09945: yyValue = new Action<Node>() {
09946: public Node run(Node v$1) {
09947: return GNode.create("SubscriptExpression",
09948: v$1, v$g$2);
09949: }
09950: };
09951:
09952: return yyResult.createValue(yyValue, yyError);
09953: } else {
09954: yyError = yyError.select("\"]\" expected", yyBase);
09955: }
09956: }
09957: }
09958:
09959: // Alternative 2.
09960:
09961: yyResult = pSymbol(yyStart);
09962: yyError = yyResult.select(yyError);
09963: if (yyResult.hasValue()
09964: && ((Node) yyResult.semanticValue()).getTokenText()
09965: .equals(".")) {
09966: final Node v$pt$4 = yyResult.semanticValue();
09967:
09968: yyResult = pIdentifier(yyResult.index);
09969: yyError = yyResult.select(yyError);
09970: if (yyResult.hasValue()) {
09971: final Node v$pt$5 = yyResult.semanticValue();
09972: final Node v$g$3 = Formatting.before1(v$pt$4, v$pt$5);
09973:
09974: yyValue = new Action<Node>() {
09975: public Node run(Node v$1) {
09976: return GNode.create("DirectComponentSelection",
09977: v$1, v$g$3);
09978: }
09979: };
09980:
09981: return yyResult.createValue(yyValue, yyError);
09982: }
09983: }
09984:
09985: // Alternative 3.
09986:
09987: yyResult = pSymbol(yyStart);
09988: yyError = yyResult.select(yyError);
09989: if (yyResult.hasValue()
09990: && ((Node) yyResult.semanticValue()).getTokenText()
09991: .equals("->")) {
09992: final Node v$pt$6 = yyResult.semanticValue();
09993:
09994: yyResult = pIdentifier(yyResult.index);
09995: yyError = yyResult.select(yyError);
09996: if (yyResult.hasValue()) {
09997: final Node v$pt$7 = yyResult.semanticValue();
09998: final Node v$g$4 = Formatting.before1(v$pt$6, v$pt$7);
09999:
10000: yyValue = new Action<Node>() {
10001: public Node run(Node v$1) {
10002: return GNode.create(
10003: "IndirectComponentSelection", v$1,
10004: v$g$4);
10005: }
10006: };
10007:
10008: return yyResult.createValue(yyValue, yyError);
10009: }
10010: }
10011:
10012: // Alternative 4.
10013:
10014: yyResult = pSymbol(yyStart);
10015: yyError = yyResult.select(yyError);
10016: if (yyResult.hasValue()
10017: && ((Node) yyResult.semanticValue()).getTokenText()
10018: .equals("(")) {
10019: final Node v$pt$8 = yyResult.semanticValue();
10020:
10021: yyOption1 = yyResult.index;
10022: yyOpValue1 = null;
10023:
10024: yyResult = pExpressionList(yyOption1);
10025: yyError = yyResult.select(yyError);
10026: if (yyResult.hasValue()) {
10027: final Node v$el$1 = yyResult.semanticValue();
10028:
10029: yyOption1 = yyResult.index;
10030: yyOpValue1 = v$el$1;
10031: }
10032: { // Start scope for v$pt$10.
10033: final Node v$pt$10 = yyOpValue1;
10034:
10035: yyBase = yyOption1;
10036: yyResult = pSymbol(yyBase);
10037: yyError = yyResult.select(yyError);
10038: if (yyResult.hasValue()
10039: && ((Node) yyResult.semanticValue())
10040: .getTokenText().equals(")")) {
10041: final Node v$pt$9 = yyResult.semanticValue();
10042: final Node v$g$5 = Formatting.round1(v$pt$8,
10043: v$pt$10, v$pt$9);
10044:
10045: yyValue = new Action<Node>() {
10046: public Node run(Node v$1) {
10047: return GNode.create("FunctionCall", v$1,
10048: v$g$5);
10049: }
10050: };
10051:
10052: return yyResult.createValue(yyValue, yyError);
10053: } else {
10054: yyError = yyError.select("\")\" expected", yyBase);
10055: }
10056: } // End scope for v$pt$10.
10057: }
10058:
10059: // Alternative 5.
10060:
10061: yyResult = pSymbol(yyStart);
10062: yyError = yyResult.select(yyError);
10063: if (yyResult.hasValue()
10064: && ((Node) yyResult.semanticValue()).getTokenText()
10065: .equals("++")) {
10066: final Node v$pt$11 = yyResult.semanticValue();
10067:
10068: yyValue = new Action<Node>() {
10069: public Node run(Node v$1) {
10070: Node yyValue = GNode.create(
10071: "PostincrementExpression", v$1);
10072: yyValue = Formatting.after1(yyValue, v$pt$11);
10073: return yyValue;
10074: }
10075: };
10076:
10077: return yyResult.createValue(yyValue, yyError);
10078: }
10079:
10080: // Alternative 6.
10081:
10082: yyResult = pSymbol(yyStart);
10083: yyError = yyResult.select(yyError);
10084: if (yyResult.hasValue()
10085: && ((Node) yyResult.semanticValue()).getTokenText()
10086: .equals("--")) {
10087: final Node v$pt$12 = yyResult.semanticValue();
10088:
10089: yyValue = new Action<Node>() {
10090: public Node run(Node v$1) {
10091: Node yyValue = GNode.create(
10092: "PostdecrementExpression", v$1);
10093: yyValue = Formatting.after1(yyValue, v$pt$12);
10094: return yyValue;
10095: }
10096: };
10097:
10098: return yyResult.createValue(yyValue, yyError);
10099: }
10100:
10101: // Done.
10102: yyError = yyError
10103: .select("postfix expression expected", yyStart);
10104: return yyError;
10105: }
10106:
10107: // =========================================================================
10108:
10109: /**
10110: * Parse nonterminal xtc.lang.C.ExpressionList.
10111: *
10112: * @param yyStart The index.
10113: * @return The result.
10114: * @throws IOException Signals an I/O error.
10115: */
10116: private Result pExpressionList(final int yyStart)
10117: throws IOException {
10118: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
10119: if (null == yyColumn.chunk2)
10120: yyColumn.chunk2 = new Chunk2();
10121: if (null == yyColumn.chunk2.fExpressionList)
10122: yyColumn.chunk2.fExpressionList = pExpressionList$1(yyStart);
10123: return yyColumn.chunk2.fExpressionList;
10124: }
10125:
10126: /** Actually parse xtc.lang.C.ExpressionList. */
10127: private Result pExpressionList$1(final int yyStart)
10128: throws IOException {
10129: Result yyResult;
10130: Node yyValue;
10131: ParseError yyError = ParseError.DUMMY;
10132:
10133: // Alternative <Expressions>.
10134:
10135: yyResult = pAssignmentExpression(yyStart);
10136: yyError = yyResult.select(yyError);
10137: if (yyResult.hasValue()) {
10138: final Node v$g$1 = yyResult.semanticValue();
10139:
10140: yyResult = pExpressionList$$Star1(yyResult.index);
10141: yyError = yyResult.select(yyError);
10142: if (yyResult.hasValue()) {
10143: final Pair<Node> v$g$2 = yyResult.semanticValue();
10144:
10145: yyValue = GNode.createFromPair("ExpressionList", v$g$1,
10146: v$g$2);
10147: yyValue.setLocation(location(yyStart));
10148:
10149: return yyResult.createValue(yyValue, yyError);
10150: }
10151: }
10152:
10153: // Done.
10154: return yyError;
10155: }
10156:
10157: // =========================================================================
10158:
10159: /**
10160: * Parse synthetic nonterminal xtc.lang.C.ExpressionList$$Star1.
10161: *
10162: * @param yyStart The index.
10163: * @return The result.
10164: * @throws IOException Signals an I/O error.
10165: */
10166: private Result pExpressionList$$Star1(final int yyStart)
10167: throws IOException {
10168:
10169: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
10170: if (null == yyColumn.chunk3)
10171: yyColumn.chunk3 = new Chunk3();
10172: if (null == yyColumn.chunk3.fExpressionList$$Star1)
10173: yyColumn.chunk3.fExpressionList$$Star1 = pExpressionList$$Star1$1(yyStart);
10174: return yyColumn.chunk3.fExpressionList$$Star1;
10175: }
10176:
10177: /** Actually parse xtc.lang.C.ExpressionList$$Star1. */
10178: private Result pExpressionList$$Star1$1(final int yyStart)
10179: throws IOException {
10180:
10181: Result yyResult;
10182: Pair<Node> yyValue;
10183: ParseError yyError = ParseError.DUMMY;
10184:
10185: // Alternative 1.
10186:
10187: yyResult = pSymbol(yyStart);
10188: yyError = yyResult.select(yyError);
10189: if (yyResult.hasValue()
10190: && ((Node) yyResult.semanticValue()).getTokenText()
10191: .equals(",")) {
10192: final Node v$pt$1 = yyResult.semanticValue();
10193:
10194: yyResult = pAssignmentExpression(yyResult.index);
10195: yyError = yyResult.select(yyError);
10196: if (yyResult.hasValue()) {
10197: final Node v$pt$2 = yyResult.semanticValue();
10198: final Node v$el$1 = Formatting.before1(v$pt$1, v$pt$2);
10199:
10200: yyResult = pExpressionList$$Star1(yyResult.index);
10201: yyError = yyResult.select(yyError);
10202: if (yyResult.hasValue()) {
10203: final Pair<Node> v$2 = yyResult.semanticValue();
10204:
10205: yyValue = new Pair<Node>(v$el$1, v$2);
10206:
10207: return yyResult.createValue(yyValue, yyError);
10208: }
10209: }
10210: }
10211:
10212: // Alternative 2.
10213:
10214: yyValue = Pair.empty();
10215:
10216: return new SemanticValue(yyValue, yyStart, yyError);
10217: }
10218:
10219: // =========================================================================
10220:
10221: /**
10222: * Parse nonterminal xtc.lang.C.CompoundLiteral.
10223: *
10224: * @param yyStart The index.
10225: * @return The result.
10226: * @throws IOException Signals an I/O error.
10227: */
10228: private Result pCompoundLiteral(final int yyStart)
10229: throws IOException {
10230: Result yyResult;
10231: int yyBase;
10232: int yyOption1;
10233: Node yyOpValue1;
10234: Node yyValue;
10235: ParseError yyError = ParseError.DUMMY;
10236:
10237: // Alternative 1.
10238:
10239: yyResult = pSymbol(yyStart);
10240: yyError = yyResult.select(yyError);
10241: if (yyResult.hasValue()
10242: && ((Node) yyResult.semanticValue()).getTokenText()
10243: .equals("(")) {
10244: final Node v$pt$1 = yyResult.semanticValue();
10245:
10246: yyResult = pTypeName(yyResult.index);
10247: yyError = yyResult.select(yyError);
10248: if (yyResult.hasValue()) {
10249: final Node v$pt$4 = yyResult.semanticValue();
10250:
10251: yyBase = yyResult.index;
10252: yyResult = pSymbol(yyBase);
10253: yyError = yyResult.select(yyError);
10254: if (yyResult.hasValue()
10255: && ((Node) yyResult.semanticValue())
10256: .getTokenText().equals(")")) {
10257: final Node v$pt$2 = yyResult.semanticValue();
10258:
10259: yyBase = yyResult.index;
10260: yyResult = pSymbol(yyBase);
10261: yyError = yyResult.select(yyError);
10262: if (yyResult.hasValue()
10263: && ((Node) yyResult.semanticValue())
10264: .getTokenText().equals("{")) {
10265: final Node v$pt$3 = yyResult.semanticValue();
10266: final Node v$g$1 = Formatting.variable().add(
10267: v$pt$1).addNode(v$pt$4).add(v$pt$2)
10268: .add(v$pt$3);
10269:
10270: yyResult = pInitializerList(yyResult.index);
10271: yyError = yyResult.select(yyError);
10272: if (yyResult.hasValue()) {
10273: final Node v$pt$7 = yyResult
10274: .semanticValue();
10275:
10276: yyOption1 = yyResult.index;
10277: yyOpValue1 = null;
10278:
10279: yyBase = yyOption1;
10280: yyResult = pSymbol(yyBase);
10281: yyError = yyResult.select(yyError);
10282: if (yyResult.hasValue()
10283: && ((Node) yyResult.semanticValue())
10284: .getTokenText().equals(",")) {
10285: final Node v$el$1 = yyResult
10286: .semanticValue();
10287:
10288: yyOption1 = yyResult.index;
10289: yyOpValue1 = v$el$1;
10290: } else {
10291: yyError = yyError.select(
10292: "\",\" expected", yyBase);
10293: }
10294: { // Start scope for v$pt$5.
10295: final Node v$pt$5 = yyOpValue1;
10296:
10297: yyBase = yyOption1;
10298: yyResult = pSymbol(yyBase);
10299: yyError = yyResult.select(yyError);
10300: if (yyResult.hasValue()
10301: && ((Node) yyResult
10302: .semanticValue())
10303: .getTokenText().equals(
10304: "}")) {
10305: final Node v$pt$6 = yyResult
10306: .semanticValue();
10307: final Node v$g$2 = Formatting
10308: .variable().addNode(v$pt$7)
10309: .add(v$pt$5).add(v$pt$6);
10310:
10311: yyValue = GNode.create(
10312: "CompoundLiteral", v$g$1,
10313: v$g$2);
10314: yyValue
10315: .setLocation(location(yyStart));
10316:
10317: return yyResult.createValue(
10318: yyValue, yyError);
10319: } else {
10320: yyError = yyError.select(
10321: "\"}\" expected", yyBase);
10322: }
10323: } // End scope for v$pt$5.
10324: }
10325: } else {
10326: yyError = yyError.select("\"{\" expected",
10327: yyBase);
10328: }
10329: } else {
10330: yyError = yyError.select("\")\" expected", yyBase);
10331: }
10332: }
10333: }
10334:
10335: // Done.
10336: yyError = yyError.select("compound literal expected", yyStart);
10337: return yyError;
10338: }
10339:
10340: // =========================================================================
10341:
10342: /**
10343: * Parse nonterminal xtc.lang.C.PrimaryExpression.
10344: *
10345: * @param yyStart The index.
10346: * @return The result.
10347: * @throws IOException Signals an I/O error.
10348: */
10349: private Result pPrimaryExpression(final int yyStart)
10350: throws IOException {
10351: Result yyResult;
10352: int yyBase;
10353: Node yyValue;
10354: ParseError yyError = ParseError.DUMMY;
10355:
10356: // Alternative <Constant>.
10357:
10358: yyResult = pConstant(yyStart);
10359: yyError = yyResult.select(yyError);
10360: if (yyResult.hasValue()) {
10361: yyValue = yyResult.semanticValue();
10362:
10363: return yyResult.createValue(yyValue, yyError);
10364: }
10365:
10366: // Alternative 2.
10367:
10368: yyResult = pIdentifier(yyStart);
10369: yyError = yyResult.select(yyError);
10370: if (yyResult.hasValue()) {
10371: final Node v$g$1 = yyResult.semanticValue();
10372:
10373: yyValue = GNode.create("PrimaryIdentifier", v$g$1);
10374: yyValue.setLocation(location(yyStart));
10375:
10376: return yyResult.createValue(yyValue, yyError);
10377: }
10378:
10379: // Alternative 3.
10380:
10381: if (GCC) {
10382:
10383: yyResult = pSymbol(yyStart);
10384: yyError = yyResult.select(yyError);
10385: if (yyResult.hasValue()
10386: && ((Node) yyResult.semanticValue()).getTokenText()
10387: .equals("(")) {
10388: final Node v$pt$1 = yyResult.semanticValue();
10389:
10390: yyResult = pCompoundStatement(yyResult.index);
10391: yyError = yyResult.select(yyError);
10392: if (yyResult.hasValue()) {
10393: final Node v$pt$3 = yyResult.semanticValue();
10394:
10395: yyBase = yyResult.index;
10396: yyResult = pSymbol(yyBase);
10397: yyError = yyResult.select(yyError);
10398: if (yyResult.hasValue()
10399: && ((Node) yyResult.semanticValue())
10400: .getTokenText().equals(")")) {
10401: final Node v$pt$2 = yyResult.semanticValue();
10402: final Node v$g$1 = Formatting.round1(v$pt$1,
10403: v$pt$3, v$pt$2);
10404:
10405: yyValue = GNode.create("StatementAsExpression",
10406: v$g$1);
10407: yyValue.setLocation(location(yyStart));
10408:
10409: return yyResult.createValue(yyValue, yyError);
10410: } else {
10411: yyError = yyError.select("\")\" expected",
10412: yyBase);
10413: }
10414: }
10415: }
10416: }
10417:
10418: // Alternative 4.
10419:
10420: yyResult = pKeyword(yyStart);
10421: yyError = yyResult.select(yyError);
10422: if (yyResult.hasValue()
10423: && ((Node) yyResult.semanticValue()).getTokenText()
10424: .equals("__builtin_va_arg")) {
10425: final Node v$pt$1 = yyResult.semanticValue();
10426:
10427: yyBase = yyResult.index;
10428: yyResult = pSymbol(yyBase);
10429: yyError = yyResult.select(yyError);
10430: if (yyResult.hasValue()
10431: && ((Node) yyResult.semanticValue()).getTokenText()
10432: .equals("(")) {
10433: final Node v$pt$2 = yyResult.semanticValue();
10434:
10435: yyResult = pAssignmentExpression(yyResult.index);
10436: yyError = yyResult.select(yyError);
10437: if (yyResult.hasValue()) {
10438: final Node v$pt$4 = yyResult.semanticValue();
10439:
10440: yyBase = yyResult.index;
10441: yyResult = pSymbol(yyBase);
10442: yyError = yyResult.select(yyError);
10443: if (yyResult.hasValue()
10444: && ((Node) yyResult.semanticValue())
10445: .getTokenText().equals(",")) {
10446: final Node v$pt$3 = yyResult.semanticValue();
10447: final Node v$g$1 = Formatting.variable().add(
10448: v$pt$1).add(v$pt$2).addNode(v$pt$4)
10449: .add(v$pt$3);
10450:
10451: yyResult = pTypeName(yyResult.index);
10452: yyError = yyResult.select(yyError);
10453: if (yyResult.hasValue()) {
10454: final Node v$pt$6 = yyResult
10455: .semanticValue();
10456:
10457: yyBase = yyResult.index;
10458: yyResult = pSymbol(yyBase);
10459: yyError = yyResult.select(yyError);
10460: if (yyResult.hasValue()
10461: && ((Node) yyResult.semanticValue())
10462: .getTokenText().equals(")")) {
10463: final Node v$pt$5 = yyResult
10464: .semanticValue();
10465: final Node v$g$2 = Formatting.after1(
10466: v$pt$6, v$pt$5);
10467:
10468: yyValue = GNode.create(
10469: "VariableArgumentAccess",
10470: v$g$1, v$g$2);
10471: yyValue.setLocation(location(yyStart));
10472:
10473: return yyResult.createValue(yyValue,
10474: yyError);
10475: } else {
10476: yyError = yyError.select(
10477: "\")\" expected", yyBase);
10478: }
10479: }
10480: } else {
10481: yyError = yyError.select("\",\" expected",
10482: yyBase);
10483: }
10484: }
10485: } else {
10486: yyError = yyError.select("\"(\" expected", yyBase);
10487: }
10488: }
10489:
10490: // Alternative <ParenthesizedExpression>.
10491:
10492: yyResult = pSymbol(yyStart);
10493: yyError = yyResult.select(yyError);
10494: if (yyResult.hasValue()
10495: && ((Node) yyResult.semanticValue()).getTokenText()
10496: .equals("(")) {
10497: final Node v$pt$1 = yyResult.semanticValue();
10498:
10499: yyResult = pCommaExpression(yyResult.index);
10500: yyError = yyResult.select(yyError);
10501: if (yyResult.hasValue()) {
10502: final Node v$pt$3 = yyResult.semanticValue();
10503:
10504: yyBase = yyResult.index;
10505: yyResult = pSymbol(yyBase);
10506: yyError = yyResult.select(yyError);
10507: if (yyResult.hasValue()
10508: && ((Node) yyResult.semanticValue())
10509: .getTokenText().equals(")")) {
10510: final Node v$pt$2 = yyResult.semanticValue();
10511: yyValue = Formatting.round1(v$pt$1, v$pt$3, v$pt$2);
10512:
10513: return yyResult.createValue(yyValue, yyError);
10514: } else {
10515: yyError = yyError.select("\")\" expected", yyBase);
10516: }
10517: }
10518: }
10519:
10520: // Done.
10521: yyError = yyError
10522: .select("primary expression expected", yyStart);
10523: return yyError;
10524: }
10525:
10526: // =========================================================================
10527:
10528: /**
10529: * Parse nonterminal xtc.lang.C.PrimaryIdentifier.
10530: *
10531: * @param yyStart The index.
10532: * @return The result.
10533: * @throws IOException Signals an I/O error.
10534: */
10535: private Result pPrimaryIdentifier(final int yyStart)
10536: throws IOException {
10537: Result yyResult;
10538: Node yyValue;
10539: ParseError yyError = ParseError.DUMMY;
10540:
10541: // Alternative 1.
10542:
10543: yyResult = pIdentifier(yyStart);
10544: yyError = yyResult.select(yyError);
10545: if (yyResult.hasValue()) {
10546: final Node v$g$1 = yyResult.semanticValue();
10547:
10548: yyValue = GNode.create("PrimaryIdentifier", v$g$1);
10549: yyValue.setLocation(location(yyStart));
10550:
10551: return yyResult.createValue(yyValue, yyError);
10552: }
10553:
10554: // Done.
10555: return yyError;
10556: }
10557:
10558: // =========================================================================
10559:
10560: /**
10561: * Parse nonterminal xtc.lang.C.AssemblyDefinition.
10562: *
10563: * @param yyStart The index.
10564: * @return The result.
10565: * @throws IOException Signals an I/O error.
10566: */
10567: private Result pAssemblyDefinition(final int yyStart)
10568: throws IOException {
10569: Result yyResult;
10570: int yyBase;
10571: Node yyValue;
10572: ParseError yyError = ParseError.DUMMY;
10573:
10574: // Alternative 1.
10575:
10576: yyResult = pSimpleAssemblyExpression(yyStart);
10577: yyError = yyResult.select(yyError);
10578: if (yyResult.hasValue()) {
10579: final Node v$pt$2 = yyResult.semanticValue();
10580:
10581: yyBase = yyResult.index;
10582: yyResult = pSymbol(yyBase);
10583: yyError = yyResult.select(yyError);
10584: if (yyResult.hasValue()
10585: && ((Node) yyResult.semanticValue()).getTokenText()
10586: .equals(";")) {
10587: final Node v$pt$1 = yyResult.semanticValue();
10588: final Node v$g$1 = Formatting.after1(v$pt$2, v$pt$1);
10589:
10590: yyValue = GNode.create("AssemblyDefinition", v$g$1);
10591: yyValue.setLocation(location(yyStart));
10592:
10593: return yyResult.createValue(yyValue, yyError);
10594: } else {
10595: yyError = yyError.select("\";\" expected", yyBase);
10596: }
10597: }
10598:
10599: // Done.
10600: return yyError;
10601: }
10602:
10603: // =========================================================================
10604:
10605: /**
10606: * Parse nonterminal xtc.lang.C.SimpleAssemblyExpression.
10607: *
10608: * @param yyStart The index.
10609: * @return The result.
10610: * @throws IOException Signals an I/O error.
10611: */
10612: private Result pSimpleAssemblyExpression(final int yyStart)
10613: throws IOException {
10614:
10615: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
10616: if (null == yyColumn.chunk3)
10617: yyColumn.chunk3 = new Chunk3();
10618: if (null == yyColumn.chunk3.fSimpleAssemblyExpression)
10619: yyColumn.chunk3.fSimpleAssemblyExpression = pSimpleAssemblyExpression$1(yyStart);
10620: return yyColumn.chunk3.fSimpleAssemblyExpression;
10621: }
10622:
10623: /** Actually parse xtc.lang.C.SimpleAssemblyExpression. */
10624: private Result pSimpleAssemblyExpression$1(final int yyStart)
10625: throws IOException {
10626:
10627: Result yyResult;
10628: int yyBase;
10629: Node yyValue;
10630: ParseError yyError = ParseError.DUMMY;
10631:
10632: // Alternative 1.
10633:
10634: yyResult = pAsmKeyword(yyStart);
10635: yyError = yyResult.select(yyError);
10636: if (yyResult.hasValue()) {
10637: final Node v$pt$1 = yyResult.semanticValue();
10638:
10639: yyBase = yyResult.index;
10640: yyResult = pSymbol(yyBase);
10641: yyError = yyResult.select(yyError);
10642: if (yyResult.hasValue()
10643: && ((Node) yyResult.semanticValue()).getTokenText()
10644: .equals("(")) {
10645: final Node v$pt$2 = yyResult.semanticValue();
10646:
10647: yyResult = pStringConstant(yyResult.index);
10648: yyError = yyResult.select(yyError);
10649: if (yyResult.hasValue()) {
10650: final Node v$pt$4 = yyResult.semanticValue();
10651:
10652: yyBase = yyResult.index;
10653: yyResult = pSymbol(yyBase);
10654: yyError = yyResult.select(yyError);
10655: if (yyResult.hasValue()
10656: && ((Node) yyResult.semanticValue())
10657: .getTokenText().equals(")")) {
10658: final Node v$pt$3 = yyResult.semanticValue();
10659: final Node v$g$1 = Formatting.variable().add(
10660: v$pt$1).add(v$pt$2).addNode(v$pt$4)
10661: .add(v$pt$3);
10662:
10663: yyValue = GNode.create(
10664: "SimpleAssemblyExpression", v$g$1);
10665: yyValue.setLocation(location(yyStart));
10666:
10667: return yyResult.createValue(yyValue, yyError);
10668: } else {
10669: yyError = yyError.select("\")\" expected",
10670: yyBase);
10671: }
10672: }
10673: } else {
10674: yyError = yyError.select("\"(\" expected", yyBase);
10675: }
10676: }
10677:
10678: // Done.
10679: return yyError;
10680: }
10681:
10682: // =========================================================================
10683:
10684: /**
10685: * Parse nonterminal xtc.lang.C.AssemblyArgument.
10686: *
10687: * @param yyStart The index.
10688: * @return The result.
10689: * @throws IOException Signals an I/O error.
10690: */
10691: private Result pAssemblyArgument(final int yyStart)
10692: throws IOException {
10693: Result yyResult;
10694: int yyBase;
10695: int yyOption1;
10696: Node yyOpValue1;
10697: Node yyValue;
10698: ParseError yyError = ParseError.DUMMY;
10699:
10700: // Alternative 1.
10701:
10702: yyResult = pStringConstant(yyStart);
10703: yyError = yyResult.select(yyError);
10704: if (yyResult.hasValue()) {
10705: final Node v$g$1 = yyResult.semanticValue();
10706:
10707: final int yyChoice1 = yyResult.index;
10708:
10709: // Nested alternative 1.
10710:
10711: yyBase = yyChoice1;
10712: yyResult = pSymbol(yyBase);
10713: yyError = yyResult.select(yyError);
10714: if (yyResult.hasValue()
10715: && ((Node) yyResult.semanticValue()).getTokenText()
10716: .equals(":")) {
10717: final Node v$pt$1 = yyResult.semanticValue();
10718:
10719: yyOption1 = yyResult.index;
10720: yyOpValue1 = null;
10721:
10722: yyResult = pAssemblyOperands(yyOption1);
10723: yyError = yyResult.select(yyError);
10724: if (yyResult.hasValue()) {
10725: final Node v$el$1 = yyResult.semanticValue();
10726:
10727: yyOption1 = yyResult.index;
10728: yyOpValue1 = v$el$1;
10729: }
10730: { // Start scope for v$pt$2.
10731: final Node v$pt$2 = yyOpValue1;
10732: final Node v$g$2 = Formatting.before1(v$pt$1,
10733: v$pt$2);
10734:
10735: final int yyChoice2 = yyOption1;
10736:
10737: // Nested alternative 1.
10738:
10739: yyBase = yyChoice2;
10740: yyResult = pSymbol(yyBase);
10741: yyError = yyResult.select(yyError);
10742: if (yyResult.hasValue()
10743: && ((Node) yyResult.semanticValue())
10744: .getTokenText().equals(":")) {
10745: final Node v$pt$3 = yyResult.semanticValue();
10746:
10747: yyOption1 = yyResult.index;
10748: yyOpValue1 = null;
10749:
10750: yyResult = pAssemblyOperands(yyOption1);
10751: yyError = yyResult.select(yyError);
10752: if (yyResult.hasValue()) {
10753: final Node v$el$2 = yyResult
10754: .semanticValue();
10755:
10756: yyOption1 = yyResult.index;
10757: yyOpValue1 = v$el$2;
10758: }
10759: { // Start scope for v$pt$4.
10760: final Node v$pt$4 = yyOpValue1;
10761: final Node v$g$3 = Formatting.before1(
10762: v$pt$3, v$pt$4);
10763:
10764: final int yyChoice3 = yyOption1;
10765:
10766: // Nested alternative 1.
10767:
10768: yyBase = yyChoice3;
10769: yyResult = pSymbol(yyBase);
10770: yyError = yyResult.select(yyError);
10771: if (yyResult.hasValue()
10772: && ((Node) yyResult.semanticValue())
10773: .getTokenText().equals(":")) {
10774: final Node v$pt$5 = yyResult
10775: .semanticValue();
10776:
10777: yyResult = pAssemblyClobbers(yyResult.index);
10778: yyError = yyResult.select(yyError);
10779: if (yyResult.hasValue()) {
10780: final Node v$pt$6 = yyResult
10781: .semanticValue();
10782: final Node v$g$4 = Formatting
10783: .before1(v$pt$5, v$pt$6);
10784:
10785: yyValue = GNode.create(
10786: "AssemblyArgument", v$g$1,
10787: v$g$2, v$g$3, v$g$4);
10788: yyValue
10789: .setLocation(location(yyStart));
10790:
10791: return yyResult.createValue(
10792: yyValue, yyError);
10793: }
10794: } else {
10795: yyError = yyError.select(
10796: "\":\" expected", yyBase);
10797: }
10798:
10799: // Nested alternative 2.
10800:
10801: yyValue = GNode.create("AssemblyArgument",
10802: v$g$1, v$g$2, v$g$3);
10803: yyValue.setLocation(location(yyStart));
10804:
10805: return new SemanticValue(yyValue,
10806: yyChoice3, yyError);
10807: } // End scope for v$pt$4.
10808: } else {
10809: yyError = yyError.select("\":\" expected",
10810: yyBase);
10811: }
10812:
10813: // Nested alternative 2.
10814:
10815: yyValue = GNode.create("AssemblyArgument", v$g$1,
10816: v$g$2);
10817: yyValue.setLocation(location(yyStart));
10818:
10819: return new SemanticValue(yyValue, yyChoice2,
10820: yyError);
10821: } // End scope for v$pt$2.
10822: } else {
10823: yyError = yyError.select("\":\" expected", yyBase);
10824: }
10825:
10826: // Nested alternative 2.
10827:
10828: yyValue = GNode.create("AssemblyArgument", v$g$1);
10829: yyValue.setLocation(location(yyStart));
10830:
10831: return new SemanticValue(yyValue, yyChoice1, yyError);
10832: }
10833:
10834: // Done.
10835: return yyError;
10836: }
10837:
10838: // =========================================================================
10839:
10840: /**
10841: * Parse nonterminal xtc.lang.C.AssemblyOperands.
10842: *
10843: * @param yyStart The index.
10844: * @return The result.
10845: * @throws IOException Signals an I/O error.
10846: */
10847: private Result pAssemblyOperands(final int yyStart)
10848: throws IOException {
10849: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
10850: if (null == yyColumn.chunk3)
10851: yyColumn.chunk3 = new Chunk3();
10852: if (null == yyColumn.chunk3.fAssemblyOperands)
10853: yyColumn.chunk3.fAssemblyOperands = pAssemblyOperands$1(yyStart);
10854: return yyColumn.chunk3.fAssemblyOperands;
10855: }
10856:
10857: /** Actually parse xtc.lang.C.AssemblyOperands. */
10858: private Result pAssemblyOperands$1(final int yyStart)
10859: throws IOException {
10860: Result yyResult;
10861: Node yyValue;
10862: ParseError yyError = ParseError.DUMMY;
10863:
10864: // Alternative 1.
10865:
10866: yyResult = pAssemblyOperand(yyStart);
10867: yyError = yyResult.select(yyError);
10868: if (yyResult.hasValue()) {
10869: final Node v$g$1 = yyResult.semanticValue();
10870:
10871: yyResult = pAssemblyOperands$$Star1(yyResult.index);
10872: yyError = yyResult.select(yyError);
10873: if (yyResult.hasValue()) {
10874: final Pair<Node> v$g$2 = yyResult.semanticValue();
10875:
10876: yyValue = GNode.createFromPair("AssemblyOperands",
10877: v$g$1, v$g$2);
10878: yyValue.setLocation(location(yyStart));
10879:
10880: return yyResult.createValue(yyValue, yyError);
10881: }
10882: }
10883:
10884: // Done.
10885: return yyError;
10886: }
10887:
10888: // =========================================================================
10889:
10890: /**
10891: * Parse synthetic nonterminal xtc.lang.C.AssemblyOperands$$Star1.
10892: *
10893: * @param yyStart The index.
10894: * @return The result.
10895: * @throws IOException Signals an I/O error.
10896: */
10897: private Result pAssemblyOperands$$Star1(final int yyStart)
10898: throws IOException {
10899:
10900: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
10901: if (null == yyColumn.chunk3)
10902: yyColumn.chunk3 = new Chunk3();
10903: if (null == yyColumn.chunk3.fAssemblyOperands$$Star1)
10904: yyColumn.chunk3.fAssemblyOperands$$Star1 = pAssemblyOperands$$Star1$1(yyStart);
10905: return yyColumn.chunk3.fAssemblyOperands$$Star1;
10906: }
10907:
10908: /** Actually parse xtc.lang.C.AssemblyOperands$$Star1. */
10909: private Result pAssemblyOperands$$Star1$1(final int yyStart)
10910: throws IOException {
10911:
10912: Result yyResult;
10913: Pair<Node> yyValue;
10914: ParseError yyError = ParseError.DUMMY;
10915:
10916: // Alternative 1.
10917:
10918: yyResult = pSymbol(yyStart);
10919: yyError = yyResult.select(yyError);
10920: if (yyResult.hasValue()
10921: && ((Node) yyResult.semanticValue()).getTokenText()
10922: .equals(",")) {
10923: final Node v$pt$1 = yyResult.semanticValue();
10924:
10925: yyResult = pAssemblyOperand(yyResult.index);
10926: yyError = yyResult.select(yyError);
10927: if (yyResult.hasValue()) {
10928: final Node v$pt$2 = yyResult.semanticValue();
10929: final Node v$el$1 = Formatting.before1(v$pt$1, v$pt$2);
10930:
10931: yyResult = pAssemblyOperands$$Star1(yyResult.index);
10932: yyError = yyResult.select(yyError);
10933: if (yyResult.hasValue()) {
10934: final Pair<Node> v$2 = yyResult.semanticValue();
10935:
10936: yyValue = new Pair<Node>(v$el$1, v$2);
10937:
10938: return yyResult.createValue(yyValue, yyError);
10939: }
10940: }
10941: }
10942:
10943: // Alternative 2.
10944:
10945: yyValue = Pair.empty();
10946:
10947: return new SemanticValue(yyValue, yyStart, yyError);
10948: }
10949:
10950: // =========================================================================
10951:
10952: /**
10953: * Parse nonterminal xtc.lang.C.AssemblyOperand.
10954: *
10955: * @param yyStart The index.
10956: * @return The result.
10957: * @throws IOException Signals an I/O error.
10958: */
10959: private Result pAssemblyOperand(final int yyStart)
10960: throws IOException {
10961: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
10962: if (null == yyColumn.chunk3)
10963: yyColumn.chunk3 = new Chunk3();
10964: if (null == yyColumn.chunk3.fAssemblyOperand)
10965: yyColumn.chunk3.fAssemblyOperand = pAssemblyOperand$1(yyStart);
10966: return yyColumn.chunk3.fAssemblyOperand;
10967: }
10968:
10969: /** Actually parse xtc.lang.C.AssemblyOperand. */
10970: private Result pAssemblyOperand$1(final int yyStart)
10971: throws IOException {
10972: Result yyResult;
10973: int yyBase;
10974: int yyOption1;
10975: Node yyOpValue1;
10976: Node yyValue;
10977: ParseError yyError = ParseError.DUMMY;
10978:
10979: // Alternative 1.
10980:
10981: yyOption1 = yyStart;
10982: yyOpValue1 = null;
10983:
10984: yyBase = yyOption1;
10985: yyResult = pSymbol(yyBase);
10986: yyError = yyResult.select(yyError);
10987: if (yyResult.hasValue()
10988: && ((Node) yyResult.semanticValue()).getTokenText()
10989: .equals("[")) {
10990: final Node v$pt$1 = yyResult.semanticValue();
10991:
10992: yyResult = pWord(yyResult.index);
10993: yyError = yyResult.select(yyError);
10994: if (yyResult.hasValue()) {
10995: final Node v$pt$3 = yyResult.semanticValue();
10996:
10997: yyBase = yyResult.index;
10998: yyResult = pSymbol(yyBase);
10999: yyError = yyResult.select(yyError);
11000: if (yyResult.hasValue()
11001: && ((Node) yyResult.semanticValue())
11002: .getTokenText().equals("]")) {
11003: final Node v$pt$2 = yyResult.semanticValue();
11004: final Node v$el$1 = Formatting.round1(v$pt$1,
11005: v$pt$3, v$pt$2);
11006:
11007: yyOption1 = yyResult.index;
11008: yyOpValue1 = v$el$1;
11009: } else {
11010: yyError = yyError.select("\"]\" expected", yyBase);
11011: }
11012: }
11013: } else {
11014: yyError = yyError.select("\"[\" expected", yyBase);
11015: }
11016: { // Start scope for v$g$1.
11017: final Node v$g$1 = yyOpValue1;
11018:
11019: yyResult = pStringConstant(yyOption1);
11020: yyError = yyResult.select(yyError);
11021: if (yyResult.hasValue()) {
11022: final Node v$pt$5 = yyResult.semanticValue();
11023:
11024: yyBase = yyResult.index;
11025: yyResult = pSymbol(yyBase);
11026: yyError = yyResult.select(yyError);
11027: if (yyResult.hasValue()
11028: && ((Node) yyResult.semanticValue())
11029: .getTokenText().equals("(")) {
11030: final Node v$pt$4 = yyResult.semanticValue();
11031: final Node v$g$2 = Formatting
11032: .after1(v$pt$5, v$pt$4);
11033:
11034: yyResult = pCommaExpression(yyResult.index);
11035: yyError = yyResult.select(yyError);
11036: if (yyResult.hasValue()) {
11037: final Node v$pt$7 = yyResult.semanticValue();
11038:
11039: yyBase = yyResult.index;
11040: yyResult = pSymbol(yyBase);
11041: yyError = yyResult.select(yyError);
11042: if (yyResult.hasValue()
11043: && ((Node) yyResult.semanticValue())
11044: .getTokenText().equals(")")) {
11045: final Node v$pt$6 = yyResult
11046: .semanticValue();
11047: final Node v$g$3 = Formatting.after1(
11048: v$pt$7, v$pt$6);
11049:
11050: yyValue = GNode.create("AssemblyOperand",
11051: v$g$1, v$g$2, v$g$3);
11052: yyValue.setLocation(location(yyStart));
11053:
11054: return yyResult.createValue(yyValue,
11055: yyError);
11056: } else {
11057: yyError = yyError.select("\")\" expected",
11058: yyBase);
11059: }
11060: }
11061: } else {
11062: yyError = yyError.select("\"(\" expected", yyBase);
11063: }
11064: }
11065: } // End scope for v$g$1.
11066:
11067: // Done.
11068: return yyError;
11069: }
11070:
11071: // =========================================================================
11072:
11073: /**
11074: * Parse nonterminal xtc.lang.C.AssemblyClobbers.
11075: *
11076: * @param yyStart The index.
11077: * @return The result.
11078: * @throws IOException Signals an I/O error.
11079: */
11080: private Result pAssemblyClobbers(final int yyStart)
11081: throws IOException {
11082: Result yyResult;
11083: int yyBase;
11084: int yyRepetition1;
11085: Pair<Node> yyRepValue1;
11086: Node yyValue;
11087: ParseError yyError = ParseError.DUMMY;
11088:
11089: // Alternative 1.
11090:
11091: yyResult = pStringConstant(yyStart);
11092: yyError = yyResult.select(yyError);
11093: if (yyResult.hasValue()) {
11094: final Node v$g$1 = yyResult.semanticValue();
11095:
11096: yyRepetition1 = yyResult.index;
11097: yyRepValue1 = Pair.empty();
11098: while (true) {
11099:
11100: yyBase = yyRepetition1;
11101: yyResult = pSymbol(yyBase);
11102: yyError = yyResult.select(yyError);
11103: if (yyResult.hasValue()
11104: && ((Node) yyResult.semanticValue())
11105: .getTokenText().equals(",")) {
11106: final Node v$pt$1 = yyResult.semanticValue();
11107:
11108: yyResult = pStringConstant(yyResult.index);
11109: yyError = yyResult.select(yyError);
11110: if (yyResult.hasValue()) {
11111: final Node v$pt$2 = yyResult.semanticValue();
11112: final Node v$el$1 = Formatting.before1(v$pt$1,
11113: v$pt$2);
11114:
11115: yyRepetition1 = yyResult.index;
11116: yyRepValue1 = new Pair<Node>(v$el$1,
11117: yyRepValue1);
11118: continue;
11119: }
11120: } else {
11121: yyError = yyError.select("\",\" expected", yyBase);
11122: }
11123: break;
11124: }
11125: { // Start scope for v$g$2.
11126: final Pair<Node> v$g$2 = yyRepValue1.reverse();
11127:
11128: yyValue = GNode.createFromPair("AssemblyClobbers",
11129: v$g$1, v$g$2);
11130: yyValue.setLocation(location(yyStart));
11131:
11132: return new SemanticValue(yyValue, yyRepetition1,
11133: yyError);
11134: } // End scope for v$g$2.
11135: }
11136:
11137: // Done.
11138: return yyError;
11139: }
11140:
11141: // =========================================================================
11142:
11143: /**
11144: * Parse nonterminal xtc.lang.C.AsmKeyword.
11145: *
11146: * @param yyStart The index.
11147: * @return The result.
11148: * @throws IOException Signals an I/O error.
11149: */
11150: private Result pAsmKeyword(final int yyStart) throws IOException {
11151: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
11152: if (null == yyColumn.chunk3)
11153: yyColumn.chunk3 = new Chunk3();
11154: if (null == yyColumn.chunk3.fAsmKeyword)
11155: yyColumn.chunk3.fAsmKeyword = pAsmKeyword$1(yyStart);
11156: return yyColumn.chunk3.fAsmKeyword;
11157: }
11158:
11159: /** Actually parse xtc.lang.C.AsmKeyword. */
11160: private Result pAsmKeyword$1(final int yyStart) throws IOException {
11161: Result yyResult;
11162: Node yyValue;
11163: ParseError yyError = ParseError.DUMMY;
11164:
11165: // Alternative 1.
11166:
11167: yyResult = pKeyword(yyStart);
11168: yyError = yyResult.select(yyError);
11169: if (yyResult.hasValue()
11170: && ((Node) yyResult.semanticValue()).getTokenText()
11171: .equals("asm")) {
11172: final Node v$g$1 = yyResult.semanticValue();
11173:
11174: yyValue = GNode.create("AsmKeyword", v$g$1);
11175: yyValue.setLocation(location(yyStart));
11176:
11177: return yyResult.createValue(yyValue, yyError);
11178: }
11179:
11180: // Alternative 2.
11181:
11182: yyResult = pKeyword(yyStart);
11183: yyError = yyResult.select(yyError);
11184: if (yyResult.hasValue()
11185: && ((Node) yyResult.semanticValue()).getTokenText()
11186: .equals("__asm")) {
11187: final Node v$g$2 = yyResult.semanticValue();
11188:
11189: yyValue = GNode.create("AsmKeyword", v$g$2);
11190: yyValue.setLocation(location(yyStart));
11191:
11192: return yyResult.createValue(yyValue, yyError);
11193: }
11194:
11195: // Alternative 3.
11196:
11197: yyResult = pKeyword(yyStart);
11198: yyError = yyResult.select(yyError);
11199: if (yyResult.hasValue()
11200: && ((Node) yyResult.semanticValue()).getTokenText()
11201: .equals("__asm__")) {
11202: final Node v$g$3 = yyResult.semanticValue();
11203:
11204: yyValue = GNode.create("AsmKeyword", v$g$3);
11205: yyValue.setLocation(location(yyStart));
11206:
11207: return yyResult.createValue(yyValue, yyError);
11208: }
11209:
11210: // Done.
11211: yyError = yyError.select("asm keyword expected", yyStart);
11212: return yyError;
11213: }
11214:
11215: // =========================================================================
11216:
11217: /**
11218: * Parse nonterminal xtc.lang.CConstant.Constant.
11219: *
11220: * @param yyStart The index.
11221: * @return The result.
11222: * @throws IOException Signals an I/O error.
11223: */
11224: private Result pConstant(final int yyStart) throws IOException {
11225: Result yyResult;
11226: Node yyValue;
11227: ParseError yyError = ParseError.DUMMY;
11228:
11229: // Alternative 1.
11230:
11231: yyResult = pFloatingConstant(yyStart);
11232: yyError = yyResult.select(yyError);
11233: if (yyResult.hasValue()) {
11234: final Node v$pt$2 = yyResult.semanticValue();
11235:
11236: yyResult = pSpacing(yyResult.index);
11237: yyError = yyResult.select(yyError);
11238: if (yyResult.hasValue()) {
11239: final Token v$pt$1 = yyResult.semanticValue();
11240: yyValue = Formatting.after1(v$pt$2, v$pt$1);
11241:
11242: return yyResult.createValue(yyValue, yyError);
11243: }
11244: }
11245:
11246: // Alternative 2.
11247:
11248: yyResult = pIntegerConstant(yyStart);
11249: yyError = yyResult.select(yyError);
11250: if (yyResult.hasValue()) {
11251: final Node v$pt$4 = yyResult.semanticValue();
11252:
11253: yyResult = pSpacing(yyResult.index);
11254: yyError = yyResult.select(yyError);
11255: if (yyResult.hasValue()) {
11256: final Token v$pt$3 = yyResult.semanticValue();
11257: yyValue = Formatting.after1(v$pt$4, v$pt$3);
11258:
11259: return yyResult.createValue(yyValue, yyError);
11260: }
11261: }
11262:
11263: // Alternative 3.
11264:
11265: yyResult = pCharacterConstant(yyStart);
11266: yyError = yyResult.select(yyError);
11267: if (yyResult.hasValue()) {
11268: yyValue = yyResult.semanticValue();
11269:
11270: return yyResult.createValue(yyValue, yyError);
11271: }
11272:
11273: // Alternative 4.
11274:
11275: yyResult = pStringConstant(yyStart);
11276: yyError = yyResult.select(yyError);
11277: if (yyResult.hasValue()) {
11278: yyValue = yyResult.semanticValue();
11279:
11280: return yyResult.createValue(yyValue, yyError);
11281: }
11282:
11283: // Done.
11284: return yyError;
11285: }
11286:
11287: // =========================================================================
11288:
11289: /**
11290: * Parse nonterminal xtc.lang.CConstant.IntegerConstant.
11291: *
11292: * @param yyStart The index.
11293: * @return The result.
11294: * @throws IOException Signals an I/O error.
11295: */
11296: private Result pIntegerConstant(final int yyStart)
11297: throws IOException {
11298: Result yyResult;
11299: Node yyValue;
11300: ParseError yyError = ParseError.DUMMY;
11301:
11302: // Alternative <Hex>.
11303:
11304: yyResult = pHexConstant(yyStart);
11305: yyError = yyResult.select(yyError);
11306: if (yyResult.hasValue()) {
11307: final Token v$g$1 = yyResult.semanticValue();
11308:
11309: yyValue = GNode.create("IntegerConstant", v$g$1);
11310: yyValue.setLocation(location(yyStart));
11311:
11312: return yyResult.createValue(yyValue, yyError);
11313: }
11314:
11315: // Alternative <Octal>.
11316:
11317: yyResult = pOctalConstant(yyStart);
11318: yyError = yyResult.select(yyError);
11319: if (yyResult.hasValue()) {
11320: final Token v$g$2 = yyResult.semanticValue();
11321:
11322: yyValue = GNode.create("IntegerConstant", v$g$2);
11323: yyValue.setLocation(location(yyStart));
11324:
11325: return yyResult.createValue(yyValue, yyError);
11326: }
11327:
11328: // Alternative <Decimal>.
11329:
11330: yyResult = pDecimalConstant(yyStart);
11331: yyError = yyResult.select(yyError);
11332: if (yyResult.hasValue()) {
11333: final Token v$g$3 = yyResult.semanticValue();
11334:
11335: yyValue = GNode.create("IntegerConstant", v$g$3);
11336: yyValue.setLocation(location(yyStart));
11337:
11338: return yyResult.createValue(yyValue, yyError);
11339: }
11340:
11341: // Done.
11342: return yyError;
11343: }
11344:
11345: // =========================================================================
11346:
11347: /**
11348: * Parse nonterminal xtc.lang.CConstant.DecimalConstant.
11349: *
11350: * @param yyStart The index.
11351: * @return The result.
11352: * @throws IOException Signals an I/O error.
11353: */
11354: private Result pDecimalConstant(final int yyStart)
11355: throws IOException {
11356: int yyC;
11357: int yyIndex;
11358: Result yyResult;
11359: int yyRepetition1;
11360: int yyOption1;
11361: Token yyValue;
11362: ParseError yyError = ParseError.DUMMY;
11363:
11364: // Alternative 1.
11365:
11366: yyC = character(yyStart);
11367: if (-1 != yyC) {
11368: yyIndex = yyStart + 1;
11369:
11370: switch (yyC) {
11371: case '1':
11372: case '2':
11373: case '3':
11374: case '4':
11375: case '5':
11376: case '6':
11377: case '7':
11378: case '8':
11379: case '9': {
11380: yyRepetition1 = yyIndex;
11381: while (true) {
11382:
11383: yyC = character(yyRepetition1);
11384: if (-1 != yyC) {
11385: yyIndex = yyRepetition1 + 1;
11386:
11387: switch (yyC) {
11388: case '0':
11389: case '1':
11390: case '2':
11391: case '3':
11392: case '4':
11393: case '5':
11394: case '6':
11395: case '7':
11396: case '8':
11397: case '9': {
11398: yyRepetition1 = yyIndex;
11399: continue;
11400: }
11401:
11402: default:
11403: /* No match. */
11404: }
11405: }
11406: break;
11407: }
11408:
11409: yyOption1 = yyRepetition1;
11410:
11411: yyResult = pIntegerSuffix(yyOption1);
11412: yyError = yyResult.select(yyError);
11413: if (yyResult.hasValue()) {
11414:
11415: yyOption1 = yyResult.index;
11416: }
11417:
11418: yyValue = new Token(difference(yyStart, yyOption1));
11419: yyValue.setLocation(location(yyStart));
11420:
11421: return new SemanticValue(yyValue, yyOption1, yyError);
11422: }
11423:
11424: default:
11425: /* No match. */
11426: }
11427: }
11428:
11429: // Done.
11430: yyError = yyError.select("decimal constant expected", yyStart);
11431: return yyError;
11432: }
11433:
11434: // =========================================================================
11435:
11436: /**
11437: * Parse nonterminal xtc.lang.CConstant.HexConstant.
11438: *
11439: * @param yyStart The index.
11440: * @return The result.
11441: * @throws IOException Signals an I/O error.
11442: */
11443: private Result pHexConstant(final int yyStart) throws IOException {
11444: int yyC;
11445: int yyIndex;
11446: Result yyResult;
11447: int yyRepetition1;
11448: boolean yyRepeated1;
11449: int yyOption1;
11450: Token yyValue;
11451: ParseError yyError = ParseError.DUMMY;
11452:
11453: // Alternative 1.
11454:
11455: yyResult = pHexPrefix(yyStart);
11456: yyError = yyResult.select(yyError);
11457: if (yyResult.hasValue()) {
11458:
11459: yyRepetition1 = yyResult.index;
11460: yyRepeated1 = false;
11461: while (true) {
11462:
11463: yyC = character(yyRepetition1);
11464: if (-1 != yyC) {
11465: yyIndex = yyRepetition1 + 1;
11466:
11467: switch (yyC) {
11468: case '0':
11469: case '1':
11470: case '2':
11471: case '3':
11472: case '4':
11473: case '5':
11474: case '6':
11475: case '7':
11476: case '8':
11477: case '9':
11478: case 'A':
11479: case 'B':
11480: case 'C':
11481: case 'D':
11482: case 'E':
11483: case 'F':
11484: case 'a':
11485: case 'b':
11486: case 'c':
11487: case 'd':
11488: case 'e':
11489: case 'f': {
11490: yyRepetition1 = yyIndex;
11491: yyRepeated1 = true;
11492: continue;
11493: }
11494:
11495: default:
11496: /* No match. */
11497: }
11498: }
11499: break;
11500: }
11501:
11502: if (yyRepeated1) {
11503:
11504: yyOption1 = yyRepetition1;
11505:
11506: yyResult = pIntegerSuffix(yyOption1);
11507: yyError = yyResult.select(yyError);
11508: if (yyResult.hasValue()) {
11509:
11510: yyOption1 = yyResult.index;
11511: }
11512:
11513: yyValue = new Token(difference(yyStart, yyOption1));
11514: yyValue.setLocation(location(yyStart));
11515:
11516: return new SemanticValue(yyValue, yyOption1, yyError);
11517: }
11518: }
11519:
11520: // Done.
11521: yyError = yyError.select("hex constant expected", yyStart);
11522: return yyError;
11523: }
11524:
11525: // =========================================================================
11526:
11527: /**
11528: * Parse nonterminal xtc.lang.CConstant.HexPrefix.
11529: *
11530: * @param yyStart The index.
11531: * @return The result.
11532: * @throws IOException Signals an I/O error.
11533: */
11534: private Result pHexPrefix(final int yyStart) throws IOException {
11535: int yyC;
11536: int yyIndex;
11537: Void yyValue;
11538: ParseError yyError = ParseError.DUMMY;
11539:
11540: // Alternative 1.
11541:
11542: yyC = character(yyStart);
11543: if ('0' == yyC) {
11544: yyIndex = yyStart + 1;
11545:
11546: yyC = character(yyIndex);
11547: if (-1 != yyC) {
11548: yyIndex = yyIndex + 1;
11549:
11550: switch (yyC) {
11551: case 'X':
11552: case 'x': {
11553: yyValue = null;
11554:
11555: return new SemanticValue(yyValue, yyIndex, yyError);
11556: }
11557:
11558: default:
11559: /* No match. */
11560: }
11561: }
11562: }
11563:
11564: // Done.
11565: yyError = yyError.select("hex prefix expected", yyStart);
11566: return yyError;
11567: }
11568:
11569: // =========================================================================
11570:
11571: /**
11572: * Parse nonterminal xtc.lang.CConstant.OctalConstant.
11573: *
11574: * @param yyStart The index.
11575: * @return The result.
11576: * @throws IOException Signals an I/O error.
11577: */
11578: private Result pOctalConstant(final int yyStart) throws IOException {
11579: int yyC;
11580: int yyIndex;
11581: Result yyResult;
11582: int yyRepetition1;
11583: int yyOption1;
11584: Token yyValue;
11585: ParseError yyError = ParseError.DUMMY;
11586:
11587: // Alternative 1.
11588:
11589: yyC = character(yyStart);
11590: if ('0' == yyC) {
11591: yyIndex = yyStart + 1;
11592:
11593: yyRepetition1 = yyIndex;
11594: while (true) {
11595:
11596: yyC = character(yyRepetition1);
11597: if (-1 != yyC) {
11598: yyIndex = yyRepetition1 + 1;
11599:
11600: switch (yyC) {
11601: case '0':
11602: case '1':
11603: case '2':
11604: case '3':
11605: case '4':
11606: case '5':
11607: case '6':
11608: case '7': {
11609: yyRepetition1 = yyIndex;
11610: continue;
11611: }
11612:
11613: default:
11614: /* No match. */
11615: }
11616: }
11617: break;
11618: }
11619:
11620: yyOption1 = yyRepetition1;
11621:
11622: yyResult = pIntegerSuffix(yyOption1);
11623: yyError = yyResult.select(yyError);
11624: if (yyResult.hasValue()) {
11625:
11626: yyOption1 = yyResult.index;
11627: }
11628:
11629: yyValue = new Token(difference(yyStart, yyOption1));
11630: yyValue.setLocation(location(yyStart));
11631:
11632: return new SemanticValue(yyValue, yyOption1, yyError);
11633: }
11634:
11635: // Done.
11636: yyError = yyError.select("octal constant expected", yyStart);
11637: return yyError;
11638: }
11639:
11640: // =========================================================================
11641:
11642: /**
11643: * Parse nonterminal xtc.lang.CConstant.IntegerSuffix.
11644: *
11645: * @param yyStart The index.
11646: * @return The result.
11647: * @throws IOException Signals an I/O error.
11648: */
11649: private Result pIntegerSuffix(final int yyStart) throws IOException {
11650: int yyC;
11651: int yyIndex;
11652: Result yyResult;
11653: Void yyValue;
11654: ParseError yyError = ParseError.DUMMY;
11655:
11656: // Alternative 1.
11657:
11658: yyResult = pLongLongSuffix(yyStart);
11659: yyError = yyResult.select(yyError);
11660: if (yyResult.hasValue()) {
11661:
11662: final int yyChoice1 = yyResult.index;
11663:
11664: // Nested alternative 1.
11665:
11666: yyC = character(yyChoice1);
11667: if (-1 != yyC) {
11668: yyIndex = yyChoice1 + 1;
11669:
11670: switch (yyC) {
11671: case 'U':
11672: case 'u': {
11673: yyValue = null;
11674:
11675: return new SemanticValue(yyValue, yyIndex, yyError);
11676: }
11677:
11678: default:
11679: /* No match. */
11680: }
11681: }
11682:
11683: // Nested alternative 2.
11684:
11685: yyValue = null;
11686:
11687: return new SemanticValue(yyValue, yyChoice1, yyError);
11688: }
11689:
11690: // Alternative 2.
11691:
11692: yyC = character(yyStart);
11693: if (-1 != yyC) {
11694: yyIndex = yyStart + 1;
11695:
11696: switch (yyC) {
11697: case 'L':
11698: case 'l': {
11699: final int yyChoice1 = yyIndex;
11700:
11701: // Nested alternative 1.
11702:
11703: yyC = character(yyChoice1);
11704: if (-1 != yyC) {
11705: yyIndex = yyChoice1 + 1;
11706:
11707: switch (yyC) {
11708: case 'U':
11709: case 'u': {
11710: yyValue = null;
11711:
11712: return new SemanticValue(yyValue, yyIndex,
11713: yyError);
11714: }
11715:
11716: default:
11717: /* No match. */
11718: }
11719: }
11720:
11721: // Nested alternative 2.
11722:
11723: yyValue = null;
11724:
11725: return new SemanticValue(yyValue, yyChoice1, yyError);
11726: }
11727:
11728: case 'U':
11729: case 'u': {
11730: final int yyChoice1 = yyIndex;
11731:
11732: // Nested alternative 1.
11733:
11734: yyC = character(yyChoice1);
11735: if (-1 != yyC) {
11736: yyIndex = yyChoice1 + 1;
11737:
11738: switch (yyC) {
11739: case 'l': {
11740: yyC = character(yyIndex);
11741: if (-1 != yyC) {
11742: yyIndex = yyIndex + 1;
11743: if ('l' == yyC) {
11744:
11745: yyValue = null;
11746:
11747: return new SemanticValue(yyValue,
11748: yyIndex, yyError);
11749: }
11750: }
11751: }
11752: break;
11753:
11754: case 'L': {
11755: yyC = character(yyIndex);
11756: if (-1 != yyC) {
11757: yyIndex = yyIndex + 1;
11758: if ('L' == yyC) {
11759:
11760: yyValue = null;
11761:
11762: return new SemanticValue(yyValue,
11763: yyIndex, yyError);
11764: }
11765: }
11766: }
11767: break;
11768:
11769: default:
11770: /* No match. */
11771: }
11772: }
11773:
11774: // Nested alternative 2.
11775:
11776: yyC = character(yyChoice1);
11777: if (-1 != yyC) {
11778: yyIndex = yyChoice1 + 1;
11779:
11780: switch (yyC) {
11781: case 'L':
11782: case 'l': {
11783: yyValue = null;
11784:
11785: return new SemanticValue(yyValue, yyIndex,
11786: yyError);
11787: }
11788:
11789: default:
11790: /* No match. */
11791: }
11792: }
11793:
11794: // Nested alternative 3.
11795:
11796: yyValue = null;
11797:
11798: return new SemanticValue(yyValue, yyChoice1, yyError);
11799: }
11800:
11801: default:
11802: /* No match. */
11803: }
11804: }
11805:
11806: // Done.
11807: yyError = yyError.select("integer suffix expected", yyStart);
11808: return yyError;
11809: }
11810:
11811: // =========================================================================
11812:
11813: /**
11814: * Parse nonterminal xtc.lang.CConstant.LongLongSuffix.
11815: *
11816: * @param yyStart The index.
11817: * @return The result.
11818: * @throws IOException Signals an I/O error.
11819: */
11820: private Result pLongLongSuffix(final int yyStart)
11821: throws IOException {
11822: int yyC;
11823: int yyIndex;
11824: Void yyValue;
11825: ParseError yyError = ParseError.DUMMY;
11826:
11827: // Alternative 1.
11828:
11829: yyC = character(yyStart);
11830: if (-1 != yyC) {
11831: yyIndex = yyStart + 1;
11832:
11833: switch (yyC) {
11834: case 'l': {
11835: yyC = character(yyIndex);
11836: if (-1 != yyC) {
11837: yyIndex = yyIndex + 1;
11838: if ('l' == yyC) {
11839:
11840: yyValue = null;
11841:
11842: return new SemanticValue(yyValue, yyIndex,
11843: yyError);
11844: }
11845: }
11846: }
11847: break;
11848:
11849: case 'L': {
11850: yyC = character(yyIndex);
11851: if (-1 != yyC) {
11852: yyIndex = yyIndex + 1;
11853: if ('L' == yyC) {
11854:
11855: yyValue = null;
11856:
11857: return new SemanticValue(yyValue, yyIndex,
11858: yyError);
11859: }
11860: }
11861: }
11862: break;
11863:
11864: default:
11865: /* No match. */
11866: }
11867: }
11868:
11869: // Done.
11870: yyError = yyError.select("long long suffix expected", yyStart);
11871: return yyError;
11872: }
11873:
11874: // =========================================================================
11875:
11876: /**
11877: * Parse nonterminal xtc.lang.CConstant.FloatingConstant.
11878: *
11879: * @param yyStart The index.
11880: * @return The result.
11881: * @throws IOException Signals an I/O error.
11882: */
11883: private Result pFloatingConstant(final int yyStart)
11884: throws IOException {
11885: Result yyResult;
11886: Node yyValue;
11887: ParseError yyError = ParseError.DUMMY;
11888:
11889: // Alternative <Decimal>.
11890:
11891: yyResult = pDecimalFloatingConstant(yyStart);
11892: yyError = yyResult.select(yyError);
11893: if (yyResult.hasValue()) {
11894: final Token v$g$1 = yyResult.semanticValue();
11895:
11896: yyValue = GNode.create("FloatingConstant", v$g$1);
11897: yyValue.setLocation(location(yyStart));
11898:
11899: return yyResult.createValue(yyValue, yyError);
11900: }
11901:
11902: // Alternative <Hex>.
11903:
11904: yyResult = pHexFloatingConstant(yyStart);
11905: yyError = yyResult.select(yyError);
11906: if (yyResult.hasValue()) {
11907: final Token v$g$2 = yyResult.semanticValue();
11908:
11909: yyValue = GNode.create("FloatingConstant", v$g$2);
11910: yyValue.setLocation(location(yyStart));
11911:
11912: return yyResult.createValue(yyValue, yyError);
11913: }
11914:
11915: // Done.
11916: return yyError;
11917: }
11918:
11919: // =========================================================================
11920:
11921: /**
11922: * Parse nonterminal xtc.lang.CConstant.DecimalFloatingConstant.
11923: *
11924: * @param yyStart The index.
11925: * @return The result.
11926: * @throws IOException Signals an I/O error.
11927: */
11928: private Result pDecimalFloatingConstant(final int yyStart)
11929: throws IOException {
11930:
11931: int yyC;
11932: int yyIndex;
11933: Result yyResult;
11934: int yyRepetition1;
11935: boolean yyRepeated1;
11936: int yyOption1;
11937: Token yyValue;
11938: ParseError yyError = ParseError.DUMMY;
11939:
11940: // Alternative 1.
11941:
11942: yyRepetition1 = yyStart;
11943: yyRepeated1 = false;
11944: while (true) {
11945:
11946: yyC = character(yyRepetition1);
11947: if (-1 != yyC) {
11948: yyIndex = yyRepetition1 + 1;
11949:
11950: switch (yyC) {
11951: case '0':
11952: case '1':
11953: case '2':
11954: case '3':
11955: case '4':
11956: case '5':
11957: case '6':
11958: case '7':
11959: case '8':
11960: case '9': {
11961: yyRepetition1 = yyIndex;
11962: yyRepeated1 = true;
11963: continue;
11964: }
11965:
11966: default:
11967: /* No match. */
11968: }
11969: }
11970: break;
11971: }
11972:
11973: if (yyRepeated1) {
11974:
11975: yyC = character(yyRepetition1);
11976: if ('.' == yyC) {
11977: yyIndex = yyRepetition1 + 1;
11978:
11979: yyRepetition1 = yyIndex;
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: yyRepetition1 = yyIndex;
11998: continue;
11999: }
12000:
12001: default:
12002: /* No match. */
12003: }
12004: }
12005: break;
12006: }
12007:
12008: yyOption1 = yyRepetition1;
12009:
12010: yyResult = pExponent(yyOption1);
12011: yyError = yyResult.select(yyError);
12012: if (yyResult.hasValue()) {
12013:
12014: yyOption1 = yyResult.index;
12015: }
12016:
12017: yyC = character(yyOption1);
12018: if (-1 != yyC) {
12019: yyIndex = yyOption1 + 1;
12020:
12021: switch (yyC) {
12022: case 'F':
12023: case 'L':
12024: case 'f':
12025: case 'l': {
12026: yyOption1 = yyIndex;
12027: }
12028:
12029: default:
12030: /* No match. */
12031: }
12032: }
12033:
12034: yyValue = new Token(difference(yyStart, yyOption1));
12035: yyValue.setLocation(location(yyStart));
12036:
12037: return new SemanticValue(yyValue, yyOption1, yyError);
12038: }
12039: }
12040:
12041: // Alternative 2.
12042:
12043: yyC = character(yyStart);
12044: if ('.' == yyC) {
12045: yyIndex = yyStart + 1;
12046:
12047: yyRepetition1 = yyIndex;
12048: yyRepeated1 = false;
12049: while (true) {
12050:
12051: yyC = character(yyRepetition1);
12052: if (-1 != yyC) {
12053: yyIndex = yyRepetition1 + 1;
12054:
12055: switch (yyC) {
12056: case '0':
12057: case '1':
12058: case '2':
12059: case '3':
12060: case '4':
12061: case '5':
12062: case '6':
12063: case '7':
12064: case '8':
12065: case '9': {
12066: yyRepetition1 = yyIndex;
12067: yyRepeated1 = true;
12068: continue;
12069: }
12070:
12071: default:
12072: /* No match. */
12073: }
12074: }
12075: break;
12076: }
12077:
12078: if (yyRepeated1) {
12079:
12080: yyOption1 = yyRepetition1;
12081:
12082: yyResult = pExponent(yyOption1);
12083: yyError = yyResult.select(yyError);
12084: if (yyResult.hasValue()) {
12085:
12086: yyOption1 = yyResult.index;
12087: }
12088:
12089: yyC = character(yyOption1);
12090: if (-1 != yyC) {
12091: yyIndex = yyOption1 + 1;
12092:
12093: switch (yyC) {
12094: case 'F':
12095: case 'L':
12096: case 'f':
12097: case 'l': {
12098: yyOption1 = yyIndex;
12099: }
12100:
12101: default:
12102: /* No match. */
12103: }
12104: }
12105:
12106: yyValue = new Token(difference(yyStart, yyOption1));
12107: yyValue.setLocation(location(yyStart));
12108:
12109: return new SemanticValue(yyValue, yyOption1, yyError);
12110: }
12111: }
12112:
12113: // Alternative 3.
12114:
12115: yyRepetition1 = yyStart;
12116: yyRepeated1 = false;
12117: while (true) {
12118:
12119: yyC = character(yyRepetition1);
12120: if (-1 != yyC) {
12121: yyIndex = yyRepetition1 + 1;
12122:
12123: switch (yyC) {
12124: case '0':
12125: case '1':
12126: case '2':
12127: case '3':
12128: case '4':
12129: case '5':
12130: case '6':
12131: case '7':
12132: case '8':
12133: case '9': {
12134: yyRepetition1 = yyIndex;
12135: yyRepeated1 = true;
12136: continue;
12137: }
12138:
12139: default:
12140: /* No match. */
12141: }
12142: }
12143: break;
12144: }
12145:
12146: if (yyRepeated1) {
12147:
12148: yyResult = pExponent(yyRepetition1);
12149: yyError = yyResult.select(yyError);
12150: if (yyResult.hasValue()) {
12151:
12152: yyOption1 = yyResult.index;
12153:
12154: yyC = character(yyOption1);
12155: if (-1 != yyC) {
12156: yyIndex = yyOption1 + 1;
12157:
12158: switch (yyC) {
12159: case 'F':
12160: case 'L':
12161: case 'f':
12162: case 'l': {
12163: yyOption1 = yyIndex;
12164: }
12165:
12166: default:
12167: /* No match. */
12168: }
12169: }
12170:
12171: yyValue = new Token(difference(yyStart, yyOption1));
12172: yyValue.setLocation(location(yyStart));
12173:
12174: return new SemanticValue(yyValue, yyOption1, yyError);
12175: }
12176: }
12177:
12178: // Done.
12179: yyError = yyError.select("decimal floating constant expected",
12180: yyStart);
12181: return yyError;
12182: }
12183:
12184: // =========================================================================
12185:
12186: /**
12187: * Parse nonterminal xtc.lang.CConstant.HexFloatingConstant.
12188: *
12189: * @param yyStart The index.
12190: * @return The result.
12191: * @throws IOException Signals an I/O error.
12192: */
12193: private Result pHexFloatingConstant(final int yyStart)
12194: throws IOException {
12195: int yyC;
12196: int yyIndex;
12197: Result yyResult;
12198: int yyRepetition1;
12199: boolean yyRepeated1;
12200: int yyOption1;
12201: Token yyValue;
12202: ParseError yyError = ParseError.DUMMY;
12203:
12204: // Alternative 1.
12205:
12206: yyResult = pHexPrefix(yyStart);
12207: yyError = yyResult.select(yyError);
12208: if (yyResult.hasValue()) {
12209:
12210: final int yyChoice1 = yyResult.index;
12211:
12212: // Nested alternative 1.
12213:
12214: yyRepetition1 = yyChoice1;
12215: yyRepeated1 = false;
12216: while (true) {
12217:
12218: yyC = character(yyRepetition1);
12219: if (-1 != yyC) {
12220: yyIndex = yyRepetition1 + 1;
12221:
12222: switch (yyC) {
12223: case '0':
12224: case '1':
12225: case '2':
12226: case '3':
12227: case '4':
12228: case '5':
12229: case '6':
12230: case '7':
12231: case '8':
12232: case '9':
12233: case 'A':
12234: case 'B':
12235: case 'C':
12236: case 'D':
12237: case 'E':
12238: case 'F':
12239: case 'a':
12240: case 'b':
12241: case 'c':
12242: case 'd':
12243: case 'e':
12244: case 'f': {
12245: yyRepetition1 = yyIndex;
12246: yyRepeated1 = true;
12247: continue;
12248: }
12249:
12250: default:
12251: /* No match. */
12252: }
12253: }
12254: break;
12255: }
12256:
12257: if (yyRepeated1) {
12258:
12259: yyC = character(yyRepetition1);
12260: if ('.' == yyC) {
12261: yyIndex = yyRepetition1 + 1;
12262:
12263: yyRepetition1 = yyIndex;
12264: while (true) {
12265:
12266: yyC = character(yyRepetition1);
12267: if (-1 != yyC) {
12268: yyIndex = yyRepetition1 + 1;
12269:
12270: switch (yyC) {
12271: case '0':
12272: case '1':
12273: case '2':
12274: case '3':
12275: case '4':
12276: case '5':
12277: case '6':
12278: case '7':
12279: case '8':
12280: case '9':
12281: case 'A':
12282: case 'B':
12283: case 'C':
12284: case 'D':
12285: case 'E':
12286: case 'F':
12287: case 'a':
12288: case 'b':
12289: case 'c':
12290: case 'd':
12291: case 'e':
12292: case 'f': {
12293: yyRepetition1 = yyIndex;
12294: continue;
12295: }
12296:
12297: default:
12298: /* No match. */
12299: }
12300: }
12301: break;
12302: }
12303:
12304: yyResult = pBinaryExponent(yyRepetition1);
12305: yyError = yyResult.select(yyError);
12306: if (yyResult.hasValue()) {
12307:
12308: yyOption1 = yyResult.index;
12309:
12310: yyC = character(yyOption1);
12311: if (-1 != yyC) {
12312: yyIndex = yyOption1 + 1;
12313:
12314: switch (yyC) {
12315: case 'F':
12316: case 'L':
12317: case 'f':
12318: case 'l': {
12319: yyOption1 = yyIndex;
12320: }
12321:
12322: default:
12323: /* No match. */
12324: }
12325: }
12326:
12327: yyValue = new Token(difference(yyStart,
12328: yyOption1));
12329: yyValue.setLocation(location(yyStart));
12330:
12331: return new SemanticValue(yyValue, yyOption1,
12332: yyError);
12333: }
12334: }
12335: }
12336:
12337: // Nested alternative 2.
12338:
12339: yyC = character(yyChoice1);
12340: if ('.' == yyC) {
12341: yyIndex = yyChoice1 + 1;
12342:
12343: yyRepetition1 = yyIndex;
12344: yyRepeated1 = false;
12345: while (true) {
12346:
12347: yyC = character(yyRepetition1);
12348: if (-1 != yyC) {
12349: yyIndex = yyRepetition1 + 1;
12350:
12351: switch (yyC) {
12352: case '0':
12353: case '1':
12354: case '2':
12355: case '3':
12356: case '4':
12357: case '5':
12358: case '6':
12359: case '7':
12360: case '8':
12361: case '9':
12362: case 'A':
12363: case 'B':
12364: case 'C':
12365: case 'D':
12366: case 'E':
12367: case 'F':
12368: case 'a':
12369: case 'b':
12370: case 'c':
12371: case 'd':
12372: case 'e':
12373: case 'f': {
12374: yyRepetition1 = yyIndex;
12375: yyRepeated1 = true;
12376: continue;
12377: }
12378:
12379: default:
12380: /* No match. */
12381: }
12382: }
12383: break;
12384: }
12385:
12386: if (yyRepeated1) {
12387:
12388: yyResult = pBinaryExponent(yyRepetition1);
12389: yyError = yyResult.select(yyError);
12390: if (yyResult.hasValue()) {
12391:
12392: yyOption1 = yyResult.index;
12393:
12394: yyC = character(yyOption1);
12395: if (-1 != yyC) {
12396: yyIndex = yyOption1 + 1;
12397:
12398: switch (yyC) {
12399: case 'F':
12400: case 'L':
12401: case 'f':
12402: case 'l': {
12403: yyOption1 = yyIndex;
12404: }
12405:
12406: default:
12407: /* No match. */
12408: }
12409: }
12410:
12411: yyValue = new Token(difference(yyStart,
12412: yyOption1));
12413: yyValue.setLocation(location(yyStart));
12414:
12415: return new SemanticValue(yyValue, yyOption1,
12416: yyError);
12417: }
12418: }
12419: }
12420:
12421: // Nested alternative 3.
12422:
12423: yyRepetition1 = yyChoice1;
12424: yyRepeated1 = false;
12425: while (true) {
12426:
12427: yyC = character(yyRepetition1);
12428: if (-1 != yyC) {
12429: yyIndex = yyRepetition1 + 1;
12430:
12431: switch (yyC) {
12432: case '0':
12433: case '1':
12434: case '2':
12435: case '3':
12436: case '4':
12437: case '5':
12438: case '6':
12439: case '7':
12440: case '8':
12441: case '9':
12442: case 'A':
12443: case 'B':
12444: case 'C':
12445: case 'D':
12446: case 'E':
12447: case 'F':
12448: case 'a':
12449: case 'b':
12450: case 'c':
12451: case 'd':
12452: case 'e':
12453: case 'f': {
12454: yyRepetition1 = yyIndex;
12455: yyRepeated1 = true;
12456: continue;
12457: }
12458:
12459: default:
12460: /* No match. */
12461: }
12462: }
12463: break;
12464: }
12465:
12466: if (yyRepeated1) {
12467:
12468: yyResult = pBinaryExponent(yyRepetition1);
12469: yyError = yyResult.select(yyError);
12470: if (yyResult.hasValue()) {
12471:
12472: yyOption1 = yyResult.index;
12473:
12474: yyC = character(yyOption1);
12475: if (-1 != yyC) {
12476: yyIndex = yyOption1 + 1;
12477:
12478: switch (yyC) {
12479: case 'F':
12480: case 'L':
12481: case 'f':
12482: case 'l': {
12483: yyOption1 = yyIndex;
12484: }
12485:
12486: default:
12487: /* No match. */
12488: }
12489: }
12490:
12491: yyValue = new Token(difference(yyStart, yyOption1));
12492: yyValue.setLocation(location(yyStart));
12493:
12494: return new SemanticValue(yyValue, yyOption1,
12495: yyError);
12496: }
12497: }
12498: }
12499:
12500: // Done.
12501: yyError = yyError.select("hex floating constant expected",
12502: yyStart);
12503: return yyError;
12504: }
12505:
12506: // =========================================================================
12507:
12508: /**
12509: * Parse nonterminal xtc.lang.CConstant.Exponent.
12510: *
12511: * @param yyStart The index.
12512: * @return The result.
12513: * @throws IOException Signals an I/O error.
12514: */
12515: private Result pExponent(final int yyStart) throws IOException {
12516: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
12517: if (null == yyColumn.chunk3)
12518: yyColumn.chunk3 = new Chunk3();
12519: if (null == yyColumn.chunk3.fExponent)
12520: yyColumn.chunk3.fExponent = pExponent$1(yyStart);
12521: return yyColumn.chunk3.fExponent;
12522: }
12523:
12524: /** Actually parse xtc.lang.CConstant.Exponent. */
12525: private Result pExponent$1(final int yyStart) throws IOException {
12526: int yyC;
12527: int yyIndex;
12528: Result yyResult;
12529: int yyOption1;
12530: Void yyValue;
12531: ParseError yyError = ParseError.DUMMY;
12532:
12533: // Alternative 1.
12534:
12535: yyC = character(yyStart);
12536: if (-1 != yyC) {
12537: yyIndex = yyStart + 1;
12538:
12539: switch (yyC) {
12540: case 'E':
12541: case 'e': {
12542: yyOption1 = yyIndex;
12543:
12544: yyC = character(yyOption1);
12545: if (-1 != yyC) {
12546: yyIndex = yyOption1 + 1;
12547:
12548: switch (yyC) {
12549: case '+':
12550: case '-': {
12551: yyOption1 = yyIndex;
12552: }
12553:
12554: default:
12555: /* No match. */
12556: }
12557: }
12558:
12559: yyResult = p$$Shared2(yyOption1);
12560: yyError = yyResult.select(yyError);
12561: if (yyResult.hasValue()) {
12562:
12563: yyValue = null;
12564:
12565: return yyResult.createValue(yyValue, yyError);
12566: }
12567: }
12568: break;
12569:
12570: default:
12571: /* No match. */
12572: }
12573: }
12574:
12575: // Done.
12576: yyError = yyError.select("exponent expected", yyStart);
12577: return yyError;
12578: }
12579:
12580: // =========================================================================
12581:
12582: /**
12583: * Parse synthetic nonterminal xtc.lang.C.$$Shared2.
12584: * This nonterminal represents the duplicate productions
12585: * xtc.lang.C.Exponent$$Plus1 and xtc.lang.C.BinaryExponent$$Plus1.
12586: *
12587: * @param yyStart The index.
12588: * @return The result.
12589: * @throws IOException Signals an I/O error.
12590: */
12591: private Result p$$Shared2(final int yyStart) throws IOException {
12592: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
12593: if (null == yyColumn.chunk3)
12594: yyColumn.chunk3 = new Chunk3();
12595: if (null == yyColumn.chunk3.f$$Shared2)
12596: yyColumn.chunk3.f$$Shared2 = p$$Shared2$1(yyStart);
12597: return yyColumn.chunk3.f$$Shared2;
12598: }
12599:
12600: /** Actually parse xtc.lang.C.$$Shared2. */
12601: private Result p$$Shared2$1(final int yyStart) throws IOException {
12602: int yyC;
12603: int yyIndex;
12604: Result yyResult;
12605: Void yyValue;
12606: ParseError yyError = ParseError.DUMMY;
12607:
12608: // Alternative 1.
12609:
12610: yyC = character(yyStart);
12611: if (-1 != yyC) {
12612: yyIndex = yyStart + 1;
12613:
12614: switch (yyC) {
12615: case '0':
12616: case '1':
12617: case '2':
12618: case '3':
12619: case '4':
12620: case '5':
12621: case '6':
12622: case '7':
12623: case '8':
12624: case '9': {
12625: final int yyChoice1 = yyIndex;
12626:
12627: // Nested alternative 1.
12628:
12629: yyResult = p$$Shared2(yyChoice1);
12630: yyError = yyResult.select(yyError);
12631: if (yyResult.hasValue()) {
12632:
12633: yyValue = null;
12634:
12635: return yyResult.createValue(yyValue, yyError);
12636: }
12637:
12638: // Nested alternative 2.
12639:
12640: yyValue = null;
12641:
12642: return new SemanticValue(yyValue, yyChoice1, yyError);
12643: }
12644:
12645: default:
12646: /* No match. */
12647: }
12648: }
12649:
12650: // Done.
12651: yyError = yyError.select(" expected", yyStart);
12652: return yyError;
12653: }
12654:
12655: // =========================================================================
12656:
12657: /**
12658: * Parse nonterminal xtc.lang.CConstant.BinaryExponent.
12659: *
12660: * @param yyStart The index.
12661: * @return The result.
12662: * @throws IOException Signals an I/O error.
12663: */
12664: private Result pBinaryExponent(final int yyStart)
12665: throws IOException {
12666: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
12667: if (null == yyColumn.chunk3)
12668: yyColumn.chunk3 = new Chunk3();
12669: if (null == yyColumn.chunk3.fBinaryExponent)
12670: yyColumn.chunk3.fBinaryExponent = pBinaryExponent$1(yyStart);
12671: return yyColumn.chunk3.fBinaryExponent;
12672: }
12673:
12674: /** Actually parse xtc.lang.CConstant.BinaryExponent. */
12675: private Result pBinaryExponent$1(final int yyStart)
12676: throws IOException {
12677: int yyC;
12678: int yyIndex;
12679: Result yyResult;
12680: int yyOption1;
12681: Void yyValue;
12682: ParseError yyError = ParseError.DUMMY;
12683:
12684: // Alternative 1.
12685:
12686: yyC = character(yyStart);
12687: if (-1 != yyC) {
12688: yyIndex = yyStart + 1;
12689:
12690: switch (yyC) {
12691: case 'P':
12692: case 'p': {
12693: yyOption1 = yyIndex;
12694:
12695: yyC = character(yyOption1);
12696: if (-1 != yyC) {
12697: yyIndex = yyOption1 + 1;
12698:
12699: switch (yyC) {
12700: case '+':
12701: case '-': {
12702: yyOption1 = yyIndex;
12703: }
12704:
12705: default:
12706: /* No match. */
12707: }
12708: }
12709:
12710: yyResult = p$$Shared2(yyOption1);
12711: yyError = yyResult.select(yyError);
12712: if (yyResult.hasValue()) {
12713:
12714: yyValue = null;
12715:
12716: return yyResult.createValue(yyValue, yyError);
12717: }
12718: }
12719: break;
12720:
12721: default:
12722: /* No match. */
12723: }
12724: }
12725:
12726: // Done.
12727: yyError = yyError.select("binary exponent expected", yyStart);
12728: return yyError;
12729: }
12730:
12731: // =========================================================================
12732:
12733: /**
12734: * Parse nonterminal xtc.lang.CConstant.CharacterConstant.
12735: *
12736: * @param yyStart The index.
12737: * @return The result.
12738: * @throws IOException Signals an I/O error.
12739: */
12740: private Result pCharacterConstant(final int yyStart)
12741: throws IOException {
12742: Result yyResult;
12743: Node yyValue;
12744: ParseError yyError = ParseError.DUMMY;
12745:
12746: // Alternative 1.
12747:
12748: yyResult = pWideCharacterLiteral(yyStart);
12749: yyError = yyResult.select(yyError);
12750: if (yyResult.hasValue()) {
12751: final Token v$pt$2 = yyResult.semanticValue();
12752:
12753: yyResult = pSpacing(yyResult.index);
12754: yyError = yyResult.select(yyError);
12755: if (yyResult.hasValue()) {
12756: final Token v$pt$1 = yyResult.semanticValue();
12757: final Node v$g$1 = Formatting.after1(v$pt$2, v$pt$1);
12758:
12759: yyValue = GNode.create("CharacterConstant", v$g$1);
12760: yyValue.setLocation(location(yyStart));
12761:
12762: return yyResult.createValue(yyValue, yyError);
12763: }
12764: }
12765:
12766: // Alternative 2.
12767:
12768: yyResult = pCharacterLiteral(yyStart);
12769: yyError = yyResult.select(yyError);
12770: if (yyResult.hasValue()) {
12771: final Token v$pt$4 = yyResult.semanticValue();
12772:
12773: yyResult = pSpacing(yyResult.index);
12774: yyError = yyResult.select(yyError);
12775: if (yyResult.hasValue()) {
12776: final Token v$pt$3 = yyResult.semanticValue();
12777: final Node v$g$2 = Formatting.after1(v$pt$4, v$pt$3);
12778:
12779: yyValue = GNode.create("CharacterConstant", v$g$2);
12780: yyValue.setLocation(location(yyStart));
12781:
12782: return yyResult.createValue(yyValue, yyError);
12783: }
12784: }
12785:
12786: // Done.
12787: return yyError;
12788: }
12789:
12790: // =========================================================================
12791:
12792: /**
12793: * Parse nonterminal xtc.lang.CConstant.WideCharacterLiteral.
12794: *
12795: * @param yyStart The index.
12796: * @return The result.
12797: * @throws IOException Signals an I/O error.
12798: */
12799: private Result pWideCharacterLiteral(final int yyStart)
12800: throws IOException {
12801: int yyC;
12802: int yyIndex;
12803: Result yyResult;
12804: Token yyValue;
12805: ParseError yyError = ParseError.DUMMY;
12806:
12807: // Alternative 1.
12808:
12809: yyC = character(yyStart);
12810: if ('L' == yyC) {
12811: yyIndex = yyStart + 1;
12812:
12813: yyResult = pCharacterLiteral(yyIndex);
12814: yyError = yyResult.select(yyError);
12815: if (yyResult.hasValue()) {
12816:
12817: yyValue = new Token(difference(yyStart, yyResult.index));
12818: yyValue.setLocation(location(yyStart));
12819:
12820: return yyResult.createValue(yyValue, yyError);
12821: }
12822: }
12823:
12824: // Done.
12825: yyError = yyError.select("wide character literal expected",
12826: yyStart);
12827: return yyError;
12828: }
12829:
12830: // =========================================================================
12831:
12832: /**
12833: * Parse nonterminal xtc.lang.CConstant.CharacterLiteral.
12834: *
12835: * @param yyStart The index.
12836: * @return The result.
12837: * @throws IOException Signals an I/O error.
12838: */
12839: private Result pCharacterLiteral(final int yyStart)
12840: throws IOException {
12841: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
12842: if (null == yyColumn.chunk3)
12843: yyColumn.chunk3 = new Chunk3();
12844: if (null == yyColumn.chunk3.fCharacterLiteral)
12845: yyColumn.chunk3.fCharacterLiteral = pCharacterLiteral$1(yyStart);
12846: return yyColumn.chunk3.fCharacterLiteral;
12847: }
12848:
12849: /** Actually parse xtc.lang.CConstant.CharacterLiteral. */
12850: private Result pCharacterLiteral$1(final int yyStart)
12851: throws IOException {
12852: int yyC;
12853: int yyIndex;
12854: Result yyResult;
12855: Token yyValue;
12856: ParseError yyError = ParseError.DUMMY;
12857:
12858: // Alternative 1.
12859:
12860: yyC = character(yyStart);
12861: if ('\'' == yyC) {
12862: yyIndex = yyStart + 1;
12863:
12864: yyResult = pCharacterLiteral$$Plus1(yyIndex);
12865: yyError = yyResult.select(yyError);
12866: if (yyResult.hasValue()) {
12867:
12868: yyC = character(yyResult.index);
12869: if ('\'' == yyC) {
12870: yyIndex = yyResult.index + 1;
12871:
12872: yyValue = new Token(difference(yyStart, yyIndex));
12873: yyValue.setLocation(location(yyStart));
12874:
12875: return new SemanticValue(yyValue, yyIndex, yyError);
12876: }
12877: }
12878: }
12879:
12880: // Done.
12881: yyError = yyError.select("character literal expected", yyStart);
12882: return yyError;
12883: }
12884:
12885: // =========================================================================
12886:
12887: /**
12888: * Parse synthetic nonterminal xtc.lang.C.CharacterLiteral$$Plus1.
12889: *
12890: * @param yyStart The index.
12891: * @return The result.
12892: * @throws IOException Signals an I/O error.
12893: */
12894: private Result pCharacterLiteral$$Plus1(final int yyStart)
12895: throws IOException {
12896:
12897: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
12898: if (null == yyColumn.chunk4)
12899: yyColumn.chunk4 = new Chunk4();
12900: if (null == yyColumn.chunk4.fCharacterLiteral$$Plus1)
12901: yyColumn.chunk4.fCharacterLiteral$$Plus1 = pCharacterLiteral$$Plus1$1(yyStart);
12902: return yyColumn.chunk4.fCharacterLiteral$$Plus1;
12903: }
12904:
12905: /** Actually parse xtc.lang.C.CharacterLiteral$$Plus1. */
12906: private Result pCharacterLiteral$$Plus1$1(final int yyStart)
12907: throws IOException {
12908:
12909: int yyC;
12910: int yyIndex;
12911: Result yyResult;
12912: Void yyValue;
12913: ParseError yyError = ParseError.DUMMY;
12914:
12915: // Alternative 1.
12916:
12917: yyResult = pEscapeCharacter(yyStart);
12918: yyError = yyResult.select(yyError);
12919: if (yyResult.hasValue()) {
12920:
12921: yyResult = pCharacterLiteral$$Plus1(yyResult.index);
12922: yyError = yyResult.select(yyError);
12923: if (yyResult.hasValue()) {
12924:
12925: yyValue = null;
12926:
12927: return yyResult.createValue(yyValue, yyError);
12928: }
12929: }
12930:
12931: // Alternative 2.
12932:
12933: yyC = character(yyStart);
12934: if (-1 != yyC) {
12935: yyIndex = yyStart + 1;
12936:
12937: switch (yyC) {
12938: case '\n':
12939: case '\r':
12940: case '\'':
12941: case '\\':
12942: /* No match. */
12943: break;
12944:
12945: default: {
12946: yyResult = pCharacterLiteral$$Plus1(yyIndex);
12947: yyError = yyResult.select(yyError);
12948: if (yyResult.hasValue()) {
12949:
12950: yyValue = null;
12951:
12952: return yyResult.createValue(yyValue, yyError);
12953: }
12954: }
12955: }
12956: }
12957:
12958: // Alternative 3.
12959:
12960: yyC = character(yyStart);
12961: if (-1 != yyC) {
12962: yyIndex = yyStart + 1;
12963:
12964: switch (yyC) {
12965: case '\\': {
12966: final int yyChoice1 = yyIndex;
12967:
12968: // Nested alternative 1.
12969:
12970: yyResult = pEscapeCode(yyChoice1);
12971: yyError = yyResult.select(yyError);
12972: if (yyResult.hasValue()) {
12973:
12974: yyValue = null;
12975:
12976: return yyResult.createValue(yyValue, yyError);
12977: }
12978:
12979: // Nested alternative 2.
12980:
12981: yyC = character(yyChoice1);
12982: if (-1 != yyC) {
12983: yyIndex = yyChoice1 + 1;
12984:
12985: switch (yyC) {
12986: case 'u': {
12987: yyResult = pHexQuad(yyIndex);
12988: yyError = yyResult.select(yyError);
12989: if (yyResult.hasValue()) {
12990:
12991: yyValue = null;
12992:
12993: return yyResult.createValue(yyValue,
12994: yyError);
12995: }
12996: }
12997: break;
12998:
12999: case 'U': {
13000: yyResult = pHexQuad(yyIndex);
13001: yyError = yyResult.select(yyError);
13002: if (yyResult.hasValue()) {
13003:
13004: yyResult = pHexQuad(yyResult.index);
13005: yyError = yyResult.select(yyError);
13006: if (yyResult.hasValue()) {
13007:
13008: yyValue = null;
13009:
13010: return yyResult.createValue(yyValue,
13011: yyError);
13012: }
13013: }
13014: }
13015: break;
13016:
13017: default:
13018: /* No match. */
13019: }
13020: }
13021: }
13022: break;
13023:
13024: default:
13025: /* No match. */
13026: }
13027: }
13028:
13029: // Alternative 4.
13030:
13031: yyC = character(yyStart);
13032: if (-1 != yyC) {
13033: yyIndex = yyStart + 1;
13034:
13035: switch (yyC) {
13036: case '\n':
13037: case '\r':
13038: case '\'':
13039: case '\\':
13040: /* No match. */
13041: break;
13042:
13043: default: {
13044: yyValue = null;
13045:
13046: return new SemanticValue(yyValue, yyIndex, yyError);
13047: }
13048: }
13049: }
13050:
13051: // Done.
13052: yyError = yyError.select("character literal expected", yyStart);
13053: return yyError;
13054: }
13055:
13056: // =========================================================================
13057:
13058: /**
13059: * Parse nonterminal xtc.lang.CConstant.StringConstant.
13060: *
13061: * @param yyStart The index.
13062: * @return The result.
13063: * @throws IOException Signals an I/O error.
13064: */
13065: private Result pStringConstant(final int yyStart)
13066: throws IOException {
13067: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
13068: if (null == yyColumn.chunk4)
13069: yyColumn.chunk4 = new Chunk4();
13070: if (null == yyColumn.chunk4.fStringConstant)
13071: yyColumn.chunk4.fStringConstant = pStringConstant$1(yyStart);
13072: return yyColumn.chunk4.fStringConstant;
13073: }
13074:
13075: /** Actually parse xtc.lang.CConstant.StringConstant. */
13076: private Result pStringConstant$1(final int yyStart)
13077: throws IOException {
13078: Result yyResult;
13079: Node yyValue;
13080: ParseError yyError = ParseError.DUMMY;
13081:
13082: // Alternative 1.
13083:
13084: yyResult = pStringConstant$$Plus1(yyStart);
13085: yyError = yyResult.select(yyError);
13086: if (yyResult.hasValue()) {
13087: final Pair<Node> v$g$1 = yyResult.semanticValue();
13088:
13089: yyValue = GNode.createFromPair("StringConstant", v$g$1);
13090: yyValue.setLocation(location(yyStart));
13091:
13092: return yyResult.createValue(yyValue, yyError);
13093: }
13094:
13095: // Done.
13096: return yyError;
13097: }
13098:
13099: // =========================================================================
13100:
13101: /**
13102: * Parse synthetic nonterminal xtc.lang.C.StringConstant$$Choice1.
13103: *
13104: * @param yyStart The index.
13105: * @return The result.
13106: * @throws IOException Signals an I/O error.
13107: */
13108: private Result pStringConstant$$Choice1(final int yyStart)
13109: throws IOException {
13110:
13111: Result yyResult;
13112: Node yyValue;
13113: ParseError yyError = ParseError.DUMMY;
13114:
13115: // Alternative 1.
13116:
13117: yyResult = pWideStringLiteral(yyStart);
13118: yyError = yyResult.select(yyError);
13119: if (yyResult.hasValue()) {
13120: final Token v$pt$2 = yyResult.semanticValue();
13121:
13122: yyResult = pSpacing(yyResult.index);
13123: yyError = yyResult.select(yyError);
13124: if (yyResult.hasValue()) {
13125: final Token v$pt$1 = yyResult.semanticValue();
13126: yyValue = Formatting.after1(v$pt$2, v$pt$1);
13127:
13128: return yyResult.createValue(yyValue, yyError);
13129: }
13130: }
13131:
13132: // Alternative 2.
13133:
13134: yyResult = pStringLiteral(yyStart);
13135: yyError = yyResult.select(yyError);
13136: if (yyResult.hasValue()) {
13137: final Token v$pt$4 = yyResult.semanticValue();
13138:
13139: yyResult = pSpacing(yyResult.index);
13140: yyError = yyResult.select(yyError);
13141: if (yyResult.hasValue()) {
13142: final Token v$pt$3 = yyResult.semanticValue();
13143: yyValue = Formatting.after1(v$pt$4, v$pt$3);
13144:
13145: return yyResult.createValue(yyValue, yyError);
13146: }
13147: }
13148:
13149: // Done.
13150: return yyError;
13151: }
13152:
13153: // =========================================================================
13154:
13155: /**
13156: * Parse synthetic nonterminal xtc.lang.C.StringConstant$$Plus1.
13157: *
13158: * @param yyStart The index.
13159: * @return The result.
13160: * @throws IOException Signals an I/O error.
13161: */
13162: private Result pStringConstant$$Plus1(final int yyStart)
13163: throws IOException {
13164:
13165: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
13166: if (null == yyColumn.chunk4)
13167: yyColumn.chunk4 = new Chunk4();
13168: if (null == yyColumn.chunk4.fStringConstant$$Plus1)
13169: yyColumn.chunk4.fStringConstant$$Plus1 = pStringConstant$$Plus1$1(yyStart);
13170: return yyColumn.chunk4.fStringConstant$$Plus1;
13171: }
13172:
13173: /** Actually parse xtc.lang.C.StringConstant$$Plus1. */
13174: private Result pStringConstant$$Plus1$1(final int yyStart)
13175: throws IOException {
13176:
13177: Result yyResult;
13178: Pair<Node> yyValue;
13179: ParseError yyError = ParseError.DUMMY;
13180:
13181: // Alternative 1.
13182:
13183: yyResult = pStringConstant$$Choice1(yyStart);
13184: yyError = yyResult.select(yyError);
13185: if (yyResult.hasValue()) {
13186: final Node v$el$1 = yyResult.semanticValue();
13187:
13188: final int yyChoice1 = yyResult.index;
13189:
13190: // Nested alternative 1.
13191:
13192: yyResult = pStringConstant$$Plus1(yyChoice1);
13193: yyError = yyResult.select(yyError);
13194: if (yyResult.hasValue()) {
13195: final Pair<Node> v$4 = yyResult.semanticValue();
13196:
13197: yyValue = new Pair<Node>(v$el$1, v$4);
13198:
13199: return yyResult.createValue(yyValue, yyError);
13200: }
13201:
13202: // Nested alternative 2.
13203:
13204: yyValue = new Pair<Node>(v$el$1);
13205:
13206: return new SemanticValue(yyValue, yyChoice1, yyError);
13207: }
13208:
13209: // Done.
13210: return yyError;
13211: }
13212:
13213: // =========================================================================
13214:
13215: /**
13216: * Parse nonterminal xtc.lang.CConstant.WideStringLiteral.
13217: *
13218: * @param yyStart The index.
13219: * @return The result.
13220: * @throws IOException Signals an I/O error.
13221: */
13222: private Result pWideStringLiteral(final int yyStart)
13223: throws IOException {
13224: int yyC;
13225: int yyIndex;
13226: Result yyResult;
13227: Token yyValue;
13228: ParseError yyError = ParseError.DUMMY;
13229:
13230: // Alternative 1.
13231:
13232: yyC = character(yyStart);
13233: if ('L' == yyC) {
13234: yyIndex = yyStart + 1;
13235:
13236: yyResult = pStringLiteral(yyIndex);
13237: yyError = yyResult.select(yyError);
13238: if (yyResult.hasValue()) {
13239:
13240: yyValue = new Token(difference(yyStart, yyResult.index));
13241: yyValue.setLocation(location(yyStart));
13242:
13243: return yyResult.createValue(yyValue, yyError);
13244: }
13245: }
13246:
13247: // Done.
13248: yyError = yyError.select("wide string literal expected",
13249: yyStart);
13250: return yyError;
13251: }
13252:
13253: // =========================================================================
13254:
13255: /**
13256: * Parse nonterminal xtc.lang.CConstant.StringLiteral.
13257: *
13258: * @param yyStart The index.
13259: * @return The result.
13260: * @throws IOException Signals an I/O error.
13261: */
13262: private Result pStringLiteral(final int yyStart) throws IOException {
13263: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
13264: if (null == yyColumn.chunk4)
13265: yyColumn.chunk4 = new Chunk4();
13266: if (null == yyColumn.chunk4.fStringLiteral)
13267: yyColumn.chunk4.fStringLiteral = pStringLiteral$1(yyStart);
13268: return yyColumn.chunk4.fStringLiteral;
13269: }
13270:
13271: /** Actually parse xtc.lang.CConstant.StringLiteral. */
13272: private Result pStringLiteral$1(final int yyStart)
13273: throws IOException {
13274: int yyC;
13275: int yyIndex;
13276: Result yyResult;
13277: Token yyValue;
13278: ParseError yyError = ParseError.DUMMY;
13279:
13280: // Alternative 1.
13281:
13282: yyC = character(yyStart);
13283: if ('\"' == yyC) {
13284: yyIndex = yyStart + 1;
13285:
13286: yyResult = pStringLiteral$$Star1(yyIndex);
13287: yyError = yyResult.select(yyError);
13288: if (yyResult.hasValue()) {
13289:
13290: yyC = character(yyResult.index);
13291: if ('\"' == yyC) {
13292: yyIndex = yyResult.index + 1;
13293:
13294: yyValue = new Token(difference(yyStart, yyIndex));
13295: yyValue.setLocation(location(yyStart));
13296:
13297: return new SemanticValue(yyValue, yyIndex, yyError);
13298: }
13299: }
13300: }
13301:
13302: // Done.
13303: yyError = yyError.select("string literal expected", yyStart);
13304: return yyError;
13305: }
13306:
13307: // =========================================================================
13308:
13309: /**
13310: * Parse synthetic nonterminal xtc.lang.C.StringLiteral$$Star1.
13311: *
13312: * @param yyStart The index.
13313: * @return The result.
13314: * @throws IOException Signals an I/O error.
13315: */
13316: private Result pStringLiteral$$Star1(final int yyStart)
13317: throws IOException {
13318: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
13319: if (null == yyColumn.chunk4)
13320: yyColumn.chunk4 = new Chunk4();
13321: if (null == yyColumn.chunk4.fStringLiteral$$Star1)
13322: yyColumn.chunk4.fStringLiteral$$Star1 = pStringLiteral$$Star1$1(yyStart);
13323: return yyColumn.chunk4.fStringLiteral$$Star1;
13324: }
13325:
13326: /** Actually parse xtc.lang.C.StringLiteral$$Star1. */
13327: private Result pStringLiteral$$Star1$1(final int yyStart)
13328: throws IOException {
13329:
13330: int yyC;
13331: int yyIndex;
13332: Result yyResult;
13333: Void yyValue;
13334: ParseError yyError = ParseError.DUMMY;
13335:
13336: // Alternative 1.
13337:
13338: yyResult = pEscapeCharacter(yyStart);
13339: yyError = yyResult.select(yyError);
13340: if (yyResult.hasValue()) {
13341:
13342: yyResult = pStringLiteral$$Star1(yyResult.index);
13343: yyError = yyResult.select(yyError);
13344: if (yyResult.hasValue()) {
13345:
13346: yyValue = null;
13347:
13348: return yyResult.createValue(yyValue, yyError);
13349: }
13350: }
13351:
13352: // Alternative 2.
13353:
13354: yyC = character(yyStart);
13355: if (-1 != yyC) {
13356: yyIndex = yyStart + 1;
13357:
13358: switch (yyC) {
13359: case '\n':
13360: case '\r':
13361: case '\"':
13362: case '\\':
13363: /* No match. */
13364: break;
13365:
13366: default: {
13367: yyResult = pStringLiteral$$Star1(yyIndex);
13368: yyError = yyResult.select(yyError);
13369: if (yyResult.hasValue()) {
13370:
13371: yyValue = null;
13372:
13373: return yyResult.createValue(yyValue, yyError);
13374: }
13375: }
13376: }
13377: }
13378:
13379: // Alternative 3.
13380:
13381: yyValue = null;
13382:
13383: return new SemanticValue(yyValue, yyStart, yyError);
13384: }
13385:
13386: // =========================================================================
13387:
13388: /**
13389: * Parse nonterminal xtc.lang.CConstant.EscapeCharacter.
13390: *
13391: * @param yyStart The index.
13392: * @return The result.
13393: * @throws IOException Signals an I/O error.
13394: */
13395: private Result pEscapeCharacter(final int yyStart)
13396: throws IOException {
13397: int yyC;
13398: int yyIndex;
13399: Result yyResult;
13400: Void yyValue;
13401: ParseError yyError = ParseError.DUMMY;
13402:
13403: // Alternative 1.
13404:
13405: yyC = character(yyStart);
13406: if (-1 != yyC) {
13407: yyIndex = yyStart + 1;
13408: if ('\\' == yyC) {
13409:
13410: final int yyChoice1 = yyIndex;
13411:
13412: // Nested alternative 1.
13413:
13414: yyResult = pEscapeCode(yyChoice1);
13415: yyError = yyResult.select(yyError);
13416: if (yyResult.hasValue()) {
13417:
13418: yyValue = null;
13419:
13420: return yyResult.createValue(yyValue, yyError);
13421: }
13422:
13423: // Nested alternative 2.
13424:
13425: yyC = character(yyChoice1);
13426: if (-1 != yyC) {
13427: yyIndex = yyChoice1 + 1;
13428:
13429: switch (yyC) {
13430: case 'u': {
13431: yyResult = pHexQuad(yyIndex);
13432: yyError = yyResult.select(yyError);
13433: if (yyResult.hasValue()) {
13434:
13435: yyValue = null;
13436:
13437: return yyResult.createValue(yyValue,
13438: yyError);
13439: }
13440: }
13441: break;
13442:
13443: case 'U': {
13444: yyResult = pHexQuad(yyIndex);
13445: yyError = yyResult.select(yyError);
13446: if (yyResult.hasValue()) {
13447:
13448: yyResult = pHexQuad(yyResult.index);
13449: yyError = yyResult.select(yyError);
13450: if (yyResult.hasValue()) {
13451:
13452: yyValue = null;
13453:
13454: return yyResult.createValue(yyValue,
13455: yyError);
13456: }
13457: }
13458: }
13459: break;
13460:
13461: default:
13462: /* No match. */
13463: }
13464: }
13465: }
13466: }
13467:
13468: // Done.
13469: yyError = yyError.select("escape character expected", yyStart);
13470: return yyError;
13471: }
13472:
13473: // =========================================================================
13474:
13475: /**
13476: * Parse nonterminal xtc.lang.CConstant.EscapeCode.
13477: *
13478: * @param yyStart The index.
13479: * @return The result.
13480: * @throws IOException Signals an I/O error.
13481: */
13482: private Result pEscapeCode(final int yyStart) throws IOException {
13483: int yyC;
13484: int yyIndex;
13485: int yyRepetition1;
13486: boolean yyRepeated1;
13487: Void yyValue;
13488: ParseError yyError = ParseError.DUMMY;
13489:
13490: // Alternative 1.
13491:
13492: yyC = character(yyStart);
13493: if (-1 != yyC) {
13494: yyIndex = yyStart + 1;
13495:
13496: switch (yyC) {
13497: case '\"':
13498: case '\'':
13499: case '?':
13500: case '\\':
13501: case 'a':
13502: case 'b':
13503: case 'f':
13504: case 'n':
13505: case 'r':
13506: case 't':
13507: case 'v': {
13508: yyValue = null;
13509:
13510: return new SemanticValue(yyValue, yyIndex, yyError);
13511: }
13512:
13513: case '0':
13514: case '1':
13515: case '2':
13516: case '3':
13517: case '4':
13518: case '5':
13519: case '6':
13520: case '7': {
13521: final int yyChoice1 = yyIndex;
13522:
13523: // Nested alternative 1.
13524:
13525: yyC = character(yyChoice1);
13526: if (-1 != yyC) {
13527: yyIndex = yyChoice1 + 1;
13528:
13529: switch (yyC) {
13530: case '0':
13531: case '1':
13532: case '2':
13533: case '3':
13534: case '4':
13535: case '5':
13536: case '6':
13537: case '7': {
13538: final int yyChoice2 = yyIndex;
13539:
13540: // Nested alternative 1.
13541:
13542: yyC = character(yyChoice2);
13543: if (-1 != yyC) {
13544: yyIndex = yyChoice2 + 1;
13545:
13546: switch (yyC) {
13547: case '0':
13548: case '1':
13549: case '2':
13550: case '3':
13551: case '4':
13552: case '5':
13553: case '6':
13554: case '7': {
13555: yyValue = null;
13556:
13557: return new SemanticValue(yyValue,
13558: yyIndex, yyError);
13559: }
13560:
13561: default:
13562: /* No match. */
13563: }
13564: }
13565:
13566: // Nested alternative 2.
13567:
13568: yyValue = null;
13569:
13570: return new SemanticValue(yyValue, yyChoice2,
13571: yyError);
13572: }
13573:
13574: default:
13575: /* No match. */
13576: }
13577: }
13578:
13579: // Nested alternative 2.
13580:
13581: yyValue = null;
13582:
13583: return new SemanticValue(yyValue, yyChoice1, yyError);
13584: }
13585:
13586: case 'x': {
13587: yyRepetition1 = yyIndex;
13588: yyRepeated1 = false;
13589: while (true) {
13590:
13591: yyC = character(yyRepetition1);
13592: if (-1 != yyC) {
13593: yyIndex = yyRepetition1 + 1;
13594:
13595: switch (yyC) {
13596: case '0':
13597: case '1':
13598: case '2':
13599: case '3':
13600: case '4':
13601: case '5':
13602: case '6':
13603: case '7':
13604: case '8':
13605: case '9':
13606: case 'A':
13607: case 'B':
13608: case 'C':
13609: case 'D':
13610: case 'E':
13611: case 'F':
13612: case 'a':
13613: case 'b':
13614: case 'c':
13615: case 'd':
13616: case 'e':
13617: case 'f': {
13618: yyRepetition1 = yyIndex;
13619: yyRepeated1 = true;
13620: continue;
13621: }
13622:
13623: default:
13624: /* No match. */
13625: }
13626: }
13627: break;
13628: }
13629:
13630: if (yyRepeated1) {
13631:
13632: yyValue = null;
13633:
13634: return new SemanticValue(yyValue, yyRepetition1,
13635: yyError);
13636: }
13637: }
13638: break;
13639:
13640: default:
13641: /* No match. */
13642: }
13643: }
13644:
13645: // Done.
13646: yyError = yyError.select("escape code expected", yyStart);
13647: return yyError;
13648: }
13649:
13650: // =========================================================================
13651:
13652: /**
13653: * Parse nonterminal xtc.lang.CConstant.HexQuad.
13654: *
13655: * @param yyStart The index.
13656: * @return The result.
13657: * @throws IOException Signals an I/O error.
13658: */
13659: private Result pHexQuad(final int yyStart) throws IOException {
13660: int yyC;
13661: int yyIndex;
13662: Void yyValue;
13663: ParseError yyError = ParseError.DUMMY;
13664:
13665: // Alternative 1.
13666:
13667: yyC = character(yyStart);
13668: if (-1 != yyC) {
13669: yyIndex = yyStart + 1;
13670:
13671: switch (yyC) {
13672: case '0':
13673: case '1':
13674: case '2':
13675: case '3':
13676: case '4':
13677: case '5':
13678: case '6':
13679: case '7':
13680: case '8':
13681: case '9':
13682: case 'A':
13683: case 'B':
13684: case 'C':
13685: case 'D':
13686: case 'E':
13687: case 'F':
13688: case 'a':
13689: case 'b':
13690: case 'c':
13691: case 'd':
13692: case 'e':
13693: case 'f': {
13694: yyC = character(yyIndex);
13695: if (-1 != yyC) {
13696: yyIndex = yyIndex + 1;
13697:
13698: switch (yyC) {
13699: case '0':
13700: case '1':
13701: case '2':
13702: case '3':
13703: case '4':
13704: case '5':
13705: case '6':
13706: case '7':
13707: case '8':
13708: case '9':
13709: case 'A':
13710: case 'B':
13711: case 'C':
13712: case 'D':
13713: case 'E':
13714: case 'F':
13715: case 'a':
13716: case 'b':
13717: case 'c':
13718: case 'd':
13719: case 'e':
13720: case 'f': {
13721: yyC = character(yyIndex);
13722: if (-1 != yyC) {
13723: yyIndex = yyIndex + 1;
13724:
13725: switch (yyC) {
13726: case '0':
13727: case '1':
13728: case '2':
13729: case '3':
13730: case '4':
13731: case '5':
13732: case '6':
13733: case '7':
13734: case '8':
13735: case '9':
13736: case 'A':
13737: case 'B':
13738: case 'C':
13739: case 'D':
13740: case 'E':
13741: case 'F':
13742: case 'a':
13743: case 'b':
13744: case 'c':
13745: case 'd':
13746: case 'e':
13747: case 'f': {
13748: yyC = character(yyIndex);
13749: if (-1 != yyC) {
13750: yyIndex = yyIndex + 1;
13751:
13752: switch (yyC) {
13753: case '0':
13754: case '1':
13755: case '2':
13756: case '3':
13757: case '4':
13758: case '5':
13759: case '6':
13760: case '7':
13761: case '8':
13762: case '9':
13763: case 'A':
13764: case 'B':
13765: case 'C':
13766: case 'D':
13767: case 'E':
13768: case 'F':
13769: case 'a':
13770: case 'b':
13771: case 'c':
13772: case 'd':
13773: case 'e':
13774: case 'f': {
13775: yyValue = null;
13776:
13777: return new SemanticValue(
13778: yyValue, yyIndex,
13779: yyError);
13780: }
13781:
13782: default:
13783: /* No match. */
13784: }
13785: }
13786: }
13787: break;
13788:
13789: default:
13790: /* No match. */
13791: }
13792: }
13793: }
13794: break;
13795:
13796: default:
13797: /* No match. */
13798: }
13799: }
13800: }
13801: break;
13802:
13803: default:
13804: /* No match. */
13805: }
13806: }
13807:
13808: // Done.
13809: yyError = yyError.select("hex quad expected", yyStart);
13810: return yyError;
13811: }
13812:
13813: // =========================================================================
13814:
13815: /**
13816: * Parse nonterminal xtc.lang.CIdentifier.Identifier.
13817: *
13818: * @param yyStart The index.
13819: * @return The result.
13820: * @throws IOException Signals an I/O error.
13821: */
13822: private Result pIdentifier(final int yyStart) throws IOException {
13823: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
13824: if (null == yyColumn.chunk4)
13825: yyColumn.chunk4 = new Chunk4();
13826: if (null == yyColumn.chunk4.fIdentifier)
13827: yyColumn.chunk4.fIdentifier = pIdentifier$1(yyStart);
13828: return yyColumn.chunk4.fIdentifier;
13829: }
13830:
13831: /** Actually parse xtc.lang.CIdentifier.Identifier. */
13832: private Result pIdentifier$1(final int yyStart) throws IOException {
13833: Result yyResult;
13834: Node yyValue;
13835: ParseError yyError = ParseError.DUMMY;
13836:
13837: // Alternative 1.
13838:
13839: yyResult = pWord(yyStart);
13840: yyError = yyResult.select(yyError);
13841: if (yyResult.hasValue()) {
13842: yyValue = yyResult.semanticValue();
13843:
13844: if (!contains(C_KEYWORDS, toText(yyValue))) {
13845:
13846: return yyResult.createValue(yyValue, yyError);
13847: }
13848: }
13849:
13850: // Done.
13851: yyError = yyError.select("identifier expected", yyStart);
13852: return yyError;
13853: }
13854:
13855: // =========================================================================
13856:
13857: /**
13858: * Parse nonterminal xtc.lang.CIdentifier.Keyword.
13859: *
13860: * @param yyStart The index.
13861: * @return The result.
13862: * @throws IOException Signals an I/O error.
13863: */
13864: private Result pKeyword(final int yyStart) throws IOException {
13865: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
13866: if (null == yyColumn.chunk4)
13867: yyColumn.chunk4 = new Chunk4();
13868: if (null == yyColumn.chunk4.fKeyword)
13869: yyColumn.chunk4.fKeyword = pKeyword$1(yyStart);
13870: return yyColumn.chunk4.fKeyword;
13871: }
13872:
13873: /** Actually parse xtc.lang.CIdentifier.Keyword. */
13874: private Result pKeyword$1(final int yyStart) throws IOException {
13875: Result yyResult;
13876: Node yyValue;
13877: ParseError yyError = ParseError.DUMMY;
13878:
13879: // Alternative 1.
13880:
13881: yyResult = pWord(yyStart);
13882: yyError = yyResult.select(yyError);
13883: if (yyResult.hasValue()) {
13884: yyValue = yyResult.semanticValue();
13885:
13886: if (contains(C_KEYWORDS, toText(yyValue))) {
13887:
13888: return yyResult.createValue(yyValue, yyError);
13889: }
13890: }
13891:
13892: // Done.
13893: yyError = yyError.select("keyword expected", yyStart);
13894: return yyError;
13895: }
13896:
13897: // =========================================================================
13898:
13899: /**
13900: * Parse nonterminal xtc.lang.CIdentifier.Word.
13901: *
13902: * @param yyStart The index.
13903: * @return The result.
13904: * @throws IOException Signals an I/O error.
13905: */
13906: private Result pWord(final int yyStart) throws IOException {
13907: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
13908: if (null == yyColumn.chunk4)
13909: yyColumn.chunk4 = new Chunk4();
13910: if (null == yyColumn.chunk4.fWord)
13911: yyColumn.chunk4.fWord = pWord$1(yyStart);
13912: return yyColumn.chunk4.fWord;
13913: }
13914:
13915: /** Actually parse xtc.lang.CIdentifier.Word. */
13916: private Result pWord$1(final int yyStart) throws IOException {
13917: Result yyResult;
13918: Node yyValue;
13919: ParseError yyError = ParseError.DUMMY;
13920:
13921: // Alternative 1.
13922:
13923: yyResult = pWordCharacters(yyStart);
13924: yyError = yyResult.select(yyError);
13925: if (yyResult.hasValue()) {
13926: final Token v$pt$2 = yyResult.semanticValue();
13927:
13928: yyResult = pSpacing(yyResult.index);
13929: yyError = yyResult.select(yyError);
13930: if (yyResult.hasValue()) {
13931: final Token v$pt$1 = yyResult.semanticValue();
13932: yyValue = Formatting.after1(v$pt$2, v$pt$1);
13933:
13934: return yyResult.createValue(yyValue, yyError);
13935: }
13936: }
13937:
13938: // Done.
13939: return yyError;
13940: }
13941:
13942: // =========================================================================
13943:
13944: /**
13945: * Parse nonterminal xtc.lang.CIdentifier.WordCharacters.
13946: *
13947: * @param yyStart The index.
13948: * @return The result.
13949: * @throws IOException Signals an I/O error.
13950: */
13951: private Result pWordCharacters(final int yyStart)
13952: throws IOException {
13953: int yyC;
13954: int yyIndex;
13955: int yyRepetition1;
13956: Token yyValue;
13957: ParseError yyError = ParseError.DUMMY;
13958:
13959: // Alternative 1.
13960:
13961: yyC = character(yyStart);
13962: if (-1 != yyC) {
13963: yyIndex = yyStart + 1;
13964: if ((('A' <= yyC) && (yyC <= 'Z')) || ('_' == yyC)
13965: || (('a' <= yyC) && (yyC <= 'z'))) {
13966:
13967: yyRepetition1 = yyIndex;
13968: while (true) {
13969:
13970: yyC = character(yyRepetition1);
13971: if (-1 != yyC) {
13972: yyIndex = yyRepetition1 + 1;
13973: if ((('0' <= yyC) && (yyC <= '9'))
13974: || (('A' <= yyC) && (yyC <= 'Z'))
13975: || ('_' == yyC)
13976: || (('a' <= yyC) && (yyC <= 'z'))) {
13977:
13978: yyRepetition1 = yyIndex;
13979: continue;
13980: }
13981: }
13982: break;
13983: }
13984:
13985: yyValue = new Token(difference(yyStart, yyRepetition1));
13986: yyValue.setLocation(location(yyStart));
13987:
13988: return new SemanticValue(yyValue, yyRepetition1,
13989: yyError);
13990: }
13991: }
13992:
13993: // Done.
13994: yyError = yyError.select("word characters expected", yyStart);
13995: return yyError;
13996: }
13997:
13998: // =========================================================================
13999:
14000: /**
14001: * Parse nonterminal xtc.lang.CSymbol.Symbol.
14002: *
14003: * @param yyStart The index.
14004: * @return The result.
14005: * @throws IOException Signals an I/O error.
14006: */
14007: private Result pSymbol(final int yyStart) throws IOException {
14008: CReaderColumn yyColumn = (CReaderColumn) column(yyStart);
14009: if (null == yyColumn.chunk4)
14010: yyColumn.chunk4 = new Chunk4();
14011: if (null == yyColumn.chunk4.fSymbol)
14012: yyColumn.chunk4.fSymbol = pSymbol$1(yyStart);
14013: return yyColumn.chunk4.fSymbol;
14014: }
14015:
14016: /** Actually parse xtc.lang.CSymbol.Symbol. */
14017: private Result pSymbol$1(final int yyStart) throws IOException {
14018: Result yyResult;
14019: Node yyValue;
14020: ParseError yyError = ParseError.DUMMY;
14021:
14022: // Alternative 1.
14023:
14024: yyResult = pSymbolCharacters(yyStart);
14025: yyError = yyResult.select(yyError);
14026: if (yyResult.hasValue()) {
14027: final Token v$pt$2 = yyResult.semanticValue();
14028:
14029: yyResult = pSpacing(yyResult.index);
14030: yyError = yyResult.select(yyError);
14031: if (yyResult.hasValue()) {
14032: final Token v$pt$1 = yyResult.semanticValue();
14033: yyValue = Formatting.after1(v$pt$2, v$pt$1);
14034:
14035: return yyResult.createValue(yyValue, yyError);
14036: }
14037: }
14038:
14039: // Done.
14040: return yyError;
14041: }
14042:
14043: // =========================================================================
14044:
14045: /**
14046: * Parse nonterminal xtc.lang.CSymbol.SymbolCharacters.
14047: *
14048: * @param yyStart The index.
14049: * @return The result.
14050: * @throws IOException Signals an I/O error.
14051: */
14052: private Result pSymbolCharacters(final int yyStart)
14053: throws IOException {
14054: int yyC;
14055: int yyIndex;
14056: Token yyValue;
14057: ParseError yyError = ParseError.DUMMY;
14058:
14059: // Alternative 1.
14060:
14061: yyC = character(yyStart);
14062: if (-1 != yyC) {
14063: yyIndex = yyStart + 1;
14064:
14065: switch (yyC) {
14066: case '>': {
14067: final int yyChoice1 = yyIndex;
14068:
14069: // Nested alternative 1.
14070:
14071: yyC = character(yyChoice1);
14072: if (-1 != yyC) {
14073: yyIndex = yyChoice1 + 1;
14074:
14075: switch (yyC) {
14076: case '>': {
14077: final int yyChoice2 = yyIndex;
14078:
14079: // Nested alternative 1.
14080:
14081: yyC = character(yyChoice2);
14082: if (-1 != yyC) {
14083: yyIndex = yyChoice2 + 1;
14084: if ('=' == yyC) {
14085:
14086: yyValue = new Token(">>=");
14087: yyValue.setLocation(location(yyStart));
14088:
14089: return new SemanticValue(yyValue,
14090: yyIndex, yyError);
14091: }
14092: }
14093:
14094: // Nested alternative 2.
14095:
14096: yyValue = new Token(">>");
14097: yyValue.setLocation(location(yyStart));
14098:
14099: return new SemanticValue(yyValue, yyChoice2,
14100: yyError);
14101: }
14102:
14103: case '=': {
14104: yyValue = new Token(">=");
14105: yyValue.setLocation(location(yyStart));
14106:
14107: return new SemanticValue(yyValue, yyIndex,
14108: yyError);
14109: }
14110:
14111: default:
14112: /* No match. */
14113: }
14114: }
14115:
14116: // Nested alternative 2.
14117:
14118: yyValue = new Token(">");
14119: yyValue.setLocation(location(yyStart));
14120:
14121: return new SemanticValue(yyValue, yyChoice1, yyError);
14122: }
14123:
14124: case '<': {
14125: final int yyChoice1 = yyIndex;
14126:
14127: // Nested alternative 1.
14128:
14129: yyC = character(yyChoice1);
14130: if (-1 != yyC) {
14131: yyIndex = yyChoice1 + 1;
14132:
14133: switch (yyC) {
14134: case '<': {
14135: final int yyChoice2 = yyIndex;
14136:
14137: // Nested alternative 1.
14138:
14139: yyC = character(yyChoice2);
14140: if (-1 != yyC) {
14141: yyIndex = yyChoice2 + 1;
14142: if ('=' == yyC) {
14143:
14144: yyValue = new Token("<<=");
14145: yyValue.setLocation(location(yyStart));
14146:
14147: return new SemanticValue(yyValue,
14148: yyIndex, yyError);
14149: }
14150: }
14151:
14152: // Nested alternative 2.
14153:
14154: yyValue = new Token("<<");
14155: yyValue.setLocation(location(yyStart));
14156:
14157: return new SemanticValue(yyValue, yyChoice2,
14158: yyError);
14159: }
14160:
14161: case '=': {
14162: yyValue = new Token("<=");
14163: yyValue.setLocation(location(yyStart));
14164:
14165: return new SemanticValue(yyValue, yyIndex,
14166: yyError);
14167: }
14168:
14169: default:
14170: /* No match. */
14171: }
14172: }
14173:
14174: // Nested alternative 2.
14175:
14176: yyValue = new Token("<");
14177: yyValue.setLocation(location(yyStart));
14178:
14179: return new SemanticValue(yyValue, yyChoice1, yyError);
14180: }
14181:
14182: case '.': {
14183: final int yyChoice1 = yyIndex;
14184:
14185: // Nested alternative 1.
14186:
14187: yyC = character(yyChoice1);
14188: if (-1 != yyC) {
14189: yyIndex = yyChoice1 + 1;
14190: if ('.' == yyC) {
14191:
14192: yyC = character(yyIndex);
14193: if (-1 != yyC) {
14194: yyIndex = yyIndex + 1;
14195: if ('.' == yyC) {
14196:
14197: yyValue = new Token("...");
14198: yyValue.setLocation(location(yyStart));
14199:
14200: return new SemanticValue(yyValue,
14201: yyIndex, yyError);
14202: }
14203: }
14204: }
14205: }
14206:
14207: // Nested alternative 2.
14208:
14209: yyValue = new Token(".");
14210: yyValue.setLocation(location(yyStart));
14211:
14212: return new SemanticValue(yyValue, yyChoice1, yyError);
14213: }
14214:
14215: case '+': {
14216: final int yyChoice1 = yyIndex;
14217:
14218: // Nested alternative 1.
14219:
14220: yyC = character(yyChoice1);
14221: if (-1 != yyC) {
14222: yyIndex = yyChoice1 + 1;
14223:
14224: switch (yyC) {
14225: case '=': {
14226: yyValue = new Token("+=");
14227: yyValue.setLocation(location(yyStart));
14228:
14229: return new SemanticValue(yyValue, yyIndex,
14230: yyError);
14231: }
14232:
14233: case '+': {
14234: yyValue = new Token("++");
14235: yyValue.setLocation(location(yyStart));
14236:
14237: return new SemanticValue(yyValue, yyIndex,
14238: yyError);
14239: }
14240:
14241: default:
14242: /* No match. */
14243: }
14244: }
14245:
14246: // Nested alternative 2.
14247:
14248: yyValue = new Token("+");
14249: yyValue.setLocation(location(yyStart));
14250:
14251: return new SemanticValue(yyValue, yyChoice1, yyError);
14252: }
14253:
14254: case '-': {
14255: final int yyChoice1 = yyIndex;
14256:
14257: // Nested alternative 1.
14258:
14259: yyC = character(yyChoice1);
14260: if (-1 != yyC) {
14261: yyIndex = yyChoice1 + 1;
14262:
14263: switch (yyC) {
14264: case '=': {
14265: yyValue = new Token("-=");
14266: yyValue.setLocation(location(yyStart));
14267:
14268: return new SemanticValue(yyValue, yyIndex,
14269: yyError);
14270: }
14271:
14272: case '-': {
14273: yyValue = new Token("--");
14274: yyValue.setLocation(location(yyStart));
14275:
14276: return new SemanticValue(yyValue, yyIndex,
14277: yyError);
14278: }
14279:
14280: case '>': {
14281: yyValue = new Token("->");
14282: yyValue.setLocation(location(yyStart));
14283:
14284: return new SemanticValue(yyValue, yyIndex,
14285: yyError);
14286: }
14287:
14288: default:
14289: /* No match. */
14290: }
14291: }
14292:
14293: // Nested alternative 2.
14294:
14295: yyValue = new Token("-");
14296: yyValue.setLocation(location(yyStart));
14297:
14298: return new SemanticValue(yyValue, yyChoice1, yyError);
14299: }
14300:
14301: case '*': {
14302: final int yyChoice1 = yyIndex;
14303:
14304: // Nested alternative 1.
14305:
14306: yyC = character(yyChoice1);
14307: if (-1 != yyC) {
14308: yyIndex = yyChoice1 + 1;
14309: if ('=' == yyC) {
14310:
14311: yyValue = new Token("*=");
14312: yyValue.setLocation(location(yyStart));
14313:
14314: return new SemanticValue(yyValue, yyIndex,
14315: yyError);
14316: }
14317: }
14318:
14319: // Nested alternative 2.
14320:
14321: yyValue = new Token("*");
14322: yyValue.setLocation(location(yyStart));
14323:
14324: return new SemanticValue(yyValue, yyChoice1, yyError);
14325: }
14326:
14327: case '/': {
14328: final int yyChoice1 = yyIndex;
14329:
14330: // Nested alternative 1.
14331:
14332: yyC = character(yyChoice1);
14333: if (-1 != yyC) {
14334: yyIndex = yyChoice1 + 1;
14335: if ('=' == yyC) {
14336:
14337: yyValue = new Token("/=");
14338: yyValue.setLocation(location(yyStart));
14339:
14340: return new SemanticValue(yyValue, yyIndex,
14341: yyError);
14342: }
14343: }
14344:
14345: // Nested alternative 2.
14346:
14347: yyValue = new Token("/");
14348: yyValue.setLocation(location(yyStart));
14349:
14350: return new SemanticValue(yyValue, yyChoice1, yyError);
14351: }
14352:
14353: case '%': {
14354: final int yyChoice1 = yyIndex;
14355:
14356: // Nested alternative 1.
14357:
14358: yyC = character(yyChoice1);
14359: if (-1 != yyC) {
14360: yyIndex = yyChoice1 + 1;
14361: if ('=' == yyC) {
14362:
14363: yyValue = new Token("%=");
14364: yyValue.setLocation(location(yyStart));
14365:
14366: return new SemanticValue(yyValue, yyIndex,
14367: yyError);
14368: }
14369: }
14370:
14371: // Nested alternative 2.
14372:
14373: yyValue = new Token("%");
14374: yyValue.setLocation(location(yyStart));
14375:
14376: return new SemanticValue(yyValue, yyChoice1, yyError);
14377: }
14378:
14379: case '&': {
14380: final int yyChoice1 = yyIndex;
14381:
14382: // Nested alternative 1.
14383:
14384: yyC = character(yyChoice1);
14385: if (-1 != yyC) {
14386: yyIndex = yyChoice1 + 1;
14387:
14388: switch (yyC) {
14389: case '=': {
14390: yyValue = new Token("&=");
14391: yyValue.setLocation(location(yyStart));
14392:
14393: return new SemanticValue(yyValue, yyIndex,
14394: yyError);
14395: }
14396:
14397: case '&': {
14398: yyValue = new Token("&&");
14399: yyValue.setLocation(location(yyStart));
14400:
14401: return new SemanticValue(yyValue, yyIndex,
14402: yyError);
14403: }
14404:
14405: default:
14406: /* No match. */
14407: }
14408: }
14409:
14410: // Nested alternative 2.
14411:
14412: yyValue = new Token("&");
14413: yyValue.setLocation(location(yyStart));
14414:
14415: return new SemanticValue(yyValue, yyChoice1, yyError);
14416: }
14417:
14418: case '^': {
14419: final int yyChoice1 = yyIndex;
14420:
14421: // Nested alternative 1.
14422:
14423: yyC = character(yyChoice1);
14424: if (-1 != yyC) {
14425: yyIndex = yyChoice1 + 1;
14426: if ('=' == yyC) {
14427:
14428: yyValue = new Token("^=");
14429: yyValue.setLocation(location(yyStart));
14430:
14431: return new SemanticValue(yyValue, yyIndex,
14432: yyError);
14433: }
14434: }
14435:
14436: // Nested alternative 2.
14437:
14438: yyValue = new Token("^");
14439: yyValue.setLocation(location(yyStart));
14440:
14441: return new SemanticValue(yyValue, yyChoice1, yyError);
14442: }
14443:
14444: case '|': {
14445: final int yyChoice1 = yyIndex;
14446:
14447: // Nested alternative 1.
14448:
14449: yyC = character(yyChoice1);
14450: if (-1 != yyC) {
14451: yyIndex = yyChoice1 + 1;
14452:
14453: switch (yyC) {
14454: case '=': {
14455: yyValue = new Token("|=");
14456: yyValue.setLocation(location(yyStart));
14457:
14458: return new SemanticValue(yyValue, yyIndex,
14459: yyError);
14460: }
14461:
14462: case '|': {
14463: yyValue = new Token("||");
14464: yyValue.setLocation(location(yyStart));
14465:
14466: return new SemanticValue(yyValue, yyIndex,
14467: yyError);
14468: }
14469:
14470: default:
14471: /* No match. */
14472: }
14473: }
14474:
14475: // Nested alternative 2.
14476:
14477: yyValue = new Token("|");
14478: yyValue.setLocation(location(yyStart));
14479:
14480: return new SemanticValue(yyValue, yyChoice1, yyError);
14481: }
14482:
14483: case '=': {
14484: final int yyChoice1 = yyIndex;
14485:
14486: // Nested alternative 1.
14487:
14488: yyC = character(yyChoice1);
14489: if (-1 != yyC) {
14490: yyIndex = yyChoice1 + 1;
14491: if ('=' == yyC) {
14492:
14493: yyValue = new Token("==");
14494: yyValue.setLocation(location(yyStart));
14495:
14496: return new SemanticValue(yyValue, yyIndex,
14497: yyError);
14498: }
14499: }
14500:
14501: // Nested alternative 2.
14502:
14503: yyValue = new Token("=");
14504: yyValue.setLocation(location(yyStart));
14505:
14506: return new SemanticValue(yyValue, yyChoice1, yyError);
14507: }
14508:
14509: case '!': {
14510: final int yyChoice1 = yyIndex;
14511:
14512: // Nested alternative 1.
14513:
14514: yyC = character(yyChoice1);
14515: if (-1 != yyC) {
14516: yyIndex = yyChoice1 + 1;
14517: if ('=' == yyC) {
14518:
14519: yyValue = new Token("!=");
14520: yyValue.setLocation(location(yyStart));
14521:
14522: return new SemanticValue(yyValue, yyIndex,
14523: yyError);
14524: }
14525: }
14526:
14527: // Nested alternative 2.
14528:
14529: yyValue = new Token("!");
14530: yyValue.setLocation(location(yyStart));
14531:
14532: return new SemanticValue(yyValue, yyChoice1, yyError);
14533: }
14534:
14535: case ';': {
14536: yyValue = new Token(";");
14537: yyValue.setLocation(location(yyStart));
14538:
14539: return new SemanticValue(yyValue, yyIndex, yyError);
14540: }
14541:
14542: case ':': {
14543: yyValue = new Token(":");
14544: yyValue.setLocation(location(yyStart));
14545:
14546: return new SemanticValue(yyValue, yyIndex, yyError);
14547: }
14548:
14549: case ',': {
14550: yyValue = new Token(",");
14551: yyValue.setLocation(location(yyStart));
14552:
14553: return new SemanticValue(yyValue, yyIndex, yyError);
14554: }
14555:
14556: case '{': {
14557: yyValue = new Token("{");
14558: yyValue.setLocation(location(yyStart));
14559:
14560: return new SemanticValue(yyValue, yyIndex, yyError);
14561: }
14562:
14563: case '}': {
14564: yyValue = new Token("}");
14565: yyValue.setLocation(location(yyStart));
14566:
14567: return new SemanticValue(yyValue, yyIndex, yyError);
14568: }
14569:
14570: case '(': {
14571: yyValue = new Token("(");
14572: yyValue.setLocation(location(yyStart));
14573:
14574: return new SemanticValue(yyValue, yyIndex, yyError);
14575: }
14576:
14577: case ')': {
14578: yyValue = new Token(")");
14579: yyValue.setLocation(location(yyStart));
14580:
14581: return new SemanticValue(yyValue, yyIndex, yyError);
14582: }
14583:
14584: case '[': {
14585: yyValue = new Token("[");
14586: yyValue.setLocation(location(yyStart));
14587:
14588: return new SemanticValue(yyValue, yyIndex, yyError);
14589: }
14590:
14591: case ']': {
14592: yyValue = new Token("]");
14593: yyValue.setLocation(location(yyStart));
14594:
14595: return new SemanticValue(yyValue, yyIndex, yyError);
14596: }
14597:
14598: case '~': {
14599: yyValue = new Token("~");
14600: yyValue.setLocation(location(yyStart));
14601:
14602: return new SemanticValue(yyValue, yyIndex, yyError);
14603: }
14604:
14605: case '?': {
14606: yyValue = new Token("?");
14607: yyValue.setLocation(location(yyStart));
14608:
14609: return new SemanticValue(yyValue, yyIndex, yyError);
14610: }
14611:
14612: default:
14613: /* No match. */
14614: }
14615: }
14616:
14617: // Done.
14618: yyError = yyError.select("symbol characters expected", yyStart);
14619: return yyError;
14620: }
14621:
14622: // =========================================================================
14623:
14624: /**
14625: * Parse nonterminal xtc.lang.CSpacing.Spacing.
14626: *
14627: * @param yyStart The index.
14628: * @return The result.
14629: * @throws IOException Signals an I/O error.
14630: */
14631: private Result pSpacing(final int yyStart) throws IOException {
14632: int yyC;
14633: int yyIndex;
14634: Result yyResult;
14635: Result yyPredResult;
14636: boolean yyPredMatched;
14637: int yyBase;
14638: int yyRepetition1;
14639: int yyRepetition2;
14640: Token yyValue;
14641: ParseError yyError = ParseError.DUMMY;
14642:
14643: // Alternative 1.
14644:
14645: yyRepetition1 = yyStart;
14646: while (true) {
14647:
14648: final int yyChoice1 = yyRepetition1;
14649:
14650: // Nested alternative 1.
14651:
14652: yyC = character(yyChoice1);
14653: if (-1 != yyC) {
14654: yyIndex = yyChoice1 + 1;
14655:
14656: switch (yyC) {
14657: case ' ': {
14658: yyRepetition1 = yyIndex;
14659: continue;
14660: }
14661:
14662: case '\t': {
14663: yyRepetition1 = yyIndex;
14664: continue;
14665: }
14666:
14667: case '\f': {
14668: yyRepetition1 = yyIndex;
14669: continue;
14670: }
14671:
14672: case '/': {
14673: yyC = character(yyIndex);
14674: if (-1 != yyC) {
14675: yyIndex = yyIndex + 1;
14676:
14677: switch (yyC) {
14678: case '*': {
14679: yyRepetition2 = yyIndex;
14680: while (true) {
14681:
14682: final int yyChoice2 = yyRepetition2;
14683:
14684: // Nested alternative 1.
14685:
14686: yyC = character(yyChoice2);
14687: if (-1 != yyC) {
14688: yyIndex = yyChoice2 + 1;
14689:
14690: switch (yyC) {
14691: case '*': {
14692: yyPredMatched = false;
14693:
14694: yyC = character(yyIndex);
14695: if ('/' == yyC) {
14696:
14697: yyPredMatched = true;
14698: }
14699:
14700: if (!yyPredMatched) {
14701:
14702: yyRepetition2 = yyIndex;
14703: continue;
14704: } else {
14705: yyError = yyError.select(
14706: "spacing expected",
14707: yyStart);
14708: }
14709: }
14710: break;
14711:
14712: default: {
14713: yyRepetition2 = yyIndex;
14714: continue;
14715: }
14716: }
14717: }
14718: break;
14719: }
14720:
14721: yyBase = yyRepetition2;
14722: yyC = character(yyBase);
14723: if ('*' == yyC) {
14724: yyIndex = yyRepetition2 + 1;
14725:
14726: yyC = character(yyIndex);
14727: if ('/' == yyC) {
14728: yyIndex = yyIndex + 1;
14729:
14730: yyRepetition1 = yyIndex;
14731: continue;
14732: } else {
14733: yyError = yyError.select(
14734: "\"*/\" expected", yyBase);
14735: }
14736: } else {
14737: yyError = yyError.select(
14738: "\"*/\" expected", yyBase);
14739: }
14740: }
14741: break;
14742:
14743: case '/': {
14744: yyRepetition2 = yyIndex;
14745: while (true) {
14746:
14747: yyC = character(yyRepetition2);
14748: if (-1 != yyC) {
14749: yyIndex = yyRepetition2 + 1;
14750:
14751: switch (yyC) {
14752: case '\n':
14753: case '\r':
14754: /* No match. */
14755: break;
14756:
14757: default: {
14758: yyRepetition2 = yyIndex;
14759: continue;
14760: }
14761: }
14762: }
14763: break;
14764: }
14765:
14766: yyPredResult = pLineTerminator(yyRepetition2);
14767: yyError = yyPredResult.select(yyError);
14768: if (yyPredResult.hasValue()) {
14769:
14770: yyRepetition1 = yyRepetition2;
14771: continue;
14772: }
14773: }
14774: break;
14775:
14776: default:
14777: /* No match. */
14778: }
14779: }
14780: }
14781: break;
14782:
14783: case '\r': {
14784: final int yyChoice2 = yyIndex;
14785:
14786: // Nested alternative 1.
14787:
14788: yyC = character(yyChoice2);
14789: if ('\n' == yyC) {
14790: yyIndex = yyChoice2 + 1;
14791:
14792: yyResult = pDirective(yyIndex);
14793: yyError = yyResult.select(yyError);
14794: if (yyResult.hasValue()) {
14795:
14796: yyRepetition1 = yyResult.index;
14797: continue;
14798: }
14799: }
14800:
14801: // Nested alternative 2.
14802:
14803: yyResult = pDirective(yyChoice2);
14804: yyError = yyResult.select(yyError);
14805: if (yyResult.hasValue()) {
14806:
14807: yyRepetition1 = yyResult.index;
14808: continue;
14809: }
14810: }
14811: break;
14812:
14813: case '\n': {
14814: yyResult = pDirective(yyIndex);
14815: yyError = yyResult.select(yyError);
14816: if (yyResult.hasValue()) {
14817:
14818: yyRepetition1 = yyResult.index;
14819: continue;
14820: }
14821: }
14822: break;
14823:
14824: default:
14825: /* No match. */
14826: }
14827: }
14828: break;
14829: }
14830:
14831: yyValue = new Token(difference(yyStart, yyRepetition1));
14832: yyValue.setLocation(location(yyStart));
14833:
14834: return new SemanticValue(yyValue, yyRepetition1, yyError);
14835: }
14836:
14837: // =========================================================================
14838:
14839: /**
14840: * Parse nonterminal xtc.lang.CSpacing.Space.
14841: *
14842: * @param yyStart The index.
14843: * @return The result.
14844: * @throws IOException Signals an I/O error.
14845: */
14846: private Result pSpace(final int yyStart) throws IOException {
14847: int yyC;
14848: int yyIndex;
14849: Void yyValue;
14850: ParseError yyError = ParseError.DUMMY;
14851:
14852: // Alternative 1.
14853:
14854: yyC = character(yyStart);
14855: if (-1 != yyC) {
14856: yyIndex = yyStart + 1;
14857:
14858: switch (yyC) {
14859: case ' ': {
14860: yyValue = null;
14861:
14862: return new SemanticValue(yyValue, yyIndex, yyError);
14863: }
14864:
14865: case '\t': {
14866: yyValue = null;
14867:
14868: return new SemanticValue(yyValue, yyIndex, yyError);
14869: }
14870:
14871: case '\f': {
14872: yyValue = null;
14873:
14874: return new SemanticValue(yyValue, yyIndex, yyError);
14875: }
14876:
14877: default:
14878: /* No match. */
14879: }
14880: }
14881:
14882: // Done.
14883: yyError = yyError.select("space expected", yyStart);
14884: return yyError;
14885: }
14886:
14887: // =========================================================================
14888:
14889: /**
14890: * Parse nonterminal xtc.lang.CSpacing.LineTerminator.
14891: *
14892: * @param yyStart The index.
14893: * @return The result.
14894: * @throws IOException Signals an I/O error.
14895: */
14896: private Result pLineTerminator(final int yyStart)
14897: throws IOException {
14898: int yyC;
14899: int yyIndex;
14900: Void yyValue;
14901: ParseError yyError = ParseError.DUMMY;
14902:
14903: // Alternative 1.
14904:
14905: yyC = character(yyStart);
14906: if (-1 != yyC) {
14907: yyIndex = yyStart + 1;
14908:
14909: switch (yyC) {
14910: case '\r': {
14911: final int yyChoice1 = yyIndex;
14912:
14913: // Nested alternative 1.
14914:
14915: yyC = character(yyChoice1);
14916: if ('\n' == yyC) {
14917: yyIndex = yyChoice1 + 1;
14918:
14919: yyValue = null;
14920:
14921: return new SemanticValue(yyValue, yyIndex, yyError);
14922: }
14923:
14924: // Nested alternative 2.
14925:
14926: yyValue = null;
14927:
14928: return new SemanticValue(yyValue, yyChoice1, yyError);
14929: }
14930:
14931: case '\n': {
14932: yyValue = null;
14933:
14934: return new SemanticValue(yyValue, yyIndex, yyError);
14935: }
14936:
14937: default:
14938: /* No match. */
14939: }
14940: }
14941:
14942: // Done.
14943: yyError = yyError.select("line terminator expected", yyStart);
14944: return yyError;
14945: }
14946:
14947: // =========================================================================
14948:
14949: /**
14950: * Parse nonterminal xtc.lang.CSpacing.EndOfFile.
14951: *
14952: * @param yyStart The index.
14953: * @return The result.
14954: * @throws IOException Signals an I/O error.
14955: */
14956: private Result pEndOfFile(final int yyStart) throws IOException {
14957: int yyC;
14958: boolean yyPredMatched;
14959: Void yyValue;
14960: ParseError yyError = ParseError.DUMMY;
14961:
14962: // Alternative 1.
14963:
14964: yyPredMatched = false;
14965:
14966: yyC = character(yyStart);
14967: if (-1 != yyC) {
14968:
14969: yyPredMatched = true;
14970: }
14971:
14972: if (!yyPredMatched) {
14973:
14974: yyValue = null;
14975:
14976: return new SemanticValue(yyValue, yyStart, yyError);
14977: } else {
14978: yyError = yyError.select("end of file expected", yyStart);
14979: }
14980:
14981: // Done.
14982: return yyError;
14983: }
14984:
14985: // =========================================================================
14986:
14987: /**
14988: * Parse nonterminal xtc.lang.CSpacing.Directive.
14989: *
14990: * @param yyStart The index.
14991: * @return The result.
14992: * @throws IOException Signals an I/O error.
14993: */
14994: private Result pDirective(final int yyStart) throws IOException {
14995: int yyC;
14996: int yyIndex;
14997: Result yyResult;
14998: Result yyPredResult;
14999: int yyBase;
15000: int yyRepetition1;
15001: boolean yyRepeated1;
15002: int yyOption1;
15003: String yyOpValue1;
15004: Void yyValue;
15005: ParseError yyError = ParseError.DUMMY;
15006:
15007: // Alternative 1.
15008:
15009: yyC = character(yyStart);
15010: if ('#' == yyC) {
15011: yyIndex = yyStart + 1;
15012:
15013: final int yyChoice1 = yyIndex;
15014:
15015: // Nested alternative 1.
15016:
15017: yyC = character(yyChoice1);
15018: if (' ' == yyC) {
15019: yyIndex = yyChoice1 + 1;
15020:
15021: yyResult = pLineNumber(yyIndex);
15022: yyError = yyResult.select(yyError);
15023: if (yyResult.hasValue()) {
15024: final String line = yyResult.semanticValue();
15025:
15026: yyC = character(yyResult.index);
15027: if (' ' == yyC) {
15028: yyIndex = yyResult.index + 1;
15029:
15030: yyC = character(yyIndex);
15031: if ('\"' == yyC) {
15032: yyIndex = yyIndex + 1;
15033:
15034: yyResult = pFileName(yyIndex);
15035: yyError = yyResult.select(yyError);
15036: if (yyResult.hasValue()) {
15037: final String file = yyResult
15038: .semanticValue();
15039:
15040: yyC = character(yyResult.index);
15041: if ('\"' == yyC) {
15042: yyIndex = yyResult.index + 1;
15043:
15044: yyOption1 = yyIndex;
15045: yyOpValue1 = null;
15046:
15047: yyBase = yyOption1;
15048: yyC = character(yyBase);
15049: if (' ' == yyC) {
15050: yyIndex = yyOption1 + 1;
15051:
15052: yyC = character(yyIndex);
15053: if ('1' == yyC) {
15054: yyIndex = yyIndex + 1;
15055: final String v$el$1 = " 1";
15056:
15057: yyOption1 = yyIndex;
15058: yyOpValue1 = v$el$1;
15059: } else {
15060: yyError = yyError.select(
15061: "\" 1\" expected",
15062: yyBase);
15063: }
15064: } else {
15065: yyError = yyError.select(
15066: "\" 1\" expected",
15067: yyBase);
15068: }
15069: { // Start scope for f1.
15070: final String f1 = yyOpValue1;
15071:
15072: yyOpValue1 = null;
15073:
15074: yyBase = yyOption1;
15075: yyC = character(yyBase);
15076: if (' ' == yyC) {
15077: yyIndex = yyOption1 + 1;
15078:
15079: yyC = character(yyIndex);
15080: if ('2' == yyC) {
15081: yyIndex = yyIndex + 1;
15082: final String v$el$2 = " 2";
15083:
15084: yyOption1 = yyIndex;
15085: yyOpValue1 = v$el$2;
15086: } else {
15087: yyError = yyError
15088: .select(
15089: "\" 2\" expected",
15090: yyBase);
15091: }
15092: } else {
15093: yyError = yyError.select(
15094: "\" 2\" expected",
15095: yyBase);
15096: }
15097: { // Start scope for f2.
15098: final String f2 = yyOpValue1;
15099:
15100: yyOpValue1 = null;
15101:
15102: yyBase = yyOption1;
15103: yyC = character(yyBase);
15104: if (' ' == yyC) {
15105: yyIndex = yyOption1 + 1;
15106:
15107: yyC = character(yyIndex);
15108: if ('3' == yyC) {
15109: yyIndex = yyIndex + 1;
15110: final String v$el$3 = " 3";
15111:
15112: yyOption1 = yyIndex;
15113: yyOpValue1 = v$el$3;
15114: } else {
15115: yyError = yyError
15116: .select(
15117: "\" 3\" expected",
15118: yyBase);
15119: }
15120: } else {
15121: yyError = yyError
15122: .select(
15123: "\" 3\" expected",
15124: yyBase);
15125: }
15126: { // Start scope for f3.
15127: final String f3 = yyOpValue1;
15128:
15129: yyOpValue1 = null;
15130:
15131: yyBase = yyOption1;
15132: yyC = character(yyBase);
15133: if (' ' == yyC) {
15134: yyIndex = yyOption1 + 1;
15135:
15136: yyC = character(yyIndex);
15137: if ('4' == yyC) {
15138: yyIndex = yyIndex + 1;
15139: final String v$el$4 = " 4";
15140:
15141: yyOption1 = yyIndex;
15142: yyOpValue1 = v$el$4;
15143: } else {
15144: yyError = yyError
15145: .select(
15146: "\" 4\" expected",
15147: yyBase);
15148: }
15149: } else {
15150: yyError = yyError
15151: .select(
15152: "\" 4\" expected",
15153: yyBase);
15154: }
15155: { // Start scope for f4.
15156: final String f4 = yyOpValue1;
15157:
15158: yyPredResult = pLineTerminator(yyOption1);
15159: yyError = yyPredResult
15160: .select(yyError);
15161: if (yyPredResult
15162: .hasValue()) {
15163:
15164: final int lineNo = Integer
15165: .parseInt(line);
15166: if (RELOCATE)
15167: setLocation(
15168: yyStart,
15169: file,
15170: lineNo - 1,
15171: FIRST_COLUMN);
15172: yyState
15173: .lineMarker(
15174: file,
15175: lineNo,
15176: f1,
15177: f2,
15178: f3,
15179: f4,
15180: location(yyStart));
15181:
15182: yyValue = null;
15183:
15184: return new SemanticValue(
15185: yyValue,
15186: yyOption1,
15187: yyError);
15188: }
15189: } // End scope for f4.
15190: } // End scope for f3.
15191: } // End scope for f2.
15192: } // End scope for f1.
15193: }
15194: }
15195: }
15196: }
15197: }
15198: }
15199:
15200: // Nested alternative 2.
15201:
15202: yyRepetition1 = yyChoice1;
15203: while (true) {
15204:
15205: yyResult = pSpace(yyRepetition1);
15206: yyError = yyResult.select(yyError);
15207: if (yyResult.hasValue()) {
15208:
15209: yyRepetition1 = yyResult.index;
15210: continue;
15211: }
15212: break;
15213: }
15214: { // Start scope for nested choice.
15215:
15216: final int yyChoice2 = yyRepetition1;
15217:
15218: // Nested alternative 1.
15219:
15220: yyC = character(yyChoice2);
15221: if (-1 != yyC) {
15222: yyIndex = yyChoice2 + 1;
15223:
15224: switch (yyC) {
15225: case 'p': {
15226: yyC = character(yyIndex);
15227: if (-1 != yyC) {
15228: yyIndex = yyIndex + 1;
15229: if ('r' == yyC) {
15230:
15231: yyC = character(yyIndex);
15232: if (-1 != yyC) {
15233: yyIndex = yyIndex + 1;
15234: if ('a' == yyC) {
15235:
15236: yyC = character(yyIndex);
15237: if (-1 != yyC) {
15238: yyIndex = yyIndex + 1;
15239: if ('g' == yyC) {
15240:
15241: yyC = character(yyIndex);
15242: if (-1 != yyC) {
15243: yyIndex = yyIndex + 1;
15244: if ('m' == yyC) {
15245:
15246: yyC = character(yyIndex);
15247: if (-1 != yyC) {
15248: yyIndex = yyIndex + 1;
15249: if ('a' == yyC) {
15250:
15251: yyC = character(yyIndex);
15252: if (-1 != yyC) {
15253: yyIndex = yyIndex + 1;
15254: if (' ' == yyC) {
15255:
15256: yyResult = pPragma(yyIndex);
15257: yyError = yyResult
15258: .select(yyError);
15259: if (yyResult
15260: .hasValue()) {
15261: final String pragma = yyResult
15262: .semanticValue();
15263:
15264: yyPredResult = pLineTerminator(yyResult.index);
15265: yyError = yyPredResult
15266: .select(yyError);
15267: if (yyPredResult
15268: .hasValue()) {
15269:
15270: yyState
15271: .pragma(
15272: pragma,
15273: location(yyStart));
15274:
15275: yyValue = null;
15276:
15277: return yyResult
15278: .createValue(
15279: yyValue,
15280: yyError);
15281: }
15282: }
15283: }
15284: }
15285: }
15286: }
15287: }
15288: }
15289: }
15290: }
15291: }
15292: }
15293: }
15294: }
15295: }
15296: break;
15297:
15298: case 'i': {
15299: yyC = character(yyIndex);
15300: if (-1 != yyC) {
15301: yyIndex = yyIndex + 1;
15302: if ('d' == yyC) {
15303:
15304: yyC = character(yyIndex);
15305: if (-1 != yyC) {
15306: yyIndex = yyIndex + 1;
15307: if ('e' == yyC) {
15308:
15309: yyC = character(yyIndex);
15310: if (-1 != yyC) {
15311: yyIndex = yyIndex + 1;
15312: if ('n' == yyC) {
15313:
15314: yyC = character(yyIndex);
15315: if (-1 != yyC) {
15316: yyIndex = yyIndex + 1;
15317: if ('t' == yyC) {
15318:
15319: yyRepetition1 = yyIndex;
15320: yyRepeated1 = false;
15321: while (true) {
15322:
15323: yyResult = pSpace(yyRepetition1);
15324: yyError = yyResult
15325: .select(yyError);
15326: if (yyResult
15327: .hasValue()) {
15328:
15329: yyRepetition1 = yyResult.index;
15330: yyRepeated1 = true;
15331: continue;
15332: }
15333: break;
15334: }
15335:
15336: if (yyRepeated1) {
15337:
15338: yyC = character(yyRepetition1);
15339: if ('\"' == yyC) {
15340: yyIndex = yyRepetition1 + 1;
15341:
15342: yyResult = pFileName(yyIndex);
15343: yyError = yyResult
15344: .select(yyError);
15345: if (yyResult
15346: .hasValue()) {
15347: final String s = yyResult
15348: .semanticValue();
15349:
15350: yyC = character(yyResult.index);
15351: if ('\"' == yyC) {
15352: yyIndex = yyResult.index + 1;
15353:
15354: yyPredResult = pLineTerminator(yyIndex);
15355: yyError = yyPredResult
15356: .select(yyError);
15357: if (yyPredResult
15358: .hasValue()) {
15359:
15360: yyState
15361: .ident(
15362: s,
15363: location(yyStart));
15364:
15365: yyValue = null;
15366:
15367: return new SemanticValue(
15368: yyValue,
15369: yyIndex,
15370: yyError);
15371: }
15372: }
15373: }
15374: }
15375: }
15376: }
15377: }
15378: }
15379: }
15380: }
15381: }
15382: }
15383: }
15384: }
15385: break;
15386:
15387: default:
15388: /* No match. */
15389: }
15390: }
15391: } // End scope for nested choice.
15392: }
15393:
15394: // Alternative 2.
15395:
15396: yyValue = null;
15397:
15398: return new SemanticValue(yyValue, yyStart, yyError);
15399: }
15400:
15401: // =========================================================================
15402:
15403: /**
15404: * Parse nonterminal xtc.lang.CSpacing.LineNumber.
15405: *
15406: * @param yyStart The index.
15407: * @return The result.
15408: * @throws IOException Signals an I/O error.
15409: */
15410: private Result pLineNumber(final int yyStart) throws IOException {
15411: int yyC;
15412: int yyIndex;
15413: int yyRepetition1;
15414: String yyValue;
15415: ParseError yyError = ParseError.DUMMY;
15416:
15417: // Alternative 1.
15418:
15419: yyC = character(yyStart);
15420: if (-1 != yyC) {
15421: yyIndex = yyStart + 1;
15422:
15423: switch (yyC) {
15424: case '1':
15425: case '2':
15426: case '3':
15427: case '4':
15428: case '5':
15429: case '6':
15430: case '7':
15431: case '8':
15432: case '9': {
15433: yyRepetition1 = yyIndex;
15434: while (true) {
15435:
15436: yyC = character(yyRepetition1);
15437: if (-1 != yyC) {
15438: yyIndex = yyRepetition1 + 1;
15439:
15440: switch (yyC) {
15441: case '0':
15442: case '1':
15443: case '2':
15444: case '3':
15445: case '4':
15446: case '5':
15447: case '6':
15448: case '7':
15449: case '8':
15450: case '9': {
15451: yyRepetition1 = yyIndex;
15452: continue;
15453: }
15454:
15455: default:
15456: /* No match. */
15457: }
15458: }
15459: break;
15460: }
15461:
15462: yyValue = difference(yyStart, yyRepetition1);
15463:
15464: return new SemanticValue(yyValue, yyRepetition1,
15465: yyError);
15466: }
15467:
15468: default:
15469: /* No match. */
15470: }
15471: }
15472:
15473: // Done.
15474: yyError = yyError.select("line number expected", yyStart);
15475: return yyError;
15476: }
15477:
15478: // =========================================================================
15479:
15480: /**
15481: * Parse nonterminal xtc.lang.CSpacing.FileName.
15482: *
15483: * @param yyStart The index.
15484: * @return The result.
15485: * @throws IOException Signals an I/O error.
15486: */
15487: private Result pFileName(final int yyStart) throws IOException {
15488: int yyC;
15489: int yyIndex;
15490: int yyRepetition1;
15491: String yyValue;
15492: ParseError yyError = ParseError.DUMMY;
15493:
15494: // Alternative 1.
15495:
15496: yyRepetition1 = yyStart;
15497: while (true) {
15498:
15499: final int yyChoice1 = yyRepetition1;
15500:
15501: // Nested alternative 1.
15502:
15503: yyC = character(yyChoice1);
15504: if (-1 != yyC) {
15505: yyIndex = yyChoice1 + 1;
15506:
15507: switch (yyC) {
15508: case '\\': {
15509: yyC = character(yyIndex);
15510: if (-1 != yyC) {
15511: yyIndex = yyIndex + 1;
15512:
15513: yyRepetition1 = yyIndex;
15514: continue;
15515: }
15516: }
15517: break;
15518:
15519: default:
15520: /* No match. */
15521: }
15522: }
15523:
15524: // Nested alternative 2.
15525:
15526: yyC = character(yyChoice1);
15527: if (-1 != yyC) {
15528: yyIndex = yyChoice1 + 1;
15529:
15530: switch (yyC) {
15531: case '\"':
15532: case '\\':
15533: /* No match. */
15534: break;
15535:
15536: default: {
15537: yyRepetition1 = yyIndex;
15538: continue;
15539: }
15540: }
15541: }
15542: break;
15543: }
15544:
15545: yyValue = difference(yyStart, yyRepetition1);
15546:
15547: return new SemanticValue(yyValue, yyRepetition1, yyError);
15548: }
15549:
15550: // =========================================================================
15551:
15552: /**
15553: * Parse nonterminal xtc.lang.CSpacing.Pragma.
15554: *
15555: * @param yyStart The index.
15556: * @return The result.
15557: * @throws IOException Signals an I/O error.
15558: */
15559: private Result pPragma(final int yyStart) throws IOException {
15560: int yyC;
15561: int yyIndex;
15562: int yyRepetition1;
15563: String yyValue;
15564: ParseError yyError = ParseError.DUMMY;
15565:
15566: // Alternative 1.
15567:
15568: yyRepetition1 = yyStart;
15569: while (true) {
15570:
15571: yyC = character(yyRepetition1);
15572: if (-1 != yyC) {
15573: yyIndex = yyRepetition1 + 1;
15574:
15575: switch (yyC) {
15576: case '\n':
15577: case '\r':
15578: /* No match. */
15579: break;
15580:
15581: default: {
15582: yyRepetition1 = yyIndex;
15583: continue;
15584: }
15585: }
15586: }
15587: break;
15588: }
15589:
15590: yyValue = difference(yyStart, yyRepetition1);
15591:
15592: return new SemanticValue(yyValue, yyRepetition1, yyError);
15593: }
15594:
15595: // =========================================================================
15596:
15597: /**
15598: * Parse nonterminal xtc.lang.CContext.TypedefContext.
15599: *
15600: * @param yyStart The index.
15601: * @return The result.
15602: * @throws IOException Signals an I/O error.
15603: */
15604: private Result pTypedefContext(final int yyStart)
15605: throws IOException {
15606: Void yyValue;
15607: ParseError yyError = ParseError.DUMMY;
15608:
15609: // Alternative 1.
15610:
15611: yyState.typedef();
15612:
15613: yyValue = null;
15614:
15615: return new SemanticValue(yyValue, yyStart, yyError);
15616: }
15617:
15618: // =========================================================================
15619:
15620: /**
15621: * Parse nonterminal xtc.lang.CContext.ParameterContext.
15622: *
15623: * @param yyStart The index.
15624: * @return The result.
15625: * @throws IOException Signals an I/O error.
15626: */
15627: private Result pParameterContext(final int yyStart)
15628: throws IOException {
15629: Void yyValue;
15630: ParseError yyError = ParseError.DUMMY;
15631:
15632: // Alternative 1.
15633:
15634: yyState.parameters();
15635:
15636: yyValue = null;
15637:
15638: return new SemanticValue(yyValue, yyStart, yyError);
15639: }
15640:
15641: // =========================================================================
15642:
15643: /**
15644: * Parse nonterminal xtc.lang.CContext.FunctionDeclaratorContext.
15645: *
15646: * @param yyStart The index.
15647: * @return The result.
15648: * @throws IOException Signals an I/O error.
15649: */
15650: private Result pFunctionDeclaratorContext(final int yyStart)
15651: throws IOException {
15652:
15653: Void yyValue;
15654: ParseError yyError = ParseError.DUMMY;
15655:
15656: // Alternative 1.
15657:
15658: yyState.functionDeclarator();
15659:
15660: yyValue = null;
15661:
15662: return new SemanticValue(yyValue, yyStart, yyError);
15663: }
15664:
15665: // =========================================================================
15666:
15667: /**
15668: * Parse nonterminal xtc.lang.CContext.TypeSpecContext.
15669: *
15670: * @param yyStart The index.
15671: * @return The result.
15672: * @throws IOException Signals an I/O error.
15673: */
15674: private Result pTypeSpecContext(final int yyStart)
15675: throws IOException {
15676: Void yyValue;
15677: ParseError yyError = ParseError.DUMMY;
15678:
15679: // Alternative 1.
15680:
15681: yyState.typeSpecifier();
15682:
15683: yyValue = null;
15684:
15685: return new SemanticValue(yyValue, yyStart, yyError);
15686: }
15687:
15688: // =========================================================================
15689:
15690: /**
15691: * Parse nonterminal xtc.lang.CContext.PushScope.
15692: *
15693: * @param yyStart The index.
15694: * @return The result.
15695: * @throws IOException Signals an I/O error.
15696: */
15697: private Result pPushScope(final int yyStart) throws IOException {
15698: Void yyValue;
15699: ParseError yyError = ParseError.DUMMY;
15700:
15701: // Alternative 1.
15702:
15703: yyState.pushScope();
15704:
15705: yyValue = null;
15706:
15707: return new SemanticValue(yyValue, yyStart, yyError);
15708: }
15709:
15710: // =========================================================================
15711:
15712: /**
15713: * Parse nonterminal xtc.lang.CContext.PopScope.
15714: *
15715: * @param yyStart The index.
15716: * @return The result.
15717: * @throws IOException Signals an I/O error.
15718: */
15719: private Result pPopScope(final int yyStart) throws IOException {
15720: Void yyValue;
15721: ParseError yyError = ParseError.DUMMY;
15722:
15723: // Alternative 1.
15724:
15725: yyState.popScope();
15726:
15727: yyValue = null;
15728:
15729: return new SemanticValue(yyValue, yyStart, yyError);
15730: }
15731:
15732: // =========================================================================
15733:
15734: /**
15735: * Parse nonterminal xtc.lang.CContext.EnterStructure.
15736: *
15737: * @param yyStart The index.
15738: * @return The result.
15739: * @throws IOException Signals an I/O error.
15740: */
15741: private Result pEnterStructure(final int yyStart)
15742: throws IOException {
15743: Void yyValue;
15744: ParseError yyError = ParseError.DUMMY;
15745:
15746: // Alternative 1.
15747:
15748: yyState.enterStructure();
15749:
15750: yyValue = null;
15751:
15752: return new SemanticValue(yyValue, yyStart, yyError);
15753: }
15754:
15755: // =========================================================================
15756:
15757: /**
15758: * Parse nonterminal xtc.lang.CContext.ExitStructure.
15759: *
15760: * @param yyStart The index.
15761: * @return The result.
15762: * @throws IOException Signals an I/O error.
15763: */
15764: private Result pExitStructure(final int yyStart) throws IOException {
15765: Void yyValue;
15766: ParseError yyError = ParseError.DUMMY;
15767:
15768: // Alternative 1.
15769:
15770: yyState.exitStructure();
15771:
15772: yyValue = null;
15773:
15774: return new SemanticValue(yyValue, yyStart, yyError);
15775: }
15776:
15777: // =========================================================================
15778:
15779: static {
15780: add(C_KEYWORDS, new String[] { "auto", "break", "case", "char",
15781: "const", "continue", "default", "do", "double", "else",
15782: "enum", "extern", "float", "for", "goto", "if", "int",
15783: "long", "register", "return", "short", "signed",
15784: "sizeof", "static", "struct", "switch", "typedef",
15785: "union", "unsigned", "void", "volatile", "while" });
15786:
15787: if (C99)
15788: add(C_KEYWORDS, new String[] { "_Bool", "_Complex",
15789: "inline", "restrict" });
15790:
15791: if (GCC)
15792: add(C_KEYWORDS, new String[] { "__alignof", "__alignof__",
15793: "asm", "__asm", "__asm__", "__attribute",
15794: "__attribute__", "__builtin_offsetof",
15795: "__builtin_types_compatible_p", "__builtin_va_arg",
15796: "__builtin_va_list", "__complex__", "__const",
15797: "__const__", "__extension__", "__inline",
15798: "__inline__", "__label__", "__restrict",
15799: "__restrict__", "__signed", "__signed__", "typeof",
15800: "__typeof", "__typeof__", "__volatile",
15801: "__volatile__" });
15802:
15803: }
15804:
15805: // =========================================================================
15806:
15807: /**
15808: * Get the text for the specified annotated token.
15809: *
15810: * @param n The annotated token.
15811: * @return The corresponding text.
15812: */
15813: protected static final String toText(Node n) {
15814: return n.getTokenText();
15815: }
15816:
15817: // =========================================================================
15818:
15819: /**
15820: * Add the specified values to the specified set.
15821: *
15822: * @param set The set.
15823: * @param values The new values.
15824: */
15825: protected static final <T> void add(Set<T> set, T[] values) {
15826: for (T v : values)
15827: set.add(v);
15828: }
15829:
15830: /**
15831: * Check whether the specified set contains the specified value.
15832: *
15833: * @param set The set.
15834: * @param value The value.
15835: * @return <code>true</code> if the set contains the value.
15836: */
15837: protected static final <T> boolean contains(Set<T> set, T value) {
15838: return set.contains(value);
15839: }
15840:
15841: }
|