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:08 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:
00023: import xtc.parser.ParserBase;
00024: import xtc.parser.Column;
00025: import xtc.parser.Result;
00026: import xtc.parser.SemanticValue;
00027: import xtc.parser.ParseError;
00028:
00029: /**
00030: * Packrat parser for grammar <code>xtc.lang.C</code>.
00031: *
00032: * <p />This class has been generated by the <i>Rats!</i> parser
00033: * generator, version 1.13.2, (C) 2004-2007 Robert Grimm.
00034: */
00035: public final class CParser extends ParserBase {
00036:
00037: /** The GCC flag. */
00038: public static final boolean GCC = true;
00039:
00040: /** The C_KEYWORDS set. */
00041: public static final Set<String> C_KEYWORDS = new HashSet<String>();
00042:
00043: /** The RELOCATE flag. */
00044: public static final boolean RELOCATE = true;
00045:
00046: /** The C99 flag. */
00047: public static final boolean C99 = true;
00048:
00049: // =========================================================================
00050:
00051: /** Chunk 1 of memoized results. */
00052: static final class Chunk1 {
00053: Result fDeclarationSpecifiers;
00054: Result fSpecifierQualifierList;
00055: Result fAttributedDeclarator;
00056: Result fDeclarator;
00057: Result fPointer;
00058: Result fVariableLength;
00059: Result fParameterTypeList;
00060: Result fAbstractDeclarator;
00061: Result fTypeName;
00062: Result fAttributeSpecifierList;
00063: }
00064:
00065: /** Chunk 2 of memoized results. */
00066: static final class Chunk2 {
00067: Result fAttributeSpecifier;
00068: Result fStatement;
00069: Result fCompoundStatement;
00070: Result fCompoundStatement$$Star1;
00071: Result fCompoundStatement$$Star2;
00072: Result fCommaExpression;
00073: Result fAssignmentExpression;
00074: Result fConditionalExpression;
00075: Result fLogicalOrExpression;
00076: Result fCastExpression;
00077: }
00078:
00079: /** Chunk 3 of memoized results. */
00080: static final class Chunk3 {
00081: Result fUnaryExpression;
00082: Result fExpressionList;
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: }
00092:
00093: /** Chunk 4 of memoized results. */
00094: static final class Chunk4 {
00095: Result fBinaryExponent;
00096: Result fCharacterLiteral;
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: }
00106:
00107: /** Chunk 5 of memoized results. */
00108: static final class Chunk5 {
00109: Result fSymbol;
00110: }
00111:
00112: // =========================================================================
00113:
00114: /** Memoization table column. */
00115: static final class CParserColumn extends Column {
00116: Chunk1 chunk1;
00117: Chunk2 chunk2;
00118: Chunk3 chunk3;
00119: Chunk4 chunk4;
00120: Chunk5 chunk5;
00121: }
00122:
00123: // =========================================================================
00124:
00125: /** The global state object. */
00126: protected final CParserState yyState;
00127:
00128: // =========================================================================
00129:
00130: /**
00131: * Create a new packrat parser.
00132: *
00133: * @param reader The reader.
00134: * @param file The file name.
00135: */
00136: public CParser(final Reader reader, final String file) {
00137: super (reader, file);
00138: yyState = new CParserState();
00139: }
00140:
00141: /**
00142: * Create a new packrat parser.
00143: *
00144: * @param reader The file reader.
00145: * @param file The file name.
00146: * @param size The file size.
00147: */
00148: public CParser(final Reader reader, final String file,
00149: final int size) {
00150: super (reader, file, size);
00151: yyState = new CParserState();
00152: }
00153:
00154: // =========================================================================
00155:
00156: protected Column newColumn() {
00157: return new CParserColumn();
00158: }
00159:
00160: // =========================================================================
00161:
00162: /**
00163: * Parse nonterminal xtc.lang.C.TranslationUnit.
00164: *
00165: * @param yyStart The index.
00166: * @return The result.
00167: * @throws IOException Signals an I/O error.
00168: */
00169: public Result pTranslationUnit(final int yyStart)
00170: throws IOException {
00171: Result yyResult;
00172: int yyRepetition1;
00173: Pair<Node> yyRepValue1;
00174: Node yyValue;
00175: ParseError yyError = ParseError.DUMMY;
00176:
00177: // Alternative <Unit>.
00178:
00179: yyResult = pPrelude(yyStart);
00180: yyError = yyResult.select(yyError);
00181: if (yyResult.hasValue()) {
00182:
00183: yyRepetition1 = yyResult.index;
00184: yyRepValue1 = Pair.empty();
00185: while (true) {
00186:
00187: yyResult = pExternalDeclaration(yyRepetition1);
00188: yyError = yyResult.select(yyError);
00189: if (yyResult.hasValue()) {
00190: final Node v$el$1 = yyResult.semanticValue();
00191:
00192: yyRepetition1 = yyResult.index;
00193: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
00194: continue;
00195: }
00196: break;
00197: }
00198: { // Start scope for v$g$1.
00199: final Pair<Node> v$g$1 = yyRepValue1.reverse();
00200:
00201: yyResult = pAnnotations(yyRepetition1);
00202: yyError = yyResult.select(yyError);
00203: if (yyResult.hasValue()) {
00204: final Node v$g$2 = yyResult.semanticValue();
00205:
00206: yyResult = pEndOfFile(yyResult.index);
00207: yyError = yyResult.select(yyError);
00208: if (yyResult.hasValue()) {
00209:
00210: yyValue = GNode.create("TranslationUnit",
00211: v$g$1.size() + 1).addAll(v$g$1).add(
00212: v$g$2);
00213: yyValue.setLocation(location(yyStart));
00214:
00215: return yyResult.createValue(yyValue, yyError);
00216: }
00217: }
00218: } // End scope for v$g$1.
00219: }
00220:
00221: // Done.
00222: return yyError;
00223: }
00224:
00225: // =========================================================================
00226:
00227: /**
00228: * Parse nonterminal xtc.lang.C.Prelude.
00229: *
00230: * @param yyStart The index.
00231: * @return The result.
00232: * @throws IOException Signals an I/O error.
00233: */
00234: public Result pPrelude(final int yyStart) throws IOException {
00235: Result yyResult;
00236: Void yyValue;
00237: ParseError yyError = ParseError.DUMMY;
00238:
00239: // Reset the global state object.
00240: yyState.reset(column(yyStart).file);
00241:
00242: // Alternative 1.
00243:
00244: yyResult = pDirective(yyStart);
00245: yyError = yyResult.select(yyError);
00246: if (yyResult.hasValue()) {
00247:
00248: yyResult = pSpacing(yyResult.index);
00249: yyError = yyResult.select(yyError);
00250: if (yyResult.hasValue()) {
00251:
00252: yyValue = null;
00253:
00254: return yyResult.createValue(yyValue, yyError);
00255: }
00256: }
00257:
00258: // Done.
00259: return yyError;
00260: }
00261:
00262: // =========================================================================
00263:
00264: /**
00265: * Parse nonterminal xtc.lang.C.ExternalDeclaration.
00266: *
00267: * @param yyStart The index.
00268: * @return The result.
00269: * @throws IOException Signals an I/O error.
00270: */
00271: public Result pExternalDeclaration(final int yyStart)
00272: throws IOException {
00273: Result yyResult;
00274: Node yyValue;
00275: ParseError yyError = ParseError.DUMMY;
00276:
00277: // Start a state modification.
00278: yyState.start();
00279:
00280: // Alternative <Declaration>.
00281:
00282: yyState.mark();
00283:
00284: yyResult = pDeclaration(yyStart);
00285: yyError = yyResult.select(yyError);
00286: if (yyResult.hasValue()) {
00287: final Node d = yyResult.semanticValue();
00288:
00289: yyValue = yyState.annotate(d);
00290:
00291: // Commit the state modification.
00292: yyState.commit();
00293:
00294: setLocation(yyValue, yyStart);
00295: return yyResult.createValue(yyValue, yyError);
00296: }
00297:
00298: // Alternative <Function>.
00299:
00300: yyResult = pFunctionDefinition(yyStart);
00301: yyError = yyResult.select(yyError);
00302: if (yyResult.hasValue()) {
00303: final Node fd = yyResult.semanticValue();
00304:
00305: yyValue = yyState.annotate(fd);
00306:
00307: // Commit the state modification.
00308: yyState.commit();
00309:
00310: setLocation(yyValue, yyStart);
00311: return yyResult.createValue(yyValue, yyError);
00312: }
00313:
00314: // Alternative <Assembly>.
00315:
00316: yyResult = pAssemblyDefinition(yyStart);
00317: yyError = yyResult.select(yyError);
00318: if (yyResult.hasValue()) {
00319: final Node a = yyResult.semanticValue();
00320:
00321: yyValue = yyState.annotate(a);
00322:
00323: // Commit the state modification.
00324: yyState.commit();
00325:
00326: setLocation(yyValue, yyStart);
00327: return yyResult.createValue(yyValue, yyError);
00328: }
00329:
00330: // Alternative <Empty>.
00331:
00332: yyResult = pEmptyDefinition(yyStart);
00333: yyError = yyResult.select(yyError);
00334: if (yyResult.hasValue()) {
00335: final Node e = yyResult.semanticValue();
00336:
00337: yyValue = yyState.annotate(e);
00338:
00339: // Commit the state modification.
00340: yyState.commit();
00341:
00342: setLocation(yyValue, yyStart);
00343: return yyResult.createValue(yyValue, yyError);
00344: }
00345:
00346: // Abort the state modification.
00347: yyState.abort();
00348:
00349: // Done.
00350: return yyError;
00351: }
00352:
00353: // =========================================================================
00354:
00355: /**
00356: * Parse nonterminal xtc.lang.C.FunctionDefinition.
00357: *
00358: * @param yyStart The index.
00359: * @return The result.
00360: * @throws IOException Signals an I/O error.
00361: */
00362: private Result pFunctionDefinition(final int yyStart)
00363: throws IOException {
00364: Result yyResult;
00365: int yyBase;
00366: int yyOption1;
00367: Object yyOpValue1;
00368: Node yyValue;
00369: ParseError yyError = ParseError.DUMMY;
00370:
00371: // Alternative <Definition>.
00372:
00373: yyOption1 = yyStart;
00374: yyOpValue1 = null;
00375:
00376: yyBase = yyOption1;
00377: yyResult = pKeyword(yyBase);
00378: yyError = yyResult.select(yyError);
00379: if (yyResult.hasValue("__extension__")) {
00380: final String v$el$1 = "__extension__";
00381:
00382: yyOption1 = yyResult.index;
00383: yyOpValue1 = v$el$1;
00384: } else {
00385: yyError = yyError.select("\"__extension__\" expected",
00386: yyBase);
00387: }
00388: { // Start scope for v$g$1.
00389: final String v$g$1 = cast(yyOpValue1);
00390:
00391: yyOpValue1 = null;
00392:
00393: yyResult = pDeclarationSpecifiers(yyOption1);
00394: yyError = yyResult.select(yyError);
00395: if (yyResult.hasValue()) {
00396: final Node v$el$2 = yyResult.semanticValue();
00397:
00398: yyOption1 = yyResult.index;
00399: yyOpValue1 = v$el$2;
00400: }
00401: { // Start scope for v$g$2.
00402: final Node v$g$2 = cast(yyOpValue1);
00403:
00404: yyResult = pDeclarator(yyOption1);
00405: yyError = yyResult.select(yyError);
00406: if (yyResult.hasValue()) {
00407: final Node v$g$3 = yyResult.semanticValue();
00408:
00409: yyResult = pFunctionDeclaratorContext(yyResult.index);
00410: yyError = yyResult.select(yyError);
00411: if (yyResult.hasValue()) {
00412:
00413: yyOption1 = yyResult.index;
00414: yyOpValue1 = null;
00415:
00416: yyResult = pDeclarationList(yyOption1);
00417: yyError = yyResult.select(yyError);
00418: if (yyResult.hasValue()) {
00419: final Node v$el$3 = yyResult
00420: .semanticValue();
00421:
00422: yyOption1 = yyResult.index;
00423: yyOpValue1 = v$el$3;
00424: }
00425: { // Start scope for v$g$4.
00426: final Node v$g$4 = cast(yyOpValue1);
00427:
00428: yyResult = pCompoundStatement(yyOption1);
00429: yyError = yyResult.select(yyError);
00430: if (yyResult.hasValue()) {
00431: final Node v$g$5 = yyResult
00432: .semanticValue();
00433:
00434: yyValue = GNode.create(
00435: "FunctionDefinition", v$g$1,
00436: v$g$2, v$g$3, v$g$4, v$g$5);
00437: yyValue.setLocation(location(yyStart));
00438:
00439: return yyResult.createValue(yyValue,
00440: yyError);
00441: }
00442: } // End scope for v$g$4.
00443: }
00444: }
00445: } // End scope for v$g$2.
00446: } // End scope for v$g$1.
00447:
00448: // Done.
00449: return yyError;
00450: }
00451:
00452: // =========================================================================
00453:
00454: /**
00455: * Parse nonterminal xtc.lang.C.DeclarationList.
00456: *
00457: * @param yyStart The index.
00458: * @return The result.
00459: * @throws IOException Signals an I/O error.
00460: */
00461: private Result pDeclarationList(final int yyStart)
00462: throws IOException {
00463: Result yyResult;
00464: int yyRepetition1;
00465: boolean yyRepeated1;
00466: Pair<Node> yyRepValue1;
00467: Node yyValue;
00468: ParseError yyError = ParseError.DUMMY;
00469:
00470: // Alternative <List>.
00471:
00472: yyRepetition1 = yyStart;
00473: yyRepeated1 = false;
00474: yyRepValue1 = Pair.empty();
00475: while (true) {
00476:
00477: yyResult = pDeclarationListEntry(yyRepetition1);
00478: yyError = yyResult.select(yyError);
00479: if (yyResult.hasValue()) {
00480: final Node v$el$1 = yyResult.semanticValue();
00481:
00482: yyRepetition1 = yyResult.index;
00483: yyRepeated1 = true;
00484: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
00485: continue;
00486: }
00487: break;
00488: }
00489:
00490: if (yyRepeated1) {
00491: final Pair<Node> v$g$1 = yyRepValue1.reverse();
00492:
00493: yyValue = GNode.createFromPair("DeclarationList", v$g$1);
00494: yyValue.setLocation(location(yyStart));
00495:
00496: return new SemanticValue(yyValue, yyRepetition1, yyError);
00497: }
00498:
00499: // Done.
00500: return yyError;
00501: }
00502:
00503: // =========================================================================
00504:
00505: /**
00506: * Parse nonterminal xtc.lang.C.DeclarationListEntry.
00507: *
00508: * @param yyStart The index.
00509: * @return The result.
00510: * @throws IOException Signals an I/O error.
00511: */
00512: private Result pDeclarationListEntry(final int yyStart)
00513: throws IOException {
00514: Result yyResult;
00515: Node yyValue;
00516: ParseError yyError = ParseError.DUMMY;
00517:
00518: // Start a state modification.
00519: yyState.start();
00520:
00521: // Alternative <Entry>.
00522:
00523: yyResult = pDeclaration(yyStart);
00524: yyError = yyResult.select(yyError);
00525: if (yyResult.hasValue()) {
00526: yyValue = yyResult.semanticValue();
00527:
00528: // Commit the state modification.
00529: yyState.commit();
00530:
00531: return yyResult.createValue(yyValue, yyError);
00532: }
00533:
00534: // Abort the state modification.
00535: yyState.abort();
00536:
00537: // Done.
00538: return yyError;
00539: }
00540:
00541: // =========================================================================
00542:
00543: /**
00544: * Parse nonterminal xtc.lang.C.EmptyDefinition.
00545: *
00546: * @param yyStart The index.
00547: * @return The result.
00548: * @throws IOException Signals an I/O error.
00549: */
00550: private Result pEmptyDefinition(final int yyStart)
00551: throws IOException {
00552: Result yyResult;
00553: Node yyValue;
00554: ParseError yyError = ParseError.DUMMY;
00555:
00556: // Alternative 1.
00557:
00558: yyResult = pSymbol(yyStart);
00559: yyError = yyResult.select(yyError);
00560: if (yyResult.hasValue(";")) {
00561:
00562: yyValue = GNode.create("EmptyDefinition", false);
00563: yyValue.setLocation(location(yyStart));
00564:
00565: return yyResult.createValue(yyValue, yyError);
00566: }
00567:
00568: // Done.
00569: yyError = yyError.select("empty definition expected", yyStart);
00570: return yyError;
00571: }
00572:
00573: // =========================================================================
00574:
00575: /**
00576: * Parse nonterminal xtc.lang.C.Annotations.
00577: *
00578: * @param yyStart The index.
00579: * @return The result.
00580: * @throws IOException Signals an I/O error.
00581: */
00582: public Result pAnnotations(final int yyStart) throws IOException {
00583: Node yyValue;
00584: ParseError yyError = ParseError.DUMMY;
00585:
00586: // Start a state modification.
00587: yyState.start();
00588:
00589: // Alternative 1.
00590:
00591: yyState.mark();
00592: yyValue = yyState.annotate(null);
00593:
00594: // Commit the state modification.
00595: yyState.commit();
00596:
00597: setLocation(yyValue, yyStart);
00598: return new SemanticValue(yyValue, yyStart, yyError);
00599: }
00600:
00601: // =========================================================================
00602:
00603: /**
00604: * Parse nonterminal xtc.lang.C.Declaration.
00605: *
00606: * @param yyStart The index.
00607: * @return The result.
00608: * @throws IOException Signals an I/O error.
00609: */
00610: private Result pDeclaration(final int yyStart) throws IOException {
00611: Result yyResult;
00612: int yyBase;
00613: int yyOption1;
00614: Object yyOpValue1;
00615: Node yyValue;
00616: ParseError yyError = ParseError.DUMMY;
00617:
00618: // Alternative 1.
00619:
00620: yyOption1 = yyStart;
00621: yyOpValue1 = null;
00622:
00623: yyBase = yyOption1;
00624: yyResult = pKeyword(yyBase);
00625: yyError = yyResult.select(yyError);
00626: if (yyResult.hasValue("__extension__")) {
00627: final String v$el$1 = "__extension__";
00628:
00629: yyOption1 = yyResult.index;
00630: yyOpValue1 = v$el$1;
00631: } else {
00632: yyError = yyError.select("\"__extension__\" expected",
00633: yyBase);
00634: }
00635: { // Start scope for v$g$1.
00636: final String v$g$1 = cast(yyOpValue1);
00637:
00638: yyResult = pDeclarationSpecifiers(yyOption1);
00639: yyError = yyResult.select(yyError);
00640: if (yyResult.hasValue()) {
00641: final Node v$g$2 = yyResult.semanticValue();
00642:
00643: yyOption1 = yyResult.index;
00644: yyOpValue1 = null;
00645:
00646: yyResult = pInitializedDeclaratorList(yyOption1);
00647: yyError = yyResult.select(yyError);
00648: if (yyResult.hasValue()) {
00649: final Node v$el$2 = yyResult.semanticValue();
00650:
00651: yyOption1 = yyResult.index;
00652: yyOpValue1 = v$el$2;
00653: }
00654: { // Start scope for l.
00655: final Node l = cast(yyOpValue1);
00656:
00657: if (yyState.isValid(l)) {
00658:
00659: yyBase = yyOption1;
00660: yyResult = pSymbol(yyBase);
00661: yyError = yyResult.select(yyError);
00662: if (yyResult.hasValue(";")) {
00663:
00664: yyValue = GNode.create("Declaration",
00665: v$g$1, v$g$2, l);
00666: yyValue.setLocation(location(yyStart));
00667:
00668: return yyResult.createValue(yyValue,
00669: yyError);
00670: } else {
00671: yyError = yyError.select("\";\" expected",
00672: yyBase);
00673: }
00674: }
00675: } // End scope for l.
00676: }
00677: } // End scope for v$g$1.
00678:
00679: // Done.
00680: yyError = yyError.select("declaration expected", yyStart);
00681: return yyError;
00682: }
00683:
00684: // =========================================================================
00685:
00686: /**
00687: * Parse nonterminal xtc.lang.C.DeclarationSpecifiers.
00688: *
00689: * @param yyStart The index.
00690: * @return The result.
00691: * @throws IOException Signals an I/O error.
00692: */
00693: private Result pDeclarationSpecifiers(final int yyStart)
00694: throws IOException {
00695:
00696: CParserColumn yyColumn = (CParserColumn) column(yyStart);
00697: if (null == yyColumn.chunk1)
00698: yyColumn.chunk1 = new Chunk1();
00699: if (null == yyColumn.chunk1.fDeclarationSpecifiers)
00700: yyColumn.chunk1.fDeclarationSpecifiers = pDeclarationSpecifiers$1(yyStart);
00701: return yyColumn.chunk1.fDeclarationSpecifiers;
00702: }
00703:
00704: /** Actually parse xtc.lang.C.DeclarationSpecifiers. */
00705: private Result pDeclarationSpecifiers$1(final int yyStart)
00706: throws IOException {
00707:
00708: Result yyResult;
00709: Node yyValue;
00710: ParseError yyError = ParseError.DUMMY;
00711:
00712: // Alternative 1.
00713:
00714: yyResult = pDeclarationSpecifierPlus(yyStart);
00715: yyError = yyResult.select(yyError);
00716: if (yyResult.hasValue()) {
00717: final Pair<Node> v$g$1 = yyResult.semanticValue();
00718:
00719: yyValue = GNode.createFromPair("DeclarationSpecifiers",
00720: v$g$1);
00721: yyValue.setLocation(location(yyStart));
00722:
00723: return yyResult.createValue(yyValue, yyError);
00724: }
00725:
00726: // Done.
00727: return yyError;
00728: }
00729:
00730: // =========================================================================
00731:
00732: /**
00733: * Parse nonterminal xtc.lang.C.DeclarationSpecifierPlus.
00734: *
00735: * @param yyStart The index.
00736: * @return The result.
00737: * @throws IOException Signals an I/O error.
00738: */
00739: private Result pDeclarationSpecifierPlus(final int yyStart)
00740: throws IOException {
00741:
00742: Result yyResult;
00743: int yyRepetition1;
00744: boolean yyRepeated1;
00745: Pair<Node> yyRepValue1;
00746: Pair<Node> yyValue;
00747: ParseError yyError = ParseError.DUMMY;
00748:
00749: // Alternative 1.
00750:
00751: yyRepetition1 = yyStart;
00752: yyRepeated1 = false;
00753: yyRepValue1 = Pair.empty();
00754: while (true) {
00755:
00756: yyResult = pDeclarationSpecifier(yyRepetition1);
00757: yyError = yyResult.select(yyError);
00758: if (yyResult.hasValue()) {
00759: final Node v$el$1 = yyResult.semanticValue();
00760:
00761: yyRepetition1 = yyResult.index;
00762: yyRepeated1 = true;
00763: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
00764: continue;
00765: }
00766: break;
00767: }
00768:
00769: if (yyRepeated1) {
00770: yyValue = yyRepValue1.reverse();
00771:
00772: return new SemanticValue(yyValue, yyRepetition1, yyError);
00773: }
00774:
00775: // Done.
00776: return yyError;
00777: }
00778:
00779: // =========================================================================
00780:
00781: /**
00782: * Parse nonterminal xtc.lang.C.DeclarationSpecifier.
00783: *
00784: * @param yyStart The index.
00785: * @return The result.
00786: * @throws IOException Signals an I/O error.
00787: */
00788: private Result pDeclarationSpecifier(final int yyStart)
00789: throws IOException {
00790: Result yyResult;
00791: Node yyValue;
00792: ParseError yyError = ParseError.DUMMY;
00793:
00794: // Alternative <StorageClass>.
00795:
00796: yyResult = pStorageClassSpecifier(yyStart);
00797: yyError = yyResult.select(yyError);
00798: if (yyResult.hasValue()) {
00799: yyValue = yyResult.semanticValue();
00800:
00801: return yyResult.createValue(yyValue, yyError);
00802: }
00803:
00804: // Alternative <TypeSpecifier>.
00805:
00806: yyResult = pTypeSpecifier(yyStart);
00807: yyError = yyResult.select(yyError);
00808: if (yyResult.hasValue()) {
00809: yyValue = yyResult.semanticValue();
00810:
00811: yyResult = pTypeSpecContext(yyResult.index);
00812: yyError = yyResult.select(yyError);
00813: if (yyResult.hasValue()) {
00814:
00815: return yyResult.createValue(yyValue, yyError);
00816: }
00817: }
00818:
00819: // Alternative <TypeQualifier>.
00820:
00821: yyResult = pTypeQualifier(yyStart);
00822: yyError = yyResult.select(yyError);
00823: if (yyResult.hasValue()) {
00824: yyValue = yyResult.semanticValue();
00825:
00826: return yyResult.createValue(yyValue, yyError);
00827: }
00828:
00829: // Alternative 4.
00830:
00831: yyResult = pKeyword(yyStart);
00832: yyError = yyResult.select(yyError);
00833: if (yyResult.hasValue("inline")) {
00834: final String v$g$1 = "inline";
00835:
00836: yyValue = GNode.create("FunctionSpecifier", v$g$1);
00837: yyValue.setLocation(location(yyStart));
00838:
00839: return yyResult.createValue(yyValue, yyError);
00840: }
00841:
00842: // Alternative 5.
00843:
00844: yyResult = pKeyword(yyStart);
00845: yyError = yyResult.select(yyError);
00846: if (yyResult.hasValue("__inline")) {
00847: final String v$g$2 = "__inline";
00848:
00849: yyValue = GNode.create("FunctionSpecifier", v$g$2);
00850: yyValue.setLocation(location(yyStart));
00851:
00852: return yyResult.createValue(yyValue, yyError);
00853: }
00854:
00855: // Alternative 6.
00856:
00857: yyResult = pKeyword(yyStart);
00858: yyError = yyResult.select(yyError);
00859: if (yyResult.hasValue("__inline__")) {
00860: final String v$g$3 = "__inline__";
00861:
00862: yyValue = GNode.create("FunctionSpecifier", v$g$3);
00863: yyValue.setLocation(location(yyStart));
00864:
00865: return yyResult.createValue(yyValue, yyError);
00866: }
00867:
00868: // Alternative <Attribute>.
00869:
00870: yyResult = pAttributeSpecifier(yyStart);
00871: yyError = yyResult.select(yyError);
00872: if (yyResult.hasValue()) {
00873: yyValue = yyResult.semanticValue();
00874:
00875: return yyResult.createValue(yyValue, yyError);
00876: }
00877:
00878: // Done.
00879: yyError = yyError.select("declaration specifier expected",
00880: yyStart);
00881: return yyError;
00882: }
00883:
00884: // =========================================================================
00885:
00886: /**
00887: * Parse nonterminal xtc.lang.C.InitializedDeclaratorList.
00888: *
00889: * @param yyStart The index.
00890: * @return The result.
00891: * @throws IOException Signals an I/O error.
00892: */
00893: private Result pInitializedDeclaratorList(final int yyStart)
00894: throws IOException {
00895:
00896: Result yyResult;
00897: int yyBase;
00898: int yyRepetition1;
00899: Pair<Node> yyRepValue1;
00900: Node yyValue;
00901: ParseError yyError = ParseError.DUMMY;
00902:
00903: // Alternative <List>.
00904:
00905: yyResult = pInitializedDeclarator(yyStart);
00906: yyError = yyResult.select(yyError);
00907: if (yyResult.hasValue()) {
00908: final Node v$g$1 = yyResult.semanticValue();
00909:
00910: yyRepetition1 = yyResult.index;
00911: yyRepValue1 = Pair.empty();
00912: while (true) {
00913:
00914: yyBase = yyRepetition1;
00915: yyResult = pSymbol(yyBase);
00916: yyError = yyResult.select(yyError);
00917: if (yyResult.hasValue(",")) {
00918:
00919: yyResult = pInitializedDeclarator(yyResult.index);
00920: yyError = yyResult.select(yyError);
00921: if (yyResult.hasValue()) {
00922: final Node v$el$1 = yyResult.semanticValue();
00923:
00924: yyRepetition1 = yyResult.index;
00925: yyRepValue1 = new Pair<Node>(v$el$1,
00926: yyRepValue1);
00927: continue;
00928: }
00929: } else {
00930: yyError = yyError.select("\",\" expected", yyBase);
00931: }
00932: break;
00933: }
00934: { // Start scope for v$g$2.
00935: final Pair<Node> v$g$2 = yyRepValue1.reverse();
00936:
00937: yyValue = GNode.createFromPair(
00938: "InitializedDeclaratorList", v$g$1, v$g$2);
00939: yyValue.setLocation(location(yyStart));
00940:
00941: return new SemanticValue(yyValue, yyRepetition1,
00942: yyError);
00943: } // End scope for v$g$2.
00944: }
00945:
00946: // Done.
00947: return yyError;
00948: }
00949:
00950: // =========================================================================
00951:
00952: /**
00953: * Parse nonterminal xtc.lang.C.InitializedDeclarator.
00954: *
00955: * @param yyStart The index.
00956: * @return The result.
00957: * @throws IOException Signals an I/O error.
00958: */
00959: private Result pInitializedDeclarator(final int yyStart)
00960: throws IOException {
00961:
00962: Result yyResult;
00963: int yyBase;
00964: int yyOption1;
00965: Node yyOpValue1;
00966: Node yyValue;
00967: ParseError yyError = ParseError.DUMMY;
00968:
00969: // Alternative 1.
00970:
00971: yyOption1 = yyStart;
00972: yyOpValue1 = null;
00973:
00974: yyResult = pAttributeSpecifierList(yyOption1);
00975: yyError = yyResult.select(yyError);
00976: if (yyResult.hasValue()) {
00977: final Node v$el$1 = yyResult.semanticValue();
00978:
00979: yyOption1 = yyResult.index;
00980: yyOpValue1 = v$el$1;
00981: }
00982: { // Start scope for v$g$1.
00983: final Node v$g$1 = yyOpValue1;
00984:
00985: yyResult = pDeclarator(yyOption1);
00986: yyError = yyResult.select(yyError);
00987: if (yyResult.hasValue()) {
00988: final Node v$g$2 = yyResult.semanticValue();
00989:
00990: yyOption1 = yyResult.index;
00991: yyOpValue1 = null;
00992:
00993: yyResult = pSimpleAssemblyExpression(yyOption1);
00994: yyError = yyResult.select(yyError);
00995: if (yyResult.hasValue()) {
00996: final Node v$el$2 = yyResult.semanticValue();
00997:
00998: yyOption1 = yyResult.index;
00999: yyOpValue1 = v$el$2;
01000: }
01001: { // Start scope for v$g$3.
01002: final Node v$g$3 = yyOpValue1;
01003:
01004: yyOpValue1 = null;
01005:
01006: yyResult = pAttributeSpecifierList(yyOption1);
01007: yyError = yyResult.select(yyError);
01008: if (yyResult.hasValue()) {
01009: final Node v$el$3 = yyResult.semanticValue();
01010:
01011: yyOption1 = yyResult.index;
01012: yyOpValue1 = v$el$3;
01013: }
01014: { // Start scope for v$g$4.
01015: final Node v$g$4 = yyOpValue1;
01016:
01017: yyOpValue1 = null;
01018:
01019: yyBase = yyOption1;
01020: yyResult = pSymbol(yyBase);
01021: yyError = yyResult.select(yyError);
01022: if (yyResult.hasValue("=")) {
01023:
01024: yyResult = pInitializer(yyResult.index);
01025: yyError = yyResult.select(yyError);
01026: if (yyResult.hasValue()) {
01027: final Node v$el$4 = yyResult
01028: .semanticValue();
01029:
01030: yyOption1 = yyResult.index;
01031: yyOpValue1 = v$el$4;
01032: }
01033: } else {
01034: yyError = yyError.select("\"=\" expected",
01035: yyBase);
01036: }
01037: { // Start scope for v$g$5.
01038: final Node v$g$5 = yyOpValue1;
01039:
01040: yyValue = GNode.create(
01041: "InitializedDeclarator", v$g$1,
01042: v$g$2, v$g$3, v$g$4, v$g$5);
01043: yyValue.setLocation(location(yyStart));
01044:
01045: return new SemanticValue(yyValue,
01046: yyOption1, yyError);
01047: } // End scope for v$g$5.
01048: } // End scope for v$g$4.
01049: } // End scope for v$g$3.
01050: }
01051: } // End scope for v$g$1.
01052:
01053: // Done.
01054: return yyError;
01055: }
01056:
01057: // =========================================================================
01058:
01059: /**
01060: * Parse nonterminal xtc.lang.C.StorageClassSpecifier.
01061: *
01062: * @param yyStart The index.
01063: * @return The result.
01064: * @throws IOException Signals an I/O error.
01065: */
01066: private Result pStorageClassSpecifier(final int yyStart)
01067: throws IOException {
01068:
01069: Result yyResult;
01070: Node yyValue;
01071: ParseError yyError = ParseError.DUMMY;
01072:
01073: // Alternative 1.
01074:
01075: yyResult = pKeyword(yyStart);
01076: yyError = yyResult.select(yyError);
01077: if (yyResult.hasValue("auto")) {
01078:
01079: yyValue = GNode.create("AutoSpecifier", false);
01080: yyValue.setLocation(location(yyStart));
01081:
01082: return yyResult.createValue(yyValue, yyError);
01083: }
01084:
01085: // Alternative 2.
01086:
01087: yyResult = pKeyword(yyStart);
01088: yyError = yyResult.select(yyError);
01089: if (yyResult.hasValue("extern")) {
01090:
01091: yyValue = GNode.create("ExternSpecifier", false);
01092: yyValue.setLocation(location(yyStart));
01093:
01094: return yyResult.createValue(yyValue, yyError);
01095: }
01096:
01097: // Alternative 3.
01098:
01099: yyResult = pKeyword(yyStart);
01100: yyError = yyResult.select(yyError);
01101: if (yyResult.hasValue("register")) {
01102:
01103: yyValue = GNode.create("RegisterSpecifier", false);
01104: yyValue.setLocation(location(yyStart));
01105:
01106: return yyResult.createValue(yyValue, yyError);
01107: }
01108:
01109: // Alternative 4.
01110:
01111: yyResult = pKeyword(yyStart);
01112: yyError = yyResult.select(yyError);
01113: if (yyResult.hasValue("static")) {
01114:
01115: yyValue = GNode.create("StaticSpecifier", false);
01116: yyValue.setLocation(location(yyStart));
01117:
01118: return yyResult.createValue(yyValue, yyError);
01119: }
01120:
01121: // Alternative 5.
01122:
01123: yyResult = pKeyword(yyStart);
01124: yyError = yyResult.select(yyError);
01125: if (yyResult.hasValue("typedef")) {
01126:
01127: yyResult = pTypedefContext(yyResult.index);
01128: yyError = yyResult.select(yyError);
01129: if (yyResult.hasValue()) {
01130:
01131: yyValue = GNode.create("TypedefSpecifier", false);
01132: yyValue.setLocation(location(yyStart));
01133:
01134: return yyResult.createValue(yyValue, yyError);
01135: }
01136: }
01137:
01138: // Done.
01139: yyError = yyError.select("storage class specifier expected",
01140: yyStart);
01141: return yyError;
01142: }
01143:
01144: // =========================================================================
01145:
01146: /**
01147: * Parse nonterminal xtc.lang.C.TypeQualifier.
01148: *
01149: * @param yyStart The index.
01150: * @return The result.
01151: * @throws IOException Signals an I/O error.
01152: */
01153: private Result pTypeQualifier(final int yyStart) throws IOException {
01154: Result yyResult;
01155: Node yyValue;
01156: ParseError yyError = ParseError.DUMMY;
01157:
01158: // Alternative 1.
01159:
01160: yyResult = pKeyword(yyStart);
01161: yyError = yyResult.select(yyError);
01162: if (yyResult.hasValue("volatile")) {
01163: final String v$g$1 = "volatile";
01164:
01165: yyValue = GNode.create("VolatileQualifier", v$g$1);
01166: yyValue.setLocation(location(yyStart));
01167:
01168: return yyResult.createValue(yyValue, yyError);
01169: }
01170:
01171: // Alternative 2.
01172:
01173: yyResult = pKeyword(yyStart);
01174: yyError = yyResult.select(yyError);
01175: if (yyResult.hasValue("__volatile")) {
01176: final String v$g$2 = "__volatile";
01177:
01178: yyValue = GNode.create("VolatileQualifier", v$g$2);
01179: yyValue.setLocation(location(yyStart));
01180:
01181: return yyResult.createValue(yyValue, yyError);
01182: }
01183:
01184: // Alternative 3.
01185:
01186: yyResult = pKeyword(yyStart);
01187: yyError = yyResult.select(yyError);
01188: if (yyResult.hasValue("__volatile__")) {
01189: final String v$g$3 = "__volatile__";
01190:
01191: yyValue = GNode.create("VolatileQualifier", v$g$3);
01192: yyValue.setLocation(location(yyStart));
01193:
01194: return yyResult.createValue(yyValue, yyError);
01195: }
01196:
01197: // Alternative 4.
01198:
01199: yyResult = pKeyword(yyStart);
01200: yyError = yyResult.select(yyError);
01201: if (yyResult.hasValue("const")) {
01202: final String v$g$1 = "const";
01203:
01204: yyValue = GNode.create("ConstantQualifier", v$g$1);
01205: yyValue.setLocation(location(yyStart));
01206:
01207: return yyResult.createValue(yyValue, yyError);
01208: }
01209:
01210: // Alternative 5.
01211:
01212: yyResult = pKeyword(yyStart);
01213: yyError = yyResult.select(yyError);
01214: if (yyResult.hasValue("__const")) {
01215: final String v$g$2 = "__const";
01216:
01217: yyValue = GNode.create("ConstantQualifier", v$g$2);
01218: yyValue.setLocation(location(yyStart));
01219:
01220: return yyResult.createValue(yyValue, yyError);
01221: }
01222:
01223: // Alternative 6.
01224:
01225: yyResult = pKeyword(yyStart);
01226: yyError = yyResult.select(yyError);
01227: if (yyResult.hasValue("__const__")) {
01228: final String v$g$3 = "__const__";
01229:
01230: yyValue = GNode.create("ConstantQualifier", v$g$3);
01231: yyValue.setLocation(location(yyStart));
01232:
01233: return yyResult.createValue(yyValue, yyError);
01234: }
01235:
01236: // Alternative 7.
01237:
01238: yyResult = pKeyword(yyStart);
01239: yyError = yyResult.select(yyError);
01240: if (yyResult.hasValue("restrict")) {
01241: final String v$g$1 = "restrict";
01242:
01243: yyValue = GNode.create("RestrictQualifier", v$g$1);
01244: yyValue.setLocation(location(yyStart));
01245:
01246: return yyResult.createValue(yyValue, yyError);
01247: }
01248:
01249: // Alternative 8.
01250:
01251: yyResult = pKeyword(yyStart);
01252: yyError = yyResult.select(yyError);
01253: if (yyResult.hasValue("__restrict")) {
01254: final String v$g$2 = "__restrict";
01255:
01256: yyValue = GNode.create("RestrictQualifier", v$g$2);
01257: yyValue.setLocation(location(yyStart));
01258:
01259: return yyResult.createValue(yyValue, yyError);
01260: }
01261:
01262: // Alternative 9.
01263:
01264: yyResult = pKeyword(yyStart);
01265: yyError = yyResult.select(yyError);
01266: if (yyResult.hasValue("__restrict__")) {
01267: final String v$g$3 = "__restrict__";
01268:
01269: yyValue = GNode.create("RestrictQualifier", v$g$3);
01270: yyValue.setLocation(location(yyStart));
01271:
01272: return yyResult.createValue(yyValue, yyError);
01273: }
01274:
01275: // Done.
01276: yyError = yyError.select("type qualifier expected", yyStart);
01277: return yyError;
01278: }
01279:
01280: // =========================================================================
01281:
01282: /**
01283: * Parse nonterminal xtc.lang.C.TypeSpecifier.
01284: *
01285: * @param yyStart The index.
01286: * @return The result.
01287: * @throws IOException Signals an I/O error.
01288: */
01289: private Result pTypeSpecifier(final int yyStart) throws IOException {
01290: Result yyResult;
01291: int yyBase;
01292: Node yyValue;
01293: ParseError yyError = ParseError.DUMMY;
01294:
01295: // Alternative <Enumeration>.
01296:
01297: yyResult = pEnumerationTypeSpecifier(yyStart);
01298: yyError = yyResult.select(yyError);
01299: if (yyResult.hasValue()) {
01300: yyValue = yyResult.semanticValue();
01301:
01302: return yyResult.createValue(yyValue, yyError);
01303: }
01304:
01305: // Alternative <Structure>.
01306:
01307: yyResult = pStructureTypeSpecifier(yyStart);
01308: yyError = yyResult.select(yyError);
01309: if (yyResult.hasValue()) {
01310: yyValue = yyResult.semanticValue();
01311:
01312: return yyResult.createValue(yyValue, yyError);
01313: }
01314:
01315: // Alternative <Union>.
01316:
01317: yyResult = pUnionTypeSpecifier(yyStart);
01318: yyError = yyResult.select(yyError);
01319: if (yyResult.hasValue()) {
01320: yyValue = yyResult.semanticValue();
01321:
01322: return yyResult.createValue(yyValue, yyError);
01323: }
01324:
01325: // Alternative <Floating>.
01326:
01327: yyResult = pFloatingPointTypeSpecifier(yyStart);
01328: yyError = yyResult.select(yyError);
01329: if (yyResult.hasValue()) {
01330: yyValue = yyResult.semanticValue();
01331:
01332: return yyResult.createValue(yyValue, yyError);
01333: }
01334:
01335: // Alternative <Integer>.
01336:
01337: yyResult = pIntegerTypeSpecifier(yyStart);
01338: yyError = yyResult.select(yyError);
01339: if (yyResult.hasValue()) {
01340: yyValue = yyResult.semanticValue();
01341:
01342: return yyResult.createValue(yyValue, yyError);
01343: }
01344:
01345: // Alternative 6.
01346:
01347: yyResult = pIdentifier(yyStart);
01348: yyError = yyResult.select(yyError);
01349: if (yyResult.hasValue()) {
01350: final String id = yyResult.semanticValue();
01351:
01352: if (yyState.isType(toText(id))) {
01353:
01354: yyValue = GNode.create("TypedefName", id);
01355: yyValue.setLocation(location(yyStart));
01356:
01357: return yyResult.createValue(yyValue, yyError);
01358: }
01359: }
01360:
01361: // Alternative 7.
01362:
01363: yyResult = pTypeofKeyword(yyStart);
01364: yyError = yyResult.select(yyError);
01365: if (yyResult.hasValue()) {
01366:
01367: yyBase = yyResult.index;
01368: yyResult = pSymbol(yyBase);
01369: yyError = yyResult.select(yyError);
01370: if (yyResult.hasValue("(")) {
01371:
01372: final int yyChoice1 = yyResult.index;
01373:
01374: // Nested alternative 1.
01375:
01376: yyResult = pTypeName(yyChoice1);
01377: yyError = yyResult.select(yyError);
01378: if (yyResult.hasValue()) {
01379: final Node v$g$1 = yyResult.semanticValue();
01380:
01381: yyBase = yyResult.index;
01382: yyResult = pSymbol(yyBase);
01383: yyError = yyResult.select(yyError);
01384: if (yyResult.hasValue(")")) {
01385:
01386: yyValue = GNode
01387: .create("TypeofSpecifier", v$g$1);
01388: yyValue.setLocation(location(yyStart));
01389:
01390: return yyResult.createValue(yyValue, yyError);
01391: } else {
01392: yyError = yyError.select("\")\" expected",
01393: yyBase);
01394: }
01395: }
01396:
01397: // Nested alternative 2.
01398:
01399: yyResult = pCommaExpression(yyChoice1);
01400: yyError = yyResult.select(yyError);
01401: if (yyResult.hasValue()) {
01402: final Node v$g$2 = yyResult.semanticValue();
01403:
01404: yyBase = yyResult.index;
01405: yyResult = pSymbol(yyBase);
01406: yyError = yyResult.select(yyError);
01407: if (yyResult.hasValue(")")) {
01408:
01409: yyValue = GNode
01410: .create("TypeofSpecifier", v$g$2);
01411: yyValue.setLocation(location(yyStart));
01412:
01413: return yyResult.createValue(yyValue, yyError);
01414: } else {
01415: yyError = yyError.select("\")\" expected",
01416: yyBase);
01417: }
01418: }
01419: } else {
01420: yyError = yyError.select("\"(\" expected", yyBase);
01421: }
01422: }
01423:
01424: // Alternative 8.
01425:
01426: yyResult = pKeyword(yyStart);
01427: yyError = yyResult.select(yyError);
01428: if (yyResult.hasValue("void")) {
01429:
01430: yyValue = GNode.create("VoidTypeSpecifier", false);
01431: yyValue.setLocation(location(yyStart));
01432:
01433: return yyResult.createValue(yyValue, yyError);
01434: }
01435:
01436: // Alternative 9.
01437:
01438: yyResult = pKeyword(yyStart);
01439: yyError = yyResult.select(yyError);
01440: if (yyResult.hasValue("__builtin_va_list")) {
01441:
01442: yyValue = GNode.create("VarArgListSpecifier", false);
01443: yyValue.setLocation(location(yyStart));
01444:
01445: return yyResult.createValue(yyValue, yyError);
01446: }
01447:
01448: // Done.
01449: yyError = yyError.select("type specifier expected", yyStart);
01450: return yyError;
01451: }
01452:
01453: // =========================================================================
01454:
01455: /**
01456: * Parse nonterminal xtc.lang.C.EnumerationTypeSpecifier.
01457: *
01458: * @param yyStart The index.
01459: * @return The result.
01460: * @throws IOException Signals an I/O error.
01461: */
01462: private Result pEnumerationTypeSpecifier(final int yyStart)
01463: throws IOException {
01464:
01465: Result yyResult;
01466: int yyBase;
01467: int yyOption1;
01468: Object yyOpValue1;
01469: Node yyValue;
01470: ParseError yyError = ParseError.DUMMY;
01471:
01472: // Alternative 1.
01473:
01474: yyResult = pKeyword(yyStart);
01475: yyError = yyResult.select(yyError);
01476: if (yyResult.hasValue("enum")) {
01477:
01478: yyOption1 = yyResult.index;
01479: yyOpValue1 = null;
01480:
01481: yyResult = pAttributeSpecifierList(yyOption1);
01482: yyError = yyResult.select(yyError);
01483: if (yyResult.hasValue()) {
01484: final Node v$el$1 = yyResult.semanticValue();
01485:
01486: yyOption1 = yyResult.index;
01487: yyOpValue1 = v$el$1;
01488: }
01489: { // Start scope for v$g$1.
01490: final Node v$g$1 = cast(yyOpValue1);
01491:
01492: final int yyChoice1 = yyOption1;
01493:
01494: // Nested alternative 1.
01495:
01496: yyOption1 = yyChoice1;
01497: yyOpValue1 = null;
01498:
01499: yyResult = pIdentifier(yyOption1);
01500: yyError = yyResult.select(yyError);
01501: if (yyResult.hasValue()) {
01502: final String v$el$2 = yyResult.semanticValue();
01503:
01504: yyOption1 = yyResult.index;
01505: yyOpValue1 = v$el$2;
01506: }
01507: { // Start scope for v$g$2.
01508: final String v$g$2 = cast(yyOpValue1);
01509:
01510: yyBase = yyOption1;
01511: yyResult = pSymbol(yyBase);
01512: yyError = yyResult.select(yyError);
01513: if (yyResult.hasValue("{")) {
01514:
01515: yyResult = pEnumeratorList(yyResult.index);
01516: yyError = yyResult.select(yyError);
01517: if (yyResult.hasValue()) {
01518: final Node v$g$3 = yyResult.semanticValue();
01519:
01520: yyOption1 = yyResult.index;
01521:
01522: yyBase = yyOption1;
01523: yyResult = pSymbol(yyBase);
01524: yyError = yyResult.select(yyError);
01525: if (yyResult.hasValue(",")) {
01526:
01527: yyOption1 = yyResult.index;
01528: } else {
01529: yyError = yyError.select(
01530: "\",\" expected", yyBase);
01531: }
01532:
01533: yyBase = yyOption1;
01534: yyResult = pSymbol(yyBase);
01535: yyError = yyResult.select(yyError);
01536: if (yyResult.hasValue("}")) {
01537:
01538: yyOption1 = yyResult.index;
01539: yyOpValue1 = null;
01540:
01541: yyResult = pAttributeSpecifierList(yyOption1);
01542: yyError = yyResult.select(yyError);
01543: if (yyResult.hasValue()) {
01544: final Node v$el$3 = yyResult
01545: .semanticValue();
01546:
01547: yyOption1 = yyResult.index;
01548: yyOpValue1 = v$el$3;
01549: }
01550: { // Start scope for v$g$4.
01551: final Node v$g$4 = cast(yyOpValue1);
01552:
01553: yyValue = GNode
01554: .create(
01555: "EnumerationTypeDefinition",
01556: v$g$1, v$g$2,
01557: v$g$3, v$g$4);
01558: yyValue
01559: .setLocation(location(yyStart));
01560:
01561: return new SemanticValue(yyValue,
01562: yyOption1, yyError);
01563: } // End scope for v$g$4.
01564: } else {
01565: yyError = yyError.select(
01566: "\"}\" expected", yyBase);
01567: }
01568: }
01569: } else {
01570: yyError = yyError.select("\"{\" expected",
01571: yyBase);
01572: }
01573: } // End scope for v$g$2.
01574:
01575: // Nested alternative 2.
01576:
01577: yyResult = pIdentifier(yyChoice1);
01578: yyError = yyResult.select(yyError);
01579: if (yyResult.hasValue()) {
01580: final String v$g$2 = yyResult.semanticValue();
01581:
01582: yyValue = GNode.create("EnumerationTypeReference",
01583: v$g$1, v$g$2);
01584: yyValue.setLocation(location(yyStart));
01585:
01586: return yyResult.createValue(yyValue, yyError);
01587: }
01588: } // End scope for v$g$1.
01589: }
01590:
01591: // Done.
01592: yyError = yyError.select("enumeration type specifier expected",
01593: yyStart);
01594: return yyError;
01595: }
01596:
01597: // =========================================================================
01598:
01599: /**
01600: * Parse nonterminal xtc.lang.C.EnumeratorList.
01601: *
01602: * @param yyStart The index.
01603: * @return The result.
01604: * @throws IOException Signals an I/O error.
01605: */
01606: private Result pEnumeratorList(final int yyStart)
01607: throws IOException {
01608: Result yyResult;
01609: int yyBase;
01610: int yyRepetition1;
01611: Pair<Node> yyRepValue1;
01612: Node yyValue;
01613: ParseError yyError = ParseError.DUMMY;
01614:
01615: // Alternative <List>.
01616:
01617: yyResult = pEnumerator(yyStart);
01618: yyError = yyResult.select(yyError);
01619: if (yyResult.hasValue()) {
01620: final Node v$g$1 = yyResult.semanticValue();
01621:
01622: yyRepetition1 = yyResult.index;
01623: yyRepValue1 = Pair.empty();
01624: while (true) {
01625:
01626: yyBase = yyRepetition1;
01627: yyResult = pSymbol(yyBase);
01628: yyError = yyResult.select(yyError);
01629: if (yyResult.hasValue(",")) {
01630:
01631: yyResult = pEnumerator(yyResult.index);
01632: yyError = yyResult.select(yyError);
01633: if (yyResult.hasValue()) {
01634: final Node v$el$1 = yyResult.semanticValue();
01635:
01636: yyRepetition1 = yyResult.index;
01637: yyRepValue1 = new Pair<Node>(v$el$1,
01638: yyRepValue1);
01639: continue;
01640: }
01641: } else {
01642: yyError = yyError.select("\",\" expected", yyBase);
01643: }
01644: break;
01645: }
01646: { // Start scope for v$g$2.
01647: final Pair<Node> v$g$2 = yyRepValue1.reverse();
01648:
01649: yyValue = GNode.createFromPair("EnumeratorList", v$g$1,
01650: v$g$2);
01651: yyValue.setLocation(location(yyStart));
01652:
01653: return new SemanticValue(yyValue, yyRepetition1,
01654: yyError);
01655: } // End scope for v$g$2.
01656: }
01657:
01658: // Done.
01659: return yyError;
01660: }
01661:
01662: // =========================================================================
01663:
01664: /**
01665: * Parse nonterminal xtc.lang.C.Enumerator.
01666: *
01667: * @param yyStart The index.
01668: * @return The result.
01669: * @throws IOException Signals an I/O error.
01670: */
01671: private Result pEnumerator(final int yyStart) throws IOException {
01672: Result yyResult;
01673: int yyBase;
01674: int yyOption1;
01675: Node yyOpValue1;
01676: Node yyValue;
01677: ParseError yyError = ParseError.DUMMY;
01678:
01679: // Alternative <Enumerator>.
01680:
01681: yyResult = pIdentifier(yyStart);
01682: yyError = yyResult.select(yyError);
01683: if (yyResult.hasValue()) {
01684: final String id = yyResult.semanticValue();
01685:
01686: yyState.bind(toText(id), false);
01687:
01688: yyOption1 = yyResult.index;
01689: yyOpValue1 = null;
01690:
01691: yyBase = yyOption1;
01692: yyResult = pSymbol(yyBase);
01693: yyError = yyResult.select(yyError);
01694: if (yyResult.hasValue("=")) {
01695:
01696: yyResult = pConditionalExpression(yyResult.index);
01697: yyError = yyResult.select(yyError);
01698: if (yyResult.hasValue()) {
01699: final Node v$el$1 = yyResult.semanticValue();
01700:
01701: yyOption1 = yyResult.index;
01702: yyOpValue1 = v$el$1;
01703: }
01704: } else {
01705: yyError = yyError.select("\"=\" expected", yyBase);
01706: }
01707: { // Start scope for v$g$1.
01708: final Node v$g$1 = yyOpValue1;
01709:
01710: yyValue = GNode.create("Enumerator", id, v$g$1);
01711: yyValue.setLocation(location(yyStart));
01712:
01713: return new SemanticValue(yyValue, yyOption1, yyError);
01714: } // End scope for v$g$1.
01715: }
01716:
01717: // Done.
01718: return yyError;
01719: }
01720:
01721: // =========================================================================
01722:
01723: /**
01724: * Parse nonterminal xtc.lang.C.StructureTypeSpecifier.
01725: *
01726: * @param yyStart The index.
01727: * @return The result.
01728: * @throws IOException Signals an I/O error.
01729: */
01730: private Result pStructureTypeSpecifier(final int yyStart)
01731: throws IOException {
01732:
01733: Result yyResult;
01734: int yyBase;
01735: int yyOption1;
01736: Object yyOpValue1;
01737: Node yyValue;
01738: ParseError yyError = ParseError.DUMMY;
01739:
01740: // Alternative 1.
01741:
01742: yyResult = pKeyword(yyStart);
01743: yyError = yyResult.select(yyError);
01744: if (yyResult.hasValue("struct")) {
01745:
01746: yyOption1 = yyResult.index;
01747: yyOpValue1 = null;
01748:
01749: yyResult = pAttributeSpecifierList(yyOption1);
01750: yyError = yyResult.select(yyError);
01751: if (yyResult.hasValue()) {
01752: final Node v$el$1 = yyResult.semanticValue();
01753:
01754: yyOption1 = yyResult.index;
01755: yyOpValue1 = v$el$1;
01756: }
01757: { // Start scope for v$g$1.
01758: final Node v$g$1 = cast(yyOpValue1);
01759:
01760: final int yyChoice1 = yyOption1;
01761:
01762: // Nested alternative 1.
01763:
01764: yyOption1 = yyChoice1;
01765: yyOpValue1 = null;
01766:
01767: yyResult = pIdentifier(yyOption1);
01768: yyError = yyResult.select(yyError);
01769: if (yyResult.hasValue()) {
01770: final String v$el$2 = yyResult.semanticValue();
01771:
01772: yyOption1 = yyResult.index;
01773: yyOpValue1 = v$el$2;
01774: }
01775: { // Start scope for v$g$2.
01776: final String v$g$2 = cast(yyOpValue1);
01777:
01778: yyBase = yyOption1;
01779: yyResult = pSymbol(yyBase);
01780: yyError = yyResult.select(yyError);
01781: if (yyResult.hasValue("{")) {
01782:
01783: yyResult = pPushScope(yyResult.index);
01784: yyError = yyResult.select(yyError);
01785: if (yyResult.hasValue()) {
01786:
01787: yyResult = pEnterStructure(yyResult.index);
01788: yyError = yyResult.select(yyError);
01789: if (yyResult.hasValue()) {
01790:
01791: yyResult = pStructureDeclarationList(yyResult.index);
01792: yyError = yyResult.select(yyError);
01793: if (yyResult.hasValue()) {
01794: final Node v$g$3 = yyResult
01795: .semanticValue();
01796:
01797: yyBase = yyResult.index;
01798: yyResult = pSymbol(yyBase);
01799: yyError = yyResult.select(yyError);
01800: if (yyResult.hasValue("}")) {
01801:
01802: yyResult = pExitStructure(yyResult.index);
01803: yyError = yyResult
01804: .select(yyError);
01805: if (yyResult.hasValue()) {
01806:
01807: yyResult = pPopScope(yyResult.index);
01808: yyError = yyResult
01809: .select(yyError);
01810: if (yyResult.hasValue()) {
01811:
01812: yyOption1 = yyResult.index;
01813: yyOpValue1 = null;
01814:
01815: yyResult = pAttributeSpecifierList(yyOption1);
01816: yyError = yyResult
01817: .select(yyError);
01818: if (yyResult.hasValue()) {
01819: final Node v$el$3 = yyResult
01820: .semanticValue();
01821:
01822: yyOption1 = yyResult.index;
01823: yyOpValue1 = v$el$3;
01824: }
01825: { // Start scope for v$g$4.
01826: final Node v$g$4 = cast(yyOpValue1);
01827:
01828: yyValue = GNode
01829: .create(
01830: "StructureTypeDefinition",
01831: v$g$1,
01832: v$g$2,
01833: v$g$3,
01834: v$g$4);
01835: yyValue
01836: .setLocation(location(yyStart));
01837:
01838: return new SemanticValue(
01839: yyValue,
01840: yyOption1,
01841: yyError);
01842: } // End scope for v$g$4.
01843: }
01844: }
01845: } else {
01846: yyError = yyError.select(
01847: "\"}\" expected",
01848: yyBase);
01849: }
01850: }
01851: }
01852: }
01853: } else {
01854: yyError = yyError.select("\"{\" expected",
01855: yyBase);
01856: }
01857: } // End scope for v$g$2.
01858:
01859: // Nested alternative 2.
01860:
01861: yyResult = pIdentifier(yyChoice1);
01862: yyError = yyResult.select(yyError);
01863: if (yyResult.hasValue()) {
01864: final String v$g$2 = yyResult.semanticValue();
01865:
01866: yyValue = GNode.create("StructureTypeReference",
01867: v$g$1, v$g$2);
01868: yyValue.setLocation(location(yyStart));
01869:
01870: return yyResult.createValue(yyValue, yyError);
01871: }
01872: } // End scope for v$g$1.
01873: }
01874:
01875: // Done.
01876: yyError = yyError.select("structure type specifier expected",
01877: yyStart);
01878: return yyError;
01879: }
01880:
01881: // =========================================================================
01882:
01883: /**
01884: * Parse nonterminal xtc.lang.C.UnionTypeSpecifier.
01885: *
01886: * @param yyStart The index.
01887: * @return The result.
01888: * @throws IOException Signals an I/O error.
01889: */
01890: private Result pUnionTypeSpecifier(final int yyStart)
01891: throws IOException {
01892: Result yyResult;
01893: int yyBase;
01894: int yyOption1;
01895: Object 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("union")) {
01904:
01905: yyOption1 = yyResult.index;
01906: yyOpValue1 = null;
01907:
01908: yyResult = pAttributeSpecifierList(yyOption1);
01909: yyError = yyResult.select(yyError);
01910: if (yyResult.hasValue()) {
01911: final Node v$el$1 = yyResult.semanticValue();
01912:
01913: yyOption1 = yyResult.index;
01914: yyOpValue1 = v$el$1;
01915: }
01916: { // Start scope for v$g$1.
01917: final Node v$g$1 = cast(yyOpValue1);
01918:
01919: final int yyChoice1 = yyOption1;
01920:
01921: // Nested alternative 1.
01922:
01923: yyOption1 = yyChoice1;
01924: yyOpValue1 = null;
01925:
01926: yyResult = pIdentifier(yyOption1);
01927: yyError = yyResult.select(yyError);
01928: if (yyResult.hasValue()) {
01929: final String v$el$2 = yyResult.semanticValue();
01930:
01931: yyOption1 = yyResult.index;
01932: yyOpValue1 = v$el$2;
01933: }
01934: { // Start scope for v$g$2.
01935: final String v$g$2 = cast(yyOpValue1);
01936:
01937: yyBase = yyOption1;
01938: yyResult = pSymbol(yyBase);
01939: yyError = yyResult.select(yyError);
01940: if (yyResult.hasValue("{")) {
01941:
01942: yyResult = pPushScope(yyResult.index);
01943: yyError = yyResult.select(yyError);
01944: if (yyResult.hasValue()) {
01945:
01946: yyResult = pEnterStructure(yyResult.index);
01947: yyError = yyResult.select(yyError);
01948: if (yyResult.hasValue()) {
01949:
01950: yyResult = pStructureDeclarationList(yyResult.index);
01951: yyError = yyResult.select(yyError);
01952: if (yyResult.hasValue()) {
01953: final Node v$g$3 = yyResult
01954: .semanticValue();
01955:
01956: yyBase = yyResult.index;
01957: yyResult = pSymbol(yyBase);
01958: yyError = yyResult.select(yyError);
01959: if (yyResult.hasValue("}")) {
01960:
01961: yyResult = pExitStructure(yyResult.index);
01962: yyError = yyResult
01963: .select(yyError);
01964: if (yyResult.hasValue()) {
01965:
01966: yyResult = pPopScope(yyResult.index);
01967: yyError = yyResult
01968: .select(yyError);
01969: if (yyResult.hasValue()) {
01970:
01971: yyOption1 = yyResult.index;
01972: yyOpValue1 = null;
01973:
01974: yyResult = pAttributeSpecifierList(yyOption1);
01975: yyError = yyResult
01976: .select(yyError);
01977: if (yyResult.hasValue()) {
01978: final Node v$el$3 = yyResult
01979: .semanticValue();
01980:
01981: yyOption1 = yyResult.index;
01982: yyOpValue1 = v$el$3;
01983: }
01984: { // Start scope for v$g$4.
01985: final Node v$g$4 = cast(yyOpValue1);
01986:
01987: yyValue = GNode
01988: .create(
01989: "UnionTypeDefinition",
01990: v$g$1,
01991: v$g$2,
01992: v$g$3,
01993: v$g$4);
01994: yyValue
01995: .setLocation(location(yyStart));
01996:
01997: return new SemanticValue(
01998: yyValue,
01999: yyOption1,
02000: yyError);
02001: } // End scope for v$g$4.
02002: }
02003: }
02004: } else {
02005: yyError = yyError.select(
02006: "\"}\" expected",
02007: yyBase);
02008: }
02009: }
02010: }
02011: }
02012: } else {
02013: yyError = yyError.select("\"{\" expected",
02014: yyBase);
02015: }
02016: } // End scope for v$g$2.
02017:
02018: // Nested alternative 2.
02019:
02020: yyResult = pIdentifier(yyChoice1);
02021: yyError = yyResult.select(yyError);
02022: if (yyResult.hasValue()) {
02023: final String v$g$2 = yyResult.semanticValue();
02024:
02025: yyValue = GNode.create("UnionTypeReference", v$g$1,
02026: v$g$2);
02027: yyValue.setLocation(location(yyStart));
02028:
02029: return yyResult.createValue(yyValue, yyError);
02030: }
02031: } // End scope for v$g$1.
02032: }
02033:
02034: // Done.
02035: yyError = yyError.select("union type specifier expected",
02036: yyStart);
02037: return yyError;
02038: }
02039:
02040: // =========================================================================
02041:
02042: /**
02043: * Parse nonterminal xtc.lang.C.StructureDeclarationList.
02044: *
02045: * @param yyStart The index.
02046: * @return The result.
02047: * @throws IOException Signals an I/O error.
02048: */
02049: private Result pStructureDeclarationList(final int yyStart)
02050: throws IOException {
02051:
02052: Result yyResult;
02053: int yyRepetition1;
02054: boolean yyRepeated1;
02055: Pair<Node> yyRepValue1;
02056: Node yyValue;
02057: ParseError yyError = ParseError.DUMMY;
02058:
02059: // Alternative <Regular>.
02060:
02061: yyRepetition1 = yyStart;
02062: yyRepeated1 = false;
02063: yyRepValue1 = Pair.empty();
02064: while (true) {
02065:
02066: yyResult = pAnnotatedStructureDeclaration(yyRepetition1);
02067: yyError = yyResult.select(yyError);
02068: if (yyResult.hasValue()) {
02069: final Node v$el$1 = yyResult.semanticValue();
02070:
02071: yyRepetition1 = yyResult.index;
02072: yyRepeated1 = true;
02073: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
02074: continue;
02075: }
02076: break;
02077: }
02078:
02079: if (yyRepeated1) {
02080: final Pair<Node> v$g$1 = yyRepValue1.reverse();
02081:
02082: yyResult = pAnnotations(yyRepetition1);
02083: yyError = yyResult.select(yyError);
02084: if (yyResult.hasValue()) {
02085: final Node v$g$2 = yyResult.semanticValue();
02086:
02087: yyValue = GNode.create("StructureDeclarationList",
02088: v$g$1.size() + 1).addAll(v$g$1).add(v$g$2);
02089: yyValue.setLocation(location(yyStart));
02090:
02091: return yyResult.createValue(yyValue, yyError);
02092: }
02093: }
02094:
02095: // Alternative <Empty>.
02096:
02097: if (GCC) {
02098:
02099: yyResult = pAnnotations(yyStart);
02100: yyError = yyResult.select(yyError);
02101: if (yyResult.hasValue()) {
02102: final Node v$g$3 = yyResult.semanticValue();
02103:
02104: yyValue = GNode.create("StructureDeclarationList",
02105: v$g$3);
02106: yyValue.setLocation(location(yyStart));
02107:
02108: return yyResult.createValue(yyValue, yyError);
02109: }
02110: }
02111:
02112: // Done.
02113: yyError = yyError.select("structure declaration list expected",
02114: yyStart);
02115: return yyError;
02116: }
02117:
02118: // =========================================================================
02119:
02120: /**
02121: * Parse nonterminal xtc.lang.C.AnnotatedStructureDeclaration.
02122: *
02123: * @param yyStart The index.
02124: * @return The result.
02125: * @throws IOException Signals an I/O error.
02126: */
02127: private Result pAnnotatedStructureDeclaration(final int yyStart)
02128: throws IOException {
02129:
02130: Result yyResult;
02131: Node yyValue;
02132: ParseError yyError = ParseError.DUMMY;
02133:
02134: // Start a state modification.
02135: yyState.start();
02136:
02137: // Alternative 1.
02138:
02139: yyState.mark();
02140:
02141: yyResult = pStructureDeclaration(yyStart);
02142: yyError = yyResult.select(yyError);
02143: if (yyResult.hasValue()) {
02144: final Node d = yyResult.semanticValue();
02145:
02146: yyValue = yyState.annotate(d);
02147:
02148: // Commit the state modification.
02149: yyState.commit();
02150:
02151: setLocation(yyValue, yyStart);
02152: return yyResult.createValue(yyValue, yyError);
02153: }
02154:
02155: // Abort the state modification.
02156: yyState.abort();
02157:
02158: // Done.
02159: return yyError;
02160: }
02161:
02162: // =========================================================================
02163:
02164: /**
02165: * Parse nonterminal xtc.lang.C.StructureDeclaration.
02166: *
02167: * @param yyStart The index.
02168: * @return The result.
02169: * @throws IOException Signals an I/O error.
02170: */
02171: private Result pStructureDeclaration(final int yyStart)
02172: throws IOException {
02173: Result yyResult;
02174: int yyBase;
02175: int yyRepetition1;
02176: boolean yyRepeated1;
02177: int yyOption1;
02178: String yyOpValue1;
02179: Node yyValue;
02180: ParseError yyError = ParseError.DUMMY;
02181:
02182: // Alternative <Declaration>.
02183:
02184: yyOption1 = yyStart;
02185: yyOpValue1 = null;
02186:
02187: yyBase = yyOption1;
02188: yyResult = pKeyword(yyBase);
02189: yyError = yyResult.select(yyError);
02190: if (yyResult.hasValue("__extension__")) {
02191: final String v$el$1 = "__extension__";
02192:
02193: yyOption1 = yyResult.index;
02194: yyOpValue1 = v$el$1;
02195: } else {
02196: yyError = yyError.select("\"__extension__\" expected",
02197: yyBase);
02198: }
02199: { // Start scope for v$g$1.
02200: final String v$g$1 = yyOpValue1;
02201:
02202: yyResult = pSpecifierQualifierList(yyOption1);
02203: yyError = yyResult.select(yyError);
02204: if (yyResult.hasValue()) {
02205: final Node v$g$2 = yyResult.semanticValue();
02206:
02207: yyResult = pOptionalStructureDeclaratorList(yyResult.index);
02208: yyError = yyResult.select(yyError);
02209: if (yyResult.hasValue()) {
02210: final Node v$g$3 = yyResult.semanticValue();
02211:
02212: yyBase = yyResult.index;
02213: yyResult = pSymbol(yyBase);
02214: yyError = yyResult.select(yyError);
02215: if (yyResult.hasValue(";")) {
02216:
02217: yyOption1 = yyResult.index;
02218:
02219: if (GCC) {
02220:
02221: yyRepetition1 = yyOption1;
02222: yyRepeated1 = false;
02223: while (true) {
02224:
02225: yyBase = yyRepetition1;
02226: yyResult = pSymbol(yyBase);
02227: yyError = yyResult.select(yyError);
02228: if (yyResult.hasValue(";")) {
02229:
02230: yyRepetition1 = yyResult.index;
02231: yyRepeated1 = true;
02232: continue;
02233: } else {
02234: yyError = yyError.select(
02235: "\";\" expected", yyBase);
02236: }
02237: break;
02238: }
02239:
02240: if (yyRepeated1) {
02241:
02242: yyOption1 = yyRepetition1;
02243: }
02244: }
02245:
02246: yyValue = GNode.create("StructureDeclaration",
02247: v$g$1, v$g$2, v$g$3);
02248: yyValue.setLocation(location(yyStart));
02249:
02250: return new SemanticValue(yyValue, yyOption1,
02251: yyError);
02252: } else {
02253: yyError = yyError.select("\";\" expected",
02254: yyBase);
02255: }
02256: }
02257: }
02258: } // End scope for v$g$1.
02259:
02260: // Done.
02261: yyError = yyError.select("structure declaration expected",
02262: yyStart);
02263: return yyError;
02264: }
02265:
02266: // =========================================================================
02267:
02268: /**
02269: * Parse nonterminal xtc.lang.C.SpecifierQualifierList.
02270: *
02271: * @param yyStart The index.
02272: * @return The result.
02273: * @throws IOException Signals an I/O error.
02274: */
02275: private Result pSpecifierQualifierList(final int yyStart)
02276: throws IOException {
02277:
02278: CParserColumn yyColumn = (CParserColumn) column(yyStart);
02279: if (null == yyColumn.chunk1)
02280: yyColumn.chunk1 = new Chunk1();
02281: if (null == yyColumn.chunk1.fSpecifierQualifierList)
02282: yyColumn.chunk1.fSpecifierQualifierList = pSpecifierQualifierList$1(yyStart);
02283: return yyColumn.chunk1.fSpecifierQualifierList;
02284: }
02285:
02286: /** Actually parse xtc.lang.C.SpecifierQualifierList. */
02287: private Result pSpecifierQualifierList$1(final int yyStart)
02288: throws IOException {
02289:
02290: Result yyResult;
02291: Node yyValue;
02292: ParseError yyError = ParseError.DUMMY;
02293:
02294: // Alternative 1.
02295:
02296: yyResult = pSpecifierQualifierPlus(yyStart);
02297: yyError = yyResult.select(yyError);
02298: if (yyResult.hasValue()) {
02299: final Pair<Node> v$g$1 = yyResult.semanticValue();
02300:
02301: yyValue = GNode.createFromPair("SpecifierQualifierList",
02302: v$g$1);
02303: yyValue.setLocation(location(yyStart));
02304:
02305: return yyResult.createValue(yyValue, yyError);
02306: }
02307:
02308: // Done.
02309: return yyError;
02310: }
02311:
02312: // =========================================================================
02313:
02314: /**
02315: * Parse nonterminal xtc.lang.C.SpecifierQualifierPlus.
02316: *
02317: * @param yyStart The index.
02318: * @return The result.
02319: * @throws IOException Signals an I/O error.
02320: */
02321: private Result pSpecifierQualifierPlus(final int yyStart)
02322: throws IOException {
02323:
02324: Result yyResult;
02325: int yyRepetition1;
02326: boolean yyRepeated1;
02327: Pair<Node> yyRepValue1;
02328: Pair<Node> yyValue;
02329: ParseError yyError = ParseError.DUMMY;
02330:
02331: // Alternative 1.
02332:
02333: yyRepetition1 = yyStart;
02334: yyRepeated1 = false;
02335: yyRepValue1 = Pair.empty();
02336: while (true) {
02337:
02338: yyResult = pSpecifierQualifier(yyRepetition1);
02339: yyError = yyResult.select(yyError);
02340: if (yyResult.hasValue()) {
02341: final Node v$el$1 = yyResult.semanticValue();
02342:
02343: yyRepetition1 = yyResult.index;
02344: yyRepeated1 = true;
02345: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
02346: continue;
02347: }
02348: break;
02349: }
02350:
02351: if (yyRepeated1) {
02352: yyValue = yyRepValue1.reverse();
02353:
02354: return new SemanticValue(yyValue, yyRepetition1, yyError);
02355: }
02356:
02357: // Done.
02358: return yyError;
02359: }
02360:
02361: // =========================================================================
02362:
02363: /**
02364: * Parse nonterminal xtc.lang.C.SpecifierQualifier.
02365: *
02366: * @param yyStart The index.
02367: * @return The result.
02368: * @throws IOException Signals an I/O error.
02369: */
02370: private Result pSpecifierQualifier(final int yyStart)
02371: throws IOException {
02372: Result yyResult;
02373: Node yyValue;
02374: ParseError yyError = ParseError.DUMMY;
02375:
02376: // Alternative <TypeSpecifier>.
02377:
02378: yyResult = pTypeSpecifier(yyStart);
02379: yyError = yyResult.select(yyError);
02380: if (yyResult.hasValue()) {
02381: yyValue = yyResult.semanticValue();
02382:
02383: yyResult = pTypeSpecContext(yyResult.index);
02384: yyError = yyResult.select(yyError);
02385: if (yyResult.hasValue()) {
02386:
02387: return yyResult.createValue(yyValue, yyError);
02388: }
02389: }
02390:
02391: // Alternative <TypeQualifier>.
02392:
02393: yyResult = pTypeQualifier(yyStart);
02394: yyError = yyResult.select(yyError);
02395: if (yyResult.hasValue()) {
02396: yyValue = yyResult.semanticValue();
02397:
02398: return yyResult.createValue(yyValue, yyError);
02399: }
02400:
02401: // Alternative <Attribute>.
02402:
02403: yyResult = pAttributeSpecifier(yyStart);
02404: yyError = yyResult.select(yyError);
02405: if (yyResult.hasValue()) {
02406: yyValue = yyResult.semanticValue();
02407:
02408: return yyResult.createValue(yyValue, yyError);
02409: }
02410:
02411: // Done.
02412: return yyError;
02413: }
02414:
02415: // =========================================================================
02416:
02417: /**
02418: * Parse nonterminal xtc.lang.C.OptionalStructureDeclaratorList.
02419: *
02420: * @param yyStart The index.
02421: * @return The result.
02422: * @throws IOException Signals an I/O error.
02423: */
02424: private Result pOptionalStructureDeclaratorList(final int yyStart)
02425: throws IOException {
02426:
02427: Result yyResult;
02428: Node yyValue;
02429: ParseError yyError = ParseError.DUMMY;
02430:
02431: // Alternative <List>.
02432:
02433: yyResult = pStructureDeclaratorList(yyStart);
02434: yyError = yyResult.select(yyError);
02435: if (yyResult.hasValue()) {
02436: yyValue = yyResult.semanticValue();
02437:
02438: return yyResult.createValue(yyValue, yyError);
02439: }
02440:
02441: // Alternative <Null>.
02442:
02443: if (GCC) {
02444: { // Start scope for yyValue.
02445: yyValue = null;
02446:
02447: return new SemanticValue(yyValue, yyStart, yyError);
02448: } // End scope for yyValue.
02449: }
02450:
02451: // Done.
02452: yyError = yyError.select(
02453: "optional structure declarator list expected", yyStart);
02454: return yyError;
02455: }
02456:
02457: // =========================================================================
02458:
02459: /**
02460: * Parse nonterminal xtc.lang.C.StructureDeclaratorList.
02461: *
02462: * @param yyStart The index.
02463: * @return The result.
02464: * @throws IOException Signals an I/O error.
02465: */
02466: private Result pStructureDeclaratorList(final int yyStart)
02467: throws IOException {
02468:
02469: Result yyResult;
02470: int yyBase;
02471: int yyRepetition1;
02472: Pair<Node> yyRepValue1;
02473: Node yyValue;
02474: ParseError yyError = ParseError.DUMMY;
02475:
02476: // Alternative <List>.
02477:
02478: yyResult = pStructureDeclarator(yyStart);
02479: yyError = yyResult.select(yyError);
02480: if (yyResult.hasValue()) {
02481: final Node v$g$1 = yyResult.semanticValue();
02482:
02483: yyRepetition1 = yyResult.index;
02484: yyRepValue1 = Pair.empty();
02485: while (true) {
02486:
02487: yyBase = yyRepetition1;
02488: yyResult = pSymbol(yyBase);
02489: yyError = yyResult.select(yyError);
02490: if (yyResult.hasValue(",")) {
02491:
02492: yyResult = pStructureDeclarator(yyResult.index);
02493: yyError = yyResult.select(yyError);
02494: if (yyResult.hasValue()) {
02495: final Node v$el$1 = yyResult.semanticValue();
02496:
02497: yyRepetition1 = yyResult.index;
02498: yyRepValue1 = new Pair<Node>(v$el$1,
02499: yyRepValue1);
02500: continue;
02501: }
02502: } else {
02503: yyError = yyError.select("\",\" expected", yyBase);
02504: }
02505: break;
02506: }
02507: { // Start scope for v$g$2.
02508: final Pair<Node> v$g$2 = yyRepValue1.reverse();
02509:
02510: yyValue = GNode.createFromPair(
02511: "StructureDeclaratorList", v$g$1, v$g$2);
02512: yyValue.setLocation(location(yyStart));
02513:
02514: return new SemanticValue(yyValue, yyRepetition1,
02515: yyError);
02516: } // End scope for v$g$2.
02517: }
02518:
02519: // Done.
02520: return yyError;
02521: }
02522:
02523: // =========================================================================
02524:
02525: /**
02526: * Parse nonterminal xtc.lang.C.StructureDeclarator.
02527: *
02528: * @param yyStart The index.
02529: * @return The result.
02530: * @throws IOException Signals an I/O error.
02531: */
02532: private Result pStructureDeclarator(final int yyStart)
02533: throws IOException {
02534: Result yyResult;
02535: int yyBase;
02536: int yyOption1;
02537: Node yyOpValue1;
02538: Node yyValue;
02539: ParseError yyError = ParseError.DUMMY;
02540:
02541: // Alternative 1.
02542:
02543: yyOption1 = yyStart;
02544: yyOpValue1 = null;
02545:
02546: yyResult = pAttributeSpecifierList(yyOption1);
02547: yyError = yyResult.select(yyError);
02548: if (yyResult.hasValue()) {
02549: final Node v$el$1 = yyResult.semanticValue();
02550:
02551: yyOption1 = yyResult.index;
02552: yyOpValue1 = v$el$1;
02553: }
02554: { // Start scope for v$g$1.
02555: final Node v$g$1 = yyOpValue1;
02556:
02557: yyOpValue1 = null;
02558:
02559: yyResult = pDeclarator(yyOption1);
02560: yyError = yyResult.select(yyError);
02561: if (yyResult.hasValue()) {
02562: final Node v$el$2 = yyResult.semanticValue();
02563:
02564: yyOption1 = yyResult.index;
02565: yyOpValue1 = v$el$2;
02566: }
02567: { // Start scope for v$g$2.
02568: final Node v$g$2 = yyOpValue1;
02569:
02570: yyBase = yyOption1;
02571: yyResult = pSymbol(yyBase);
02572: yyError = yyResult.select(yyError);
02573: if (yyResult.hasValue(":")) {
02574:
02575: yyResult = pConditionalExpression(yyResult.index);
02576: yyError = yyResult.select(yyError);
02577: if (yyResult.hasValue()) {
02578: final Node v$g$3 = yyResult.semanticValue();
02579:
02580: yyOption1 = yyResult.index;
02581: yyOpValue1 = null;
02582:
02583: yyResult = pAttributeSpecifierList(yyOption1);
02584: yyError = yyResult.select(yyError);
02585: if (yyResult.hasValue()) {
02586: final Node v$el$3 = yyResult
02587: .semanticValue();
02588:
02589: yyOption1 = yyResult.index;
02590: yyOpValue1 = v$el$3;
02591: }
02592: { // Start scope for v$g$4.
02593: final Node v$g$4 = yyOpValue1;
02594:
02595: yyValue = GNode.create("BitField", v$g$1,
02596: v$g$2, v$g$3, v$g$4);
02597: yyValue.setLocation(location(yyStart));
02598:
02599: return new SemanticValue(yyValue,
02600: yyOption1, yyError);
02601: } // End scope for v$g$4.
02602: }
02603: } else {
02604: yyError = yyError.select("\":\" expected", yyBase);
02605: }
02606: } // End scope for v$g$2.
02607: } // End scope for v$g$1.
02608:
02609: // Alternative <Simple>.
02610:
02611: yyResult = pAttributedDeclarator(yyStart);
02612: yyError = yyResult.select(yyError);
02613: if (yyResult.hasValue()) {
02614: yyValue = yyResult.semanticValue();
02615:
02616: return yyResult.createValue(yyValue, yyError);
02617: }
02618:
02619: // Done.
02620: return yyError;
02621: }
02622:
02623: // =========================================================================
02624:
02625: /**
02626: * Parse nonterminal xtc.lang.C.AttributedDeclarator.
02627: *
02628: * @param yyStart The index.
02629: * @return The result.
02630: * @throws IOException Signals an I/O error.
02631: */
02632: private Result pAttributedDeclarator(final int yyStart)
02633: throws IOException {
02634: CParserColumn yyColumn = (CParserColumn) column(yyStart);
02635: if (null == yyColumn.chunk1)
02636: yyColumn.chunk1 = new Chunk1();
02637: if (null == yyColumn.chunk1.fAttributedDeclarator)
02638: yyColumn.chunk1.fAttributedDeclarator = pAttributedDeclarator$1(yyStart);
02639: return yyColumn.chunk1.fAttributedDeclarator;
02640: }
02641:
02642: /** Actually parse xtc.lang.C.AttributedDeclarator. */
02643: private Result pAttributedDeclarator$1(final int yyStart)
02644: throws IOException {
02645:
02646: Result yyResult;
02647: int yyOption1;
02648: Node yyOpValue1;
02649: Node yyValue;
02650: ParseError yyError = ParseError.DUMMY;
02651:
02652: // Alternative 1.
02653:
02654: yyOption1 = yyStart;
02655: yyOpValue1 = null;
02656:
02657: yyResult = pAttributeSpecifierList(yyOption1);
02658: yyError = yyResult.select(yyError);
02659: if (yyResult.hasValue()) {
02660: final Node v$el$1 = yyResult.semanticValue();
02661:
02662: yyOption1 = yyResult.index;
02663: yyOpValue1 = v$el$1;
02664: }
02665: { // Start scope for v$g$1.
02666: final Node v$g$1 = yyOpValue1;
02667:
02668: yyResult = pDeclarator(yyOption1);
02669: yyError = yyResult.select(yyError);
02670: if (yyResult.hasValue()) {
02671: final Node v$g$2 = yyResult.semanticValue();
02672:
02673: yyOption1 = yyResult.index;
02674: yyOpValue1 = null;
02675:
02676: yyResult = pAttributeSpecifierList(yyOption1);
02677: yyError = yyResult.select(yyError);
02678: if (yyResult.hasValue()) {
02679: final Node v$el$2 = yyResult.semanticValue();
02680:
02681: yyOption1 = yyResult.index;
02682: yyOpValue1 = v$el$2;
02683: }
02684: { // Start scope for v$g$3.
02685: final Node v$g$3 = yyOpValue1;
02686:
02687: yyValue = GNode.create("AttributedDeclarator",
02688: v$g$1, v$g$2, v$g$3);
02689: yyValue.setLocation(location(yyStart));
02690:
02691: return new SemanticValue(yyValue, yyOption1,
02692: yyError);
02693: } // End scope for v$g$3.
02694: }
02695: } // End scope for v$g$1.
02696:
02697: // Done.
02698: return yyError;
02699: }
02700:
02701: // =========================================================================
02702:
02703: /**
02704: * Parse nonterminal xtc.lang.C.Declarator.
02705: *
02706: * @param yyStart The index.
02707: * @return The result.
02708: * @throws IOException Signals an I/O error.
02709: */
02710: private Result pDeclarator(final int yyStart) throws IOException {
02711: CParserColumn yyColumn = (CParserColumn) column(yyStart);
02712: if (null == yyColumn.chunk1)
02713: yyColumn.chunk1 = new Chunk1();
02714: if (null == yyColumn.chunk1.fDeclarator)
02715: yyColumn.chunk1.fDeclarator = pDeclarator$1(yyStart);
02716: return yyColumn.chunk1.fDeclarator;
02717: }
02718:
02719: /** Actually parse xtc.lang.C.Declarator. */
02720: private Result pDeclarator$1(final int yyStart) throws IOException {
02721: Result yyResult;
02722: Node yyValue;
02723: ParseError yyError = ParseError.DUMMY;
02724:
02725: // Alternative <Pointer>.
02726:
02727: yyResult = pPointerDeclarator(yyStart);
02728: yyError = yyResult.select(yyError);
02729: if (yyResult.hasValue()) {
02730: yyValue = yyResult.semanticValue();
02731:
02732: return yyResult.createValue(yyValue, yyError);
02733: }
02734:
02735: // Alternative <Direct>.
02736:
02737: yyResult = pDirectDeclarator(yyStart);
02738: yyError = yyResult.select(yyError);
02739: if (yyResult.hasValue()) {
02740: yyValue = yyResult.semanticValue();
02741:
02742: return yyResult.createValue(yyValue, yyError);
02743: }
02744:
02745: // Done.
02746: return yyError;
02747: }
02748:
02749: // =========================================================================
02750:
02751: /**
02752: * Parse nonterminal xtc.lang.C.PointerDeclarator.
02753: *
02754: * @param yyStart The index.
02755: * @return The result.
02756: * @throws IOException Signals an I/O error.
02757: */
02758: private Result pPointerDeclarator(final int yyStart)
02759: throws IOException {
02760: Result yyResult;
02761: Node yyValue;
02762: ParseError yyError = ParseError.DUMMY;
02763:
02764: // Alternative 1.
02765:
02766: yyResult = pPointer(yyStart);
02767: yyError = yyResult.select(yyError);
02768: if (yyResult.hasValue()) {
02769: final Node v$g$1 = yyResult.semanticValue();
02770:
02771: yyResult = pDirectDeclarator(yyResult.index);
02772: yyError = yyResult.select(yyError);
02773: if (yyResult.hasValue()) {
02774: final Node v$g$2 = yyResult.semanticValue();
02775:
02776: yyValue = GNode.create("PointerDeclarator", v$g$1,
02777: v$g$2);
02778: yyValue.setLocation(location(yyStart));
02779:
02780: return yyResult.createValue(yyValue, yyError);
02781: }
02782: }
02783:
02784: // Done.
02785: return yyError;
02786: }
02787:
02788: // =========================================================================
02789:
02790: /**
02791: * Parse nonterminal xtc.lang.C.Pointer.
02792: *
02793: * @param yyStart The index.
02794: * @return The result.
02795: * @throws IOException Signals an I/O error.
02796: */
02797: private Result pPointer(final int yyStart) throws IOException {
02798: CParserColumn yyColumn = (CParserColumn) column(yyStart);
02799: if (null == yyColumn.chunk1)
02800: yyColumn.chunk1 = new Chunk1();
02801: if (null == yyColumn.chunk1.fPointer)
02802: yyColumn.chunk1.fPointer = pPointer$1(yyStart);
02803: return yyColumn.chunk1.fPointer;
02804: }
02805:
02806: /** Actually parse xtc.lang.C.Pointer. */
02807: private Result pPointer$1(final int yyStart) throws IOException {
02808: Result yyResult;
02809: int yyOption1;
02810: Node yyOpValue1;
02811: Node yyValue;
02812: ParseError yyError = ParseError.DUMMY;
02813:
02814: // Alternative 1.
02815:
02816: yyResult = pSymbol(yyStart);
02817: yyError = yyResult.select(yyError);
02818: if (yyResult.hasValue("*")) {
02819:
02820: yyResult = pTypeQualifierList(yyResult.index);
02821: yyError = yyResult.select(yyError);
02822: if (yyResult.hasValue()) {
02823: final Node v$g$1 = yyResult.semanticValue();
02824:
02825: yyOption1 = yyResult.index;
02826: yyOpValue1 = null;
02827:
02828: yyResult = pPointer(yyOption1);
02829: yyError = yyResult.select(yyError);
02830: if (yyResult.hasValue()) {
02831: final Node v$el$1 = yyResult.semanticValue();
02832:
02833: yyOption1 = yyResult.index;
02834: yyOpValue1 = v$el$1;
02835: }
02836: { // Start scope for v$g$2.
02837: final Node v$g$2 = yyOpValue1;
02838:
02839: yyValue = GNode.create("Pointer", v$g$1, v$g$2);
02840: yyValue.setLocation(location(yyStart));
02841:
02842: return new SemanticValue(yyValue, yyOption1,
02843: yyError);
02844: } // End scope for v$g$2.
02845: }
02846: }
02847:
02848: // Done.
02849: yyError = yyError.select("pointer expected", yyStart);
02850: return yyError;
02851: }
02852:
02853: // =========================================================================
02854:
02855: /**
02856: * Parse nonterminal xtc.lang.C.TypeQualifierList.
02857: *
02858: * @param yyStart The index.
02859: * @return The result.
02860: * @throws IOException Signals an I/O error.
02861: */
02862: private Result pTypeQualifierList(final int yyStart)
02863: throws IOException {
02864: Result yyResult;
02865: int yyRepetition1;
02866: Pair<Node> yyRepValue1;
02867: Node yyValue;
02868: ParseError yyError = ParseError.DUMMY;
02869:
02870: // Alternative 1.
02871:
02872: yyRepetition1 = yyStart;
02873: yyRepValue1 = Pair.empty();
02874: while (true) {
02875:
02876: yyResult = pTypeQualifierList$$Choice1(yyRepetition1);
02877: yyError = yyResult.select(yyError);
02878: if (yyResult.hasValue()) {
02879: final Node v$el$1 = yyResult.semanticValue();
02880:
02881: yyRepetition1 = yyResult.index;
02882: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
02883: continue;
02884: }
02885: break;
02886: }
02887: { // Start scope for v$g$1.
02888: final Pair<Node> v$g$1 = yyRepValue1.reverse();
02889:
02890: yyValue = GNode.createFromPair("TypeQualifierList", v$g$1);
02891: yyValue.setLocation(location(yyStart));
02892:
02893: return new SemanticValue(yyValue, yyRepetition1, yyError);
02894: } // End scope for v$g$1.
02895: }
02896:
02897: // =========================================================================
02898:
02899: /**
02900: * Parse synthetic nonterminal xtc.lang.C.TypeQualifierList$$Choice1.
02901: *
02902: * @param yyStart The index.
02903: * @return The result.
02904: * @throws IOException Signals an I/O error.
02905: */
02906: private Result pTypeQualifierList$$Choice1(final int yyStart)
02907: throws IOException {
02908:
02909: Result yyResult;
02910: Node yyValue;
02911: ParseError yyError = ParseError.DUMMY;
02912:
02913: // Alternative 1.
02914:
02915: yyResult = pTypeQualifier(yyStart);
02916: yyError = yyResult.select(yyError);
02917: if (yyResult.hasValue()) {
02918: yyValue = yyResult.semanticValue();
02919:
02920: return yyResult.createValue(yyValue, yyError);
02921: }
02922:
02923: // Alternative 2.
02924:
02925: yyResult = pAttributeSpecifier(yyStart);
02926: yyError = yyResult.select(yyError);
02927: if (yyResult.hasValue()) {
02928: yyValue = yyResult.semanticValue();
02929:
02930: return yyResult.createValue(yyValue, yyError);
02931: }
02932:
02933: // Done.
02934: return yyError;
02935: }
02936:
02937: // =========================================================================
02938:
02939: /**
02940: * Parse nonterminal xtc.lang.C.DirectDeclarator.
02941: *
02942: * @param yyStart The index.
02943: * @return The result.
02944: * @throws IOException Signals an I/O error.
02945: */
02946: private Result pDirectDeclarator(final int yyStart)
02947: throws IOException {
02948: Result yyResult;
02949: int yyBase;
02950: int yyRepetition1;
02951: Pair<Action<Node>> yyRepValue1;
02952: Node yyValue;
02953: ParseError yyError = ParseError.DUMMY;
02954:
02955: // Alternative <FullBase>.
02956:
02957: yyResult = pSymbol(yyStart);
02958: yyError = yyResult.select(yyError);
02959: if (yyResult.hasValue("(")) {
02960:
02961: yyResult = pAttributedDeclarator(yyResult.index);
02962: yyError = yyResult.select(yyError);
02963: if (yyResult.hasValue()) {
02964: final Node v$g$7 = yyResult.semanticValue();
02965:
02966: yyBase = yyResult.index;
02967: yyResult = pSymbol(yyBase);
02968: yyError = yyResult.select(yyError);
02969: if (yyResult.hasValue(")")) {
02970:
02971: yyRepetition1 = yyResult.index;
02972: yyRepValue1 = Pair.empty();
02973: while (true) {
02974:
02975: yyResult = pDirectDeclarator$$Tail1(yyRepetition1);
02976: yyError = yyResult.select(yyError);
02977: if (yyResult.hasValue()) {
02978: final Action<Node> v$8 = yyResult
02979: .semanticValue();
02980:
02981: yyRepetition1 = yyResult.index;
02982: yyRepValue1 = new Pair<Action<Node>>(v$8,
02983: yyRepValue1);
02984: continue;
02985: }
02986: break;
02987: }
02988: { // Start scope for v$9.
02989: final Pair<Action<Node>> v$9 = yyRepValue1
02990: .reverse();
02991:
02992: yyValue = apply(v$9, v$g$7, yyStart);
02993:
02994: return new SemanticValue(yyValue,
02995: yyRepetition1, yyError);
02996: } // End scope for v$9.
02997: } else {
02998: yyError = yyError.select("\")\" expected", yyBase);
02999: }
03000: }
03001: }
03002:
03003: // Alternative <SimpleBase>.
03004:
03005: yyResult = pSimpleDeclarator(yyStart);
03006: yyError = yyResult.select(yyError);
03007: if (yyResult.hasValue()) {
03008: final Node v$g$10 = yyResult.semanticValue();
03009:
03010: yyRepetition1 = yyResult.index;
03011: yyRepValue1 = Pair.empty();
03012: while (true) {
03013:
03014: yyResult = pDirectDeclarator$$Tail1(yyRepetition1);
03015: yyError = yyResult.select(yyError);
03016: if (yyResult.hasValue()) {
03017: final Action<Node> v$11 = yyResult.semanticValue();
03018:
03019: yyRepetition1 = yyResult.index;
03020: yyRepValue1 = new Pair<Action<Node>>(v$11,
03021: yyRepValue1);
03022: continue;
03023: }
03024: break;
03025: }
03026: { // Start scope for v$12.
03027: final Pair<Action<Node>> v$12 = yyRepValue1.reverse();
03028:
03029: yyValue = apply(v$12, v$g$10, yyStart);
03030:
03031: return new SemanticValue(yyValue, yyRepetition1,
03032: yyError);
03033: } // End scope for v$12.
03034: }
03035:
03036: // Done.
03037: yyError = yyError.select("direct declarator expected", yyStart);
03038: return yyError;
03039: }
03040:
03041: // =========================================================================
03042:
03043: /**
03044: * Parse synthetic nonterminal xtc.lang.C.DirectDeclarator$$Tail1.
03045: *
03046: * @param yyStart The index.
03047: * @return The result.
03048: * @throws IOException Signals an I/O error.
03049: */
03050: private Result pDirectDeclarator$$Tail1(final int yyStart)
03051: throws IOException {
03052:
03053: Result yyResult;
03054: int yyBase;
03055: int yyOption1;
03056: Node yyOpValue1;
03057: Action<Node> yyValue;
03058: ParseError yyError = ParseError.DUMMY;
03059:
03060: // Alternative 1.
03061:
03062: yyResult = pSymbol(yyStart);
03063: yyError = yyResult.select(yyError);
03064: if (yyResult.hasValue("(")) {
03065:
03066: yyResult = pPushScope(yyResult.index);
03067: yyError = yyResult.select(yyError);
03068: if (yyResult.hasValue()) {
03069:
03070: final int yyChoice1 = yyResult.index;
03071:
03072: // Nested alternative 1.
03073:
03074: yyResult = pParameterTypeList(yyChoice1);
03075: yyError = yyResult.select(yyError);
03076: if (yyResult.hasValue()) {
03077: final Node v$g$2 = yyResult.semanticValue();
03078:
03079: yyBase = yyResult.index;
03080: yyResult = pSymbol(yyBase);
03081: yyError = yyResult.select(yyError);
03082: if (yyResult.hasValue(")")) {
03083:
03084: yyResult = pParameterContext(yyResult.index);
03085: yyError = yyResult.select(yyError);
03086: if (yyResult.hasValue()) {
03087:
03088: yyValue = new Action<Node>() {
03089: public Node run(Node v$1) {
03090: return GNode.create(
03091: "FunctionDeclarator", v$1,
03092: v$g$2);
03093: }
03094: };
03095:
03096: return yyResult.createValue(yyValue,
03097: yyError);
03098: }
03099: } else {
03100: yyError = yyError.select("\")\" expected",
03101: yyBase);
03102: }
03103: }
03104:
03105: // Nested alternative 2.
03106:
03107: yyOption1 = yyChoice1;
03108: yyOpValue1 = null;
03109:
03110: yyResult = pIdentifierList(yyOption1);
03111: yyError = yyResult.select(yyError);
03112: if (yyResult.hasValue()) {
03113: final Node v$el$1 = yyResult.semanticValue();
03114:
03115: yyOption1 = yyResult.index;
03116: yyOpValue1 = v$el$1;
03117: }
03118: { // Start scope for v$g$3.
03119: final Node v$g$3 = yyOpValue1;
03120:
03121: yyBase = yyOption1;
03122: yyResult = pSymbol(yyBase);
03123: yyError = yyResult.select(yyError);
03124: if (yyResult.hasValue(")")) {
03125:
03126: yyResult = pParameterContext(yyResult.index);
03127: yyError = yyResult.select(yyError);
03128: if (yyResult.hasValue()) {
03129:
03130: yyValue = new Action<Node>() {
03131: public Node run(Node v$1) {
03132: return GNode.create(
03133: "FunctionDeclarator", v$1,
03134: v$g$3);
03135: }
03136: };
03137:
03138: return yyResult.createValue(yyValue,
03139: yyError);
03140: }
03141: } else {
03142: yyError = yyError.select("\")\" expected",
03143: yyBase);
03144: }
03145: } // End scope for v$g$3.
03146: }
03147: }
03148:
03149: // Alternative 2.
03150:
03151: yyResult = pSymbol(yyStart);
03152: yyError = yyResult.select(yyError);
03153: if (yyResult.hasValue("[")) {
03154:
03155: yyResult = pArrayQualifierList(yyResult.index);
03156: yyError = yyResult.select(yyError);
03157: if (yyResult.hasValue()) {
03158: final Node v$g$4 = yyResult.semanticValue();
03159:
03160: final int yyChoice1 = yyResult.index;
03161:
03162: // Nested alternative 1.
03163:
03164: yyOption1 = yyChoice1;
03165: yyOpValue1 = null;
03166:
03167: yyResult = pAssignmentExpression(yyOption1);
03168: yyError = yyResult.select(yyError);
03169: if (yyResult.hasValue()) {
03170: final Node v$el$2 = yyResult.semanticValue();
03171:
03172: yyOption1 = yyResult.index;
03173: yyOpValue1 = v$el$2;
03174: }
03175: { // Start scope for v$g$5.
03176: final Node v$g$5 = yyOpValue1;
03177:
03178: yyBase = yyOption1;
03179: yyResult = pSymbol(yyBase);
03180: yyError = yyResult.select(yyError);
03181: if (yyResult.hasValue("]")) {
03182:
03183: yyValue = new Action<Node>() {
03184: public Node run(Node v$1) {
03185: return GNode.create("ArrayDeclarator",
03186: v$1, v$g$4, v$g$5);
03187: }
03188: };
03189:
03190: return yyResult.createValue(yyValue, yyError);
03191: } else {
03192: yyError = yyError.select("\"]\" expected",
03193: yyBase);
03194: }
03195: } // End scope for v$g$5.
03196:
03197: // Nested alternative 2.
03198:
03199: yyResult = pVariableLength(yyChoice1);
03200: yyError = yyResult.select(yyError);
03201: if (yyResult.hasValue()) {
03202: final Node v$g$6 = yyResult.semanticValue();
03203:
03204: yyBase = yyResult.index;
03205: yyResult = pSymbol(yyBase);
03206: yyError = yyResult.select(yyError);
03207: if (yyResult.hasValue("]")) {
03208:
03209: yyValue = new Action<Node>() {
03210: public Node run(Node v$1) {
03211: return GNode.create("ArrayDeclarator",
03212: v$1, v$g$4, v$g$6);
03213: }
03214: };
03215:
03216: return yyResult.createValue(yyValue, yyError);
03217: } else {
03218: yyError = yyError.select("\"]\" expected",
03219: yyBase);
03220: }
03221: }
03222: }
03223: }
03224:
03225: // Done.
03226: yyError = yyError.select("direct declarator expected", yyStart);
03227: return yyError;
03228: }
03229:
03230: // =========================================================================
03231:
03232: /**
03233: * Parse nonterminal xtc.lang.C.VariableLength.
03234: *
03235: * @param yyStart The index.
03236: * @return The result.
03237: * @throws IOException Signals an I/O error.
03238: */
03239: private Result pVariableLength(final int yyStart)
03240: throws IOException {
03241: CParserColumn yyColumn = (CParserColumn) column(yyStart);
03242: if (null == yyColumn.chunk1)
03243: yyColumn.chunk1 = new Chunk1();
03244: if (null == yyColumn.chunk1.fVariableLength)
03245: yyColumn.chunk1.fVariableLength = pVariableLength$1(yyStart);
03246: return yyColumn.chunk1.fVariableLength;
03247: }
03248:
03249: /** Actually parse xtc.lang.C.VariableLength. */
03250: private Result pVariableLength$1(final int yyStart)
03251: throws IOException {
03252: Result yyResult;
03253: Node yyValue;
03254: ParseError yyError = ParseError.DUMMY;
03255:
03256: // Alternative 1.
03257:
03258: yyResult = pSymbol(yyStart);
03259: yyError = yyResult.select(yyError);
03260: if (yyResult.hasValue("*")) {
03261:
03262: yyValue = GNode.create("VariableLength", false);
03263: yyValue.setLocation(location(yyStart));
03264:
03265: return yyResult.createValue(yyValue, yyError);
03266: }
03267:
03268: // Done.
03269: yyError = yyError.select("variable length expected", yyStart);
03270: return yyError;
03271: }
03272:
03273: // =========================================================================
03274:
03275: /**
03276: * Parse nonterminal xtc.lang.C.SimpleDeclarator.
03277: *
03278: * @param yyStart The index.
03279: * @return The result.
03280: * @throws IOException Signals an I/O error.
03281: */
03282: private Result pSimpleDeclarator(final int yyStart)
03283: throws IOException {
03284: Result yyResult;
03285: Node yyValue;
03286: ParseError yyError = ParseError.DUMMY;
03287:
03288: // Alternative <Declarator>.
03289:
03290: yyResult = pIdentifier(yyStart);
03291: yyError = yyResult.select(yyError);
03292: if (yyResult.hasValue()) {
03293: final String id = yyResult.semanticValue();
03294:
03295: yyState.bind(toText(id));
03296:
03297: yyValue = GNode.create("SimpleDeclarator", id);
03298: yyValue.setLocation(location(yyStart));
03299:
03300: return yyResult.createValue(yyValue, yyError);
03301: }
03302:
03303: // Done.
03304: return yyError;
03305: }
03306:
03307: // =========================================================================
03308:
03309: /**
03310: * Parse nonterminal xtc.lang.C.ParameterTypeList.
03311: *
03312: * @param yyStart The index.
03313: * @return The result.
03314: * @throws IOException Signals an I/O error.
03315: */
03316: private Result pParameterTypeList(final int yyStart)
03317: throws IOException {
03318: CParserColumn yyColumn = (CParserColumn) column(yyStart);
03319: if (null == yyColumn.chunk1)
03320: yyColumn.chunk1 = new Chunk1();
03321: if (null == yyColumn.chunk1.fParameterTypeList)
03322: yyColumn.chunk1.fParameterTypeList = pParameterTypeList$1(yyStart);
03323: return yyColumn.chunk1.fParameterTypeList;
03324: }
03325:
03326: /** Actually parse xtc.lang.C.ParameterTypeList. */
03327: private Result pParameterTypeList$1(final int yyStart)
03328: throws IOException {
03329: Result yyResult;
03330: int yyBase;
03331: int yyOption1;
03332: String yyOpValue1;
03333: Node yyValue;
03334: ParseError yyError = ParseError.DUMMY;
03335:
03336: // Alternative 1.
03337:
03338: yyResult = pParameterList(yyStart);
03339: yyError = yyResult.select(yyError);
03340: if (yyResult.hasValue()) {
03341: final Node v$g$1 = yyResult.semanticValue();
03342:
03343: yyOption1 = yyResult.index;
03344: yyOpValue1 = null;
03345:
03346: yyBase = yyOption1;
03347: yyResult = pSymbol(yyBase);
03348: yyError = yyResult.select(yyError);
03349: if (yyResult.hasValue(",")) {
03350:
03351: yyBase = yyResult.index;
03352: yyResult = pSymbol(yyBase);
03353: yyError = yyResult.select(yyError);
03354: if (yyResult.hasValue("...")) {
03355: final String v$el$1 = "...";
03356:
03357: yyOption1 = yyResult.index;
03358: yyOpValue1 = v$el$1;
03359: } else {
03360: yyError = yyError
03361: .select("\"...\" expected", yyBase);
03362: }
03363: } else {
03364: yyError = yyError.select("\",\" expected", yyBase);
03365: }
03366: { // Start scope for v$g$2.
03367: final String v$g$2 = yyOpValue1;
03368:
03369: yyValue = GNode.create("ParameterTypeList", v$g$1,
03370: v$g$2);
03371: yyValue.setLocation(location(yyStart));
03372:
03373: return new SemanticValue(yyValue, yyOption1, yyError);
03374: } // End scope for v$g$2.
03375: }
03376:
03377: // Done.
03378: return yyError;
03379: }
03380:
03381: // =========================================================================
03382:
03383: /**
03384: * Parse nonterminal xtc.lang.C.ParameterList.
03385: *
03386: * @param yyStart The index.
03387: * @return The result.
03388: * @throws IOException Signals an I/O error.
03389: */
03390: private Result pParameterList(final int yyStart) throws IOException {
03391: Result yyResult;
03392: int yyBase;
03393: int yyRepetition1;
03394: Pair<Node> yyRepValue1;
03395: Node yyValue;
03396: ParseError yyError = ParseError.DUMMY;
03397:
03398: // Alternative 1.
03399:
03400: yyResult = pParameterDeclaration(yyStart);
03401: yyError = yyResult.select(yyError);
03402: if (yyResult.hasValue()) {
03403: final Node v$g$1 = yyResult.semanticValue();
03404:
03405: yyRepetition1 = yyResult.index;
03406: yyRepValue1 = Pair.empty();
03407: while (true) {
03408:
03409: yyBase = yyRepetition1;
03410: yyResult = pSymbol(yyBase);
03411: yyError = yyResult.select(yyError);
03412: if (yyResult.hasValue(",")) {
03413:
03414: yyResult = pParameterDeclaration(yyResult.index);
03415: yyError = yyResult.select(yyError);
03416: if (yyResult.hasValue()) {
03417: final Node v$el$1 = yyResult.semanticValue();
03418:
03419: yyRepetition1 = yyResult.index;
03420: yyRepValue1 = new Pair<Node>(v$el$1,
03421: yyRepValue1);
03422: continue;
03423: }
03424: } else {
03425: yyError = yyError.select("\",\" expected", yyBase);
03426: }
03427: break;
03428: }
03429: { // Start scope for v$g$2.
03430: final Pair<Node> v$g$2 = yyRepValue1.reverse();
03431:
03432: yyValue = GNode.createFromPair("ParameterList", v$g$1,
03433: v$g$2);
03434: yyValue.setLocation(location(yyStart));
03435:
03436: return new SemanticValue(yyValue, yyRepetition1,
03437: yyError);
03438: } // End scope for v$g$2.
03439: }
03440:
03441: // Done.
03442: return yyError;
03443: }
03444:
03445: // =========================================================================
03446:
03447: /**
03448: * Parse nonterminal xtc.lang.C.ParameterDeclaration.
03449: *
03450: * @param yyStart The index.
03451: * @return The result.
03452: * @throws IOException Signals an I/O error.
03453: */
03454: private Result pParameterDeclaration(final int yyStart)
03455: throws IOException {
03456: Result yyResult;
03457: int yyOption1;
03458: Node yyOpValue1;
03459: Node yyValue;
03460: ParseError yyError = ParseError.DUMMY;
03461:
03462: // Start a state modification.
03463: yyState.start();
03464:
03465: // Alternative 1.
03466:
03467: yyResult = pDeclarationSpecifiers(yyStart);
03468: yyError = yyResult.select(yyError);
03469: if (yyResult.hasValue()) {
03470: final Node v$g$1 = yyResult.semanticValue();
03471:
03472: final int yyChoice1 = yyResult.index;
03473:
03474: // Nested alternative 1.
03475:
03476: yyResult = pDeclarator(yyChoice1);
03477: yyError = yyResult.select(yyError);
03478: if (yyResult.hasValue()) {
03479: final Node v$g$2 = yyResult.semanticValue();
03480:
03481: yyOption1 = yyResult.index;
03482: yyOpValue1 = null;
03483:
03484: yyResult = pAttributeSpecifierList(yyOption1);
03485: yyError = yyResult.select(yyError);
03486: if (yyResult.hasValue()) {
03487: final Node v$el$1 = yyResult.semanticValue();
03488:
03489: yyOption1 = yyResult.index;
03490: yyOpValue1 = v$el$1;
03491: }
03492: { // Start scope for v$g$3.
03493: final Node v$g$3 = yyOpValue1;
03494:
03495: yyValue = GNode.create("ParameterDeclaration",
03496: v$g$1, v$g$2, v$g$3);
03497: yyValue.setLocation(location(yyStart));
03498:
03499: // Commit the state modification.
03500: yyState.commit();
03501:
03502: return new SemanticValue(yyValue, yyOption1,
03503: yyError);
03504: } // End scope for v$g$3.
03505: }
03506:
03507: // Nested alternative 2.
03508:
03509: yyOption1 = yyChoice1;
03510: yyOpValue1 = null;
03511:
03512: yyResult = pAbstractDeclarator(yyOption1);
03513: yyError = yyResult.select(yyError);
03514: if (yyResult.hasValue()) {
03515: final Node v$el$2 = yyResult.semanticValue();
03516:
03517: yyOption1 = yyResult.index;
03518: yyOpValue1 = v$el$2;
03519: }
03520: { // Start scope for v$g$4.
03521: final Node v$g$4 = yyOpValue1;
03522:
03523: yyOpValue1 = null;
03524:
03525: yyResult = pAttributeSpecifierList(yyOption1);
03526: yyError = yyResult.select(yyError);
03527: if (yyResult.hasValue()) {
03528: final Node v$el$3 = yyResult.semanticValue();
03529:
03530: yyOption1 = yyResult.index;
03531: yyOpValue1 = v$el$3;
03532: }
03533: { // Start scope for v$g$5.
03534: final Node v$g$5 = yyOpValue1;
03535:
03536: yyValue = GNode.create("ParameterDeclaration",
03537: v$g$1, v$g$4, v$g$5);
03538: yyValue.setLocation(location(yyStart));
03539:
03540: // Commit the state modification.
03541: yyState.commit();
03542:
03543: return new SemanticValue(yyValue, yyOption1,
03544: yyError);
03545: } // End scope for v$g$5.
03546: } // End scope for v$g$4.
03547: }
03548:
03549: // Abort the state modification.
03550: yyState.abort();
03551:
03552: // Done.
03553: return yyError;
03554: }
03555:
03556: // =========================================================================
03557:
03558: /**
03559: * Parse nonterminal xtc.lang.C.AttributedAbstractDeclarator.
03560: *
03561: * @param yyStart The index.
03562: * @return The result.
03563: * @throws IOException Signals an I/O error.
03564: */
03565: private Result pAttributedAbstractDeclarator(final int yyStart)
03566: throws IOException {
03567:
03568: Result yyResult;
03569: int yyOption1;
03570: Node yyOpValue1;
03571: Node yyValue;
03572: ParseError yyError = ParseError.DUMMY;
03573:
03574: // Alternative 1.
03575:
03576: yyOption1 = yyStart;
03577: yyOpValue1 = null;
03578:
03579: yyResult = pAttributeSpecifierList(yyOption1);
03580: yyError = yyResult.select(yyError);
03581: if (yyResult.hasValue()) {
03582: final Node v$el$1 = yyResult.semanticValue();
03583:
03584: yyOption1 = yyResult.index;
03585: yyOpValue1 = v$el$1;
03586: }
03587: { // Start scope for v$g$1.
03588: final Node v$g$1 = yyOpValue1;
03589:
03590: yyResult = pAbstractDeclarator(yyOption1);
03591: yyError = yyResult.select(yyError);
03592: if (yyResult.hasValue()) {
03593: final Node v$g$2 = yyResult.semanticValue();
03594:
03595: yyValue = GNode.create("AttributedAbstractDeclarator",
03596: v$g$1, v$g$2);
03597: yyValue.setLocation(location(yyStart));
03598:
03599: return yyResult.createValue(yyValue, yyError);
03600: }
03601: } // End scope for v$g$1.
03602:
03603: // Done.
03604: return yyError;
03605: }
03606:
03607: // =========================================================================
03608:
03609: /**
03610: * Parse nonterminal xtc.lang.C.AbstractDeclarator.
03611: *
03612: * @param yyStart The index.
03613: * @return The result.
03614: * @throws IOException Signals an I/O error.
03615: */
03616: private Result pAbstractDeclarator(final int yyStart)
03617: throws IOException {
03618: CParserColumn yyColumn = (CParserColumn) column(yyStart);
03619: if (null == yyColumn.chunk1)
03620: yyColumn.chunk1 = new Chunk1();
03621: if (null == yyColumn.chunk1.fAbstractDeclarator)
03622: yyColumn.chunk1.fAbstractDeclarator = pAbstractDeclarator$1(yyStart);
03623: return yyColumn.chunk1.fAbstractDeclarator;
03624: }
03625:
03626: /** Actually parse xtc.lang.C.AbstractDeclarator. */
03627: private Result pAbstractDeclarator$1(final int yyStart)
03628: throws IOException {
03629: Result yyResult;
03630: int yyOption1;
03631: Node yyOpValue1;
03632: Node yyValue;
03633: ParseError yyError = ParseError.DUMMY;
03634:
03635: // Alternative 1.
03636:
03637: yyOption1 = yyStart;
03638: yyOpValue1 = null;
03639:
03640: yyResult = pPointer(yyOption1);
03641: yyError = yyResult.select(yyError);
03642: if (yyResult.hasValue()) {
03643: final Node v$el$1 = yyResult.semanticValue();
03644:
03645: yyOption1 = yyResult.index;
03646: yyOpValue1 = v$el$1;
03647: }
03648: { // Start scope for p.
03649: final Node p = yyOpValue1;
03650:
03651: yyResult = pDirectAbstractDeclarator(yyOption1);
03652: yyError = yyResult.select(yyError);
03653: if (yyResult.hasValue()) {
03654: final Node d = yyResult.semanticValue();
03655:
03656: if ((null != p) || (null != d)) {
03657:
03658: yyValue = GNode.create("AbstractDeclarator", p, d);
03659: yyValue.setLocation(location(yyStart));
03660:
03661: return yyResult.createValue(yyValue, yyError);
03662: }
03663: }
03664: } // End scope for p.
03665:
03666: // Done.
03667: yyError = yyError.select("abstract declarator expected",
03668: yyStart);
03669: return yyError;
03670: }
03671:
03672: // =========================================================================
03673:
03674: /**
03675: * Parse nonterminal xtc.lang.C.DirectAbstractDeclarator.
03676: *
03677: * @param yyStart The index.
03678: * @return The result.
03679: * @throws IOException Signals an I/O error.
03680: */
03681: private Result pDirectAbstractDeclarator(final int yyStart)
03682: throws IOException {
03683:
03684: Result yyResult;
03685: int yyBase;
03686: int yyRepetition1;
03687: Pair<Action<Node>> yyRepValue1;
03688: Node yyValue;
03689: ParseError yyError = ParseError.DUMMY;
03690:
03691: // Alternative <Parenthesized>.
03692:
03693: yyResult = pSymbol(yyStart);
03694: yyError = yyResult.select(yyError);
03695: if (yyResult.hasValue("(")) {
03696:
03697: yyResult = pAttributedAbstractDeclarator(yyResult.index);
03698: yyError = yyResult.select(yyError);
03699: if (yyResult.hasValue()) {
03700: final Node v$g$7 = yyResult.semanticValue();
03701:
03702: yyBase = yyResult.index;
03703: yyResult = pSymbol(yyBase);
03704: yyError = yyResult.select(yyError);
03705: if (yyResult.hasValue(")")) {
03706:
03707: yyRepetition1 = yyResult.index;
03708: yyRepValue1 = Pair.empty();
03709: while (true) {
03710:
03711: yyResult = pDirectAbstractDeclarator$$Tail1(yyRepetition1);
03712: yyError = yyResult.select(yyError);
03713: if (yyResult.hasValue()) {
03714: final Action<Node> v$8 = yyResult
03715: .semanticValue();
03716:
03717: yyRepetition1 = yyResult.index;
03718: yyRepValue1 = new Pair<Action<Node>>(v$8,
03719: yyRepValue1);
03720: continue;
03721: }
03722: break;
03723: }
03724: { // Start scope for v$9.
03725: final Pair<Action<Node>> v$9 = yyRepValue1
03726: .reverse();
03727:
03728: yyValue = apply(v$9, v$g$7, yyStart);
03729:
03730: return new SemanticValue(yyValue,
03731: yyRepetition1, yyError);
03732: } // End scope for v$9.
03733: } else {
03734: yyError = yyError.select("\")\" expected", yyBase);
03735: }
03736: }
03737: }
03738:
03739: // Alternative <Empty>.
03740:
03741: yyRepetition1 = yyStart;
03742: yyRepValue1 = Pair.empty();
03743: while (true) {
03744:
03745: yyResult = pDirectAbstractDeclarator$$Tail1(yyRepetition1);
03746: yyError = yyResult.select(yyError);
03747: if (yyResult.hasValue()) {
03748: final Action<Node> v$11 = yyResult.semanticValue();
03749:
03750: yyRepetition1 = yyResult.index;
03751: yyRepValue1 = new Pair<Action<Node>>(v$11, yyRepValue1);
03752: continue;
03753: }
03754: break;
03755: }
03756: { // Start scope for v$12.
03757: final Pair<Action<Node>> v$12 = yyRepValue1.reverse();
03758:
03759: yyValue = apply(v$12, null, yyStart);
03760:
03761: return new SemanticValue(yyValue, yyRepetition1, yyError);
03762: } // End scope for v$12.
03763: }
03764:
03765: // =========================================================================
03766:
03767: /**
03768: * Parse synthetic nonterminal xtc.lang.C.DirectAbstractDeclarator$$Tail1.
03769: *
03770: * @param yyStart The index.
03771: * @return The result.
03772: * @throws IOException Signals an I/O error.
03773: */
03774: private Result pDirectAbstractDeclarator$$Tail1(final int yyStart)
03775: throws IOException {
03776:
03777: Result yyResult;
03778: int yyBase;
03779: int yyOption1;
03780: Node yyOpValue1;
03781: Action<Node> yyValue;
03782: ParseError yyError = ParseError.DUMMY;
03783:
03784: // Alternative 1.
03785:
03786: yyResult = pSymbol(yyStart);
03787: yyError = yyResult.select(yyError);
03788: if (yyResult.hasValue("[")) {
03789: final String v$g$2 = "[";
03790:
03791: final int yyChoice1 = yyResult.index;
03792:
03793: // Nested alternative 1.
03794:
03795: yyOption1 = yyChoice1;
03796: yyOpValue1 = null;
03797:
03798: yyResult = pAssignmentExpression(yyOption1);
03799: yyError = yyResult.select(yyError);
03800: if (yyResult.hasValue()) {
03801: final Node v$el$1 = yyResult.semanticValue();
03802:
03803: yyOption1 = yyResult.index;
03804: yyOpValue1 = v$el$1;
03805: }
03806: { // Start scope for v$g$3.
03807: final Node v$g$3 = yyOpValue1;
03808:
03809: yyBase = yyOption1;
03810: yyResult = pSymbol(yyBase);
03811: yyError = yyResult.select(yyError);
03812: if (yyResult.hasValue("]")) {
03813:
03814: yyValue = new Action<Node>() {
03815: public Node run(Node v$1) {
03816: return GNode.create(
03817: "DirectAbstractDeclarator", v$1,
03818: v$g$2, v$g$3);
03819: }
03820: };
03821:
03822: return yyResult.createValue(yyValue, yyError);
03823: } else {
03824: yyError = yyError.select("\"]\" expected", yyBase);
03825: }
03826: } // End scope for v$g$3.
03827:
03828: // Nested alternative 2.
03829:
03830: yyResult = pVariableLength(yyChoice1);
03831: yyError = yyResult.select(yyError);
03832: if (yyResult.hasValue()) {
03833: final Node v$g$4 = yyResult.semanticValue();
03834:
03835: yyBase = yyResult.index;
03836: yyResult = pSymbol(yyBase);
03837: yyError = yyResult.select(yyError);
03838: if (yyResult.hasValue("]")) {
03839:
03840: yyValue = new Action<Node>() {
03841: public Node run(Node v$1) {
03842: return GNode.create(
03843: "DirectAbstractDeclarator", v$1,
03844: v$g$2, v$g$4);
03845: }
03846: };
03847:
03848: return yyResult.createValue(yyValue, yyError);
03849: } else {
03850: yyError = yyError.select("\"]\" expected", yyBase);
03851: }
03852: }
03853: }
03854:
03855: // Alternative 2.
03856:
03857: yyResult = pSymbol(yyStart);
03858: yyError = yyResult.select(yyError);
03859: if (yyResult.hasValue("(")) {
03860: final String v$g$5 = "(";
03861:
03862: yyOption1 = yyResult.index;
03863: yyOpValue1 = null;
03864:
03865: yyResult = pParameterTypeList(yyOption1);
03866: yyError = yyResult.select(yyError);
03867: if (yyResult.hasValue()) {
03868: final Node v$el$2 = yyResult.semanticValue();
03869:
03870: yyOption1 = yyResult.index;
03871: yyOpValue1 = v$el$2;
03872: }
03873: { // Start scope for v$g$6.
03874: final Node v$g$6 = yyOpValue1;
03875:
03876: yyBase = yyOption1;
03877: yyResult = pSymbol(yyBase);
03878: yyError = yyResult.select(yyError);
03879: if (yyResult.hasValue(")")) {
03880:
03881: yyValue = new Action<Node>() {
03882: public Node run(Node v$1) {
03883: return GNode.create(
03884: "DirectAbstractDeclarator", v$1,
03885: v$g$5, v$g$6);
03886: }
03887: };
03888:
03889: return yyResult.createValue(yyValue, yyError);
03890: } else {
03891: yyError = yyError.select("\")\" expected", yyBase);
03892: }
03893: } // End scope for v$g$6.
03894: }
03895:
03896: // Done.
03897: yyError = yyError.select("direct abstract declarator expected",
03898: yyStart);
03899: return yyError;
03900: }
03901:
03902: // =========================================================================
03903:
03904: /**
03905: * Parse nonterminal xtc.lang.C.IdentifierList.
03906: *
03907: * @param yyStart The index.
03908: * @return The result.
03909: * @throws IOException Signals an I/O error.
03910: */
03911: private Result pIdentifierList(final int yyStart)
03912: throws IOException {
03913: Result yyResult;
03914: int yyBase;
03915: int yyRepetition1;
03916: Pair<String> yyRepValue1;
03917: Node yyValue;
03918: ParseError yyError = ParseError.DUMMY;
03919:
03920: // Alternative 1.
03921:
03922: yyResult = pIdentifier(yyStart);
03923: yyError = yyResult.select(yyError);
03924: if (yyResult.hasValue()) {
03925: final String id1 = yyResult.semanticValue();
03926:
03927: yyState.bind(toText(id1));
03928:
03929: yyRepetition1 = yyResult.index;
03930: yyRepValue1 = Pair.empty();
03931: while (true) {
03932:
03933: yyBase = yyRepetition1;
03934: yyResult = pSymbol(yyBase);
03935: yyError = yyResult.select(yyError);
03936: if (yyResult.hasValue(",")) {
03937:
03938: yyResult = pIdentifier(yyResult.index);
03939: yyError = yyResult.select(yyError);
03940: if (yyResult.hasValue()) {
03941: final String id2 = yyResult.semanticValue();
03942:
03943: yyState.bind(toText(id2));
03944:
03945: yyRepetition1 = yyResult.index;
03946: yyRepValue1 = new Pair<String>(id2, yyRepValue1);
03947: continue;
03948: }
03949: } else {
03950: yyError = yyError.select("\",\" expected", yyBase);
03951: }
03952: break;
03953: }
03954: { // Start scope for v$g$1.
03955: final Pair<String> v$g$1 = yyRepValue1.reverse();
03956:
03957: yyValue = GNode.createFromPair("IdentifierList", id1,
03958: v$g$1);
03959: yyValue.setLocation(location(yyStart));
03960:
03961: return new SemanticValue(yyValue, yyRepetition1,
03962: yyError);
03963: } // End scope for v$g$1.
03964: }
03965:
03966: // Done.
03967: return yyError;
03968: }
03969:
03970: // =========================================================================
03971:
03972: /**
03973: * Parse nonterminal xtc.lang.C.ArrayQualifierList.
03974: *
03975: * @param yyStart The index.
03976: * @return The result.
03977: * @throws IOException Signals an I/O error.
03978: */
03979: private Result pArrayQualifierList(final int yyStart)
03980: throws IOException {
03981: Result yyResult;
03982: int yyRepetition1;
03983: Pair<Node> yyRepValue1;
03984: Node yyValue;
03985: ParseError yyError = ParseError.DUMMY;
03986:
03987: // Alternative 1.
03988:
03989: yyRepetition1 = yyStart;
03990: yyRepValue1 = Pair.empty();
03991: while (true) {
03992:
03993: yyResult = pArrayQualifierList$$Choice1(yyRepetition1);
03994: yyError = yyResult.select(yyError);
03995: if (yyResult.hasValue()) {
03996: final Node v$el$1 = yyResult.semanticValue();
03997:
03998: yyRepetition1 = yyResult.index;
03999: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
04000: continue;
04001: }
04002: break;
04003: }
04004: { // Start scope for v$g$1.
04005: final Pair<Node> v$g$1 = yyRepValue1.reverse();
04006:
04007: yyValue = GNode.createFromPair("ArrayQualifierList", v$g$1);
04008: yyValue.setLocation(location(yyStart));
04009:
04010: return new SemanticValue(yyValue, yyRepetition1, yyError);
04011: } // End scope for v$g$1.
04012: }
04013:
04014: // =========================================================================
04015:
04016: /**
04017: * Parse synthetic nonterminal xtc.lang.C.ArrayQualifierList$$Choice1.
04018: *
04019: * @param yyStart The index.
04020: * @return The result.
04021: * @throws IOException Signals an I/O error.
04022: */
04023: private Result pArrayQualifierList$$Choice1(final int yyStart)
04024: throws IOException {
04025:
04026: Result yyResult;
04027: Node yyValue;
04028: ParseError yyError = ParseError.DUMMY;
04029:
04030: // Alternative 1.
04031:
04032: yyResult = pKeyword(yyStart);
04033: yyError = yyResult.select(yyError);
04034: if (yyResult.hasValue("static")) {
04035:
04036: yyValue = GNode.create("StaticSpecifier", false);
04037: yyValue.setLocation(location(yyStart));
04038:
04039: return yyResult.createValue(yyValue, yyError);
04040: }
04041:
04042: // Alternative 2.
04043:
04044: yyResult = pKeyword(yyStart);
04045: yyError = yyResult.select(yyError);
04046: if (yyResult.hasValue("volatile")) {
04047: final String v$g$1 = "volatile";
04048:
04049: yyValue = GNode.create("VolatileQualifier", v$g$1);
04050: yyValue.setLocation(location(yyStart));
04051:
04052: return yyResult.createValue(yyValue, yyError);
04053: }
04054:
04055: // Alternative 3.
04056:
04057: yyResult = pKeyword(yyStart);
04058: yyError = yyResult.select(yyError);
04059: if (yyResult.hasValue("__volatile")) {
04060: final String v$g$2 = "__volatile";
04061:
04062: yyValue = GNode.create("VolatileQualifier", v$g$2);
04063: yyValue.setLocation(location(yyStart));
04064:
04065: return yyResult.createValue(yyValue, yyError);
04066: }
04067:
04068: // Alternative 4.
04069:
04070: yyResult = pKeyword(yyStart);
04071: yyError = yyResult.select(yyError);
04072: if (yyResult.hasValue("__volatile__")) {
04073: final String v$g$3 = "__volatile__";
04074:
04075: yyValue = GNode.create("VolatileQualifier", v$g$3);
04076: yyValue.setLocation(location(yyStart));
04077:
04078: return yyResult.createValue(yyValue, yyError);
04079: }
04080:
04081: // Alternative 5.
04082:
04083: yyResult = pKeyword(yyStart);
04084: yyError = yyResult.select(yyError);
04085: if (yyResult.hasValue("restrict")) {
04086: final String v$g$1 = "restrict";
04087:
04088: yyValue = GNode.create("RestrictQualifier", v$g$1);
04089: yyValue.setLocation(location(yyStart));
04090:
04091: return yyResult.createValue(yyValue, yyError);
04092: }
04093:
04094: // Alternative 6.
04095:
04096: yyResult = pKeyword(yyStart);
04097: yyError = yyResult.select(yyError);
04098: if (yyResult.hasValue("__restrict")) {
04099: final String v$g$2 = "__restrict";
04100:
04101: yyValue = GNode.create("RestrictQualifier", v$g$2);
04102: yyValue.setLocation(location(yyStart));
04103:
04104: return yyResult.createValue(yyValue, yyError);
04105: }
04106:
04107: // Alternative 7.
04108:
04109: yyResult = pKeyword(yyStart);
04110: yyError = yyResult.select(yyError);
04111: if (yyResult.hasValue("__restrict__")) {
04112: final String v$g$3 = "__restrict__";
04113:
04114: yyValue = GNode.create("RestrictQualifier", v$g$3);
04115: yyValue.setLocation(location(yyStart));
04116:
04117: return yyResult.createValue(yyValue, yyError);
04118: }
04119:
04120: // Alternative 8.
04121:
04122: yyResult = pKeyword(yyStart);
04123: yyError = yyResult.select(yyError);
04124: if (yyResult.hasValue("const")) {
04125: final String v$g$1 = "const";
04126:
04127: yyValue = GNode.create("ConstantQualifier", v$g$1);
04128: yyValue.setLocation(location(yyStart));
04129:
04130: return yyResult.createValue(yyValue, yyError);
04131: }
04132:
04133: // Alternative 9.
04134:
04135: yyResult = pKeyword(yyStart);
04136: yyError = yyResult.select(yyError);
04137: if (yyResult.hasValue("__const")) {
04138: final String v$g$2 = "__const";
04139:
04140: yyValue = GNode.create("ConstantQualifier", v$g$2);
04141: yyValue.setLocation(location(yyStart));
04142:
04143: return yyResult.createValue(yyValue, yyError);
04144: }
04145:
04146: // Alternative 10.
04147:
04148: yyResult = pKeyword(yyStart);
04149: yyError = yyResult.select(yyError);
04150: if (yyResult.hasValue("__const__")) {
04151: final String v$g$3 = "__const__";
04152:
04153: yyValue = GNode.create("ConstantQualifier", v$g$3);
04154: yyValue.setLocation(location(yyStart));
04155:
04156: return yyResult.createValue(yyValue, yyError);
04157: }
04158:
04159: // Alternative 11.
04160:
04161: yyResult = pAttributeSpecifier(yyStart);
04162: yyError = yyResult.select(yyError);
04163: if (yyResult.hasValue()) {
04164: yyValue = yyResult.semanticValue();
04165:
04166: return yyResult.createValue(yyValue, yyError);
04167: }
04168:
04169: // Done.
04170: yyError = yyError.select("array qualifier list expected",
04171: yyStart);
04172: return yyError;
04173: }
04174:
04175: // =========================================================================
04176:
04177: /**
04178: * Parse nonterminal xtc.lang.C.FloatingPointTypeSpecifier.
04179: *
04180: * @param yyStart The index.
04181: * @return The result.
04182: * @throws IOException Signals an I/O error.
04183: */
04184: private Result pFloatingPointTypeSpecifier(final int yyStart)
04185: throws IOException {
04186:
04187: Result yyResult;
04188: Node yyValue;
04189: ParseError yyError = ParseError.DUMMY;
04190:
04191: // Alternative 1.
04192:
04193: yyResult = pKeyword(yyStart);
04194: yyError = yyResult.select(yyError);
04195: if (yyResult.hasValue("_Complex")) {
04196: final String v$g$1 = "_Complex";
04197:
04198: yyValue = GNode.create("Complex", v$g$1);
04199: yyValue.setLocation(location(yyStart));
04200:
04201: return yyResult.createValue(yyValue, yyError);
04202: }
04203:
04204: // Alternative 2.
04205:
04206: yyResult = pKeyword(yyStart);
04207: yyError = yyResult.select(yyError);
04208: if (yyResult.hasValue("__complex__")) {
04209: final String v$g$2 = "__complex__";
04210:
04211: yyValue = GNode.create("Complex", v$g$2);
04212: yyValue.setLocation(location(yyStart));
04213:
04214: return yyResult.createValue(yyValue, yyError);
04215: }
04216:
04217: // Alternative 3.
04218:
04219: yyResult = pKeyword(yyStart);
04220: yyError = yyResult.select(yyError);
04221: if (yyResult.hasValue("double")) {
04222:
04223: yyValue = GNode.create("Double", false);
04224: yyValue.setLocation(location(yyStart));
04225:
04226: return yyResult.createValue(yyValue, yyError);
04227: }
04228:
04229: // Alternative 4.
04230:
04231: yyResult = pKeyword(yyStart);
04232: yyError = yyResult.select(yyError);
04233: if (yyResult.hasValue("float")) {
04234:
04235: yyValue = GNode.create("Float", false);
04236: yyValue.setLocation(location(yyStart));
04237:
04238: return yyResult.createValue(yyValue, yyError);
04239: }
04240:
04241: // Done.
04242: yyError = yyError.select(
04243: "floating point type specifier expected", yyStart);
04244: return yyError;
04245: }
04246:
04247: // =========================================================================
04248:
04249: /**
04250: * Parse nonterminal xtc.lang.C.IntegerTypeSpecifier.
04251: *
04252: * @param yyStart The index.
04253: * @return The result.
04254: * @throws IOException Signals an I/O error.
04255: */
04256: private Result pIntegerTypeSpecifier(final int yyStart)
04257: throws IOException {
04258: Result yyResult;
04259: Node yyValue;
04260: ParseError yyError = ParseError.DUMMY;
04261:
04262: // Alternative 1.
04263:
04264: yyResult = pKeyword(yyStart);
04265: yyError = yyResult.select(yyError);
04266: if (yyResult.hasValue("long")) {
04267:
04268: yyValue = GNode.create("Long", false);
04269: yyValue.setLocation(location(yyStart));
04270:
04271: return yyResult.createValue(yyValue, yyError);
04272: }
04273:
04274: // Alternative 2.
04275:
04276: yyResult = pKeyword(yyStart);
04277: yyError = yyResult.select(yyError);
04278: if (yyResult.hasValue("int")) {
04279:
04280: yyValue = GNode.create("Int", false);
04281: yyValue.setLocation(location(yyStart));
04282:
04283: return yyResult.createValue(yyValue, yyError);
04284: }
04285:
04286: // Alternative 3.
04287:
04288: yyResult = pKeyword(yyStart);
04289: yyError = yyResult.select(yyError);
04290: if (yyResult.hasValue("short")) {
04291:
04292: yyValue = GNode.create("Short", false);
04293: yyValue.setLocation(location(yyStart));
04294:
04295: return yyResult.createValue(yyValue, yyError);
04296: }
04297:
04298: // Alternative 4.
04299:
04300: yyResult = pKeyword(yyStart);
04301: yyError = yyResult.select(yyError);
04302: if (yyResult.hasValue("char")) {
04303:
04304: yyValue = GNode.create("Char", false);
04305: yyValue.setLocation(location(yyStart));
04306:
04307: return yyResult.createValue(yyValue, yyError);
04308: }
04309:
04310: // Alternative 5.
04311:
04312: yyResult = pKeyword(yyStart);
04313: yyError = yyResult.select(yyError);
04314: if (yyResult.hasValue("_Bool")) {
04315:
04316: yyValue = GNode.create("Bool", false);
04317: yyValue.setLocation(location(yyStart));
04318:
04319: return yyResult.createValue(yyValue, yyError);
04320: }
04321:
04322: // Alternative 6.
04323:
04324: yyResult = pKeyword(yyStart);
04325: yyError = yyResult.select(yyError);
04326: if (yyResult.hasValue("unsigned")) {
04327:
04328: yyValue = GNode.create("Unsigned", false);
04329: yyValue.setLocation(location(yyStart));
04330:
04331: return yyResult.createValue(yyValue, yyError);
04332: }
04333:
04334: // Alternative 7.
04335:
04336: yyResult = pKeyword(yyStart);
04337: yyError = yyResult.select(yyError);
04338: if (yyResult.hasValue("signed")) {
04339: final String v$g$1 = "signed";
04340:
04341: yyValue = GNode.create("Signed", v$g$1);
04342: yyValue.setLocation(location(yyStart));
04343:
04344: return yyResult.createValue(yyValue, yyError);
04345: }
04346:
04347: // Alternative 8.
04348:
04349: yyResult = pKeyword(yyStart);
04350: yyError = yyResult.select(yyError);
04351: if (yyResult.hasValue("__signed")) {
04352: final String v$g$2 = "__signed";
04353:
04354: yyValue = GNode.create("Signed", v$g$2);
04355: yyValue.setLocation(location(yyStart));
04356:
04357: return yyResult.createValue(yyValue, yyError);
04358: }
04359:
04360: // Alternative 9.
04361:
04362: yyResult = pKeyword(yyStart);
04363: yyError = yyResult.select(yyError);
04364: if (yyResult.hasValue("__signed__")) {
04365: final String v$g$3 = "__signed__";
04366:
04367: yyValue = GNode.create("Signed", v$g$3);
04368: yyValue.setLocation(location(yyStart));
04369:
04370: return yyResult.createValue(yyValue, yyError);
04371: }
04372:
04373: // Done.
04374: yyError = yyError.select("integer type specifier expected",
04375: yyStart);
04376: return yyError;
04377: }
04378:
04379: // =========================================================================
04380:
04381: /**
04382: * Parse nonterminal xtc.lang.C.TypeofKeyword.
04383: *
04384: * @param yyStart The index.
04385: * @return The result.
04386: * @throws IOException Signals an I/O error.
04387: */
04388: private Result pTypeofKeyword(final int yyStart) throws IOException {
04389: Result yyResult;
04390: Void yyValue;
04391: ParseError yyError = ParseError.DUMMY;
04392:
04393: // Alternative 1.
04394:
04395: yyResult = pKeyword(yyStart);
04396: yyError = yyResult.select(yyError);
04397: if (yyResult.hasValue("typeof")) {
04398:
04399: yyValue = null;
04400:
04401: return yyResult.createValue(yyValue, yyError);
04402: }
04403:
04404: // Alternative 2.
04405:
04406: yyResult = pKeyword(yyStart);
04407: yyError = yyResult.select(yyError);
04408: if (yyResult.hasValue("__typeof")) {
04409:
04410: yyValue = null;
04411:
04412: return yyResult.createValue(yyValue, yyError);
04413: }
04414:
04415: // Alternative 3.
04416:
04417: yyResult = pKeyword(yyStart);
04418: yyError = yyResult.select(yyError);
04419: if (yyResult.hasValue("__typeof__")) {
04420:
04421: yyValue = null;
04422:
04423: return yyResult.createValue(yyValue, yyError);
04424: }
04425:
04426: // Done.
04427: yyError = yyError.select("typeof keyword expected", yyStart);
04428: return yyError;
04429: }
04430:
04431: // =========================================================================
04432:
04433: /**
04434: * Parse nonterminal xtc.lang.C.Initializer.
04435: *
04436: * @param yyStart The index.
04437: * @return The result.
04438: * @throws IOException Signals an I/O error.
04439: */
04440: private Result pInitializer(final int yyStart) throws IOException {
04441: Result yyResult;
04442: int yyBase;
04443: int yyOption1;
04444: Node yyValue;
04445: ParseError yyError = ParseError.DUMMY;
04446:
04447: // Alternative <Complex>.
04448:
04449: yyResult = pSymbol(yyStart);
04450: yyError = yyResult.select(yyError);
04451: if (yyResult.hasValue("{")) {
04452:
04453: yyResult = pInitializerList(yyResult.index);
04454: yyError = yyResult.select(yyError);
04455: if (yyResult.hasValue()) {
04456: yyValue = yyResult.semanticValue();
04457:
04458: yyOption1 = yyResult.index;
04459:
04460: yyBase = yyOption1;
04461: yyResult = pSymbol(yyBase);
04462: yyError = yyResult.select(yyError);
04463: if (yyResult.hasValue(",")) {
04464:
04465: yyOption1 = yyResult.index;
04466: } else {
04467: yyError = yyError.select("\",\" expected", yyBase);
04468: }
04469:
04470: yyBase = yyOption1;
04471: yyResult = pSymbol(yyBase);
04472: yyError = yyResult.select(yyError);
04473: if (yyResult.hasValue("}")) {
04474:
04475: return yyResult.createValue(yyValue, yyError);
04476: } else {
04477: yyError = yyError.select("\"}\" expected", yyBase);
04478: }
04479: }
04480: }
04481:
04482: // Alternative <Simple>.
04483:
04484: yyResult = pAssignmentExpression(yyStart);
04485: yyError = yyResult.select(yyError);
04486: if (yyResult.hasValue()) {
04487: yyValue = yyResult.semanticValue();
04488:
04489: return yyResult.createValue(yyValue, yyError);
04490: }
04491:
04492: // Done.
04493: yyError = yyError.select("initializer expected", yyStart);
04494: return yyError;
04495: }
04496:
04497: // =========================================================================
04498:
04499: /**
04500: * Parse nonterminal xtc.lang.C.InitializerList.
04501: *
04502: * @param yyStart The index.
04503: * @return The result.
04504: * @throws IOException Signals an I/O error.
04505: */
04506: private Result pInitializerList(final int yyStart)
04507: throws IOException {
04508: Result yyResult;
04509: int yyBase;
04510: int yyRepetition1;
04511: Pair<Node> yyRepValue1;
04512: Node yyValue;
04513: ParseError yyError = ParseError.DUMMY;
04514:
04515: // Alternative 1.
04516:
04517: yyResult = pInitializerListEntry(yyStart);
04518: yyError = yyResult.select(yyError);
04519: if (yyResult.hasValue()) {
04520: final Node v$g$1 = yyResult.semanticValue();
04521:
04522: yyRepetition1 = yyResult.index;
04523: yyRepValue1 = Pair.empty();
04524: while (true) {
04525:
04526: yyBase = yyRepetition1;
04527: yyResult = pSymbol(yyBase);
04528: yyError = yyResult.select(yyError);
04529: if (yyResult.hasValue(",")) {
04530:
04531: yyResult = pInitializerListEntry(yyResult.index);
04532: yyError = yyResult.select(yyError);
04533: if (yyResult.hasValue()) {
04534: final Node v$el$1 = yyResult.semanticValue();
04535:
04536: yyRepetition1 = yyResult.index;
04537: yyRepValue1 = new Pair<Node>(v$el$1,
04538: yyRepValue1);
04539: continue;
04540: }
04541: } else {
04542: yyError = yyError.select("\",\" expected", yyBase);
04543: }
04544: break;
04545: }
04546: { // Start scope for v$g$2.
04547: final Pair<Node> v$g$2 = yyRepValue1.reverse();
04548:
04549: yyValue = GNode.createFromPair("InitializerList",
04550: v$g$1, v$g$2);
04551: yyValue.setLocation(location(yyStart));
04552:
04553: return new SemanticValue(yyValue, yyRepetition1,
04554: yyError);
04555: } // End scope for v$g$2.
04556: }
04557:
04558: // Alternative 2.
04559:
04560: if (GCC) {
04561:
04562: yyValue = GNode.create("InitializerList", false);
04563: yyValue.setLocation(location(yyStart));
04564:
04565: return new SemanticValue(yyValue, yyStart, yyError);
04566: }
04567:
04568: // Done.
04569: yyError = yyError.select("initializer list expected", yyStart);
04570: return yyError;
04571: }
04572:
04573: // =========================================================================
04574:
04575: /**
04576: * Parse nonterminal xtc.lang.C.InitializerListEntry.
04577: *
04578: * @param yyStart The index.
04579: * @return The result.
04580: * @throws IOException Signals an I/O error.
04581: */
04582: private Result pInitializerListEntry(final int yyStart)
04583: throws IOException {
04584: Result yyResult;
04585: int yyOption1;
04586: Node yyOpValue1;
04587: Node yyValue;
04588: ParseError yyError = ParseError.DUMMY;
04589:
04590: // Alternative 1.
04591:
04592: yyOption1 = yyStart;
04593: yyOpValue1 = null;
04594:
04595: yyResult = pDesignation(yyOption1);
04596: yyError = yyResult.select(yyError);
04597: if (yyResult.hasValue()) {
04598: final Node v$el$1 = yyResult.semanticValue();
04599:
04600: yyOption1 = yyResult.index;
04601: yyOpValue1 = v$el$1;
04602: }
04603: { // Start scope for v$g$1.
04604: final Node v$g$1 = yyOpValue1;
04605:
04606: yyResult = pInitializer(yyOption1);
04607: yyError = yyResult.select(yyError);
04608: if (yyResult.hasValue()) {
04609: final Node v$g$2 = yyResult.semanticValue();
04610:
04611: yyValue = GNode.create("InitializerListEntry", v$g$1,
04612: v$g$2);
04613: yyValue.setLocation(location(yyStart));
04614:
04615: return yyResult.createValue(yyValue, yyError);
04616: }
04617: } // End scope for v$g$1.
04618:
04619: // Done.
04620: return yyError;
04621: }
04622:
04623: // =========================================================================
04624:
04625: /**
04626: * Parse nonterminal xtc.lang.C.Designation.
04627: *
04628: * @param yyStart The index.
04629: * @return The result.
04630: * @throws IOException Signals an I/O error.
04631: */
04632: private Result pDesignation(final int yyStart) throws IOException {
04633: Result yyResult;
04634: int yyBase;
04635: int yyRepetition1;
04636: boolean yyRepeated1;
04637: Pair<Node> yyRepValue1;
04638: Node yyValue;
04639: ParseError yyError = ParseError.DUMMY;
04640:
04641: // Alternative <Standard>.
04642:
04643: yyRepetition1 = yyStart;
04644: yyRepeated1 = false;
04645: yyRepValue1 = Pair.empty();
04646: while (true) {
04647:
04648: yyResult = pDesignator(yyRepetition1);
04649: yyError = yyResult.select(yyError);
04650: if (yyResult.hasValue()) {
04651: final Node v$el$1 = yyResult.semanticValue();
04652:
04653: yyRepetition1 = yyResult.index;
04654: yyRepeated1 = true;
04655: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
04656: continue;
04657: }
04658: break;
04659: }
04660:
04661: if (yyRepeated1) {
04662: final Pair<Node> v$g$1 = yyRepValue1.reverse();
04663:
04664: yyBase = yyRepetition1;
04665: yyResult = pSymbol(yyBase);
04666: yyError = yyResult.select(yyError);
04667: if (yyResult.hasValue("=")) {
04668:
04669: yyValue = GNode.createFromPair("Designation", v$g$1);
04670: yyValue.setLocation(location(yyStart));
04671:
04672: return yyResult.createValue(yyValue, yyError);
04673: } else {
04674: yyError = yyError.select("\"=\" expected", yyBase);
04675: }
04676: }
04677:
04678: // Alternative 2.
04679:
04680: if (GCC) {
04681:
04682: final int yyChoice1 = yyStart;
04683:
04684: // Nested alternative 1.
04685:
04686: yyResult = pObsoleteArrayDesignation(yyChoice1);
04687: yyError = yyResult.select(yyError);
04688: if (yyResult.hasValue()) {
04689: yyValue = yyResult.semanticValue();
04690:
04691: return yyResult.createValue(yyValue, yyError);
04692: }
04693:
04694: // Nested alternative 2.
04695:
04696: yyResult = pObsoleteFieldDesignation(yyChoice1);
04697: yyError = yyResult.select(yyError);
04698: if (yyResult.hasValue()) {
04699: yyValue = yyResult.semanticValue();
04700:
04701: return yyResult.createValue(yyValue, yyError);
04702: }
04703: }
04704:
04705: // Done.
04706: yyError = yyError.select("designation expected", yyStart);
04707: return yyError;
04708: }
04709:
04710: // =========================================================================
04711:
04712: /**
04713: * Parse nonterminal xtc.lang.C.Designator.
04714: *
04715: * @param yyStart The index.
04716: * @return The result.
04717: * @throws IOException Signals an I/O error.
04718: */
04719: private Result pDesignator(final int yyStart) throws IOException {
04720: Result yyResult;
04721: int yyBase;
04722: Node yyValue;
04723: ParseError yyError = ParseError.DUMMY;
04724:
04725: // Alternative <Array>.
04726:
04727: yyResult = pSymbol(yyStart);
04728: yyError = yyResult.select(yyError);
04729: if (yyResult.hasValue("[")) {
04730: final String v$g$1 = "[";
04731:
04732: yyResult = pConditionalExpression(yyResult.index);
04733: yyError = yyResult.select(yyError);
04734: if (yyResult.hasValue()) {
04735: final Node v$g$2 = yyResult.semanticValue();
04736:
04737: yyBase = yyResult.index;
04738: yyResult = pSymbol(yyBase);
04739: yyError = yyResult.select(yyError);
04740: if (yyResult.hasValue("]")) {
04741:
04742: yyValue = GNode.create("Designator", v$g$1, v$g$2);
04743: yyValue.setLocation(location(yyStart));
04744:
04745: return yyResult.createValue(yyValue, yyError);
04746: } else {
04747: yyError = yyError.select("\"]\" expected", yyBase);
04748: }
04749: }
04750: }
04751:
04752: // Alternative <ArrayRange>.
04753:
04754: if (GCC) {
04755:
04756: yyResult = pSymbol(yyStart);
04757: yyError = yyResult.select(yyError);
04758: if (yyResult.hasValue("[")) {
04759: final String v$g$3 = "[";
04760:
04761: yyResult = pConditionalExpression(yyResult.index);
04762: yyError = yyResult.select(yyError);
04763: if (yyResult.hasValue()) {
04764: final Node v$g$4 = yyResult.semanticValue();
04765:
04766: yyBase = yyResult.index;
04767: yyResult = pSymbol(yyBase);
04768: yyError = yyResult.select(yyError);
04769: if (yyResult.hasValue("...")) {
04770:
04771: yyResult = pConditionalExpression(yyResult.index);
04772: yyError = yyResult.select(yyError);
04773: if (yyResult.hasValue()) {
04774: final Node v$g$5 = yyResult.semanticValue();
04775:
04776: yyBase = yyResult.index;
04777: yyResult = pSymbol(yyBase);
04778: yyError = yyResult.select(yyError);
04779: if (yyResult.hasValue("]")) {
04780:
04781: yyValue = GNode.create("Designator",
04782: v$g$3, v$g$4, v$g$5);
04783: yyValue.setLocation(location(yyStart));
04784:
04785: return yyResult.createValue(yyValue,
04786: yyError);
04787: } else {
04788: yyError = yyError.select(
04789: "\"]\" expected", yyBase);
04790: }
04791: }
04792: } else {
04793: yyError = yyError.select("\"...\" expected",
04794: yyBase);
04795: }
04796: }
04797: }
04798: }
04799:
04800: // Alternative <Structure>.
04801:
04802: yyResult = pSymbol(yyStart);
04803: yyError = yyResult.select(yyError);
04804: if (yyResult.hasValue(".")) {
04805: final String v$g$6 = ".";
04806:
04807: yyResult = pPrimaryIdentifier(yyResult.index);
04808: yyError = yyResult.select(yyError);
04809: if (yyResult.hasValue()) {
04810: final Node v$g$7 = yyResult.semanticValue();
04811:
04812: yyValue = GNode.create("Designator", v$g$6, v$g$7);
04813: yyValue.setLocation(location(yyStart));
04814:
04815: return yyResult.createValue(yyValue, yyError);
04816: }
04817: }
04818:
04819: // Done.
04820: yyError = yyError.select("designator expected", yyStart);
04821: return yyError;
04822: }
04823:
04824: // =========================================================================
04825:
04826: /**
04827: * Parse nonterminal xtc.lang.C.ObsoleteArrayDesignation.
04828: *
04829: * @param yyStart The index.
04830: * @return The result.
04831: * @throws IOException Signals an I/O error.
04832: */
04833: private Result pObsoleteArrayDesignation(final int yyStart)
04834: throws IOException {
04835:
04836: Result yyResult;
04837: int yyBase;
04838: Node yyValue;
04839: ParseError yyError = ParseError.DUMMY;
04840:
04841: // Alternative 1.
04842:
04843: yyResult = pSymbol(yyStart);
04844: yyError = yyResult.select(yyError);
04845: if (yyResult.hasValue("[")) {
04846: final String v$g$1 = "[";
04847:
04848: yyResult = pConditionalExpression(yyResult.index);
04849: yyError = yyResult.select(yyError);
04850: if (yyResult.hasValue()) {
04851: final Node v$g$2 = yyResult.semanticValue();
04852:
04853: final int yyChoice1 = yyResult.index;
04854:
04855: // Nested alternative 1.
04856:
04857: yyBase = yyChoice1;
04858: yyResult = pSymbol(yyBase);
04859: yyError = yyResult.select(yyError);
04860: if (yyResult.hasValue("]")) {
04861:
04862: yyValue = GNode.create("ObsoleteArrayDesignation",
04863: v$g$1, v$g$2);
04864: yyValue.setLocation(location(yyStart));
04865:
04866: return yyResult.createValue(yyValue, yyError);
04867: } else {
04868: yyError = yyError.select("\"]\" expected", yyBase);
04869: }
04870:
04871: // Nested alternative 2.
04872:
04873: yyBase = yyChoice1;
04874: yyResult = pSymbol(yyBase);
04875: yyError = yyResult.select(yyError);
04876: if (yyResult.hasValue("...")) {
04877:
04878: yyResult = pConditionalExpression(yyResult.index);
04879: yyError = yyResult.select(yyError);
04880: if (yyResult.hasValue()) {
04881: final Node v$g$3 = yyResult.semanticValue();
04882:
04883: yyBase = yyResult.index;
04884: yyResult = pSymbol(yyBase);
04885: yyError = yyResult.select(yyError);
04886: if (yyResult.hasValue("]")) {
04887:
04888: yyValue = GNode.create(
04889: "ObsoleteArrayDesignation", v$g$1,
04890: v$g$2, v$g$3);
04891: yyValue.setLocation(location(yyStart));
04892:
04893: return yyResult.createValue(yyValue,
04894: yyError);
04895: } else {
04896: yyError = yyError.select("\"]\" expected",
04897: yyBase);
04898: }
04899: }
04900: } else {
04901: yyError = yyError
04902: .select("\"...\" expected", yyBase);
04903: }
04904: }
04905: }
04906:
04907: // Done.
04908: yyError = yyError.select("obsolete array designation expected",
04909: yyStart);
04910: return yyError;
04911: }
04912:
04913: // =========================================================================
04914:
04915: /**
04916: * Parse nonterminal xtc.lang.C.ObsoleteFieldDesignation.
04917: *
04918: * @param yyStart The index.
04919: * @return The result.
04920: * @throws IOException Signals an I/O error.
04921: */
04922: private Result pObsoleteFieldDesignation(final int yyStart)
04923: throws IOException {
04924:
04925: Result yyResult;
04926: int yyBase;
04927: Node yyValue;
04928: ParseError yyError = ParseError.DUMMY;
04929:
04930: // Alternative 1.
04931:
04932: yyResult = pIdentifier(yyStart);
04933: yyError = yyResult.select(yyError);
04934: if (yyResult.hasValue()) {
04935: final String v$g$1 = yyResult.semanticValue();
04936:
04937: yyBase = yyResult.index;
04938: yyResult = pSymbol(yyBase);
04939: yyError = yyResult.select(yyError);
04940: if (yyResult.hasValue(":")) {
04941:
04942: yyValue = GNode.create("ObsoleteFieldDesignation",
04943: v$g$1);
04944: yyValue.setLocation(location(yyStart));
04945:
04946: return yyResult.createValue(yyValue, yyError);
04947: } else {
04948: yyError = yyError.select("\":\" expected", yyBase);
04949: }
04950: }
04951:
04952: // Done.
04953: return yyError;
04954: }
04955:
04956: // =========================================================================
04957:
04958: /**
04959: * Parse nonterminal xtc.lang.C.TypeName.
04960: *
04961: * @param yyStart The index.
04962: * @return The result.
04963: * @throws IOException Signals an I/O error.
04964: */
04965: private Result pTypeName(final int yyStart) throws IOException {
04966: CParserColumn yyColumn = (CParserColumn) column(yyStart);
04967: if (null == yyColumn.chunk1)
04968: yyColumn.chunk1 = new Chunk1();
04969: if (null == yyColumn.chunk1.fTypeName)
04970: yyColumn.chunk1.fTypeName = pTypeName$1(yyStart);
04971: return yyColumn.chunk1.fTypeName;
04972: }
04973:
04974: /** Actually parse xtc.lang.C.TypeName. */
04975: private Result pTypeName$1(final int yyStart) throws IOException {
04976: Result yyResult;
04977: int yyOption1;
04978: Node yyOpValue1;
04979: Node yyValue;
04980: ParseError yyError = ParseError.DUMMY;
04981:
04982: // Start a state modification.
04983: yyState.start();
04984:
04985: // Alternative 1.
04986:
04987: yyResult = pSpecifierQualifierList(yyStart);
04988: yyError = yyResult.select(yyError);
04989: if (yyResult.hasValue()) {
04990: final Node v$g$1 = yyResult.semanticValue();
04991:
04992: yyOption1 = yyResult.index;
04993: yyOpValue1 = null;
04994:
04995: yyResult = pAbstractDeclarator(yyOption1);
04996: yyError = yyResult.select(yyError);
04997: if (yyResult.hasValue()) {
04998: final Node v$el$1 = yyResult.semanticValue();
04999:
05000: yyOption1 = yyResult.index;
05001: yyOpValue1 = v$el$1;
05002: }
05003: { // Start scope for v$g$2.
05004: final Node v$g$2 = yyOpValue1;
05005:
05006: yyValue = GNode.create("TypeName", v$g$1, v$g$2);
05007: yyValue.setLocation(location(yyStart));
05008:
05009: // Commit the state modification.
05010: yyState.commit();
05011:
05012: return new SemanticValue(yyValue, yyOption1, yyError);
05013: } // End scope for v$g$2.
05014: }
05015:
05016: // Abort the state modification.
05017: yyState.abort();
05018:
05019: // Done.
05020: return yyError;
05021: }
05022:
05023: // =========================================================================
05024:
05025: /**
05026: * Parse nonterminal xtc.lang.C.AttributeSpecifierList.
05027: *
05028: * @param yyStart The index.
05029: * @return The result.
05030: * @throws IOException Signals an I/O error.
05031: */
05032: private Result pAttributeSpecifierList(final int yyStart)
05033: throws IOException {
05034:
05035: CParserColumn yyColumn = (CParserColumn) column(yyStart);
05036: if (null == yyColumn.chunk1)
05037: yyColumn.chunk1 = new Chunk1();
05038: if (null == yyColumn.chunk1.fAttributeSpecifierList)
05039: yyColumn.chunk1.fAttributeSpecifierList = pAttributeSpecifierList$1(yyStart);
05040: return yyColumn.chunk1.fAttributeSpecifierList;
05041: }
05042:
05043: /** Actually parse xtc.lang.C.AttributeSpecifierList. */
05044: private Result pAttributeSpecifierList$1(final int yyStart)
05045: throws IOException {
05046:
05047: Result yyResult;
05048: Node yyValue;
05049: ParseError yyError = ParseError.DUMMY;
05050:
05051: // Alternative 1.
05052:
05053: yyResult = pAttributeSpecifierPlus(yyStart);
05054: yyError = yyResult.select(yyError);
05055: if (yyResult.hasValue()) {
05056: final Pair<Node> v$g$1 = yyResult.semanticValue();
05057:
05058: yyValue = GNode.createFromPair("AttributeSpecifierList",
05059: v$g$1);
05060: yyValue.setLocation(location(yyStart));
05061:
05062: return yyResult.createValue(yyValue, yyError);
05063: }
05064:
05065: // Done.
05066: return yyError;
05067: }
05068:
05069: // =========================================================================
05070:
05071: /**
05072: * Parse nonterminal xtc.lang.C.AttributeSpecifierPlus.
05073: *
05074: * @param yyStart The index.
05075: * @return The result.
05076: * @throws IOException Signals an I/O error.
05077: */
05078: private Result pAttributeSpecifierPlus(final int yyStart)
05079: throws IOException {
05080:
05081: Result yyResult;
05082: int yyRepetition1;
05083: boolean yyRepeated1;
05084: Pair<Node> yyRepValue1;
05085: Pair<Node> yyValue;
05086: ParseError yyError = ParseError.DUMMY;
05087:
05088: // Alternative 1.
05089:
05090: yyRepetition1 = yyStart;
05091: yyRepeated1 = false;
05092: yyRepValue1 = Pair.empty();
05093: while (true) {
05094:
05095: yyResult = pAttributeSpecifier(yyRepetition1);
05096: yyError = yyResult.select(yyError);
05097: if (yyResult.hasValue()) {
05098: final Node v$el$1 = yyResult.semanticValue();
05099:
05100: yyRepetition1 = yyResult.index;
05101: yyRepeated1 = true;
05102: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
05103: continue;
05104: }
05105: break;
05106: }
05107:
05108: if (yyRepeated1) {
05109: yyValue = yyRepValue1.reverse();
05110:
05111: return new SemanticValue(yyValue, yyRepetition1, yyError);
05112: }
05113:
05114: // Done.
05115: return yyError;
05116: }
05117:
05118: // =========================================================================
05119:
05120: /**
05121: * Parse nonterminal xtc.lang.C.AttributeSpecifier.
05122: *
05123: * @param yyStart The index.
05124: * @return The result.
05125: * @throws IOException Signals an I/O error.
05126: */
05127: private Result pAttributeSpecifier(final int yyStart)
05128: throws IOException {
05129: CParserColumn yyColumn = (CParserColumn) column(yyStart);
05130: if (null == yyColumn.chunk2)
05131: yyColumn.chunk2 = new Chunk2();
05132: if (null == yyColumn.chunk2.fAttributeSpecifier)
05133: yyColumn.chunk2.fAttributeSpecifier = pAttributeSpecifier$1(yyStart);
05134: return yyColumn.chunk2.fAttributeSpecifier;
05135: }
05136:
05137: /** Actually parse xtc.lang.C.AttributeSpecifier. */
05138: private Result pAttributeSpecifier$1(final int yyStart)
05139: throws IOException {
05140: Result yyResult;
05141: int yyBase;
05142: int yyOption1;
05143: Node yyOpValue1;
05144: Node yyValue;
05145: ParseError yyError = ParseError.DUMMY;
05146:
05147: // Alternative 1.
05148:
05149: yyResult = pAttributeKeyword(yyStart);
05150: yyError = yyResult.select(yyError);
05151: if (yyResult.hasValue()) {
05152:
05153: yyBase = yyResult.index;
05154: yyResult = pSymbol(yyBase);
05155: yyError = yyResult.select(yyError);
05156: if (yyResult.hasValue("(")) {
05157:
05158: yyBase = yyResult.index;
05159: yyResult = pSymbol(yyBase);
05160: yyError = yyResult.select(yyError);
05161: if (yyResult.hasValue("(")) {
05162:
05163: yyOption1 = yyResult.index;
05164: yyOpValue1 = null;
05165:
05166: yyResult = pAttributeList(yyOption1);
05167: yyError = yyResult.select(yyError);
05168: if (yyResult.hasValue()) {
05169: final Node v$el$1 = yyResult.semanticValue();
05170:
05171: yyOption1 = yyResult.index;
05172: yyOpValue1 = v$el$1;
05173: }
05174: { // Start scope for v$g$1.
05175: final Node v$g$1 = yyOpValue1;
05176:
05177: yyBase = yyOption1;
05178: yyResult = pSymbol(yyBase);
05179: yyError = yyResult.select(yyError);
05180: if (yyResult.hasValue(")")) {
05181:
05182: yyBase = yyResult.index;
05183: yyResult = pSymbol(yyBase);
05184: yyError = yyResult.select(yyError);
05185: if (yyResult.hasValue(")")) {
05186:
05187: yyValue = GNode.create(
05188: "AttributeSpecifier", v$g$1);
05189: yyValue.setLocation(location(yyStart));
05190:
05191: return yyResult.createValue(yyValue,
05192: yyError);
05193: } else {
05194: yyError = yyError.select(
05195: "\")\" expected", yyBase);
05196: }
05197: } else {
05198: yyError = yyError.select("\")\" expected",
05199: yyBase);
05200: }
05201: } // End scope for v$g$1.
05202: } else {
05203: yyError = yyError.select("\"(\" expected", yyBase);
05204: }
05205: } else {
05206: yyError = yyError.select("\"(\" expected", yyBase);
05207: }
05208: }
05209:
05210: // Done.
05211: return yyError;
05212: }
05213:
05214: // =========================================================================
05215:
05216: /**
05217: * Parse nonterminal xtc.lang.C.AttributeKeyword.
05218: *
05219: * @param yyStart The index.
05220: * @return The result.
05221: * @throws IOException Signals an I/O error.
05222: */
05223: private Result pAttributeKeyword(final int yyStart)
05224: throws IOException {
05225: Result yyResult;
05226: Void yyValue;
05227: ParseError yyError = ParseError.DUMMY;
05228:
05229: // Alternative 1.
05230:
05231: yyResult = pKeyword(yyStart);
05232: yyError = yyResult.select(yyError);
05233: if (yyResult.hasValue("__attribute")) {
05234:
05235: yyValue = null;
05236:
05237: return yyResult.createValue(yyValue, yyError);
05238: }
05239:
05240: // Alternative 2.
05241:
05242: yyResult = pKeyword(yyStart);
05243: yyError = yyResult.select(yyError);
05244: if (yyResult.hasValue("__attribute__")) {
05245:
05246: yyValue = null;
05247:
05248: return yyResult.createValue(yyValue, yyError);
05249: }
05250:
05251: // Done.
05252: yyError = yyError.select("attribute keyword expected", yyStart);
05253: return yyError;
05254: }
05255:
05256: // =========================================================================
05257:
05258: /**
05259: * Parse nonterminal xtc.lang.C.AttributeList.
05260: *
05261: * @param yyStart The index.
05262: * @return The result.
05263: * @throws IOException Signals an I/O error.
05264: */
05265: private Result pAttributeList(final int yyStart) throws IOException {
05266: Result yyResult;
05267: int yyBase;
05268: int yyRepetition1;
05269: Pair<Node> yyRepValue1;
05270: Node yyValue;
05271: ParseError yyError = ParseError.DUMMY;
05272:
05273: // Alternative 1.
05274:
05275: yyResult = pAttributeListEntry(yyStart);
05276: yyError = yyResult.select(yyError);
05277: if (yyResult.hasValue()) {
05278: final Node v$g$1 = yyResult.semanticValue();
05279:
05280: yyRepetition1 = yyResult.index;
05281: yyRepValue1 = Pair.empty();
05282: while (true) {
05283:
05284: yyBase = yyRepetition1;
05285: yyResult = pSymbol(yyBase);
05286: yyError = yyResult.select(yyError);
05287: if (yyResult.hasValue(",")) {
05288:
05289: yyResult = pAttributeListEntry(yyResult.index);
05290: yyError = yyResult.select(yyError);
05291: if (yyResult.hasValue()) {
05292: final Node v$el$1 = yyResult.semanticValue();
05293:
05294: yyRepetition1 = yyResult.index;
05295: yyRepValue1 = new Pair<Node>(v$el$1,
05296: yyRepValue1);
05297: continue;
05298: }
05299: } else {
05300: yyError = yyError.select("\",\" expected", yyBase);
05301: }
05302: break;
05303: }
05304: { // Start scope for v$g$2.
05305: final Pair<Node> v$g$2 = yyRepValue1.reverse();
05306:
05307: yyValue = GNode.createFromPair("AttributeList", v$g$1,
05308: v$g$2);
05309: yyValue.setLocation(location(yyStart));
05310:
05311: return new SemanticValue(yyValue, yyRepetition1,
05312: yyError);
05313: } // End scope for v$g$2.
05314: }
05315:
05316: // Done.
05317: return yyError;
05318: }
05319:
05320: // =========================================================================
05321:
05322: /**
05323: * Parse nonterminal xtc.lang.C.AttributeListEntry.
05324: *
05325: * @param yyStart The index.
05326: * @return The result.
05327: * @throws IOException Signals an I/O error.
05328: */
05329: private Result pAttributeListEntry(final int yyStart)
05330: throws IOException {
05331: Result yyResult;
05332: int yyBase;
05333: int yyOption1;
05334: Node yyOpValue1;
05335: int yyOption2;
05336: Node yyOpValue2;
05337: Node yyValue;
05338: ParseError yyError = ParseError.DUMMY;
05339:
05340: // Alternative 1.
05341:
05342: yyResult = pWord(yyStart);
05343: yyError = yyResult.select(yyError);
05344: if (yyResult.hasValue()) {
05345: final String v$g$1 = yyResult.semanticValue();
05346:
05347: yyOption1 = yyResult.index;
05348: yyOpValue1 = null;
05349:
05350: yyBase = yyOption1;
05351: yyResult = pSymbol(yyBase);
05352: yyError = yyResult.select(yyError);
05353: if (yyResult.hasValue("(")) {
05354:
05355: yyOption2 = yyResult.index;
05356: yyOpValue2 = null;
05357:
05358: yyResult = pExpressionList(yyOption2);
05359: yyError = yyResult.select(yyError);
05360: if (yyResult.hasValue()) {
05361: final Node v$el$2 = yyResult.semanticValue();
05362:
05363: yyOption2 = yyResult.index;
05364: yyOpValue2 = v$el$2;
05365: }
05366: { // Start scope for v$el$1.
05367: final Node v$el$1 = yyOpValue2;
05368:
05369: yyBase = yyOption2;
05370: yyResult = pSymbol(yyBase);
05371: yyError = yyResult.select(yyError);
05372: if (yyResult.hasValue(")")) {
05373:
05374: yyOption1 = yyResult.index;
05375: yyOpValue1 = v$el$1;
05376: } else {
05377: yyError = yyError.select("\")\" expected",
05378: yyBase);
05379: }
05380: } // End scope for v$el$1.
05381: } else {
05382: yyError = yyError.select("\"(\" expected", yyBase);
05383: }
05384: { // Start scope for v$g$2.
05385: final Node v$g$2 = yyOpValue1;
05386:
05387: yyValue = GNode.create("AttributeListEntry", v$g$1,
05388: v$g$2);
05389: yyValue.setLocation(location(yyStart));
05390:
05391: return new SemanticValue(yyValue, yyOption1, yyError);
05392: } // End scope for v$g$2.
05393: }
05394:
05395: // Done.
05396: return yyError;
05397: }
05398:
05399: // =========================================================================
05400:
05401: /**
05402: * Parse nonterminal xtc.lang.C.Statement.
05403: *
05404: * @param yyStart The index.
05405: * @return The result.
05406: * @throws IOException Signals an I/O error.
05407: */
05408: private Result pStatement(final int yyStart) throws IOException {
05409: CParserColumn yyColumn = (CParserColumn) column(yyStart);
05410: if (null == yyColumn.chunk2)
05411: yyColumn.chunk2 = new Chunk2();
05412: if (null == yyColumn.chunk2.fStatement)
05413: yyColumn.chunk2.fStatement = pStatement$1(yyStart);
05414: return yyColumn.chunk2.fStatement;
05415: }
05416:
05417: /** Actually parse xtc.lang.C.Statement. */
05418: private Result pStatement$1(final int yyStart) throws IOException {
05419: Result yyResult;
05420: int yyBase;
05421: int yyOption1;
05422: Node yyOpValue1;
05423: Node yyValue;
05424: ParseError yyError = ParseError.DUMMY;
05425:
05426: // Alternative 1.
05427:
05428: yyResult = pCommaExpression(yyStart);
05429: yyError = yyResult.select(yyError);
05430: if (yyResult.hasValue()) {
05431: final Node v$g$1 = yyResult.semanticValue();
05432:
05433: yyBase = yyResult.index;
05434: yyResult = pSymbol(yyBase);
05435: yyError = yyResult.select(yyError);
05436: if (yyResult.hasValue(";")) {
05437:
05438: yyValue = GNode.create("ExpressionStatement", v$g$1);
05439: yyValue.setLocation(location(yyStart));
05440:
05441: return yyResult.createValue(yyValue, yyError);
05442: } else {
05443: yyError = yyError.select("\";\" expected", yyBase);
05444: }
05445: }
05446:
05447: // Alternative <Compound>.
05448:
05449: yyResult = pCompoundStatement(yyStart);
05450: yyError = yyResult.select(yyError);
05451: if (yyResult.hasValue()) {
05452: yyValue = yyResult.semanticValue();
05453:
05454: return yyResult.createValue(yyValue, yyError);
05455: }
05456:
05457: // Alternative 3.
05458:
05459: yyResult = pKeyword(yyStart);
05460: yyError = yyResult.select(yyError);
05461: if (yyResult.hasValue("if")) {
05462:
05463: yyBase = yyResult.index;
05464: yyResult = pSymbol(yyBase);
05465: yyError = yyResult.select(yyError);
05466: if (yyResult.hasValue("(")) {
05467:
05468: yyResult = pCommaExpression(yyResult.index);
05469: yyError = yyResult.select(yyError);
05470: if (yyResult.hasValue()) {
05471: final Node v$g$1 = yyResult.semanticValue();
05472:
05473: yyBase = yyResult.index;
05474: yyResult = pSymbol(yyBase);
05475: yyError = yyResult.select(yyError);
05476: if (yyResult.hasValue(")")) {
05477:
05478: yyResult = pStatement(yyResult.index);
05479: yyError = yyResult.select(yyError);
05480: if (yyResult.hasValue()) {
05481: final Node v$g$2 = yyResult.semanticValue();
05482:
05483: final int yyChoice1 = yyResult.index;
05484:
05485: // Nested alternative 1.
05486:
05487: yyBase = yyChoice1;
05488: yyResult = pKeyword(yyBase);
05489: yyError = yyResult.select(yyError);
05490: if (yyResult.hasValue("else")) {
05491:
05492: yyResult = pStatement(yyResult.index);
05493: yyError = yyResult.select(yyError);
05494: if (yyResult.hasValue()) {
05495: final Node v$g$3 = yyResult
05496: .semanticValue();
05497:
05498: yyValue = GNode.create(
05499: "IfElseStatement", v$g$1,
05500: v$g$2, v$g$3);
05501: yyValue
05502: .setLocation(location(yyStart));
05503:
05504: return yyResult.createValue(
05505: yyValue, yyError);
05506: }
05507: } else {
05508: yyError = yyError.select(
05509: "\"else\" expected", yyBase);
05510: }
05511:
05512: // Nested alternative 2.
05513:
05514: yyValue = GNode.create("IfStatement",
05515: v$g$1, v$g$2);
05516: yyValue.setLocation(location(yyStart));
05517:
05518: return new SemanticValue(yyValue,
05519: yyChoice1, yyError);
05520: }
05521: } else {
05522: yyError = yyError.select("\")\" expected",
05523: yyBase);
05524: }
05525: }
05526: } else {
05527: yyError = yyError.select("\"(\" expected", yyBase);
05528: }
05529: }
05530:
05531: // Alternative 4.
05532:
05533: yyResult = pKeyword(yyStart);
05534: yyError = yyResult.select(yyError);
05535: if (yyResult.hasValue("while")) {
05536:
05537: yyBase = yyResult.index;
05538: yyResult = pSymbol(yyBase);
05539: yyError = yyResult.select(yyError);
05540: if (yyResult.hasValue("(")) {
05541:
05542: yyResult = pCommaExpression(yyResult.index);
05543: yyError = yyResult.select(yyError);
05544: if (yyResult.hasValue()) {
05545: final Node v$g$1 = yyResult.semanticValue();
05546:
05547: yyBase = yyResult.index;
05548: yyResult = pSymbol(yyBase);
05549: yyError = yyResult.select(yyError);
05550: if (yyResult.hasValue(")")) {
05551:
05552: yyResult = pStatement(yyResult.index);
05553: yyError = yyResult.select(yyError);
05554: if (yyResult.hasValue()) {
05555: final Node v$g$2 = yyResult.semanticValue();
05556:
05557: yyValue = GNode.create("WhileStatement",
05558: v$g$1, v$g$2);
05559: yyValue.setLocation(location(yyStart));
05560:
05561: return yyResult.createValue(yyValue,
05562: yyError);
05563: }
05564: } else {
05565: yyError = yyError.select("\")\" expected",
05566: yyBase);
05567: }
05568: }
05569: } else {
05570: yyError = yyError.select("\"(\" expected", yyBase);
05571: }
05572: }
05573:
05574: // Alternative 5.
05575:
05576: yyResult = pKeyword(yyStart);
05577: yyError = yyResult.select(yyError);
05578: if (yyResult.hasValue("do")) {
05579:
05580: yyResult = pStatement(yyResult.index);
05581: yyError = yyResult.select(yyError);
05582: if (yyResult.hasValue()) {
05583: final Node v$g$1 = yyResult.semanticValue();
05584:
05585: yyBase = yyResult.index;
05586: yyResult = pKeyword(yyBase);
05587: yyError = yyResult.select(yyError);
05588: if (yyResult.hasValue("while")) {
05589:
05590: yyBase = yyResult.index;
05591: yyResult = pSymbol(yyBase);
05592: yyError = yyResult.select(yyError);
05593: if (yyResult.hasValue("(")) {
05594:
05595: yyResult = pCommaExpression(yyResult.index);
05596: yyError = yyResult.select(yyError);
05597: if (yyResult.hasValue()) {
05598: final Node v$g$2 = yyResult.semanticValue();
05599:
05600: yyBase = yyResult.index;
05601: yyResult = pSymbol(yyBase);
05602: yyError = yyResult.select(yyError);
05603: if (yyResult.hasValue(")")) {
05604:
05605: yyBase = yyResult.index;
05606: yyResult = pSymbol(yyBase);
05607: yyError = yyResult.select(yyError);
05608: if (yyResult.hasValue(";")) {
05609:
05610: yyValue = GNode
05611: .create("DoStatement",
05612: v$g$1, v$g$2);
05613: yyValue
05614: .setLocation(location(yyStart));
05615:
05616: return yyResult.createValue(
05617: yyValue, yyError);
05618: } else {
05619: yyError = yyError.select(
05620: "\";\" expected", yyBase);
05621: }
05622: } else {
05623: yyError = yyError.select(
05624: "\")\" expected", yyBase);
05625: }
05626: }
05627: } else {
05628: yyError = yyError.select("\"(\" expected",
05629: yyBase);
05630: }
05631: } else {
05632: yyError = yyError.select("\"while\" expected",
05633: yyBase);
05634: }
05635: }
05636: }
05637:
05638: // Alternative 6.
05639:
05640: yyResult = pKeyword(yyStart);
05641: yyError = yyResult.select(yyError);
05642: if (yyResult.hasValue("for")) {
05643:
05644: yyResult = pPushScope(yyResult.index);
05645: yyError = yyResult.select(yyError);
05646: if (yyResult.hasValue()) {
05647:
05648: yyBase = yyResult.index;
05649: yyResult = pSymbol(yyBase);
05650: yyError = yyResult.select(yyError);
05651: if (yyResult.hasValue("(")) {
05652:
05653: yyResult = pInitialClause(yyResult.index);
05654: yyError = yyResult.select(yyError);
05655: if (yyResult.hasValue()) {
05656: final Node v$g$1 = yyResult.semanticValue();
05657:
05658: yyOption1 = yyResult.index;
05659: yyOpValue1 = null;
05660:
05661: yyResult = pCommaExpression(yyOption1);
05662: yyError = yyResult.select(yyError);
05663: if (yyResult.hasValue()) {
05664: final Node v$el$1 = yyResult
05665: .semanticValue();
05666:
05667: yyOption1 = yyResult.index;
05668: yyOpValue1 = v$el$1;
05669: }
05670: { // Start scope for v$g$2.
05671: final Node v$g$2 = yyOpValue1;
05672:
05673: yyBase = yyOption1;
05674: yyResult = pSymbol(yyBase);
05675: yyError = yyResult.select(yyError);
05676: if (yyResult.hasValue(";")) {
05677:
05678: yyOption1 = yyResult.index;
05679: yyOpValue1 = null;
05680:
05681: yyResult = pCommaExpression(yyOption1);
05682: yyError = yyResult.select(yyError);
05683: if (yyResult.hasValue()) {
05684: final Node v$el$2 = yyResult
05685: .semanticValue();
05686:
05687: yyOption1 = yyResult.index;
05688: yyOpValue1 = v$el$2;
05689: }
05690: { // Start scope for v$g$3.
05691: final Node v$g$3 = yyOpValue1;
05692:
05693: yyBase = yyOption1;
05694: yyResult = pSymbol(yyBase);
05695: yyError = yyResult.select(yyError);
05696: if (yyResult.hasValue(")")) {
05697:
05698: yyResult = pStatement(yyResult.index);
05699: yyError = yyResult
05700: .select(yyError);
05701: if (yyResult.hasValue()) {
05702: final Node v$g$4 = yyResult
05703: .semanticValue();
05704:
05705: yyResult = pPopScope(yyResult.index);
05706: yyError = yyResult
05707: .select(yyError);
05708: if (yyResult.hasValue()) {
05709:
05710: yyValue = GNode.create(
05711: "ForStatement",
05712: v$g$1, v$g$2,
05713: v$g$3, v$g$4);
05714: yyValue
05715: .setLocation(location(yyStart));
05716:
05717: return yyResult
05718: .createValue(
05719: yyValue,
05720: yyError);
05721: }
05722: }
05723: } else {
05724: yyError = yyError.select(
05725: "\")\" expected",
05726: yyBase);
05727: }
05728: } // End scope for v$g$3.
05729: } else {
05730: yyError = yyError.select(
05731: "\";\" expected", yyBase);
05732: }
05733: } // End scope for v$g$2.
05734: }
05735: } else {
05736: yyError = yyError.select("\"(\" expected", yyBase);
05737: }
05738: }
05739: }
05740:
05741: // Alternative 7.
05742:
05743: yyResult = pKeyword(yyStart);
05744: yyError = yyResult.select(yyError);
05745: if (yyResult.hasValue("switch")) {
05746:
05747: yyBase = yyResult.index;
05748: yyResult = pSymbol(yyBase);
05749: yyError = yyResult.select(yyError);
05750: if (yyResult.hasValue("(")) {
05751:
05752: yyResult = pCommaExpression(yyResult.index);
05753: yyError = yyResult.select(yyError);
05754: if (yyResult.hasValue()) {
05755: final Node v$g$1 = yyResult.semanticValue();
05756:
05757: yyBase = yyResult.index;
05758: yyResult = pSymbol(yyBase);
05759: yyError = yyResult.select(yyError);
05760: if (yyResult.hasValue(")")) {
05761:
05762: yyResult = pStatement(yyResult.index);
05763: yyError = yyResult.select(yyError);
05764: if (yyResult.hasValue()) {
05765: final Node v$g$2 = yyResult.semanticValue();
05766:
05767: yyValue = GNode.create("SwitchStatement",
05768: v$g$1, v$g$2);
05769: yyValue.setLocation(location(yyStart));
05770:
05771: return yyResult.createValue(yyValue,
05772: yyError);
05773: }
05774: } else {
05775: yyError = yyError.select("\")\" expected",
05776: yyBase);
05777: }
05778: }
05779: } else {
05780: yyError = yyError.select("\"(\" expected", yyBase);
05781: }
05782: }
05783:
05784: // Alternative <Complete>.
05785:
05786: yyResult = pLabel(yyStart);
05787: yyError = yyResult.select(yyError);
05788: if (yyResult.hasValue()) {
05789: final Node v$g$1 = yyResult.semanticValue();
05790:
05791: yyResult = pStatement(yyResult.index);
05792: yyError = yyResult.select(yyError);
05793: if (yyResult.hasValue()) {
05794: final Node v$g$2 = yyResult.semanticValue();
05795:
05796: yyValue = GNode
05797: .create("LabeledStatement", v$g$1, v$g$2);
05798: yyValue.setLocation(location(yyStart));
05799:
05800: return yyResult.createValue(yyValue, yyError);
05801: }
05802: }
05803:
05804: // Alternative <Incomplete>.
05805:
05806: if (GCC) {
05807:
05808: yyResult = pLabel(yyStart);
05809: yyError = yyResult.select(yyError);
05810: if (yyResult.hasValue()) {
05811: final Node v$g$3 = yyResult.semanticValue();
05812:
05813: yyValue = GNode.create("LabeledStatement", v$g$3, null);
05814: yyValue.setLocation(location(yyStart));
05815:
05816: return yyResult.createValue(yyValue, yyError);
05817: }
05818: }
05819:
05820: // Alternative 10.
05821:
05822: yyResult = pKeyword(yyStart);
05823: yyError = yyResult.select(yyError);
05824: if (yyResult.hasValue("break")) {
05825:
05826: yyBase = yyResult.index;
05827: yyResult = pSymbol(yyBase);
05828: yyError = yyResult.select(yyError);
05829: if (yyResult.hasValue(";")) {
05830:
05831: yyValue = GNode.create("BreakStatement", false);
05832: yyValue.setLocation(location(yyStart));
05833:
05834: return yyResult.createValue(yyValue, yyError);
05835: } else {
05836: yyError = yyError.select("\";\" expected", yyBase);
05837: }
05838: }
05839:
05840: // Alternative 11.
05841:
05842: yyResult = pKeyword(yyStart);
05843: yyError = yyResult.select(yyError);
05844: if (yyResult.hasValue("continue")) {
05845:
05846: yyBase = yyResult.index;
05847: yyResult = pSymbol(yyBase);
05848: yyError = yyResult.select(yyError);
05849: if (yyResult.hasValue(";")) {
05850:
05851: yyValue = GNode.create("ContinueStatement", false);
05852: yyValue.setLocation(location(yyStart));
05853:
05854: return yyResult.createValue(yyValue, yyError);
05855: } else {
05856: yyError = yyError.select("\";\" expected", yyBase);
05857: }
05858: }
05859:
05860: // Alternative 12.
05861:
05862: yyResult = pKeyword(yyStart);
05863: yyError = yyResult.select(yyError);
05864: if (yyResult.hasValue("return")) {
05865:
05866: yyOption1 = yyResult.index;
05867: yyOpValue1 = null;
05868:
05869: yyResult = pCommaExpression(yyOption1);
05870: yyError = yyResult.select(yyError);
05871: if (yyResult.hasValue()) {
05872: final Node v$el$1 = yyResult.semanticValue();
05873:
05874: yyOption1 = yyResult.index;
05875: yyOpValue1 = v$el$1;
05876: }
05877: { // Start scope for v$g$1.
05878: final Node v$g$1 = yyOpValue1;
05879:
05880: yyBase = yyOption1;
05881: yyResult = pSymbol(yyBase);
05882: yyError = yyResult.select(yyError);
05883: if (yyResult.hasValue(";")) {
05884:
05885: yyValue = GNode.create("ReturnStatement", v$g$1);
05886: yyValue.setLocation(location(yyStart));
05887:
05888: return yyResult.createValue(yyValue, yyError);
05889: } else {
05890: yyError = yyError.select("\";\" expected", yyBase);
05891: }
05892: } // End scope for v$g$1.
05893: }
05894:
05895: // Alternative <Direct>.
05896:
05897: yyResult = pKeyword(yyStart);
05898: yyError = yyResult.select(yyError);
05899: if (yyResult.hasValue("goto")) {
05900:
05901: yyResult = pPrimaryIdentifier(yyResult.index);
05902: yyError = yyResult.select(yyError);
05903: if (yyResult.hasValue()) {
05904: final Node v$g$2 = yyResult.semanticValue();
05905:
05906: yyBase = yyResult.index;
05907: yyResult = pSymbol(yyBase);
05908: yyError = yyResult.select(yyError);
05909: if (yyResult.hasValue(";")) {
05910:
05911: yyValue = GNode
05912: .create("GotoStatement", null, v$g$2);
05913: yyValue.setLocation(location(yyStart));
05914:
05915: return yyResult.createValue(yyValue, yyError);
05916: } else {
05917: yyError = yyError.select("\";\" expected", yyBase);
05918: }
05919: }
05920: }
05921:
05922: // Alternative <Computed>.
05923:
05924: if (GCC) {
05925:
05926: yyResult = pKeyword(yyStart);
05927: yyError = yyResult.select(yyError);
05928: if (yyResult.hasValue("goto")) {
05929:
05930: yyBase = yyResult.index;
05931: yyResult = pSymbol(yyBase);
05932: yyError = yyResult.select(yyError);
05933: if (yyResult.hasValue("*")) {
05934: final String v$g$3 = "*";
05935:
05936: yyResult = pCommaExpression(yyResult.index);
05937: yyError = yyResult.select(yyError);
05938: if (yyResult.hasValue()) {
05939: final Node v$g$4 = yyResult.semanticValue();
05940:
05941: yyBase = yyResult.index;
05942: yyResult = pSymbol(yyBase);
05943: yyError = yyResult.select(yyError);
05944: if (yyResult.hasValue(";")) {
05945:
05946: yyValue = GNode.create("GotoStatement",
05947: v$g$3, v$g$4);
05948: yyValue.setLocation(location(yyStart));
05949:
05950: return yyResult.createValue(yyValue,
05951: yyError);
05952: } else {
05953: yyError = yyError.select("\";\" expected",
05954: yyBase);
05955: }
05956: }
05957: } else {
05958: yyError = yyError.select("\"*\" expected", yyBase);
05959: }
05960: }
05961: }
05962:
05963: // Alternative 15.
05964:
05965: yyResult = pAsmKeyword(yyStart);
05966: yyError = yyResult.select(yyError);
05967: if (yyResult.hasValue()) {
05968:
05969: yyOption1 = yyResult.index;
05970: yyOpValue1 = null;
05971:
05972: yyResult = pTypeQualifier(yyOption1);
05973: yyError = yyResult.select(yyError);
05974: if (yyResult.hasValue()) {
05975: final Node v$el$1 = yyResult.semanticValue();
05976:
05977: yyOption1 = yyResult.index;
05978: yyOpValue1 = v$el$1;
05979: }
05980: { // Start scope for v$g$1.
05981: final Node v$g$1 = yyOpValue1;
05982:
05983: yyBase = yyOption1;
05984: yyResult = pSymbol(yyBase);
05985: yyError = yyResult.select(yyError);
05986: if (yyResult.hasValue("(")) {
05987:
05988: yyResult = pAssemblyArgument(yyResult.index);
05989: yyError = yyResult.select(yyError);
05990: if (yyResult.hasValue()) {
05991: final Node v$g$2 = yyResult.semanticValue();
05992:
05993: yyBase = yyResult.index;
05994: yyResult = pSymbol(yyBase);
05995: yyError = yyResult.select(yyError);
05996: if (yyResult.hasValue(")")) {
05997:
05998: yyBase = yyResult.index;
05999: yyResult = pSymbol(yyBase);
06000: yyError = yyResult.select(yyError);
06001: if (yyResult.hasValue(";")) {
06002: final String v$g$3 = ";";
06003:
06004: yyValue = GNode.create(
06005: "AssemblyStatement", v$g$1,
06006: v$g$2, v$g$3);
06007: yyValue.setLocation(location(yyStart));
06008:
06009: return yyResult.createValue(yyValue,
06010: yyError);
06011: } else {
06012: yyError = yyError.select(
06013: "\";\" expected", yyBase);
06014: }
06015: } else {
06016: yyError = yyError.select("\")\" expected",
06017: yyBase);
06018: }
06019: }
06020: } else {
06021: yyError = yyError.select("\"(\" expected", yyBase);
06022: }
06023: } // End scope for v$g$1.
06024: }
06025:
06026: // Alternative 16.
06027:
06028: yyResult = pSymbol(yyStart);
06029: yyError = yyResult.select(yyError);
06030: if (yyResult.hasValue(";")) {
06031:
06032: yyValue = GNode.create("EmptyStatement", false);
06033: yyValue.setLocation(location(yyStart));
06034:
06035: return yyResult.createValue(yyValue, yyError);
06036: }
06037:
06038: // Done.
06039: yyError = yyError.select("statement expected", yyStart);
06040: return yyError;
06041: }
06042:
06043: // =========================================================================
06044:
06045: /**
06046: * Parse nonterminal xtc.lang.C.Label.
06047: *
06048: * @param yyStart The index.
06049: * @return The result.
06050: * @throws IOException Signals an I/O error.
06051: */
06052: private Result pLabel(final int yyStart) throws IOException {
06053: Result yyResult;
06054: int yyBase;
06055: int yyOption1;
06056: Node yyOpValue1;
06057: Node yyValue;
06058: ParseError yyError = ParseError.DUMMY;
06059:
06060: // Alternative <Label>.
06061:
06062: yyResult = pIdentifier(yyStart);
06063: yyError = yyResult.select(yyError);
06064: if (yyResult.hasValue()) {
06065: final String v$g$1 = yyResult.semanticValue();
06066:
06067: yyBase = yyResult.index;
06068: yyResult = pSymbol(yyBase);
06069: yyError = yyResult.select(yyError);
06070: if (yyResult.hasValue(":")) {
06071:
06072: yyOption1 = yyResult.index;
06073: yyOpValue1 = null;
06074:
06075: yyResult = pAttributeSpecifierList(yyOption1);
06076: yyError = yyResult.select(yyError);
06077: if (yyResult.hasValue()) {
06078: final Node v$el$1 = yyResult.semanticValue();
06079:
06080: yyOption1 = yyResult.index;
06081: yyOpValue1 = v$el$1;
06082: }
06083: { // Start scope for v$g$2.
06084: final Node v$g$2 = yyOpValue1;
06085:
06086: yyValue = GNode.create("NamedLabel", v$g$1, v$g$2);
06087: yyValue.setLocation(location(yyStart));
06088:
06089: return new SemanticValue(yyValue, yyOption1,
06090: yyError);
06091: } // End scope for v$g$2.
06092: } else {
06093: yyError = yyError.select("\":\" expected", yyBase);
06094: }
06095: }
06096:
06097: // Alternative <Range>.
06098:
06099: if (GCC) {
06100:
06101: yyResult = pKeyword(yyStart);
06102: yyError = yyResult.select(yyError);
06103: if (yyResult.hasValue("case")) {
06104:
06105: yyResult = pConditionalExpression(yyResult.index);
06106: yyError = yyResult.select(yyError);
06107: if (yyResult.hasValue()) {
06108: final Node v$g$1 = yyResult.semanticValue();
06109:
06110: yyBase = yyResult.index;
06111: yyResult = pSymbol(yyBase);
06112: yyError = yyResult.select(yyError);
06113: if (yyResult.hasValue("...")) {
06114:
06115: yyResult = pConditionalExpression(yyResult.index);
06116: yyError = yyResult.select(yyError);
06117: if (yyResult.hasValue()) {
06118: final Node v$g$2 = yyResult.semanticValue();
06119:
06120: yyBase = yyResult.index;
06121: yyResult = pSymbol(yyBase);
06122: yyError = yyResult.select(yyError);
06123: if (yyResult.hasValue(":")) {
06124:
06125: yyValue = GNode.create("CaseLabel",
06126: v$g$1, v$g$2);
06127: yyValue.setLocation(location(yyStart));
06128:
06129: return yyResult.createValue(yyValue,
06130: yyError);
06131: } else {
06132: yyError = yyError.select(
06133: "\":\" expected", yyBase);
06134: }
06135: }
06136: } else {
06137: yyError = yyError.select("\"...\" expected",
06138: yyBase);
06139: }
06140: }
06141: }
06142: }
06143:
06144: // Alternative <Simple>.
06145:
06146: yyResult = pKeyword(yyStart);
06147: yyError = yyResult.select(yyError);
06148: if (yyResult.hasValue("case")) {
06149:
06150: yyResult = pConditionalExpression(yyResult.index);
06151: yyError = yyResult.select(yyError);
06152: if (yyResult.hasValue()) {
06153: final Node v$g$3 = yyResult.semanticValue();
06154:
06155: yyBase = yyResult.index;
06156: yyResult = pSymbol(yyBase);
06157: yyError = yyResult.select(yyError);
06158: if (yyResult.hasValue(":")) {
06159:
06160: yyValue = GNode.create("CaseLabel", v$g$3);
06161: yyValue.setLocation(location(yyStart));
06162:
06163: return yyResult.createValue(yyValue, yyError);
06164: } else {
06165: yyError = yyError.select("\":\" expected", yyBase);
06166: }
06167: }
06168: }
06169:
06170: // Alternative 4.
06171:
06172: yyResult = pKeyword(yyStart);
06173: yyError = yyResult.select(yyError);
06174: if (yyResult.hasValue("default")) {
06175:
06176: yyBase = yyResult.index;
06177: yyResult = pSymbol(yyBase);
06178: yyError = yyResult.select(yyError);
06179: if (yyResult.hasValue(":")) {
06180:
06181: yyValue = GNode.create("DefaultLabel", false);
06182: yyValue.setLocation(location(yyStart));
06183:
06184: return yyResult.createValue(yyValue, yyError);
06185: } else {
06186: yyError = yyError.select("\":\" expected", yyBase);
06187: }
06188: }
06189:
06190: // Done.
06191: yyError = yyError.select("label expected", yyStart);
06192: return yyError;
06193: }
06194:
06195: // =========================================================================
06196:
06197: /**
06198: * Parse nonterminal xtc.lang.C.CompoundStatement.
06199: *
06200: * @param yyStart The index.
06201: * @return The result.
06202: * @throws IOException Signals an I/O error.
06203: */
06204: private Result pCompoundStatement(final int yyStart)
06205: throws IOException {
06206: CParserColumn yyColumn = (CParserColumn) column(yyStart);
06207: if (null == yyColumn.chunk2)
06208: yyColumn.chunk2 = new Chunk2();
06209: if (null == yyColumn.chunk2.fCompoundStatement)
06210: yyColumn.chunk2.fCompoundStatement = pCompoundStatement$1(yyStart);
06211: return yyColumn.chunk2.fCompoundStatement;
06212: }
06213:
06214: /** Actually parse xtc.lang.C.CompoundStatement. */
06215: private Result pCompoundStatement$1(final int yyStart)
06216: throws IOException {
06217: Result yyResult;
06218: int yyBase;
06219: Node yyValue;
06220: ParseError yyError = ParseError.DUMMY;
06221:
06222: // Alternative <Compound>.
06223:
06224: yyResult = pSymbol(yyStart);
06225: yyError = yyResult.select(yyError);
06226: if (yyResult.hasValue("{")) {
06227:
06228: yyResult = pPushScope(yyResult.index);
06229: yyError = yyResult.select(yyError);
06230: if (yyResult.hasValue()) {
06231:
06232: yyResult = pCompoundStatement$$Star1(yyResult.index);
06233: yyError = yyResult.select(yyError);
06234: if (yyResult.hasValue()) {
06235: final Pair<Node> v$g$1 = yyResult.semanticValue();
06236:
06237: yyResult = pCompoundStatement$$Star2(yyResult.index);
06238: yyError = yyResult.select(yyError);
06239: if (yyResult.hasValue()) {
06240: final Pair<Node> v$g$2 = yyResult
06241: .semanticValue();
06242:
06243: yyResult = pAnnotations(yyResult.index);
06244: yyError = yyResult.select(yyError);
06245: if (yyResult.hasValue()) {
06246: final Node v$g$3 = yyResult.semanticValue();
06247:
06248: yyBase = yyResult.index;
06249: yyResult = pSymbol(yyBase);
06250: yyError = yyResult.select(yyError);
06251: if (yyResult.hasValue("}")) {
06252:
06253: yyResult = pPopScope(yyResult.index);
06254: yyError = yyResult.select(yyError);
06255: if (yyResult.hasValue()) {
06256:
06257: yyValue = GNode.create(
06258: "CompoundStatement",
06259: v$g$1.size() + v$g$2.size()
06260: + 1).addAll(v$g$1)
06261: .addAll(v$g$2).add(v$g$3);
06262: yyValue
06263: .setLocation(location(yyStart));
06264:
06265: return yyResult.createValue(
06266: yyValue, yyError);
06267: }
06268: } else {
06269: yyError = yyError.select(
06270: "\"}\" expected", yyBase);
06271: }
06272: }
06273: }
06274: }
06275: }
06276: }
06277:
06278: // Done.
06279: yyError = yyError
06280: .select("compound statement expected", yyStart);
06281: return yyError;
06282: }
06283:
06284: // =========================================================================
06285:
06286: /**
06287: * Parse synthetic nonterminal xtc.lang.C.CompoundStatement$$Star1.
06288: *
06289: * @param yyStart The index.
06290: * @return The result.
06291: * @throws IOException Signals an I/O error.
06292: */
06293: private Result pCompoundStatement$$Star1(final int yyStart)
06294: throws IOException {
06295:
06296: CParserColumn yyColumn = (CParserColumn) column(yyStart);
06297: if (null == yyColumn.chunk2)
06298: yyColumn.chunk2 = new Chunk2();
06299: if (null == yyColumn.chunk2.fCompoundStatement$$Star1)
06300: yyColumn.chunk2.fCompoundStatement$$Star1 = pCompoundStatement$$Star1$1(yyStart);
06301: return yyColumn.chunk2.fCompoundStatement$$Star1;
06302: }
06303:
06304: /** Actually parse xtc.lang.C.CompoundStatement$$Star1. */
06305: private Result pCompoundStatement$$Star1$1(final int yyStart)
06306: throws IOException {
06307:
06308: Result yyResult;
06309: Pair<Node> yyValue;
06310: ParseError yyError = ParseError.DUMMY;
06311:
06312: // Alternative 1.
06313:
06314: yyResult = pLocalLabelDeclaration(yyStart);
06315: yyError = yyResult.select(yyError);
06316: if (yyResult.hasValue()) {
06317: final Node v$el$1 = yyResult.semanticValue();
06318:
06319: yyResult = pCompoundStatement$$Star1(yyResult.index);
06320: yyError = yyResult.select(yyError);
06321: if (yyResult.hasValue()) {
06322: final Pair<Node> v$2 = yyResult.semanticValue();
06323:
06324: yyValue = new Pair<Node>(v$el$1, v$2);
06325:
06326: return yyResult.createValue(yyValue, yyError);
06327: }
06328: }
06329:
06330: // Alternative 2.
06331:
06332: yyValue = Pair.empty();
06333:
06334: return new SemanticValue(yyValue, yyStart, yyError);
06335: }
06336:
06337: // =========================================================================
06338:
06339: /**
06340: * Parse synthetic nonterminal xtc.lang.C.CompoundStatement$$Star2.
06341: *
06342: * @param yyStart The index.
06343: * @return The result.
06344: * @throws IOException Signals an I/O error.
06345: */
06346: private Result pCompoundStatement$$Star2(final int yyStart)
06347: throws IOException {
06348:
06349: CParserColumn yyColumn = (CParserColumn) column(yyStart);
06350: if (null == yyColumn.chunk2)
06351: yyColumn.chunk2 = new Chunk2();
06352: if (null == yyColumn.chunk2.fCompoundStatement$$Star2)
06353: yyColumn.chunk2.fCompoundStatement$$Star2 = pCompoundStatement$$Star2$1(yyStart);
06354: return yyColumn.chunk2.fCompoundStatement$$Star2;
06355: }
06356:
06357: /** Actually parse xtc.lang.C.CompoundStatement$$Star2. */
06358: private Result pCompoundStatement$$Star2$1(final int yyStart)
06359: throws IOException {
06360:
06361: Result yyResult;
06362: Pair<Node> yyValue;
06363: ParseError yyError = ParseError.DUMMY;
06364:
06365: // Alternative 1.
06366:
06367: yyResult = pDeclarationOrStatement(yyStart);
06368: yyError = yyResult.select(yyError);
06369: if (yyResult.hasValue()) {
06370: final Node v$el$3 = yyResult.semanticValue();
06371:
06372: yyResult = pCompoundStatement$$Star2(yyResult.index);
06373: yyError = yyResult.select(yyError);
06374: if (yyResult.hasValue()) {
06375: final Pair<Node> v$4 = yyResult.semanticValue();
06376:
06377: yyValue = new Pair<Node>(v$el$3, v$4);
06378:
06379: return yyResult.createValue(yyValue, yyError);
06380: }
06381: }
06382:
06383: // Alternative 2.
06384:
06385: yyValue = Pair.empty();
06386:
06387: return new SemanticValue(yyValue, yyStart, yyError);
06388: }
06389:
06390: // =========================================================================
06391:
06392: /**
06393: * Parse nonterminal xtc.lang.C.LocalLabelDeclaration.
06394: *
06395: * @param yyStart The index.
06396: * @return The result.
06397: * @throws IOException Signals an I/O error.
06398: */
06399: private Result pLocalLabelDeclaration(final int yyStart)
06400: throws IOException {
06401:
06402: Result yyResult;
06403: int yyBase;
06404: int yyRepetition1;
06405: Pair<String> yyRepValue1;
06406: Node yyValue;
06407: ParseError yyError = ParseError.DUMMY;
06408:
06409: // Alternative 1.
06410:
06411: yyResult = pKeyword(yyStart);
06412: yyError = yyResult.select(yyError);
06413: if (yyResult.hasValue("__label__")) {
06414:
06415: yyResult = pIdentifier(yyResult.index);
06416: yyError = yyResult.select(yyError);
06417: if (yyResult.hasValue()) {
06418: final String v$g$1 = yyResult.semanticValue();
06419:
06420: yyRepetition1 = yyResult.index;
06421: yyRepValue1 = Pair.empty();
06422: while (true) {
06423:
06424: yyBase = yyRepetition1;
06425: yyResult = pSymbol(yyBase);
06426: yyError = yyResult.select(yyError);
06427: if (yyResult.hasValue(",")) {
06428:
06429: yyResult = pIdentifier(yyResult.index);
06430: yyError = yyResult.select(yyError);
06431: if (yyResult.hasValue()) {
06432: final String v$el$1 = yyResult
06433: .semanticValue();
06434:
06435: yyRepetition1 = yyResult.index;
06436: yyRepValue1 = new Pair<String>(v$el$1,
06437: yyRepValue1);
06438: continue;
06439: }
06440: } else {
06441: yyError = yyError.select("\",\" expected",
06442: yyBase);
06443: }
06444: break;
06445: }
06446: { // Start scope for v$g$2.
06447: final Pair<String> v$g$2 = yyRepValue1.reverse();
06448:
06449: yyBase = yyRepetition1;
06450: yyResult = pSymbol(yyBase);
06451: yyError = yyResult.select(yyError);
06452: if (yyResult.hasValue(";")) {
06453:
06454: yyValue = GNode.createFromPair(
06455: "LocalLabelDeclaration", v$g$1, v$g$2);
06456: yyValue.setLocation(location(yyStart));
06457:
06458: return yyResult.createValue(yyValue, yyError);
06459: } else {
06460: yyError = yyError.select("\";\" expected",
06461: yyBase);
06462: }
06463: } // End scope for v$g$2.
06464: }
06465: }
06466:
06467: // Done.
06468: yyError = yyError.select("local label declaration expected",
06469: yyStart);
06470: return yyError;
06471: }
06472:
06473: // =========================================================================
06474:
06475: /**
06476: * Parse nonterminal xtc.lang.C.DeclarationOrStatement.
06477: *
06478: * @param yyStart The index.
06479: * @return The result.
06480: * @throws IOException Signals an I/O error.
06481: */
06482: private Result pDeclarationOrStatement(final int yyStart)
06483: throws IOException {
06484:
06485: Result yyResult;
06486: Node yyValue;
06487: ParseError yyError = ParseError.DUMMY;
06488:
06489: // Start a state modification.
06490: yyState.start();
06491:
06492: // Alternative <Declaration>.
06493:
06494: yyState.mark();
06495:
06496: yyResult = pDeclaration(yyStart);
06497: yyError = yyResult.select(yyError);
06498: if (yyResult.hasValue()) {
06499: final Node d = yyResult.semanticValue();
06500:
06501: yyValue = yyState.annotate(d);
06502:
06503: // Commit the state modification.
06504: yyState.commit();
06505:
06506: setLocation(yyValue, yyStart);
06507: return yyResult.createValue(yyValue, yyError);
06508: }
06509:
06510: // Alternative <Statement>.
06511:
06512: yyResult = pStatement(yyStart);
06513: yyError = yyResult.select(yyError);
06514: if (yyResult.hasValue()) {
06515: final Node s = yyResult.semanticValue();
06516:
06517: yyValue = yyState.annotate(s);
06518:
06519: // Commit the state modification.
06520: yyState.commit();
06521:
06522: setLocation(yyValue, yyStart);
06523: return yyResult.createValue(yyValue, yyError);
06524: }
06525:
06526: // Abort the state modification.
06527: yyState.abort();
06528:
06529: // Done.
06530: return yyError;
06531: }
06532:
06533: // =========================================================================
06534:
06535: /**
06536: * Parse nonterminal xtc.lang.C.InitialClause.
06537: *
06538: * @param yyStart The index.
06539: * @return The result.
06540: * @throws IOException Signals an I/O error.
06541: */
06542: private Result pInitialClause(final int yyStart) throws IOException {
06543: Result yyResult;
06544: int yyBase;
06545: int yyOption1;
06546: Node yyOpValue1;
06547: Node yyValue;
06548: ParseError yyError = ParseError.DUMMY;
06549:
06550: // Start a state modification.
06551: yyState.start();
06552:
06553: // Alternative <Declaration>.
06554:
06555: yyResult = pDeclaration(yyStart);
06556: yyError = yyResult.select(yyError);
06557: if (yyResult.hasValue()) {
06558: yyValue = yyResult.semanticValue();
06559:
06560: // Commit the state modification.
06561: yyState.commit();
06562:
06563: return yyResult.createValue(yyValue, yyError);
06564: }
06565:
06566: // Alternative <Expression>.
06567:
06568: yyOption1 = yyStart;
06569: yyOpValue1 = null;
06570:
06571: yyResult = pCommaExpression(yyOption1);
06572: yyError = yyResult.select(yyError);
06573: if (yyResult.hasValue()) {
06574: final Node v$el$3 = yyResult.semanticValue();
06575:
06576: yyOption1 = yyResult.index;
06577: yyOpValue1 = v$el$3;
06578: }
06579: { // Start scope for yyValue.
06580: yyValue = yyOpValue1;
06581:
06582: yyBase = yyOption1;
06583: yyResult = pSymbol(yyBase);
06584: yyError = yyResult.select(yyError);
06585: if (yyResult.hasValue(";")) {
06586:
06587: // Commit the state modification.
06588: yyState.commit();
06589:
06590: return yyResult.createValue(yyValue, yyError);
06591: } else {
06592: yyError = yyError.select("\";\" expected", yyBase);
06593: }
06594: } // End scope for yyValue.
06595:
06596: // Abort the state modification.
06597: yyState.abort();
06598:
06599: // Done.
06600: return yyError;
06601: }
06602:
06603: // =========================================================================
06604:
06605: /**
06606: * Parse nonterminal xtc.lang.C.CommaExpression.
06607: *
06608: * @param yyStart The index.
06609: * @return The result.
06610: * @throws IOException Signals an I/O error.
06611: */
06612: private Result pCommaExpression(final int yyStart)
06613: throws IOException {
06614: CParserColumn yyColumn = (CParserColumn) column(yyStart);
06615: if (null == yyColumn.chunk2)
06616: yyColumn.chunk2 = new Chunk2();
06617: if (null == yyColumn.chunk2.fCommaExpression)
06618: yyColumn.chunk2.fCommaExpression = pCommaExpression$1(yyStart);
06619: return yyColumn.chunk2.fCommaExpression;
06620: }
06621:
06622: /** Actually parse xtc.lang.C.CommaExpression. */
06623: private Result pCommaExpression$1(final int yyStart)
06624: throws IOException {
06625: Result yyResult;
06626: int yyRepetition1;
06627: Pair<Action<Node>> yyRepValue1;
06628: Node yyValue;
06629: ParseError yyError = ParseError.DUMMY;
06630:
06631: // Alternative <Base>.
06632:
06633: yyResult = pAssignmentExpression(yyStart);
06634: yyError = yyResult.select(yyError);
06635: if (yyResult.hasValue()) {
06636: final Node v$3 = yyResult.semanticValue();
06637:
06638: yyRepetition1 = yyResult.index;
06639: yyRepValue1 = Pair.empty();
06640: while (true) {
06641:
06642: yyResult = pCommaExpression$$Tail1(yyRepetition1);
06643: yyError = yyResult.select(yyError);
06644: if (yyResult.hasValue()) {
06645: final Action<Node> v$4 = yyResult.semanticValue();
06646:
06647: yyRepetition1 = yyResult.index;
06648: yyRepValue1 = new Pair<Action<Node>>(v$4,
06649: yyRepValue1);
06650: continue;
06651: }
06652: break;
06653: }
06654: { // Start scope for v$5.
06655: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
06656:
06657: yyValue = apply(v$5, v$3, yyStart);
06658:
06659: return new SemanticValue(yyValue, yyRepetition1,
06660: yyError);
06661: } // End scope for v$5.
06662: }
06663:
06664: // Done.
06665: return yyError;
06666: }
06667:
06668: // =========================================================================
06669:
06670: /**
06671: * Parse synthetic nonterminal xtc.lang.C.CommaExpression$$Tail1.
06672: *
06673: * @param yyStart The index.
06674: * @return The result.
06675: * @throws IOException Signals an I/O error.
06676: */
06677: private Result pCommaExpression$$Tail1(final int yyStart)
06678: throws IOException {
06679:
06680: Result yyResult;
06681: Action<Node> yyValue;
06682: ParseError yyError = ParseError.DUMMY;
06683:
06684: // Alternative <Comma>.
06685:
06686: yyResult = pSymbol(yyStart);
06687: yyError = yyResult.select(yyError);
06688: if (yyResult.hasValue(",")) {
06689:
06690: yyResult = pAssignmentExpression(yyResult.index);
06691: yyError = yyResult.select(yyError);
06692: if (yyResult.hasValue()) {
06693: final Node v$g$2 = yyResult.semanticValue();
06694:
06695: yyValue = new Action<Node>() {
06696: public Node run(Node v$1) {
06697: return GNode.create("CommaExpression", v$1,
06698: v$g$2);
06699: }
06700: };
06701:
06702: return yyResult.createValue(yyValue, yyError);
06703: }
06704: }
06705:
06706: // Done.
06707: yyError = yyError.select("comma expression expected", yyStart);
06708: return yyError;
06709: }
06710:
06711: // =========================================================================
06712:
06713: /**
06714: * Parse nonterminal xtc.lang.C.AssignmentExpression.
06715: *
06716: * @param yyStart The index.
06717: * @return The result.
06718: * @throws IOException Signals an I/O error.
06719: */
06720: private Result pAssignmentExpression(final int yyStart)
06721: throws IOException {
06722: CParserColumn yyColumn = (CParserColumn) column(yyStart);
06723: if (null == yyColumn.chunk2)
06724: yyColumn.chunk2 = new Chunk2();
06725: if (null == yyColumn.chunk2.fAssignmentExpression)
06726: yyColumn.chunk2.fAssignmentExpression = pAssignmentExpression$1(yyStart);
06727: return yyColumn.chunk2.fAssignmentExpression;
06728: }
06729:
06730: /** Actually parse xtc.lang.C.AssignmentExpression. */
06731: private Result pAssignmentExpression$1(final int yyStart)
06732: throws IOException {
06733:
06734: Result yyResult;
06735: Node yyValue;
06736: ParseError yyError = ParseError.DUMMY;
06737:
06738: // Alternative <Assignment>.
06739:
06740: yyResult = pUnaryExpression(yyStart);
06741: yyError = yyResult.select(yyError);
06742: if (yyResult.hasValue()) {
06743: final Node v$g$1 = yyResult.semanticValue();
06744:
06745: yyResult = pAssignmentOperator(yyResult.index);
06746: yyError = yyResult.select(yyError);
06747: if (yyResult.hasValue()) {
06748: final String v$g$2 = yyResult.semanticValue();
06749:
06750: yyResult = pAssignmentExpression(yyResult.index);
06751: yyError = yyResult.select(yyError);
06752: if (yyResult.hasValue()) {
06753: final Node v$g$3 = yyResult.semanticValue();
06754:
06755: yyValue = GNode.create("AssignmentExpression",
06756: v$g$1, v$g$2, v$g$3);
06757: yyValue.setLocation(location(yyStart));
06758:
06759: return yyResult.createValue(yyValue, yyError);
06760: }
06761: }
06762: }
06763:
06764: // Alternative <Base>.
06765:
06766: yyResult = pConditionalExpression(yyStart);
06767: yyError = yyResult.select(yyError);
06768: if (yyResult.hasValue()) {
06769: yyValue = yyResult.semanticValue();
06770:
06771: return yyResult.createValue(yyValue, yyError);
06772: }
06773:
06774: // Done.
06775: return yyError;
06776: }
06777:
06778: // =========================================================================
06779:
06780: /**
06781: * Parse nonterminal xtc.lang.C.AssignmentOperator.
06782: *
06783: * @param yyStart The index.
06784: * @return The result.
06785: * @throws IOException Signals an I/O error.
06786: */
06787: private Result pAssignmentOperator(final int yyStart)
06788: throws IOException {
06789: Result yyResult;
06790: String yyValue;
06791: ParseError yyError = ParseError.DUMMY;
06792:
06793: // Alternative <Equal>.
06794:
06795: yyResult = pSymbol(yyStart);
06796: yyError = yyResult.select(yyError);
06797: if (yyResult.hasValue("=")) {
06798: yyValue = "=";
06799:
06800: return yyResult.createValue(yyValue, yyError);
06801: }
06802:
06803: // Alternative <PlusEqual>.
06804:
06805: yyResult = pSymbol(yyStart);
06806: yyError = yyResult.select(yyError);
06807: if (yyResult.hasValue("+=")) {
06808: yyValue = "+=";
06809:
06810: return yyResult.createValue(yyValue, yyError);
06811: }
06812:
06813: // Alternative <MinusEqual>.
06814:
06815: yyResult = pSymbol(yyStart);
06816: yyError = yyResult.select(yyError);
06817: if (yyResult.hasValue("-=")) {
06818: yyValue = "-=";
06819:
06820: return yyResult.createValue(yyValue, yyError);
06821: }
06822:
06823: // Alternative <TimesEqual>.
06824:
06825: yyResult = pSymbol(yyStart);
06826: yyError = yyResult.select(yyError);
06827: if (yyResult.hasValue("*=")) {
06828: yyValue = "*=";
06829:
06830: return yyResult.createValue(yyValue, yyError);
06831: }
06832:
06833: // Alternative <OverEqual>.
06834:
06835: yyResult = pSymbol(yyStart);
06836: yyError = yyResult.select(yyError);
06837: if (yyResult.hasValue("/=")) {
06838: yyValue = "/=";
06839:
06840: return yyResult.createValue(yyValue, yyError);
06841: }
06842:
06843: // Alternative <ModuloEqual>.
06844:
06845: yyResult = pSymbol(yyStart);
06846: yyError = yyResult.select(yyError);
06847: if (yyResult.hasValue("%=")) {
06848: yyValue = "%=";
06849:
06850: return yyResult.createValue(yyValue, yyError);
06851: }
06852:
06853: // Alternative <LeftEqual>.
06854:
06855: yyResult = pSymbol(yyStart);
06856: yyError = yyResult.select(yyError);
06857: if (yyResult.hasValue("<<=")) {
06858: yyValue = "<<=";
06859:
06860: return yyResult.createValue(yyValue, yyError);
06861: }
06862:
06863: // Alternative <RightEqual>.
06864:
06865: yyResult = pSymbol(yyStart);
06866: yyError = yyResult.select(yyError);
06867: if (yyResult.hasValue(">>=")) {
06868: yyValue = ">>=";
06869:
06870: return yyResult.createValue(yyValue, yyError);
06871: }
06872:
06873: // Alternative <AndEqual>.
06874:
06875: yyResult = pSymbol(yyStart);
06876: yyError = yyResult.select(yyError);
06877: if (yyResult.hasValue("&=")) {
06878: yyValue = "&=";
06879:
06880: return yyResult.createValue(yyValue, yyError);
06881: }
06882:
06883: // Alternative <XorEqual>.
06884:
06885: yyResult = pSymbol(yyStart);
06886: yyError = yyResult.select(yyError);
06887: if (yyResult.hasValue("^=")) {
06888: yyValue = "^=";
06889:
06890: return yyResult.createValue(yyValue, yyError);
06891: }
06892:
06893: // Alternative <OrEqual>.
06894:
06895: yyResult = pSymbol(yyStart);
06896: yyError = yyResult.select(yyError);
06897: if (yyResult.hasValue("|=")) {
06898: yyValue = "|=";
06899:
06900: return yyResult.createValue(yyValue, yyError);
06901: }
06902:
06903: // Done.
06904: yyError = yyError.select("assignment operator expected",
06905: yyStart);
06906: return yyError;
06907: }
06908:
06909: // =========================================================================
06910:
06911: /**
06912: * Parse nonterminal xtc.lang.C.ConditionalExpression.
06913: *
06914: * @param yyStart The index.
06915: * @return The result.
06916: * @throws IOException Signals an I/O error.
06917: */
06918: private Result pConditionalExpression(final int yyStart)
06919: throws IOException {
06920:
06921: CParserColumn yyColumn = (CParserColumn) column(yyStart);
06922: if (null == yyColumn.chunk2)
06923: yyColumn.chunk2 = new Chunk2();
06924: if (null == yyColumn.chunk2.fConditionalExpression)
06925: yyColumn.chunk2.fConditionalExpression = pConditionalExpression$1(yyStart);
06926: return yyColumn.chunk2.fConditionalExpression;
06927: }
06928:
06929: /** Actually parse xtc.lang.C.ConditionalExpression. */
06930: private Result pConditionalExpression$1(final int yyStart)
06931: throws IOException {
06932:
06933: Result yyResult;
06934: int yyBase;
06935: Node yyValue;
06936: ParseError yyError = ParseError.DUMMY;
06937:
06938: // Alternative <Conditional>.
06939:
06940: yyResult = pLogicalOrExpression(yyStart);
06941: yyError = yyResult.select(yyError);
06942: if (yyResult.hasValue()) {
06943: final Node v$g$1 = yyResult.semanticValue();
06944:
06945: yyBase = yyResult.index;
06946: yyResult = pSymbol(yyBase);
06947: yyError = yyResult.select(yyError);
06948: if (yyResult.hasValue("?")) {
06949:
06950: yyResult = pCommaExpression(yyResult.index);
06951: yyError = yyResult.select(yyError);
06952: if (yyResult.hasValue()) {
06953: final Node v$g$2 = yyResult.semanticValue();
06954:
06955: yyBase = yyResult.index;
06956: yyResult = pSymbol(yyBase);
06957: yyError = yyResult.select(yyError);
06958: if (yyResult.hasValue(":")) {
06959:
06960: yyResult = pConditionalExpression(yyResult.index);
06961: yyError = yyResult.select(yyError);
06962: if (yyResult.hasValue()) {
06963: final Node v$g$3 = yyResult.semanticValue();
06964:
06965: yyValue = GNode.create(
06966: "ConditionalExpression", v$g$1,
06967: v$g$2, v$g$3);
06968: yyValue.setLocation(location(yyStart));
06969:
06970: return yyResult.createValue(yyValue,
06971: yyError);
06972: }
06973: } else {
06974: yyError = yyError.select("\":\" expected",
06975: yyBase);
06976: }
06977: }
06978: } else {
06979: yyError = yyError.select("\"?\" expected", yyBase);
06980: }
06981: }
06982:
06983: // Alternative <IncompleteConditional>.
06984:
06985: if (GCC) {
06986:
06987: yyResult = pLogicalOrExpression(yyStart);
06988: yyError = yyResult.select(yyError);
06989: if (yyResult.hasValue()) {
06990: final Node v$g$4 = yyResult.semanticValue();
06991:
06992: yyBase = yyResult.index;
06993: yyResult = pSymbol(yyBase);
06994: yyError = yyResult.select(yyError);
06995: if (yyResult.hasValue("?")) {
06996:
06997: yyBase = yyResult.index;
06998: yyResult = pSymbol(yyBase);
06999: yyError = yyResult.select(yyError);
07000: if (yyResult.hasValue(":")) {
07001:
07002: yyResult = pConditionalExpression(yyResult.index);
07003: yyError = yyResult.select(yyError);
07004: if (yyResult.hasValue()) {
07005: final Node v$g$6 = yyResult.semanticValue();
07006:
07007: yyValue = GNode.create(
07008: "ConditionalExpression", v$g$4,
07009: null, v$g$6);
07010: yyValue.setLocation(location(yyStart));
07011:
07012: return yyResult.createValue(yyValue,
07013: yyError);
07014: }
07015: } else {
07016: yyError = yyError.select("\":\" expected",
07017: yyBase);
07018: }
07019: } else {
07020: yyError = yyError.select("\"?\" expected", yyBase);
07021: }
07022: }
07023: }
07024:
07025: // Alternative <Base>.
07026:
07027: yyResult = pLogicalOrExpression(yyStart);
07028: yyError = yyResult.select(yyError);
07029: if (yyResult.hasValue()) {
07030: yyValue = yyResult.semanticValue();
07031:
07032: return yyResult.createValue(yyValue, yyError);
07033: }
07034:
07035: // Done.
07036: yyError = yyError.select("conditional expression expected",
07037: yyStart);
07038: return yyError;
07039: }
07040:
07041: // =========================================================================
07042:
07043: /**
07044: * Parse nonterminal xtc.lang.C.LogicalOrExpression.
07045: *
07046: * @param yyStart The index.
07047: * @return The result.
07048: * @throws IOException Signals an I/O error.
07049: */
07050: private Result pLogicalOrExpression(final int yyStart)
07051: throws IOException {
07052: CParserColumn yyColumn = (CParserColumn) column(yyStart);
07053: if (null == yyColumn.chunk2)
07054: yyColumn.chunk2 = new Chunk2();
07055: if (null == yyColumn.chunk2.fLogicalOrExpression)
07056: yyColumn.chunk2.fLogicalOrExpression = pLogicalOrExpression$1(yyStart);
07057: return yyColumn.chunk2.fLogicalOrExpression;
07058: }
07059:
07060: /** Actually parse xtc.lang.C.LogicalOrExpression. */
07061: private Result pLogicalOrExpression$1(final int yyStart)
07062: throws IOException {
07063:
07064: Result yyResult;
07065: int yyRepetition1;
07066: Pair<Action<Node>> yyRepValue1;
07067: Node yyValue;
07068: ParseError yyError = ParseError.DUMMY;
07069:
07070: // Alternative <Base>.
07071:
07072: yyResult = pLogicalAndExpression(yyStart);
07073: yyError = yyResult.select(yyError);
07074: if (yyResult.hasValue()) {
07075: final Node v$3 = yyResult.semanticValue();
07076:
07077: yyRepetition1 = yyResult.index;
07078: yyRepValue1 = Pair.empty();
07079: while (true) {
07080:
07081: yyResult = pLogicalOrExpression$$Tail1(yyRepetition1);
07082: yyError = yyResult.select(yyError);
07083: if (yyResult.hasValue()) {
07084: final Action<Node> v$4 = yyResult.semanticValue();
07085:
07086: yyRepetition1 = yyResult.index;
07087: yyRepValue1 = new Pair<Action<Node>>(v$4,
07088: yyRepValue1);
07089: continue;
07090: }
07091: break;
07092: }
07093: { // Start scope for v$5.
07094: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07095:
07096: yyValue = apply(v$5, v$3, yyStart);
07097:
07098: return new SemanticValue(yyValue, yyRepetition1,
07099: yyError);
07100: } // End scope for v$5.
07101: }
07102:
07103: // Done.
07104: return yyError;
07105: }
07106:
07107: // =========================================================================
07108:
07109: /**
07110: * Parse synthetic nonterminal xtc.lang.C.LogicalOrExpression$$Tail1.
07111: *
07112: * @param yyStart The index.
07113: * @return The result.
07114: * @throws IOException Signals an I/O error.
07115: */
07116: private Result pLogicalOrExpression$$Tail1(final int yyStart)
07117: throws IOException {
07118:
07119: Result yyResult;
07120: Action<Node> yyValue;
07121: ParseError yyError = ParseError.DUMMY;
07122:
07123: // Alternative <Or>.
07124:
07125: yyResult = pSymbol(yyStart);
07126: yyError = yyResult.select(yyError);
07127: if (yyResult.hasValue("||")) {
07128:
07129: yyResult = pLogicalAndExpression(yyResult.index);
07130: yyError = yyResult.select(yyError);
07131: if (yyResult.hasValue()) {
07132: final Node v$g$2 = yyResult.semanticValue();
07133:
07134: yyValue = new Action<Node>() {
07135: public Node run(Node v$1) {
07136: return GNode.create("LogicalOrExpression", v$1,
07137: v$g$2);
07138: }
07139: };
07140:
07141: return yyResult.createValue(yyValue, yyError);
07142: }
07143: }
07144:
07145: // Done.
07146: yyError = yyError.select("logical or expression expected",
07147: yyStart);
07148: return yyError;
07149: }
07150:
07151: // =========================================================================
07152:
07153: /**
07154: * Parse nonterminal xtc.lang.C.LogicalAndExpression.
07155: *
07156: * @param yyStart The index.
07157: * @return The result.
07158: * @throws IOException Signals an I/O error.
07159: */
07160: private Result pLogicalAndExpression(final int yyStart)
07161: throws IOException {
07162: Result yyResult;
07163: int yyRepetition1;
07164: Pair<Action<Node>> yyRepValue1;
07165: Node yyValue;
07166: ParseError yyError = ParseError.DUMMY;
07167:
07168: // Alternative <Base>.
07169:
07170: yyResult = pBitwiseOrExpression(yyStart);
07171: yyError = yyResult.select(yyError);
07172: if (yyResult.hasValue()) {
07173: final Node v$3 = yyResult.semanticValue();
07174:
07175: yyRepetition1 = yyResult.index;
07176: yyRepValue1 = Pair.empty();
07177: while (true) {
07178:
07179: yyResult = pLogicalAndExpression$$Tail1(yyRepetition1);
07180: yyError = yyResult.select(yyError);
07181: if (yyResult.hasValue()) {
07182: final Action<Node> v$4 = yyResult.semanticValue();
07183:
07184: yyRepetition1 = yyResult.index;
07185: yyRepValue1 = new Pair<Action<Node>>(v$4,
07186: yyRepValue1);
07187: continue;
07188: }
07189: break;
07190: }
07191: { // Start scope for v$5.
07192: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07193:
07194: yyValue = apply(v$5, v$3, yyStart);
07195:
07196: return new SemanticValue(yyValue, yyRepetition1,
07197: yyError);
07198: } // End scope for v$5.
07199: }
07200:
07201: // Done.
07202: return yyError;
07203: }
07204:
07205: // =========================================================================
07206:
07207: /**
07208: * Parse synthetic nonterminal xtc.lang.C.LogicalAndExpression$$Tail1.
07209: *
07210: * @param yyStart The index.
07211: * @return The result.
07212: * @throws IOException Signals an I/O error.
07213: */
07214: private Result pLogicalAndExpression$$Tail1(final int yyStart)
07215: throws IOException {
07216:
07217: Result yyResult;
07218: Action<Node> yyValue;
07219: ParseError yyError = ParseError.DUMMY;
07220:
07221: // Alternative <And>.
07222:
07223: yyResult = pSymbol(yyStart);
07224: yyError = yyResult.select(yyError);
07225: if (yyResult.hasValue("&&")) {
07226:
07227: yyResult = pBitwiseOrExpression(yyResult.index);
07228: yyError = yyResult.select(yyError);
07229: if (yyResult.hasValue()) {
07230: final Node v$g$2 = yyResult.semanticValue();
07231:
07232: yyValue = new Action<Node>() {
07233: public Node run(Node v$1) {
07234: return GNode.create("LogicalAndExpression",
07235: v$1, v$g$2);
07236: }
07237: };
07238:
07239: return yyResult.createValue(yyValue, yyError);
07240: }
07241: }
07242:
07243: // Done.
07244: yyError = yyError.select("logical and expression expected",
07245: yyStart);
07246: return yyError;
07247: }
07248:
07249: // =========================================================================
07250:
07251: /**
07252: * Parse nonterminal xtc.lang.C.BitwiseOrExpression.
07253: *
07254: * @param yyStart The index.
07255: * @return The result.
07256: * @throws IOException Signals an I/O error.
07257: */
07258: private Result pBitwiseOrExpression(final int yyStart)
07259: throws IOException {
07260: Result yyResult;
07261: int yyRepetition1;
07262: Pair<Action<Node>> yyRepValue1;
07263: Node yyValue;
07264: ParseError yyError = ParseError.DUMMY;
07265:
07266: // Alternative <Base>.
07267:
07268: yyResult = pBitwiseXorExpression(yyStart);
07269: yyError = yyResult.select(yyError);
07270: if (yyResult.hasValue()) {
07271: final Node v$3 = yyResult.semanticValue();
07272:
07273: yyRepetition1 = yyResult.index;
07274: yyRepValue1 = Pair.empty();
07275: while (true) {
07276:
07277: yyResult = pBitwiseOrExpression$$Tail1(yyRepetition1);
07278: yyError = yyResult.select(yyError);
07279: if (yyResult.hasValue()) {
07280: final Action<Node> v$4 = yyResult.semanticValue();
07281:
07282: yyRepetition1 = yyResult.index;
07283: yyRepValue1 = new Pair<Action<Node>>(v$4,
07284: yyRepValue1);
07285: continue;
07286: }
07287: break;
07288: }
07289: { // Start scope for v$5.
07290: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07291:
07292: yyValue = apply(v$5, v$3, yyStart);
07293:
07294: return new SemanticValue(yyValue, yyRepetition1,
07295: yyError);
07296: } // End scope for v$5.
07297: }
07298:
07299: // Done.
07300: return yyError;
07301: }
07302:
07303: // =========================================================================
07304:
07305: /**
07306: * Parse synthetic nonterminal xtc.lang.C.BitwiseOrExpression$$Tail1.
07307: *
07308: * @param yyStart The index.
07309: * @return The result.
07310: * @throws IOException Signals an I/O error.
07311: */
07312: private Result pBitwiseOrExpression$$Tail1(final int yyStart)
07313: throws IOException {
07314:
07315: Result yyResult;
07316: Action<Node> yyValue;
07317: ParseError yyError = ParseError.DUMMY;
07318:
07319: // Alternative <Or>.
07320:
07321: yyResult = pSymbol(yyStart);
07322: yyError = yyResult.select(yyError);
07323: if (yyResult.hasValue("|")) {
07324:
07325: yyResult = pBitwiseXorExpression(yyResult.index);
07326: yyError = yyResult.select(yyError);
07327: if (yyResult.hasValue()) {
07328: final Node v$g$2 = yyResult.semanticValue();
07329:
07330: yyValue = new Action<Node>() {
07331: public Node run(Node v$1) {
07332: return GNode.create("BitwiseOrExpression", v$1,
07333: v$g$2);
07334: }
07335: };
07336:
07337: return yyResult.createValue(yyValue, yyError);
07338: }
07339: }
07340:
07341: // Done.
07342: yyError = yyError.select("bitwise or expression expected",
07343: yyStart);
07344: return yyError;
07345: }
07346:
07347: // =========================================================================
07348:
07349: /**
07350: * Parse nonterminal xtc.lang.C.BitwiseXorExpression.
07351: *
07352: * @param yyStart The index.
07353: * @return The result.
07354: * @throws IOException Signals an I/O error.
07355: */
07356: private Result pBitwiseXorExpression(final int yyStart)
07357: throws IOException {
07358: Result yyResult;
07359: int yyRepetition1;
07360: Pair<Action<Node>> yyRepValue1;
07361: Node yyValue;
07362: ParseError yyError = ParseError.DUMMY;
07363:
07364: // Alternative <Base>.
07365:
07366: yyResult = pBitwiseAndExpression(yyStart);
07367: yyError = yyResult.select(yyError);
07368: if (yyResult.hasValue()) {
07369: final Node v$3 = yyResult.semanticValue();
07370:
07371: yyRepetition1 = yyResult.index;
07372: yyRepValue1 = Pair.empty();
07373: while (true) {
07374:
07375: yyResult = pBitwiseXorExpression$$Tail1(yyRepetition1);
07376: yyError = yyResult.select(yyError);
07377: if (yyResult.hasValue()) {
07378: final Action<Node> v$4 = yyResult.semanticValue();
07379:
07380: yyRepetition1 = yyResult.index;
07381: yyRepValue1 = new Pair<Action<Node>>(v$4,
07382: yyRepValue1);
07383: continue;
07384: }
07385: break;
07386: }
07387: { // Start scope for v$5.
07388: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07389:
07390: yyValue = apply(v$5, v$3, yyStart);
07391:
07392: return new SemanticValue(yyValue, yyRepetition1,
07393: yyError);
07394: } // End scope for v$5.
07395: }
07396:
07397: // Done.
07398: return yyError;
07399: }
07400:
07401: // =========================================================================
07402:
07403: /**
07404: * Parse synthetic nonterminal xtc.lang.C.BitwiseXorExpression$$Tail1.
07405: *
07406: * @param yyStart The index.
07407: * @return The result.
07408: * @throws IOException Signals an I/O error.
07409: */
07410: private Result pBitwiseXorExpression$$Tail1(final int yyStart)
07411: throws IOException {
07412:
07413: Result yyResult;
07414: Action<Node> yyValue;
07415: ParseError yyError = ParseError.DUMMY;
07416:
07417: // Alternative <Xor>.
07418:
07419: yyResult = pSymbol(yyStart);
07420: yyError = yyResult.select(yyError);
07421: if (yyResult.hasValue("^")) {
07422:
07423: yyResult = pBitwiseAndExpression(yyResult.index);
07424: yyError = yyResult.select(yyError);
07425: if (yyResult.hasValue()) {
07426: final Node v$g$2 = yyResult.semanticValue();
07427:
07428: yyValue = new Action<Node>() {
07429: public Node run(Node v$1) {
07430: return GNode.create("BitwiseXorExpression",
07431: v$1, v$g$2);
07432: }
07433: };
07434:
07435: return yyResult.createValue(yyValue, yyError);
07436: }
07437: }
07438:
07439: // Done.
07440: yyError = yyError.select("bitwise xor expression expected",
07441: yyStart);
07442: return yyError;
07443: }
07444:
07445: // =========================================================================
07446:
07447: /**
07448: * Parse nonterminal xtc.lang.C.BitwiseAndExpression.
07449: *
07450: * @param yyStart The index.
07451: * @return The result.
07452: * @throws IOException Signals an I/O error.
07453: */
07454: private Result pBitwiseAndExpression(final int yyStart)
07455: throws IOException {
07456: Result yyResult;
07457: int yyRepetition1;
07458: Pair<Action<Node>> yyRepValue1;
07459: Node yyValue;
07460: ParseError yyError = ParseError.DUMMY;
07461:
07462: // Alternative <Base>.
07463:
07464: yyResult = pEqualityExpression(yyStart);
07465: yyError = yyResult.select(yyError);
07466: if (yyResult.hasValue()) {
07467: final Node v$3 = yyResult.semanticValue();
07468:
07469: yyRepetition1 = yyResult.index;
07470: yyRepValue1 = Pair.empty();
07471: while (true) {
07472:
07473: yyResult = pBitwiseAndExpression$$Tail1(yyRepetition1);
07474: yyError = yyResult.select(yyError);
07475: if (yyResult.hasValue()) {
07476: final Action<Node> v$4 = yyResult.semanticValue();
07477:
07478: yyRepetition1 = yyResult.index;
07479: yyRepValue1 = new Pair<Action<Node>>(v$4,
07480: yyRepValue1);
07481: continue;
07482: }
07483: break;
07484: }
07485: { // Start scope for v$5.
07486: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
07487:
07488: yyValue = apply(v$5, v$3, yyStart);
07489:
07490: return new SemanticValue(yyValue, yyRepetition1,
07491: yyError);
07492: } // End scope for v$5.
07493: }
07494:
07495: // Done.
07496: return yyError;
07497: }
07498:
07499: // =========================================================================
07500:
07501: /**
07502: * Parse synthetic nonterminal xtc.lang.C.BitwiseAndExpression$$Tail1.
07503: *
07504: * @param yyStart The index.
07505: * @return The result.
07506: * @throws IOException Signals an I/O error.
07507: */
07508: private Result pBitwiseAndExpression$$Tail1(final int yyStart)
07509: throws IOException {
07510:
07511: Result yyResult;
07512: Action<Node> yyValue;
07513: ParseError yyError = ParseError.DUMMY;
07514:
07515: // Alternative <And>.
07516:
07517: yyResult = pSymbol(yyStart);
07518: yyError = yyResult.select(yyError);
07519: if (yyResult.hasValue("&")) {
07520:
07521: yyResult = pEqualityExpression(yyResult.index);
07522: yyError = yyResult.select(yyError);
07523: if (yyResult.hasValue()) {
07524: final Node v$g$2 = yyResult.semanticValue();
07525:
07526: yyValue = new Action<Node>() {
07527: public Node run(Node v$1) {
07528: return GNode.create("BitwiseAndExpression",
07529: v$1, v$g$2);
07530: }
07531: };
07532:
07533: return yyResult.createValue(yyValue, yyError);
07534: }
07535: }
07536:
07537: // Done.
07538: yyError = yyError.select("bitwise and expression expected",
07539: yyStart);
07540: return yyError;
07541: }
07542:
07543: // =========================================================================
07544:
07545: /**
07546: * Parse nonterminal xtc.lang.C.EqualityExpression.
07547: *
07548: * @param yyStart The index.
07549: * @return The result.
07550: * @throws IOException Signals an I/O error.
07551: */
07552: private Result pEqualityExpression(final int yyStart)
07553: throws IOException {
07554: Result yyResult;
07555: int yyRepetition1;
07556: Pair<Action<Node>> yyRepValue1;
07557: Node yyValue;
07558: ParseError yyError = ParseError.DUMMY;
07559:
07560: // Alternative <Base>.
07561:
07562: yyResult = pRelationalExpression(yyStart);
07563: yyError = yyResult.select(yyError);
07564: if (yyResult.hasValue()) {
07565: final Node v$4 = yyResult.semanticValue();
07566:
07567: yyRepetition1 = yyResult.index;
07568: yyRepValue1 = Pair.empty();
07569: while (true) {
07570:
07571: yyResult = pEqualityExpression$$Tail1(yyRepetition1);
07572: yyError = yyResult.select(yyError);
07573: if (yyResult.hasValue()) {
07574: final Action<Node> v$5 = yyResult.semanticValue();
07575:
07576: yyRepetition1 = yyResult.index;
07577: yyRepValue1 = new Pair<Action<Node>>(v$5,
07578: yyRepValue1);
07579: continue;
07580: }
07581: break;
07582: }
07583: { // Start scope for v$6.
07584: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
07585:
07586: yyValue = apply(v$6, v$4, yyStart);
07587:
07588: return new SemanticValue(yyValue, yyRepetition1,
07589: yyError);
07590: } // End scope for v$6.
07591: }
07592:
07593: // Done.
07594: return yyError;
07595: }
07596:
07597: // =========================================================================
07598:
07599: /**
07600: * Parse synthetic nonterminal xtc.lang.C.EqualityExpression$$Tail1.
07601: *
07602: * @param yyStart The index.
07603: * @return The result.
07604: * @throws IOException Signals an I/O error.
07605: */
07606: private Result pEqualityExpression$$Tail1(final int yyStart)
07607: throws IOException {
07608:
07609: Result yyResult;
07610: Action<Node> yyValue;
07611: ParseError yyError = ParseError.DUMMY;
07612:
07613: // Alternative <Recursion>.
07614:
07615: yyResult = pEqualityOperator(yyStart);
07616: yyError = yyResult.select(yyError);
07617: if (yyResult.hasValue()) {
07618: final String v$g$2 = yyResult.semanticValue();
07619:
07620: yyResult = pRelationalExpression(yyResult.index);
07621: yyError = yyResult.select(yyError);
07622: if (yyResult.hasValue()) {
07623: final Node v$g$3 = yyResult.semanticValue();
07624:
07625: yyValue = new Action<Node>() {
07626: public Node run(Node v$1) {
07627: return GNode.create("EqualityExpression", v$1,
07628: v$g$2, v$g$3);
07629: }
07630: };
07631:
07632: return yyResult.createValue(yyValue, yyError);
07633: }
07634: }
07635:
07636: // Done.
07637: return yyError;
07638: }
07639:
07640: // =========================================================================
07641:
07642: /**
07643: * Parse nonterminal xtc.lang.C.EqualityOperator.
07644: *
07645: * @param yyStart The index.
07646: * @return The result.
07647: * @throws IOException Signals an I/O error.
07648: */
07649: private Result pEqualityOperator(final int yyStart)
07650: throws IOException {
07651: Result yyResult;
07652: String yyValue;
07653: ParseError yyError = ParseError.DUMMY;
07654:
07655: // Alternative <Equal>.
07656:
07657: yyResult = pSymbol(yyStart);
07658: yyError = yyResult.select(yyError);
07659: if (yyResult.hasValue("==")) {
07660: yyValue = "==";
07661:
07662: return yyResult.createValue(yyValue, yyError);
07663: }
07664:
07665: // Alternative <NotEqual>.
07666:
07667: yyResult = pSymbol(yyStart);
07668: yyError = yyResult.select(yyError);
07669: if (yyResult.hasValue("!=")) {
07670: yyValue = "!=";
07671:
07672: return yyResult.createValue(yyValue, yyError);
07673: }
07674:
07675: // Done.
07676: yyError = yyError.select("equality operator expected", yyStart);
07677: return yyError;
07678: }
07679:
07680: // =========================================================================
07681:
07682: /**
07683: * Parse nonterminal xtc.lang.C.RelationalExpression.
07684: *
07685: * @param yyStart The index.
07686: * @return The result.
07687: * @throws IOException Signals an I/O error.
07688: */
07689: private Result pRelationalExpression(final int yyStart)
07690: throws IOException {
07691: Result yyResult;
07692: int yyRepetition1;
07693: Pair<Action<Node>> yyRepValue1;
07694: Node yyValue;
07695: ParseError yyError = ParseError.DUMMY;
07696:
07697: // Alternative <Base>.
07698:
07699: yyResult = pShiftExpression(yyStart);
07700: yyError = yyResult.select(yyError);
07701: if (yyResult.hasValue()) {
07702: final Node v$4 = yyResult.semanticValue();
07703:
07704: yyRepetition1 = yyResult.index;
07705: yyRepValue1 = Pair.empty();
07706: while (true) {
07707:
07708: yyResult = pRelationalExpression$$Tail1(yyRepetition1);
07709: yyError = yyResult.select(yyError);
07710: if (yyResult.hasValue()) {
07711: final Action<Node> v$5 = yyResult.semanticValue();
07712:
07713: yyRepetition1 = yyResult.index;
07714: yyRepValue1 = new Pair<Action<Node>>(v$5,
07715: yyRepValue1);
07716: continue;
07717: }
07718: break;
07719: }
07720: { // Start scope for v$6.
07721: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
07722:
07723: yyValue = apply(v$6, v$4, yyStart);
07724:
07725: return new SemanticValue(yyValue, yyRepetition1,
07726: yyError);
07727: } // End scope for v$6.
07728: }
07729:
07730: // Done.
07731: return yyError;
07732: }
07733:
07734: // =========================================================================
07735:
07736: /**
07737: * Parse synthetic nonterminal xtc.lang.C.RelationalExpression$$Tail1.
07738: *
07739: * @param yyStart The index.
07740: * @return The result.
07741: * @throws IOException Signals an I/O error.
07742: */
07743: private Result pRelationalExpression$$Tail1(final int yyStart)
07744: throws IOException {
07745:
07746: Result yyResult;
07747: Action<Node> yyValue;
07748: ParseError yyError = ParseError.DUMMY;
07749:
07750: // Alternative <Recursion>.
07751:
07752: yyResult = pRelationalOperator(yyStart);
07753: yyError = yyResult.select(yyError);
07754: if (yyResult.hasValue()) {
07755: final String v$g$2 = yyResult.semanticValue();
07756:
07757: yyResult = pShiftExpression(yyResult.index);
07758: yyError = yyResult.select(yyError);
07759: if (yyResult.hasValue()) {
07760: final Node v$g$3 = yyResult.semanticValue();
07761:
07762: yyValue = new Action<Node>() {
07763: public Node run(Node v$1) {
07764: return GNode.create("RelationalExpression",
07765: v$1, v$g$2, v$g$3);
07766: }
07767: };
07768:
07769: return yyResult.createValue(yyValue, yyError);
07770: }
07771: }
07772:
07773: // Done.
07774: return yyError;
07775: }
07776:
07777: // =========================================================================
07778:
07779: /**
07780: * Parse nonterminal xtc.lang.C.RelationalOperator.
07781: *
07782: * @param yyStart The index.
07783: * @return The result.
07784: * @throws IOException Signals an I/O error.
07785: */
07786: private Result pRelationalOperator(final int yyStart)
07787: throws IOException {
07788: Result yyResult;
07789: String yyValue;
07790: ParseError yyError = ParseError.DUMMY;
07791:
07792: // Alternative <LessEqual>.
07793:
07794: yyResult = pSymbol(yyStart);
07795: yyError = yyResult.select(yyError);
07796: if (yyResult.hasValue("<=")) {
07797: yyValue = "<=";
07798:
07799: return yyResult.createValue(yyValue, yyError);
07800: }
07801:
07802: // Alternative <Less>.
07803:
07804: yyResult = pSymbol(yyStart);
07805: yyError = yyResult.select(yyError);
07806: if (yyResult.hasValue("<")) {
07807: yyValue = "<";
07808:
07809: return yyResult.createValue(yyValue, yyError);
07810: }
07811:
07812: // Alternative <GreaterEqual>.
07813:
07814: yyResult = pSymbol(yyStart);
07815: yyError = yyResult.select(yyError);
07816: if (yyResult.hasValue(">=")) {
07817: yyValue = ">=";
07818:
07819: return yyResult.createValue(yyValue, yyError);
07820: }
07821:
07822: // Alternative <Greater>.
07823:
07824: yyResult = pSymbol(yyStart);
07825: yyError = yyResult.select(yyError);
07826: if (yyResult.hasValue(">")) {
07827: yyValue = ">";
07828:
07829: return yyResult.createValue(yyValue, yyError);
07830: }
07831:
07832: // Done.
07833: yyError = yyError.select("relational operator expected",
07834: yyStart);
07835: return yyError;
07836: }
07837:
07838: // =========================================================================
07839:
07840: /**
07841: * Parse nonterminal xtc.lang.C.ShiftExpression.
07842: *
07843: * @param yyStart The index.
07844: * @return The result.
07845: * @throws IOException Signals an I/O error.
07846: */
07847: private Result pShiftExpression(final int yyStart)
07848: throws IOException {
07849: Result yyResult;
07850: int yyRepetition1;
07851: Pair<Action<Node>> yyRepValue1;
07852: Node yyValue;
07853: ParseError yyError = ParseError.DUMMY;
07854:
07855: // Alternative <Base>.
07856:
07857: yyResult = pAdditiveExpression(yyStart);
07858: yyError = yyResult.select(yyError);
07859: if (yyResult.hasValue()) {
07860: final Node v$4 = yyResult.semanticValue();
07861:
07862: yyRepetition1 = yyResult.index;
07863: yyRepValue1 = Pair.empty();
07864: while (true) {
07865:
07866: yyResult = pShiftExpression$$Tail1(yyRepetition1);
07867: yyError = yyResult.select(yyError);
07868: if (yyResult.hasValue()) {
07869: final Action<Node> v$5 = yyResult.semanticValue();
07870:
07871: yyRepetition1 = yyResult.index;
07872: yyRepValue1 = new Pair<Action<Node>>(v$5,
07873: yyRepValue1);
07874: continue;
07875: }
07876: break;
07877: }
07878: { // Start scope for v$6.
07879: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
07880:
07881: yyValue = apply(v$6, v$4, yyStart);
07882:
07883: return new SemanticValue(yyValue, yyRepetition1,
07884: yyError);
07885: } // End scope for v$6.
07886: }
07887:
07888: // Done.
07889: return yyError;
07890: }
07891:
07892: // =========================================================================
07893:
07894: /**
07895: * Parse synthetic nonterminal xtc.lang.C.ShiftExpression$$Tail1.
07896: *
07897: * @param yyStart The index.
07898: * @return The result.
07899: * @throws IOException Signals an I/O error.
07900: */
07901: private Result pShiftExpression$$Tail1(final int yyStart)
07902: throws IOException {
07903:
07904: Result yyResult;
07905: Action<Node> yyValue;
07906: ParseError yyError = ParseError.DUMMY;
07907:
07908: // Alternative <Recursion>.
07909:
07910: yyResult = pShiftOperator(yyStart);
07911: yyError = yyResult.select(yyError);
07912: if (yyResult.hasValue()) {
07913: final String v$g$2 = yyResult.semanticValue();
07914:
07915: yyResult = pAdditiveExpression(yyResult.index);
07916: yyError = yyResult.select(yyError);
07917: if (yyResult.hasValue()) {
07918: final Node v$g$3 = yyResult.semanticValue();
07919:
07920: yyValue = new Action<Node>() {
07921: public Node run(Node v$1) {
07922: return GNode.create("ShiftExpression", v$1,
07923: v$g$2, v$g$3);
07924: }
07925: };
07926:
07927: return yyResult.createValue(yyValue, yyError);
07928: }
07929: }
07930:
07931: // Done.
07932: return yyError;
07933: }
07934:
07935: // =========================================================================
07936:
07937: /**
07938: * Parse nonterminal xtc.lang.C.ShiftOperator.
07939: *
07940: * @param yyStart The index.
07941: * @return The result.
07942: * @throws IOException Signals an I/O error.
07943: */
07944: private Result pShiftOperator(final int yyStart) throws IOException {
07945: Result yyResult;
07946: String yyValue;
07947: ParseError yyError = ParseError.DUMMY;
07948:
07949: // Alternative <Left>.
07950:
07951: yyResult = pSymbol(yyStart);
07952: yyError = yyResult.select(yyError);
07953: if (yyResult.hasValue("<<")) {
07954: yyValue = "<<";
07955:
07956: return yyResult.createValue(yyValue, yyError);
07957: }
07958:
07959: // Alternative <Right>.
07960:
07961: yyResult = pSymbol(yyStart);
07962: yyError = yyResult.select(yyError);
07963: if (yyResult.hasValue(">>")) {
07964: yyValue = ">>";
07965:
07966: return yyResult.createValue(yyValue, yyError);
07967: }
07968:
07969: // Done.
07970: yyError = yyError.select("shift operator expected", yyStart);
07971: return yyError;
07972: }
07973:
07974: // =========================================================================
07975:
07976: /**
07977: * Parse nonterminal xtc.lang.C.AdditiveExpression.
07978: *
07979: * @param yyStart The index.
07980: * @return The result.
07981: * @throws IOException Signals an I/O error.
07982: */
07983: private Result pAdditiveExpression(final int yyStart)
07984: throws IOException {
07985: Result yyResult;
07986: int yyRepetition1;
07987: Pair<Action<Node>> yyRepValue1;
07988: Node yyValue;
07989: ParseError yyError = ParseError.DUMMY;
07990:
07991: // Alternative <Base>.
07992:
07993: yyResult = pMultiplicativeExpression(yyStart);
07994: yyError = yyResult.select(yyError);
07995: if (yyResult.hasValue()) {
07996: final Node v$4 = yyResult.semanticValue();
07997:
07998: yyRepetition1 = yyResult.index;
07999: yyRepValue1 = Pair.empty();
08000: while (true) {
08001:
08002: yyResult = pAdditiveExpression$$Tail1(yyRepetition1);
08003: yyError = yyResult.select(yyError);
08004: if (yyResult.hasValue()) {
08005: final Action<Node> v$5 = yyResult.semanticValue();
08006:
08007: yyRepetition1 = yyResult.index;
08008: yyRepValue1 = new Pair<Action<Node>>(v$5,
08009: yyRepValue1);
08010: continue;
08011: }
08012: break;
08013: }
08014: { // Start scope for v$6.
08015: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
08016:
08017: yyValue = apply(v$6, v$4, yyStart);
08018:
08019: return new SemanticValue(yyValue, yyRepetition1,
08020: yyError);
08021: } // End scope for v$6.
08022: }
08023:
08024: // Done.
08025: return yyError;
08026: }
08027:
08028: // =========================================================================
08029:
08030: /**
08031: * Parse synthetic nonterminal xtc.lang.C.AdditiveExpression$$Tail1.
08032: *
08033: * @param yyStart The index.
08034: * @return The result.
08035: * @throws IOException Signals an I/O error.
08036: */
08037: private Result pAdditiveExpression$$Tail1(final int yyStart)
08038: throws IOException {
08039:
08040: Result yyResult;
08041: Action<Node> yyValue;
08042: ParseError yyError = ParseError.DUMMY;
08043:
08044: // Alternative <Recursion>.
08045:
08046: yyResult = pAdditiveOperator(yyStart);
08047: yyError = yyResult.select(yyError);
08048: if (yyResult.hasValue()) {
08049: final String v$g$2 = yyResult.semanticValue();
08050:
08051: yyResult = pMultiplicativeExpression(yyResult.index);
08052: yyError = yyResult.select(yyError);
08053: if (yyResult.hasValue()) {
08054: final Node v$g$3 = yyResult.semanticValue();
08055:
08056: yyValue = new Action<Node>() {
08057: public Node run(Node v$1) {
08058: return GNode.create("AdditiveExpression", v$1,
08059: v$g$2, v$g$3);
08060: }
08061: };
08062:
08063: return yyResult.createValue(yyValue, yyError);
08064: }
08065: }
08066:
08067: // Done.
08068: return yyError;
08069: }
08070:
08071: // =========================================================================
08072:
08073: /**
08074: * Parse nonterminal xtc.lang.C.AdditiveOperator.
08075: *
08076: * @param yyStart The index.
08077: * @return The result.
08078: * @throws IOException Signals an I/O error.
08079: */
08080: private Result pAdditiveOperator(final int yyStart)
08081: throws IOException {
08082: Result yyResult;
08083: String yyValue;
08084: ParseError yyError = ParseError.DUMMY;
08085:
08086: // Alternative <Plus>.
08087:
08088: yyResult = pSymbol(yyStart);
08089: yyError = yyResult.select(yyError);
08090: if (yyResult.hasValue("+")) {
08091: yyValue = "+";
08092:
08093: return yyResult.createValue(yyValue, yyError);
08094: }
08095:
08096: // Alternative <Minus>.
08097:
08098: yyResult = pSymbol(yyStart);
08099: yyError = yyResult.select(yyError);
08100: if (yyResult.hasValue("-")) {
08101: yyValue = "-";
08102:
08103: return yyResult.createValue(yyValue, yyError);
08104: }
08105:
08106: // Done.
08107: yyError = yyError.select("additive operator expected", yyStart);
08108: return yyError;
08109: }
08110:
08111: // =========================================================================
08112:
08113: /**
08114: * Parse nonterminal xtc.lang.C.MultiplicativeExpression.
08115: *
08116: * @param yyStart The index.
08117: * @return The result.
08118: * @throws IOException Signals an I/O error.
08119: */
08120: private Result pMultiplicativeExpression(final int yyStart)
08121: throws IOException {
08122:
08123: Result yyResult;
08124: int yyRepetition1;
08125: Pair<Action<Node>> yyRepValue1;
08126: Node yyValue;
08127: ParseError yyError = ParseError.DUMMY;
08128:
08129: // Alternative <Base>.
08130:
08131: yyResult = pCastExpression(yyStart);
08132: yyError = yyResult.select(yyError);
08133: if (yyResult.hasValue()) {
08134: final Node v$4 = yyResult.semanticValue();
08135:
08136: yyRepetition1 = yyResult.index;
08137: yyRepValue1 = Pair.empty();
08138: while (true) {
08139:
08140: yyResult = pMultiplicativeExpression$$Tail1(yyRepetition1);
08141: yyError = yyResult.select(yyError);
08142: if (yyResult.hasValue()) {
08143: final Action<Node> v$5 = yyResult.semanticValue();
08144:
08145: yyRepetition1 = yyResult.index;
08146: yyRepValue1 = new Pair<Action<Node>>(v$5,
08147: yyRepValue1);
08148: continue;
08149: }
08150: break;
08151: }
08152: { // Start scope for v$6.
08153: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
08154:
08155: yyValue = apply(v$6, v$4, yyStart);
08156:
08157: return new SemanticValue(yyValue, yyRepetition1,
08158: yyError);
08159: } // End scope for v$6.
08160: }
08161:
08162: // Done.
08163: return yyError;
08164: }
08165:
08166: // =========================================================================
08167:
08168: /**
08169: * Parse synthetic nonterminal xtc.lang.C.MultiplicativeExpression$$Tail1.
08170: *
08171: * @param yyStart The index.
08172: * @return The result.
08173: * @throws IOException Signals an I/O error.
08174: */
08175: private Result pMultiplicativeExpression$$Tail1(final int yyStart)
08176: throws IOException {
08177:
08178: Result yyResult;
08179: Action<Node> yyValue;
08180: ParseError yyError = ParseError.DUMMY;
08181:
08182: // Alternative <Recursion>.
08183:
08184: yyResult = pMultiplicativeOperator(yyStart);
08185: yyError = yyResult.select(yyError);
08186: if (yyResult.hasValue()) {
08187: final String v$g$2 = yyResult.semanticValue();
08188:
08189: yyResult = pCastExpression(yyResult.index);
08190: yyError = yyResult.select(yyError);
08191: if (yyResult.hasValue()) {
08192: final Node v$g$3 = yyResult.semanticValue();
08193:
08194: yyValue = new Action<Node>() {
08195: public Node run(Node v$1) {
08196: return GNode.create("MultiplicativeExpression",
08197: v$1, v$g$2, v$g$3);
08198: }
08199: };
08200:
08201: return yyResult.createValue(yyValue, yyError);
08202: }
08203: }
08204:
08205: // Done.
08206: return yyError;
08207: }
08208:
08209: // =========================================================================
08210:
08211: /**
08212: * Parse nonterminal xtc.lang.C.MultiplicativeOperator.
08213: *
08214: * @param yyStart The index.
08215: * @return The result.
08216: * @throws IOException Signals an I/O error.
08217: */
08218: private Result pMultiplicativeOperator(final int yyStart)
08219: throws IOException {
08220:
08221: Result yyResult;
08222: String yyValue;
08223: ParseError yyError = ParseError.DUMMY;
08224:
08225: // Alternative <Times>.
08226:
08227: yyResult = pSymbol(yyStart);
08228: yyError = yyResult.select(yyError);
08229: if (yyResult.hasValue("*")) {
08230: yyValue = "*";
08231:
08232: return yyResult.createValue(yyValue, yyError);
08233: }
08234:
08235: // Alternative <Over>.
08236:
08237: yyResult = pSymbol(yyStart);
08238: yyError = yyResult.select(yyError);
08239: if (yyResult.hasValue("/")) {
08240: yyValue = "/";
08241:
08242: return yyResult.createValue(yyValue, yyError);
08243: }
08244:
08245: // Alternative <Modulo>.
08246:
08247: yyResult = pSymbol(yyStart);
08248: yyError = yyResult.select(yyError);
08249: if (yyResult.hasValue("%")) {
08250: yyValue = "%";
08251:
08252: return yyResult.createValue(yyValue, yyError);
08253: }
08254:
08255: // Done.
08256: yyError = yyError.select("multiplicative operator expected",
08257: yyStart);
08258: return yyError;
08259: }
08260:
08261: // =========================================================================
08262:
08263: /**
08264: * Parse nonterminal xtc.lang.C.CastExpression.
08265: *
08266: * @param yyStart The index.
08267: * @return The result.
08268: * @throws IOException Signals an I/O error.
08269: */
08270: private Result pCastExpression(final int yyStart)
08271: throws IOException {
08272: CParserColumn yyColumn = (CParserColumn) column(yyStart);
08273: if (null == yyColumn.chunk2)
08274: yyColumn.chunk2 = new Chunk2();
08275: if (null == yyColumn.chunk2.fCastExpression)
08276: yyColumn.chunk2.fCastExpression = pCastExpression$1(yyStart);
08277: return yyColumn.chunk2.fCastExpression;
08278: }
08279:
08280: /** Actually parse xtc.lang.C.CastExpression. */
08281: private Result pCastExpression$1(final int yyStart)
08282: throws IOException {
08283: Result yyResult;
08284: int yyBase;
08285: Node yyValue;
08286: ParseError yyError = ParseError.DUMMY;
08287:
08288: // Alternative <Cast>.
08289:
08290: yyResult = pSymbol(yyStart);
08291: yyError = yyResult.select(yyError);
08292: if (yyResult.hasValue("(")) {
08293:
08294: yyResult = pTypeName(yyResult.index);
08295: yyError = yyResult.select(yyError);
08296: if (yyResult.hasValue()) {
08297: final Node v$g$1 = yyResult.semanticValue();
08298:
08299: yyBase = yyResult.index;
08300: yyResult = pSymbol(yyBase);
08301: yyError = yyResult.select(yyError);
08302: if (yyResult.hasValue(")")) {
08303:
08304: yyResult = pCastExpression(yyResult.index);
08305: yyError = yyResult.select(yyError);
08306: if (yyResult.hasValue()) {
08307: final Node v$g$2 = yyResult.semanticValue();
08308:
08309: yyValue = GNode.create("CastExpression", v$g$1,
08310: v$g$2);
08311: yyValue.setLocation(location(yyStart));
08312:
08313: return yyResult.createValue(yyValue, yyError);
08314: }
08315: } else {
08316: yyError = yyError.select("\")\" expected", yyBase);
08317: }
08318: }
08319: }
08320:
08321: // Alternative <Base>.
08322:
08323: yyResult = pUnaryExpression(yyStart);
08324: yyError = yyResult.select(yyError);
08325: if (yyResult.hasValue()) {
08326: yyValue = yyResult.semanticValue();
08327:
08328: return yyResult.createValue(yyValue, yyError);
08329: }
08330:
08331: // Done.
08332: yyError = yyError.select("cast expression expected", yyStart);
08333: return yyError;
08334: }
08335:
08336: // =========================================================================
08337:
08338: /**
08339: * Parse nonterminal xtc.lang.C.UnaryExpression.
08340: *
08341: * @param yyStart The index.
08342: * @return The result.
08343: * @throws IOException Signals an I/O error.
08344: */
08345: private Result pUnaryExpression(final int yyStart)
08346: throws IOException {
08347: CParserColumn yyColumn = (CParserColumn) column(yyStart);
08348: if (null == yyColumn.chunk3)
08349: yyColumn.chunk3 = new Chunk3();
08350: if (null == yyColumn.chunk3.fUnaryExpression)
08351: yyColumn.chunk3.fUnaryExpression = pUnaryExpression$1(yyStart);
08352: return yyColumn.chunk3.fUnaryExpression;
08353: }
08354:
08355: /** Actually parse xtc.lang.C.UnaryExpression. */
08356: private Result pUnaryExpression$1(final int yyStart)
08357: throws IOException {
08358: Result yyResult;
08359: Result yyPredResult;
08360: boolean yyPredMatched;
08361: int yyBase;
08362: Node yyValue;
08363: ParseError yyError = ParseError.DUMMY;
08364:
08365: // Alternative 1.
08366:
08367: yyResult = pKeyword(yyStart);
08368: yyError = yyResult.select(yyError);
08369: if (yyResult.hasValue("sizeof")) {
08370:
08371: final int yyChoice1 = yyResult.index;
08372:
08373: // Nested alternative 1.
08374:
08375: yyBase = yyChoice1;
08376: yyResult = pSymbol(yyBase);
08377: yyError = yyResult.select(yyError);
08378: if (yyResult.hasValue("(")) {
08379:
08380: yyResult = pTypeName(yyResult.index);
08381: yyError = yyResult.select(yyError);
08382: if (yyResult.hasValue()) {
08383: final Node v$g$1 = yyResult.semanticValue();
08384:
08385: yyBase = yyResult.index;
08386: yyResult = pSymbol(yyBase);
08387: yyError = yyResult.select(yyError);
08388: if (yyResult.hasValue(")")) {
08389:
08390: yyPredMatched = false;
08391:
08392: yyPredResult = pSymbol(yyResult.index);
08393: if (yyPredResult.hasValue("{")) {
08394:
08395: yyPredMatched = true;
08396: }
08397:
08398: if (!yyPredMatched) {
08399:
08400: yyValue = GNode.create("SizeofExpression",
08401: v$g$1);
08402: yyValue.setLocation(location(yyStart));
08403:
08404: return yyResult.createValue(yyValue,
08405: yyError);
08406: } else {
08407: yyError = yyError.select(
08408: "unary expression expected",
08409: yyStart);
08410: }
08411: } else {
08412: yyError = yyError.select("\")\" expected",
08413: yyBase);
08414: }
08415: }
08416: } else {
08417: yyError = yyError.select("\"(\" expected", yyBase);
08418: }
08419:
08420: // Nested alternative 2.
08421:
08422: yyResult = pUnaryExpression(yyChoice1);
08423: yyError = yyResult.select(yyError);
08424: if (yyResult.hasValue()) {
08425: final Node v$g$2 = yyResult.semanticValue();
08426:
08427: yyValue = GNode.create("SizeofExpression", v$g$2);
08428: yyValue.setLocation(location(yyStart));
08429:
08430: return yyResult.createValue(yyValue, yyError);
08431: }
08432: }
08433:
08434: // Alternative 2.
08435:
08436: yyResult = pAlignofKeyword(yyStart);
08437: yyError = yyResult.select(yyError);
08438: if (yyResult.hasValue()) {
08439:
08440: final int yyChoice1 = yyResult.index;
08441:
08442: // Nested alternative 1.
08443:
08444: yyBase = yyChoice1;
08445: yyResult = pSymbol(yyBase);
08446: yyError = yyResult.select(yyError);
08447: if (yyResult.hasValue("(")) {
08448:
08449: yyResult = pTypeName(yyResult.index);
08450: yyError = yyResult.select(yyError);
08451: if (yyResult.hasValue()) {
08452: final Node v$g$1 = yyResult.semanticValue();
08453:
08454: yyBase = yyResult.index;
08455: yyResult = pSymbol(yyBase);
08456: yyError = yyResult.select(yyError);
08457: if (yyResult.hasValue(")")) {
08458:
08459: yyPredMatched = false;
08460:
08461: yyPredResult = pSymbol(yyResult.index);
08462: if (yyPredResult.hasValue("{")) {
08463:
08464: yyPredMatched = true;
08465: }
08466:
08467: if (!yyPredMatched) {
08468:
08469: yyValue = GNode.create("AlignofExpression",
08470: v$g$1);
08471: yyValue.setLocation(location(yyStart));
08472:
08473: return yyResult.createValue(yyValue,
08474: yyError);
08475: } else {
08476: yyError = yyError.select(
08477: "unary expression expected",
08478: yyStart);
08479: }
08480: } else {
08481: yyError = yyError.select("\")\" expected",
08482: yyBase);
08483: }
08484: }
08485: } else {
08486: yyError = yyError.select("\"(\" expected", yyBase);
08487: }
08488:
08489: // Nested alternative 2.
08490:
08491: yyResult = pUnaryExpression(yyChoice1);
08492: yyError = yyResult.select(yyError);
08493: if (yyResult.hasValue()) {
08494: final Node v$g$2 = yyResult.semanticValue();
08495:
08496: yyValue = GNode.create("AlignofExpression", v$g$2);
08497: yyValue.setLocation(location(yyStart));
08498:
08499: return yyResult.createValue(yyValue, yyError);
08500: }
08501: }
08502:
08503: // Alternative 3.
08504:
08505: yyResult = pKeyword(yyStart);
08506: yyError = yyResult.select(yyError);
08507: if (yyResult.hasValue("__builtin_offsetof")) {
08508:
08509: yyBase = yyResult.index;
08510: yyResult = pSymbol(yyBase);
08511: yyError = yyResult.select(yyError);
08512: if (yyResult.hasValue("(")) {
08513:
08514: yyResult = pTypeName(yyResult.index);
08515: yyError = yyResult.select(yyError);
08516: if (yyResult.hasValue()) {
08517: final Node v$g$1 = yyResult.semanticValue();
08518:
08519: yyBase = yyResult.index;
08520: yyResult = pSymbol(yyBase);
08521: yyError = yyResult.select(yyError);
08522: if (yyResult.hasValue(",")) {
08523:
08524: yyResult = pPostfixExpression(yyResult.index);
08525: yyError = yyResult.select(yyError);
08526: if (yyResult.hasValue()) {
08527: final Node v$g$2 = yyResult.semanticValue();
08528:
08529: yyBase = yyResult.index;
08530: yyResult = pSymbol(yyBase);
08531: yyError = yyResult.select(yyError);
08532: if (yyResult.hasValue(")")) {
08533:
08534: yyValue = GNode.create(
08535: "OffsetofExpression", v$g$1,
08536: v$g$2);
08537: yyValue.setLocation(location(yyStart));
08538:
08539: return yyResult.createValue(yyValue,
08540: yyError);
08541: } else {
08542: yyError = yyError.select(
08543: "\")\" expected", yyBase);
08544: }
08545: }
08546: } else {
08547: yyError = yyError.select("\",\" expected",
08548: yyBase);
08549: }
08550: }
08551: } else {
08552: yyError = yyError.select("\"(\" expected", yyBase);
08553: }
08554: }
08555:
08556: // Alternative 4.
08557:
08558: yyResult = pKeyword(yyStart);
08559: yyError = yyResult.select(yyError);
08560: if (yyResult.hasValue("__builtin_types_compatible_p")) {
08561:
08562: yyBase = yyResult.index;
08563: yyResult = pSymbol(yyBase);
08564: yyError = yyResult.select(yyError);
08565: if (yyResult.hasValue("(")) {
08566:
08567: yyResult = pTypeName(yyResult.index);
08568: yyError = yyResult.select(yyError);
08569: if (yyResult.hasValue()) {
08570: final Node v$g$1 = yyResult.semanticValue();
08571:
08572: yyBase = yyResult.index;
08573: yyResult = pSymbol(yyBase);
08574: yyError = yyResult.select(yyError);
08575: if (yyResult.hasValue(",")) {
08576:
08577: yyResult = pTypeName(yyResult.index);
08578: yyError = yyResult.select(yyError);
08579: if (yyResult.hasValue()) {
08580: final Node v$g$2 = yyResult.semanticValue();
08581:
08582: yyBase = yyResult.index;
08583: yyResult = pSymbol(yyBase);
08584: yyError = yyResult.select(yyError);
08585: if (yyResult.hasValue(")")) {
08586:
08587: yyValue = GNode.create(
08588: "TypeCompatibilityExpression",
08589: v$g$1, v$g$2);
08590: yyValue.setLocation(location(yyStart));
08591:
08592: return yyResult.createValue(yyValue,
08593: yyError);
08594: } else {
08595: yyError = yyError.select(
08596: "\")\" expected", yyBase);
08597: }
08598: }
08599: } else {
08600: yyError = yyError.select("\",\" expected",
08601: yyBase);
08602: }
08603: }
08604: } else {
08605: yyError = yyError.select("\"(\" expected", yyBase);
08606: }
08607: }
08608:
08609: // Alternative 5.
08610:
08611: yyResult = pSymbol(yyStart);
08612: yyError = yyResult.select(yyError);
08613: if (yyResult.hasValue("-")) {
08614:
08615: yyResult = pCastExpression(yyResult.index);
08616: yyError = yyResult.select(yyError);
08617: if (yyResult.hasValue()) {
08618: final Node v$g$1 = yyResult.semanticValue();
08619:
08620: yyValue = GNode.create("UnaryMinusExpression", v$g$1);
08621: yyValue.setLocation(location(yyStart));
08622:
08623: return yyResult.createValue(yyValue, yyError);
08624: }
08625: }
08626:
08627: // Alternative 6.
08628:
08629: yyResult = pSymbol(yyStart);
08630: yyError = yyResult.select(yyError);
08631: if (yyResult.hasValue("+")) {
08632:
08633: yyResult = pCastExpression(yyResult.index);
08634: yyError = yyResult.select(yyError);
08635: if (yyResult.hasValue()) {
08636: final Node v$g$1 = yyResult.semanticValue();
08637:
08638: yyValue = GNode.create("UnaryPlusExpression", v$g$1);
08639: yyValue.setLocation(location(yyStart));
08640:
08641: return yyResult.createValue(yyValue, yyError);
08642: }
08643: }
08644:
08645: // Alternative 7.
08646:
08647: yyResult = pSymbol(yyStart);
08648: yyError = yyResult.select(yyError);
08649: if (yyResult.hasValue("!")) {
08650:
08651: yyResult = pCastExpression(yyResult.index);
08652: yyError = yyResult.select(yyError);
08653: if (yyResult.hasValue()) {
08654: final Node v$g$1 = yyResult.semanticValue();
08655:
08656: yyValue = GNode.create("LogicalNegationExpression",
08657: v$g$1);
08658: yyValue.setLocation(location(yyStart));
08659:
08660: return yyResult.createValue(yyValue, yyError);
08661: }
08662: }
08663:
08664: // Alternative 8.
08665:
08666: yyResult = pSymbol(yyStart);
08667: yyError = yyResult.select(yyError);
08668: if (yyResult.hasValue("~")) {
08669:
08670: yyResult = pCastExpression(yyResult.index);
08671: yyError = yyResult.select(yyError);
08672: if (yyResult.hasValue()) {
08673: final Node v$g$1 = yyResult.semanticValue();
08674:
08675: yyValue = GNode.create("BitwiseNegationExpression",
08676: v$g$1);
08677: yyValue.setLocation(location(yyStart));
08678:
08679: return yyResult.createValue(yyValue, yyError);
08680: }
08681: }
08682:
08683: // Alternative 9.
08684:
08685: yyResult = pSymbol(yyStart);
08686: yyError = yyResult.select(yyError);
08687: if (yyResult.hasValue("&")) {
08688:
08689: yyResult = pCastExpression(yyResult.index);
08690: yyError = yyResult.select(yyError);
08691: if (yyResult.hasValue()) {
08692: final Node v$g$1 = yyResult.semanticValue();
08693:
08694: yyValue = GNode.create("AddressExpression", v$g$1);
08695: yyValue.setLocation(location(yyStart));
08696:
08697: return yyResult.createValue(yyValue, yyError);
08698: }
08699: }
08700:
08701: // Alternative 10.
08702:
08703: if (GCC) {
08704:
08705: yyResult = pSymbol(yyStart);
08706: yyError = yyResult.select(yyError);
08707: if (yyResult.hasValue("&&")) {
08708:
08709: yyResult = pIdentifier(yyResult.index);
08710: yyError = yyResult.select(yyError);
08711: if (yyResult.hasValue()) {
08712: final String v$g$1 = yyResult.semanticValue();
08713:
08714: yyValue = GNode.create("LabelAddressExpression",
08715: v$g$1);
08716: yyValue.setLocation(location(yyStart));
08717:
08718: return yyResult.createValue(yyValue, yyError);
08719: }
08720: }
08721: }
08722:
08723: // Alternative 11.
08724:
08725: yyResult = pSymbol(yyStart);
08726: yyError = yyResult.select(yyError);
08727: if (yyResult.hasValue("*")) {
08728:
08729: yyResult = pCastExpression(yyResult.index);
08730: yyError = yyResult.select(yyError);
08731: if (yyResult.hasValue()) {
08732: final Node v$g$1 = yyResult.semanticValue();
08733:
08734: yyValue = GNode.create("IndirectionExpression", v$g$1);
08735: yyValue.setLocation(location(yyStart));
08736:
08737: return yyResult.createValue(yyValue, yyError);
08738: }
08739: }
08740:
08741: // Alternative 12.
08742:
08743: yyResult = pSymbol(yyStart);
08744: yyError = yyResult.select(yyError);
08745: if (yyResult.hasValue("++")) {
08746:
08747: yyResult = pUnaryExpression(yyResult.index);
08748: yyError = yyResult.select(yyError);
08749: if (yyResult.hasValue()) {
08750: final Node v$g$1 = yyResult.semanticValue();
08751:
08752: yyValue = GNode.create("PreincrementExpression", v$g$1);
08753: yyValue.setLocation(location(yyStart));
08754:
08755: return yyResult.createValue(yyValue, yyError);
08756: }
08757: }
08758:
08759: // Alternative 13.
08760:
08761: yyResult = pSymbol(yyStart);
08762: yyError = yyResult.select(yyError);
08763: if (yyResult.hasValue("--")) {
08764:
08765: yyResult = pUnaryExpression(yyResult.index);
08766: yyError = yyResult.select(yyError);
08767: if (yyResult.hasValue()) {
08768: final Node v$g$1 = yyResult.semanticValue();
08769:
08770: yyValue = GNode.create("PredecrementExpression", v$g$1);
08771: yyValue.setLocation(location(yyStart));
08772:
08773: return yyResult.createValue(yyValue, yyError);
08774: }
08775: }
08776:
08777: // Alternative 14.
08778:
08779: if (GCC) {
08780:
08781: yyResult = pKeyword(yyStart);
08782: yyError = yyResult.select(yyError);
08783: if (yyResult.hasValue("__extension__")) {
08784:
08785: yyResult = pCastExpression(yyResult.index);
08786: yyError = yyResult.select(yyError);
08787: if (yyResult.hasValue()) {
08788: final Node v$g$1 = yyResult.semanticValue();
08789:
08790: yyValue = GNode
08791: .create("ExtensionExpression", v$g$1);
08792: yyValue.setLocation(location(yyStart));
08793:
08794: return yyResult.createValue(yyValue, yyError);
08795: }
08796: }
08797: }
08798:
08799: // Alternative <Base>.
08800:
08801: yyResult = pPostfixExpression(yyStart);
08802: yyError = yyResult.select(yyError);
08803: if (yyResult.hasValue()) {
08804: yyValue = yyResult.semanticValue();
08805:
08806: return yyResult.createValue(yyValue, yyError);
08807: }
08808:
08809: // Done.
08810: yyError = yyError.select("unary expression expected", yyStart);
08811: return yyError;
08812: }
08813:
08814: // =========================================================================
08815:
08816: /**
08817: * Parse nonterminal xtc.lang.C.AlignofKeyword.
08818: *
08819: * @param yyStart The index.
08820: * @return The result.
08821: * @throws IOException Signals an I/O error.
08822: */
08823: private Result pAlignofKeyword(final int yyStart)
08824: throws IOException {
08825: Result yyResult;
08826: Void yyValue;
08827: ParseError yyError = ParseError.DUMMY;
08828:
08829: // Alternative 1.
08830:
08831: yyResult = pKeyword(yyStart);
08832: yyError = yyResult.select(yyError);
08833: if (yyResult.hasValue("__alignof__")) {
08834:
08835: yyValue = null;
08836:
08837: return yyResult.createValue(yyValue, yyError);
08838: }
08839:
08840: // Alternative 2.
08841:
08842: yyResult = pKeyword(yyStart);
08843: yyError = yyResult.select(yyError);
08844: if (yyResult.hasValue("__alignof")) {
08845:
08846: yyValue = null;
08847:
08848: return yyResult.createValue(yyValue, yyError);
08849: }
08850:
08851: // Done.
08852: yyError = yyError.select("alignof keyword expected", yyStart);
08853: return yyError;
08854: }
08855:
08856: // =========================================================================
08857:
08858: /**
08859: * Parse nonterminal xtc.lang.C.PostfixExpression.
08860: *
08861: * @param yyStart The index.
08862: * @return The result.
08863: * @throws IOException Signals an I/O error.
08864: */
08865: private Result pPostfixExpression(final int yyStart)
08866: throws IOException {
08867: Result yyResult;
08868: int yyRepetition1;
08869: Pair<Action<Node>> yyRepValue1;
08870: Node yyValue;
08871: ParseError yyError = ParseError.DUMMY;
08872:
08873: // Alternative <Compound>.
08874:
08875: yyResult = pCompoundLiteral(yyStart);
08876: yyError = yyResult.select(yyError);
08877: if (yyResult.hasValue()) {
08878: final Node v$g$6 = yyResult.semanticValue();
08879:
08880: yyRepetition1 = yyResult.index;
08881: yyRepValue1 = Pair.empty();
08882: while (true) {
08883:
08884: yyResult = pPostfixExpression$$Tail1(yyRepetition1);
08885: yyError = yyResult.select(yyError);
08886: if (yyResult.hasValue()) {
08887: final Action<Node> v$7 = yyResult.semanticValue();
08888:
08889: yyRepetition1 = yyResult.index;
08890: yyRepValue1 = new Pair<Action<Node>>(v$7,
08891: yyRepValue1);
08892: continue;
08893: }
08894: break;
08895: }
08896: { // Start scope for v$8.
08897: final Pair<Action<Node>> v$8 = yyRepValue1.reverse();
08898:
08899: yyValue = apply(v$8, v$g$6, yyStart);
08900:
08901: return new SemanticValue(yyValue, yyRepetition1,
08902: yyError);
08903: } // End scope for v$8.
08904: }
08905:
08906: // Alternative <Primary>.
08907:
08908: yyResult = pPrimaryExpression(yyStart);
08909: yyError = yyResult.select(yyError);
08910: if (yyResult.hasValue()) {
08911: final Node v$g$9 = yyResult.semanticValue();
08912:
08913: yyRepetition1 = yyResult.index;
08914: yyRepValue1 = Pair.empty();
08915: while (true) {
08916:
08917: yyResult = pPostfixExpression$$Tail1(yyRepetition1);
08918: yyError = yyResult.select(yyError);
08919: if (yyResult.hasValue()) {
08920: final Action<Node> v$10 = yyResult.semanticValue();
08921:
08922: yyRepetition1 = yyResult.index;
08923: yyRepValue1 = new Pair<Action<Node>>(v$10,
08924: yyRepValue1);
08925: continue;
08926: }
08927: break;
08928: }
08929: { // Start scope for v$11.
08930: final Pair<Action<Node>> v$11 = yyRepValue1.reverse();
08931:
08932: yyValue = apply(v$11, v$g$9, yyStart);
08933:
08934: return new SemanticValue(yyValue, yyRepetition1,
08935: yyError);
08936: } // End scope for v$11.
08937: }
08938:
08939: // Done.
08940: return yyError;
08941: }
08942:
08943: // =========================================================================
08944:
08945: /**
08946: * Parse synthetic nonterminal xtc.lang.C.PostfixExpression$$Tail1.
08947: *
08948: * @param yyStart The index.
08949: * @return The result.
08950: * @throws IOException Signals an I/O error.
08951: */
08952: private Result pPostfixExpression$$Tail1(final int yyStart)
08953: throws IOException {
08954:
08955: Result yyResult;
08956: int yyBase;
08957: int yyOption1;
08958: Node yyOpValue1;
08959: Action<Node> yyValue;
08960: ParseError yyError = ParseError.DUMMY;
08961:
08962: // Alternative 1.
08963:
08964: yyResult = pSymbol(yyStart);
08965: yyError = yyResult.select(yyError);
08966: if (yyResult.hasValue("[")) {
08967:
08968: yyResult = pCommaExpression(yyResult.index);
08969: yyError = yyResult.select(yyError);
08970: if (yyResult.hasValue()) {
08971: final Node v$g$2 = yyResult.semanticValue();
08972:
08973: yyBase = yyResult.index;
08974: yyResult = pSymbol(yyBase);
08975: yyError = yyResult.select(yyError);
08976: if (yyResult.hasValue("]")) {
08977:
08978: yyValue = new Action<Node>() {
08979: public Node run(Node v$1) {
08980: return GNode.create("SubscriptExpression",
08981: v$1, v$g$2);
08982: }
08983: };
08984:
08985: return yyResult.createValue(yyValue, yyError);
08986: } else {
08987: yyError = yyError.select("\"]\" expected", yyBase);
08988: }
08989: }
08990: }
08991:
08992: // Alternative 2.
08993:
08994: yyResult = pSymbol(yyStart);
08995: yyError = yyResult.select(yyError);
08996: if (yyResult.hasValue(".")) {
08997:
08998: yyResult = pIdentifier(yyResult.index);
08999: yyError = yyResult.select(yyError);
09000: if (yyResult.hasValue()) {
09001: final String v$g$3 = yyResult.semanticValue();
09002:
09003: yyValue = new Action<Node>() {
09004: public Node run(Node v$1) {
09005: return GNode.create("DirectComponentSelection",
09006: v$1, v$g$3);
09007: }
09008: };
09009:
09010: return yyResult.createValue(yyValue, yyError);
09011: }
09012: }
09013:
09014: // Alternative 3.
09015:
09016: yyResult = pSymbol(yyStart);
09017: yyError = yyResult.select(yyError);
09018: if (yyResult.hasValue("->")) {
09019:
09020: yyResult = pIdentifier(yyResult.index);
09021: yyError = yyResult.select(yyError);
09022: if (yyResult.hasValue()) {
09023: final String v$g$4 = yyResult.semanticValue();
09024:
09025: yyValue = new Action<Node>() {
09026: public Node run(Node v$1) {
09027: return GNode.create(
09028: "IndirectComponentSelection", v$1,
09029: v$g$4);
09030: }
09031: };
09032:
09033: return yyResult.createValue(yyValue, yyError);
09034: }
09035: }
09036:
09037: // Alternative 4.
09038:
09039: yyResult = pSymbol(yyStart);
09040: yyError = yyResult.select(yyError);
09041: if (yyResult.hasValue("(")) {
09042:
09043: yyOption1 = yyResult.index;
09044: yyOpValue1 = null;
09045:
09046: yyResult = pExpressionList(yyOption1);
09047: yyError = yyResult.select(yyError);
09048: if (yyResult.hasValue()) {
09049: final Node v$el$1 = yyResult.semanticValue();
09050:
09051: yyOption1 = yyResult.index;
09052: yyOpValue1 = v$el$1;
09053: }
09054: { // Start scope for v$g$5.
09055: final Node v$g$5 = yyOpValue1;
09056:
09057: yyBase = yyOption1;
09058: yyResult = pSymbol(yyBase);
09059: yyError = yyResult.select(yyError);
09060: if (yyResult.hasValue(")")) {
09061:
09062: yyValue = new Action<Node>() {
09063: public Node run(Node v$1) {
09064: return GNode.create("FunctionCall", v$1,
09065: v$g$5);
09066: }
09067: };
09068:
09069: return yyResult.createValue(yyValue, yyError);
09070: } else {
09071: yyError = yyError.select("\")\" expected", yyBase);
09072: }
09073: } // End scope for v$g$5.
09074: }
09075:
09076: // Alternative 5.
09077:
09078: yyResult = pSymbol(yyStart);
09079: yyError = yyResult.select(yyError);
09080: if (yyResult.hasValue("++")) {
09081:
09082: yyValue = new Action<Node>() {
09083: public Node run(Node v$1) {
09084: return GNode.create("PostincrementExpression", v$1);
09085: }
09086: };
09087:
09088: return yyResult.createValue(yyValue, yyError);
09089: }
09090:
09091: // Alternative 6.
09092:
09093: yyResult = pSymbol(yyStart);
09094: yyError = yyResult.select(yyError);
09095: if (yyResult.hasValue("--")) {
09096:
09097: yyValue = new Action<Node>() {
09098: public Node run(Node v$1) {
09099: return GNode.create("PostdecrementExpression", v$1);
09100: }
09101: };
09102:
09103: return yyResult.createValue(yyValue, yyError);
09104: }
09105:
09106: // Done.
09107: yyError = yyError
09108: .select("postfix expression expected", yyStart);
09109: return yyError;
09110: }
09111:
09112: // =========================================================================
09113:
09114: /**
09115: * Parse nonterminal xtc.lang.C.ExpressionList.
09116: *
09117: * @param yyStart The index.
09118: * @return The result.
09119: * @throws IOException Signals an I/O error.
09120: */
09121: private Result pExpressionList(final int yyStart)
09122: throws IOException {
09123: CParserColumn yyColumn = (CParserColumn) column(yyStart);
09124: if (null == yyColumn.chunk3)
09125: yyColumn.chunk3 = new Chunk3();
09126: if (null == yyColumn.chunk3.fExpressionList)
09127: yyColumn.chunk3.fExpressionList = pExpressionList$1(yyStart);
09128: return yyColumn.chunk3.fExpressionList;
09129: }
09130:
09131: /** Actually parse xtc.lang.C.ExpressionList. */
09132: private Result pExpressionList$1(final int yyStart)
09133: throws IOException {
09134: Result yyResult;
09135: Node yyValue;
09136: ParseError yyError = ParseError.DUMMY;
09137:
09138: // Alternative <Expressions>.
09139:
09140: yyResult = pAssignmentExpression(yyStart);
09141: yyError = yyResult.select(yyError);
09142: if (yyResult.hasValue()) {
09143: final Node v$g$1 = yyResult.semanticValue();
09144:
09145: yyResult = pExpressionList$$Star1(yyResult.index);
09146: yyError = yyResult.select(yyError);
09147: if (yyResult.hasValue()) {
09148: final Pair<Node> v$g$2 = yyResult.semanticValue();
09149:
09150: yyValue = GNode.createFromPair("ExpressionList", v$g$1,
09151: v$g$2);
09152: yyValue.setLocation(location(yyStart));
09153:
09154: return yyResult.createValue(yyValue, yyError);
09155: }
09156: }
09157:
09158: // Done.
09159: return yyError;
09160: }
09161:
09162: // =========================================================================
09163:
09164: /**
09165: * Parse synthetic nonterminal xtc.lang.C.ExpressionList$$Star1.
09166: *
09167: * @param yyStart The index.
09168: * @return The result.
09169: * @throws IOException Signals an I/O error.
09170: */
09171: private Result pExpressionList$$Star1(final int yyStart)
09172: throws IOException {
09173:
09174: CParserColumn yyColumn = (CParserColumn) column(yyStart);
09175: if (null == yyColumn.chunk3)
09176: yyColumn.chunk3 = new Chunk3();
09177: if (null == yyColumn.chunk3.fExpressionList$$Star1)
09178: yyColumn.chunk3.fExpressionList$$Star1 = pExpressionList$$Star1$1(yyStart);
09179: return yyColumn.chunk3.fExpressionList$$Star1;
09180: }
09181:
09182: /** Actually parse xtc.lang.C.ExpressionList$$Star1. */
09183: private Result pExpressionList$$Star1$1(final int yyStart)
09184: throws IOException {
09185:
09186: Result yyResult;
09187: Pair<Node> yyValue;
09188: ParseError yyError = ParseError.DUMMY;
09189:
09190: // Alternative 1.
09191:
09192: yyResult = pSymbol(yyStart);
09193: yyError = yyResult.select(yyError);
09194: if (yyResult.hasValue(",")) {
09195:
09196: yyResult = pAssignmentExpression(yyResult.index);
09197: yyError = yyResult.select(yyError);
09198: if (yyResult.hasValue()) {
09199: final Node v$el$1 = yyResult.semanticValue();
09200:
09201: yyResult = pExpressionList$$Star1(yyResult.index);
09202: yyError = yyResult.select(yyError);
09203: if (yyResult.hasValue()) {
09204: final Pair<Node> v$2 = yyResult.semanticValue();
09205:
09206: yyValue = new Pair<Node>(v$el$1, v$2);
09207:
09208: return yyResult.createValue(yyValue, yyError);
09209: }
09210: }
09211: }
09212:
09213: // Alternative 2.
09214:
09215: yyValue = Pair.empty();
09216:
09217: return new SemanticValue(yyValue, yyStart, yyError);
09218: }
09219:
09220: // =========================================================================
09221:
09222: /**
09223: * Parse nonterminal xtc.lang.C.CompoundLiteral.
09224: *
09225: * @param yyStart The index.
09226: * @return The result.
09227: * @throws IOException Signals an I/O error.
09228: */
09229: private Result pCompoundLiteral(final int yyStart)
09230: throws IOException {
09231: Result yyResult;
09232: int yyBase;
09233: int yyOption1;
09234: Node yyValue;
09235: ParseError yyError = ParseError.DUMMY;
09236:
09237: // Alternative 1.
09238:
09239: yyResult = pSymbol(yyStart);
09240: yyError = yyResult.select(yyError);
09241: if (yyResult.hasValue("(")) {
09242:
09243: yyResult = pTypeName(yyResult.index);
09244: yyError = yyResult.select(yyError);
09245: if (yyResult.hasValue()) {
09246: final Node v$g$1 = yyResult.semanticValue();
09247:
09248: yyBase = yyResult.index;
09249: yyResult = pSymbol(yyBase);
09250: yyError = yyResult.select(yyError);
09251: if (yyResult.hasValue(")")) {
09252:
09253: yyBase = yyResult.index;
09254: yyResult = pSymbol(yyBase);
09255: yyError = yyResult.select(yyError);
09256: if (yyResult.hasValue("{")) {
09257:
09258: yyResult = pInitializerList(yyResult.index);
09259: yyError = yyResult.select(yyError);
09260: if (yyResult.hasValue()) {
09261: final Node v$g$2 = yyResult.semanticValue();
09262:
09263: yyOption1 = yyResult.index;
09264:
09265: yyBase = yyOption1;
09266: yyResult = pSymbol(yyBase);
09267: yyError = yyResult.select(yyError);
09268: if (yyResult.hasValue(",")) {
09269:
09270: yyOption1 = yyResult.index;
09271: } else {
09272: yyError = yyError.select(
09273: "\",\" expected", yyBase);
09274: }
09275:
09276: yyBase = yyOption1;
09277: yyResult = pSymbol(yyBase);
09278: yyError = yyResult.select(yyError);
09279: if (yyResult.hasValue("}")) {
09280:
09281: yyValue = GNode
09282: .create("CompoundLiteral",
09283: v$g$1, v$g$2);
09284: yyValue.setLocation(location(yyStart));
09285:
09286: return yyResult.createValue(yyValue,
09287: yyError);
09288: } else {
09289: yyError = yyError.select(
09290: "\"}\" expected", yyBase);
09291: }
09292: }
09293: } else {
09294: yyError = yyError.select("\"{\" expected",
09295: yyBase);
09296: }
09297: } else {
09298: yyError = yyError.select("\")\" expected", yyBase);
09299: }
09300: }
09301: }
09302:
09303: // Done.
09304: yyError = yyError.select("compound literal expected", yyStart);
09305: return yyError;
09306: }
09307:
09308: // =========================================================================
09309:
09310: /**
09311: * Parse nonterminal xtc.lang.C.PrimaryExpression.
09312: *
09313: * @param yyStart The index.
09314: * @return The result.
09315: * @throws IOException Signals an I/O error.
09316: */
09317: private Result pPrimaryExpression(final int yyStart)
09318: throws IOException {
09319: Result yyResult;
09320: int yyBase;
09321: Node yyValue;
09322: ParseError yyError = ParseError.DUMMY;
09323:
09324: // Alternative <Constant>.
09325:
09326: yyResult = pConstant(yyStart);
09327: yyError = yyResult.select(yyError);
09328: if (yyResult.hasValue()) {
09329: yyValue = yyResult.semanticValue();
09330:
09331: return yyResult.createValue(yyValue, yyError);
09332: }
09333:
09334: // Alternative 2.
09335:
09336: yyResult = pIdentifier(yyStart);
09337: yyError = yyResult.select(yyError);
09338: if (yyResult.hasValue()) {
09339: final String v$g$1 = yyResult.semanticValue();
09340:
09341: yyValue = GNode.create("PrimaryIdentifier", v$g$1);
09342: yyValue.setLocation(location(yyStart));
09343:
09344: return yyResult.createValue(yyValue, yyError);
09345: }
09346:
09347: // Alternative 3.
09348:
09349: if (GCC) {
09350:
09351: yyResult = pSymbol(yyStart);
09352: yyError = yyResult.select(yyError);
09353: if (yyResult.hasValue("(")) {
09354:
09355: yyResult = pCompoundStatement(yyResult.index);
09356: yyError = yyResult.select(yyError);
09357: if (yyResult.hasValue()) {
09358: final Node v$g$1 = yyResult.semanticValue();
09359:
09360: yyBase = yyResult.index;
09361: yyResult = pSymbol(yyBase);
09362: yyError = yyResult.select(yyError);
09363: if (yyResult.hasValue(")")) {
09364:
09365: yyValue = GNode.create("StatementAsExpression",
09366: v$g$1);
09367: yyValue.setLocation(location(yyStart));
09368:
09369: return yyResult.createValue(yyValue, yyError);
09370: } else {
09371: yyError = yyError.select("\")\" expected",
09372: yyBase);
09373: }
09374: }
09375: }
09376: }
09377:
09378: // Alternative 4.
09379:
09380: yyResult = pKeyword(yyStart);
09381: yyError = yyResult.select(yyError);
09382: if (yyResult.hasValue("__builtin_va_arg")) {
09383:
09384: yyBase = yyResult.index;
09385: yyResult = pSymbol(yyBase);
09386: yyError = yyResult.select(yyError);
09387: if (yyResult.hasValue("(")) {
09388:
09389: yyResult = pAssignmentExpression(yyResult.index);
09390: yyError = yyResult.select(yyError);
09391: if (yyResult.hasValue()) {
09392: final Node v$g$1 = yyResult.semanticValue();
09393:
09394: yyBase = yyResult.index;
09395: yyResult = pSymbol(yyBase);
09396: yyError = yyResult.select(yyError);
09397: if (yyResult.hasValue(",")) {
09398:
09399: yyResult = pTypeName(yyResult.index);
09400: yyError = yyResult.select(yyError);
09401: if (yyResult.hasValue()) {
09402: final Node v$g$2 = yyResult.semanticValue();
09403:
09404: yyBase = yyResult.index;
09405: yyResult = pSymbol(yyBase);
09406: yyError = yyResult.select(yyError);
09407: if (yyResult.hasValue(")")) {
09408:
09409: yyValue = GNode.create(
09410: "VariableArgumentAccess",
09411: v$g$1, v$g$2);
09412: yyValue.setLocation(location(yyStart));
09413:
09414: return yyResult.createValue(yyValue,
09415: yyError);
09416: } else {
09417: yyError = yyError.select(
09418: "\")\" expected", yyBase);
09419: }
09420: }
09421: } else {
09422: yyError = yyError.select("\",\" expected",
09423: yyBase);
09424: }
09425: }
09426: } else {
09427: yyError = yyError.select("\"(\" expected", yyBase);
09428: }
09429: }
09430:
09431: // Alternative <ParenthesizedExpression>.
09432:
09433: yyResult = pSymbol(yyStart);
09434: yyError = yyResult.select(yyError);
09435: if (yyResult.hasValue("(")) {
09436:
09437: yyResult = pCommaExpression(yyResult.index);
09438: yyError = yyResult.select(yyError);
09439: if (yyResult.hasValue()) {
09440: yyValue = yyResult.semanticValue();
09441:
09442: yyBase = yyResult.index;
09443: yyResult = pSymbol(yyBase);
09444: yyError = yyResult.select(yyError);
09445: if (yyResult.hasValue(")")) {
09446:
09447: return yyResult.createValue(yyValue, yyError);
09448: } else {
09449: yyError = yyError.select("\")\" expected", yyBase);
09450: }
09451: }
09452: }
09453:
09454: // Done.
09455: yyError = yyError
09456: .select("primary expression expected", yyStart);
09457: return yyError;
09458: }
09459:
09460: // =========================================================================
09461:
09462: /**
09463: * Parse nonterminal xtc.lang.C.PrimaryIdentifier.
09464: *
09465: * @param yyStart The index.
09466: * @return The result.
09467: * @throws IOException Signals an I/O error.
09468: */
09469: private Result pPrimaryIdentifier(final int yyStart)
09470: throws IOException {
09471: Result yyResult;
09472: Node yyValue;
09473: ParseError yyError = ParseError.DUMMY;
09474:
09475: // Alternative 1.
09476:
09477: yyResult = pIdentifier(yyStart);
09478: yyError = yyResult.select(yyError);
09479: if (yyResult.hasValue()) {
09480: final String v$g$1 = yyResult.semanticValue();
09481:
09482: yyValue = GNode.create("PrimaryIdentifier", v$g$1);
09483: yyValue.setLocation(location(yyStart));
09484:
09485: return yyResult.createValue(yyValue, yyError);
09486: }
09487:
09488: // Done.
09489: return yyError;
09490: }
09491:
09492: // =========================================================================
09493:
09494: /**
09495: * Parse nonterminal xtc.lang.C.AssemblyDefinition.
09496: *
09497: * @param yyStart The index.
09498: * @return The result.
09499: * @throws IOException Signals an I/O error.
09500: */
09501: private Result pAssemblyDefinition(final int yyStart)
09502: throws IOException {
09503: Result yyResult;
09504: int yyBase;
09505: Node yyValue;
09506: ParseError yyError = ParseError.DUMMY;
09507:
09508: // Alternative 1.
09509:
09510: yyResult = pSimpleAssemblyExpression(yyStart);
09511: yyError = yyResult.select(yyError);
09512: if (yyResult.hasValue()) {
09513: final Node v$g$1 = yyResult.semanticValue();
09514:
09515: yyBase = yyResult.index;
09516: yyResult = pSymbol(yyBase);
09517: yyError = yyResult.select(yyError);
09518: if (yyResult.hasValue(";")) {
09519:
09520: yyValue = GNode.create("AssemblyDefinition", v$g$1);
09521: yyValue.setLocation(location(yyStart));
09522:
09523: return yyResult.createValue(yyValue, yyError);
09524: } else {
09525: yyError = yyError.select("\";\" expected", yyBase);
09526: }
09527: }
09528:
09529: // Done.
09530: return yyError;
09531: }
09532:
09533: // =========================================================================
09534:
09535: /**
09536: * Parse nonterminal xtc.lang.C.SimpleAssemblyExpression.
09537: *
09538: * @param yyStart The index.
09539: * @return The result.
09540: * @throws IOException Signals an I/O error.
09541: */
09542: private Result pSimpleAssemblyExpression(final int yyStart)
09543: throws IOException {
09544:
09545: CParserColumn yyColumn = (CParserColumn) column(yyStart);
09546: if (null == yyColumn.chunk3)
09547: yyColumn.chunk3 = new Chunk3();
09548: if (null == yyColumn.chunk3.fSimpleAssemblyExpression)
09549: yyColumn.chunk3.fSimpleAssemblyExpression = pSimpleAssemblyExpression$1(yyStart);
09550: return yyColumn.chunk3.fSimpleAssemblyExpression;
09551: }
09552:
09553: /** Actually parse xtc.lang.C.SimpleAssemblyExpression. */
09554: private Result pSimpleAssemblyExpression$1(final int yyStart)
09555: throws IOException {
09556:
09557: Result yyResult;
09558: int yyBase;
09559: Node yyValue;
09560: ParseError yyError = ParseError.DUMMY;
09561:
09562: // Alternative 1.
09563:
09564: yyResult = pAsmKeyword(yyStart);
09565: yyError = yyResult.select(yyError);
09566: if (yyResult.hasValue()) {
09567:
09568: yyBase = yyResult.index;
09569: yyResult = pSymbol(yyBase);
09570: yyError = yyResult.select(yyError);
09571: if (yyResult.hasValue("(")) {
09572:
09573: yyResult = pStringConstant(yyResult.index);
09574: yyError = yyResult.select(yyError);
09575: if (yyResult.hasValue()) {
09576: final Node v$g$1 = yyResult.semanticValue();
09577:
09578: yyBase = yyResult.index;
09579: yyResult = pSymbol(yyBase);
09580: yyError = yyResult.select(yyError);
09581: if (yyResult.hasValue(")")) {
09582:
09583: yyValue = GNode.create(
09584: "SimpleAssemblyExpression", v$g$1);
09585: yyValue.setLocation(location(yyStart));
09586:
09587: return yyResult.createValue(yyValue, yyError);
09588: } else {
09589: yyError = yyError.select("\")\" expected",
09590: yyBase);
09591: }
09592: }
09593: } else {
09594: yyError = yyError.select("\"(\" expected", yyBase);
09595: }
09596: }
09597:
09598: // Done.
09599: return yyError;
09600: }
09601:
09602: // =========================================================================
09603:
09604: /**
09605: * Parse nonterminal xtc.lang.C.AssemblyArgument.
09606: *
09607: * @param yyStart The index.
09608: * @return The result.
09609: * @throws IOException Signals an I/O error.
09610: */
09611: private Result pAssemblyArgument(final int yyStart)
09612: throws IOException {
09613: Result yyResult;
09614: int yyBase;
09615: int yyOption1;
09616: Node yyOpValue1;
09617: Node yyValue;
09618: ParseError yyError = ParseError.DUMMY;
09619:
09620: // Alternative 1.
09621:
09622: yyResult = pStringConstant(yyStart);
09623: yyError = yyResult.select(yyError);
09624: if (yyResult.hasValue()) {
09625: final Node v$g$1 = yyResult.semanticValue();
09626:
09627: final int yyChoice1 = yyResult.index;
09628:
09629: // Nested alternative 1.
09630:
09631: yyBase = yyChoice1;
09632: yyResult = pSymbol(yyBase);
09633: yyError = yyResult.select(yyError);
09634: if (yyResult.hasValue(":")) {
09635:
09636: yyOption1 = yyResult.index;
09637: yyOpValue1 = null;
09638:
09639: yyResult = pAssemblyOperands(yyOption1);
09640: yyError = yyResult.select(yyError);
09641: if (yyResult.hasValue()) {
09642: final Node v$el$1 = yyResult.semanticValue();
09643:
09644: yyOption1 = yyResult.index;
09645: yyOpValue1 = v$el$1;
09646: }
09647: { // Start scope for v$g$2.
09648: final Node v$g$2 = yyOpValue1;
09649:
09650: final int yyChoice2 = yyOption1;
09651:
09652: // Nested alternative 1.
09653:
09654: yyBase = yyChoice2;
09655: yyResult = pSymbol(yyBase);
09656: yyError = yyResult.select(yyError);
09657: if (yyResult.hasValue(":")) {
09658:
09659: yyOption1 = yyResult.index;
09660: yyOpValue1 = null;
09661:
09662: yyResult = pAssemblyOperands(yyOption1);
09663: yyError = yyResult.select(yyError);
09664: if (yyResult.hasValue()) {
09665: final Node v$el$2 = yyResult
09666: .semanticValue();
09667:
09668: yyOption1 = yyResult.index;
09669: yyOpValue1 = v$el$2;
09670: }
09671: { // Start scope for v$g$3.
09672: final Node v$g$3 = yyOpValue1;
09673:
09674: final int yyChoice3 = yyOption1;
09675:
09676: // Nested alternative 1.
09677:
09678: yyBase = yyChoice3;
09679: yyResult = pSymbol(yyBase);
09680: yyError = yyResult.select(yyError);
09681: if (yyResult.hasValue(":")) {
09682:
09683: yyResult = pAssemblyClobbers(yyResult.index);
09684: yyError = yyResult.select(yyError);
09685: if (yyResult.hasValue()) {
09686: final Node v$g$4 = yyResult
09687: .semanticValue();
09688:
09689: yyValue = GNode.create(
09690: "AssemblyArgument", v$g$1,
09691: v$g$2, v$g$3, v$g$4);
09692: yyValue
09693: .setLocation(location(yyStart));
09694:
09695: return yyResult.createValue(
09696: yyValue, yyError);
09697: }
09698: } else {
09699: yyError = yyError.select(
09700: "\":\" expected", yyBase);
09701: }
09702:
09703: // Nested alternative 2.
09704:
09705: yyValue = GNode.create("AssemblyArgument",
09706: v$g$1, v$g$2, v$g$3);
09707: yyValue.setLocation(location(yyStart));
09708:
09709: return new SemanticValue(yyValue,
09710: yyChoice3, yyError);
09711: } // End scope for v$g$3.
09712: } else {
09713: yyError = yyError.select("\":\" expected",
09714: yyBase);
09715: }
09716:
09717: // Nested alternative 2.
09718:
09719: yyValue = GNode.create("AssemblyArgument", v$g$1,
09720: v$g$2);
09721: yyValue.setLocation(location(yyStart));
09722:
09723: return new SemanticValue(yyValue, yyChoice2,
09724: yyError);
09725: } // End scope for v$g$2.
09726: } else {
09727: yyError = yyError.select("\":\" expected", yyBase);
09728: }
09729:
09730: // Nested alternative 2.
09731:
09732: yyValue = GNode.create("AssemblyArgument", v$g$1);
09733: yyValue.setLocation(location(yyStart));
09734:
09735: return new SemanticValue(yyValue, yyChoice1, yyError);
09736: }
09737:
09738: // Done.
09739: return yyError;
09740: }
09741:
09742: // =========================================================================
09743:
09744: /**
09745: * Parse nonterminal xtc.lang.C.AssemblyOperands.
09746: *
09747: * @param yyStart The index.
09748: * @return The result.
09749: * @throws IOException Signals an I/O error.
09750: */
09751: private Result pAssemblyOperands(final int yyStart)
09752: throws IOException {
09753: CParserColumn yyColumn = (CParserColumn) column(yyStart);
09754: if (null == yyColumn.chunk3)
09755: yyColumn.chunk3 = new Chunk3();
09756: if (null == yyColumn.chunk3.fAssemblyOperands)
09757: yyColumn.chunk3.fAssemblyOperands = pAssemblyOperands$1(yyStart);
09758: return yyColumn.chunk3.fAssemblyOperands;
09759: }
09760:
09761: /** Actually parse xtc.lang.C.AssemblyOperands. */
09762: private Result pAssemblyOperands$1(final int yyStart)
09763: throws IOException {
09764: Result yyResult;
09765: Node yyValue;
09766: ParseError yyError = ParseError.DUMMY;
09767:
09768: // Alternative 1.
09769:
09770: yyResult = pAssemblyOperand(yyStart);
09771: yyError = yyResult.select(yyError);
09772: if (yyResult.hasValue()) {
09773: final Node v$g$1 = yyResult.semanticValue();
09774:
09775: yyResult = pAssemblyOperands$$Star1(yyResult.index);
09776: yyError = yyResult.select(yyError);
09777: if (yyResult.hasValue()) {
09778: final Pair<Node> v$g$2 = yyResult.semanticValue();
09779:
09780: yyValue = GNode.createFromPair("AssemblyOperands",
09781: v$g$1, v$g$2);
09782: yyValue.setLocation(location(yyStart));
09783:
09784: return yyResult.createValue(yyValue, yyError);
09785: }
09786: }
09787:
09788: // Done.
09789: return yyError;
09790: }
09791:
09792: // =========================================================================
09793:
09794: /**
09795: * Parse synthetic nonterminal xtc.lang.C.AssemblyOperands$$Star1.
09796: *
09797: * @param yyStart The index.
09798: * @return The result.
09799: * @throws IOException Signals an I/O error.
09800: */
09801: private Result pAssemblyOperands$$Star1(final int yyStart)
09802: throws IOException {
09803:
09804: CParserColumn yyColumn = (CParserColumn) column(yyStart);
09805: if (null == yyColumn.chunk3)
09806: yyColumn.chunk3 = new Chunk3();
09807: if (null == yyColumn.chunk3.fAssemblyOperands$$Star1)
09808: yyColumn.chunk3.fAssemblyOperands$$Star1 = pAssemblyOperands$$Star1$1(yyStart);
09809: return yyColumn.chunk3.fAssemblyOperands$$Star1;
09810: }
09811:
09812: /** Actually parse xtc.lang.C.AssemblyOperands$$Star1. */
09813: private Result pAssemblyOperands$$Star1$1(final int yyStart)
09814: throws IOException {
09815:
09816: Result yyResult;
09817: Pair<Node> yyValue;
09818: ParseError yyError = ParseError.DUMMY;
09819:
09820: // Alternative 1.
09821:
09822: yyResult = pSymbol(yyStart);
09823: yyError = yyResult.select(yyError);
09824: if (yyResult.hasValue(",")) {
09825:
09826: yyResult = pAssemblyOperand(yyResult.index);
09827: yyError = yyResult.select(yyError);
09828: if (yyResult.hasValue()) {
09829: final Node v$el$1 = yyResult.semanticValue();
09830:
09831: yyResult = pAssemblyOperands$$Star1(yyResult.index);
09832: yyError = yyResult.select(yyError);
09833: if (yyResult.hasValue()) {
09834: final Pair<Node> v$2 = yyResult.semanticValue();
09835:
09836: yyValue = new Pair<Node>(v$el$1, v$2);
09837:
09838: return yyResult.createValue(yyValue, yyError);
09839: }
09840: }
09841: }
09842:
09843: // Alternative 2.
09844:
09845: yyValue = Pair.empty();
09846:
09847: return new SemanticValue(yyValue, yyStart, yyError);
09848: }
09849:
09850: // =========================================================================
09851:
09852: /**
09853: * Parse nonterminal xtc.lang.C.AssemblyOperand.
09854: *
09855: * @param yyStart The index.
09856: * @return The result.
09857: * @throws IOException Signals an I/O error.
09858: */
09859: private Result pAssemblyOperand(final int yyStart)
09860: throws IOException {
09861: CParserColumn yyColumn = (CParserColumn) column(yyStart);
09862: if (null == yyColumn.chunk3)
09863: yyColumn.chunk3 = new Chunk3();
09864: if (null == yyColumn.chunk3.fAssemblyOperand)
09865: yyColumn.chunk3.fAssemblyOperand = pAssemblyOperand$1(yyStart);
09866: return yyColumn.chunk3.fAssemblyOperand;
09867: }
09868:
09869: /** Actually parse xtc.lang.C.AssemblyOperand. */
09870: private Result pAssemblyOperand$1(final int yyStart)
09871: throws IOException {
09872: Result yyResult;
09873: int yyBase;
09874: int yyOption1;
09875: String yyOpValue1;
09876: Node yyValue;
09877: ParseError yyError = ParseError.DUMMY;
09878:
09879: // Alternative 1.
09880:
09881: yyOption1 = yyStart;
09882: yyOpValue1 = null;
09883:
09884: yyBase = yyOption1;
09885: yyResult = pSymbol(yyBase);
09886: yyError = yyResult.select(yyError);
09887: if (yyResult.hasValue("[")) {
09888:
09889: yyResult = pWord(yyResult.index);
09890: yyError = yyResult.select(yyError);
09891: if (yyResult.hasValue()) {
09892: final String v$el$1 = yyResult.semanticValue();
09893:
09894: yyBase = yyResult.index;
09895: yyResult = pSymbol(yyBase);
09896: yyError = yyResult.select(yyError);
09897: if (yyResult.hasValue("]")) {
09898:
09899: yyOption1 = yyResult.index;
09900: yyOpValue1 = v$el$1;
09901: } else {
09902: yyError = yyError.select("\"]\" expected", yyBase);
09903: }
09904: }
09905: } else {
09906: yyError = yyError.select("\"[\" expected", yyBase);
09907: }
09908: { // Start scope for v$g$1.
09909: final String v$g$1 = yyOpValue1;
09910:
09911: yyResult = pStringConstant(yyOption1);
09912: yyError = yyResult.select(yyError);
09913: if (yyResult.hasValue()) {
09914: final Node v$g$2 = yyResult.semanticValue();
09915:
09916: yyBase = yyResult.index;
09917: yyResult = pSymbol(yyBase);
09918: yyError = yyResult.select(yyError);
09919: if (yyResult.hasValue("(")) {
09920:
09921: yyResult = pCommaExpression(yyResult.index);
09922: yyError = yyResult.select(yyError);
09923: if (yyResult.hasValue()) {
09924: final Node v$g$3 = yyResult.semanticValue();
09925:
09926: yyBase = yyResult.index;
09927: yyResult = pSymbol(yyBase);
09928: yyError = yyResult.select(yyError);
09929: if (yyResult.hasValue(")")) {
09930:
09931: yyValue = GNode.create("AssemblyOperand",
09932: v$g$1, v$g$2, v$g$3);
09933: yyValue.setLocation(location(yyStart));
09934:
09935: return yyResult.createValue(yyValue,
09936: yyError);
09937: } else {
09938: yyError = yyError.select("\")\" expected",
09939: yyBase);
09940: }
09941: }
09942: } else {
09943: yyError = yyError.select("\"(\" expected", yyBase);
09944: }
09945: }
09946: } // End scope for v$g$1.
09947:
09948: // Done.
09949: return yyError;
09950: }
09951:
09952: // =========================================================================
09953:
09954: /**
09955: * Parse nonterminal xtc.lang.C.AssemblyClobbers.
09956: *
09957: * @param yyStart The index.
09958: * @return The result.
09959: * @throws IOException Signals an I/O error.
09960: */
09961: private Result pAssemblyClobbers(final int yyStart)
09962: throws IOException {
09963: Result yyResult;
09964: int yyBase;
09965: int yyRepetition1;
09966: Pair<Node> yyRepValue1;
09967: Node yyValue;
09968: ParseError yyError = ParseError.DUMMY;
09969:
09970: // Alternative 1.
09971:
09972: yyResult = pStringConstant(yyStart);
09973: yyError = yyResult.select(yyError);
09974: if (yyResult.hasValue()) {
09975: final Node v$g$1 = yyResult.semanticValue();
09976:
09977: yyRepetition1 = yyResult.index;
09978: yyRepValue1 = Pair.empty();
09979: while (true) {
09980:
09981: yyBase = yyRepetition1;
09982: yyResult = pSymbol(yyBase);
09983: yyError = yyResult.select(yyError);
09984: if (yyResult.hasValue(",")) {
09985:
09986: yyResult = pStringConstant(yyResult.index);
09987: yyError = yyResult.select(yyError);
09988: if (yyResult.hasValue()) {
09989: final Node v$el$1 = yyResult.semanticValue();
09990:
09991: yyRepetition1 = yyResult.index;
09992: yyRepValue1 = new Pair<Node>(v$el$1,
09993: yyRepValue1);
09994: continue;
09995: }
09996: } else {
09997: yyError = yyError.select("\",\" expected", yyBase);
09998: }
09999: break;
10000: }
10001: { // Start scope for v$g$2.
10002: final Pair<Node> v$g$2 = yyRepValue1.reverse();
10003:
10004: yyValue = GNode.createFromPair("AssemblyClobbers",
10005: v$g$1, v$g$2);
10006: yyValue.setLocation(location(yyStart));
10007:
10008: return new SemanticValue(yyValue, yyRepetition1,
10009: yyError);
10010: } // End scope for v$g$2.
10011: }
10012:
10013: // Done.
10014: return yyError;
10015: }
10016:
10017: // =========================================================================
10018:
10019: /**
10020: * Parse nonterminal xtc.lang.C.AsmKeyword.
10021: *
10022: * @param yyStart The index.
10023: * @return The result.
10024: * @throws IOException Signals an I/O error.
10025: */
10026: private Result pAsmKeyword(final int yyStart) throws IOException {
10027: CParserColumn yyColumn = (CParserColumn) column(yyStart);
10028: if (null == yyColumn.chunk3)
10029: yyColumn.chunk3 = new Chunk3();
10030: if (null == yyColumn.chunk3.fAsmKeyword)
10031: yyColumn.chunk3.fAsmKeyword = pAsmKeyword$1(yyStart);
10032: return yyColumn.chunk3.fAsmKeyword;
10033: }
10034:
10035: /** Actually parse xtc.lang.C.AsmKeyword. */
10036: private Result pAsmKeyword$1(final int yyStart) throws IOException {
10037: Result yyResult;
10038: Void yyValue;
10039: ParseError yyError = ParseError.DUMMY;
10040:
10041: // Alternative 1.
10042:
10043: yyResult = pKeyword(yyStart);
10044: yyError = yyResult.select(yyError);
10045: if (yyResult.hasValue("asm")) {
10046:
10047: yyValue = null;
10048:
10049: return yyResult.createValue(yyValue, yyError);
10050: }
10051:
10052: // Alternative 2.
10053:
10054: yyResult = pKeyword(yyStart);
10055: yyError = yyResult.select(yyError);
10056: if (yyResult.hasValue("__asm")) {
10057:
10058: yyValue = null;
10059:
10060: return yyResult.createValue(yyValue, yyError);
10061: }
10062:
10063: // Alternative 3.
10064:
10065: yyResult = pKeyword(yyStart);
10066: yyError = yyResult.select(yyError);
10067: if (yyResult.hasValue("__asm__")) {
10068:
10069: yyValue = null;
10070:
10071: return yyResult.createValue(yyValue, yyError);
10072: }
10073:
10074: // Done.
10075: yyError = yyError.select("asm keyword expected", yyStart);
10076: return yyError;
10077: }
10078:
10079: // =========================================================================
10080:
10081: /**
10082: * Parse nonterminal xtc.lang.CConstant.Constant.
10083: *
10084: * @param yyStart The index.
10085: * @return The result.
10086: * @throws IOException Signals an I/O error.
10087: */
10088: private Result pConstant(final int yyStart) throws IOException {
10089: Result yyResult;
10090: Node yyValue;
10091: ParseError yyError = ParseError.DUMMY;
10092:
10093: // Alternative 1.
10094:
10095: yyResult = pFloatingConstant(yyStart);
10096: yyError = yyResult.select(yyError);
10097: if (yyResult.hasValue()) {
10098: yyValue = yyResult.semanticValue();
10099:
10100: yyResult = pSpacing(yyResult.index);
10101: yyError = yyResult.select(yyError);
10102: if (yyResult.hasValue()) {
10103:
10104: return yyResult.createValue(yyValue, yyError);
10105: }
10106: }
10107:
10108: // Alternative 2.
10109:
10110: yyResult = pIntegerConstant(yyStart);
10111: yyError = yyResult.select(yyError);
10112: if (yyResult.hasValue()) {
10113: yyValue = yyResult.semanticValue();
10114:
10115: yyResult = pSpacing(yyResult.index);
10116: yyError = yyResult.select(yyError);
10117: if (yyResult.hasValue()) {
10118:
10119: return yyResult.createValue(yyValue, yyError);
10120: }
10121: }
10122:
10123: // Alternative 3.
10124:
10125: yyResult = pCharacterConstant(yyStart);
10126: yyError = yyResult.select(yyError);
10127: if (yyResult.hasValue()) {
10128: yyValue = yyResult.semanticValue();
10129:
10130: return yyResult.createValue(yyValue, yyError);
10131: }
10132:
10133: // Alternative 4.
10134:
10135: yyResult = pStringConstant(yyStart);
10136: yyError = yyResult.select(yyError);
10137: if (yyResult.hasValue()) {
10138: yyValue = yyResult.semanticValue();
10139:
10140: return yyResult.createValue(yyValue, yyError);
10141: }
10142:
10143: // Done.
10144: return yyError;
10145: }
10146:
10147: // =========================================================================
10148:
10149: /**
10150: * Parse nonterminal xtc.lang.CConstant.IntegerConstant.
10151: *
10152: * @param yyStart The index.
10153: * @return The result.
10154: * @throws IOException Signals an I/O error.
10155: */
10156: private Result pIntegerConstant(final int yyStart)
10157: throws IOException {
10158: Result yyResult;
10159: Node yyValue;
10160: ParseError yyError = ParseError.DUMMY;
10161:
10162: // Alternative <Hex>.
10163:
10164: yyResult = pHexConstant(yyStart);
10165: yyError = yyResult.select(yyError);
10166: if (yyResult.hasValue()) {
10167: final String v$g$1 = yyResult.semanticValue();
10168:
10169: yyValue = GNode.create("IntegerConstant", v$g$1);
10170: yyValue.setLocation(location(yyStart));
10171:
10172: return yyResult.createValue(yyValue, yyError);
10173: }
10174:
10175: // Alternative <Octal>.
10176:
10177: yyResult = pOctalConstant(yyStart);
10178: yyError = yyResult.select(yyError);
10179: if (yyResult.hasValue()) {
10180: final String v$g$2 = yyResult.semanticValue();
10181:
10182: yyValue = GNode.create("IntegerConstant", v$g$2);
10183: yyValue.setLocation(location(yyStart));
10184:
10185: return yyResult.createValue(yyValue, yyError);
10186: }
10187:
10188: // Alternative <Decimal>.
10189:
10190: yyResult = pDecimalConstant(yyStart);
10191: yyError = yyResult.select(yyError);
10192: if (yyResult.hasValue()) {
10193: final String v$g$3 = yyResult.semanticValue();
10194:
10195: yyValue = GNode.create("IntegerConstant", v$g$3);
10196: yyValue.setLocation(location(yyStart));
10197:
10198: return yyResult.createValue(yyValue, yyError);
10199: }
10200:
10201: // Done.
10202: return yyError;
10203: }
10204:
10205: // =========================================================================
10206:
10207: /**
10208: * Parse nonterminal xtc.lang.CConstant.DecimalConstant.
10209: *
10210: * @param yyStart The index.
10211: * @return The result.
10212: * @throws IOException Signals an I/O error.
10213: */
10214: private Result pDecimalConstant(final int yyStart)
10215: throws IOException {
10216: int yyC;
10217: int yyIndex;
10218: Result yyResult;
10219: int yyRepetition1;
10220: int yyOption1;
10221: String yyValue;
10222: ParseError yyError = ParseError.DUMMY;
10223:
10224: // Alternative 1.
10225:
10226: yyC = character(yyStart);
10227: if (-1 != yyC) {
10228: yyIndex = yyStart + 1;
10229:
10230: switch (yyC) {
10231: case '1':
10232: case '2':
10233: case '3':
10234: case '4':
10235: case '5':
10236: case '6':
10237: case '7':
10238: case '8':
10239: case '9': {
10240: yyRepetition1 = yyIndex;
10241: while (true) {
10242:
10243: yyC = character(yyRepetition1);
10244: if (-1 != yyC) {
10245: yyIndex = yyRepetition1 + 1;
10246:
10247: switch (yyC) {
10248: case '0':
10249: case '1':
10250: case '2':
10251: case '3':
10252: case '4':
10253: case '5':
10254: case '6':
10255: case '7':
10256: case '8':
10257: case '9': {
10258: yyRepetition1 = yyIndex;
10259: continue;
10260: }
10261:
10262: default:
10263: /* No match. */
10264: }
10265: }
10266: break;
10267: }
10268:
10269: yyOption1 = yyRepetition1;
10270:
10271: yyResult = pIntegerSuffix(yyOption1);
10272: yyError = yyResult.select(yyError);
10273: if (yyResult.hasValue()) {
10274:
10275: yyOption1 = yyResult.index;
10276: }
10277:
10278: yyValue = difference(yyStart, yyOption1);
10279:
10280: return new SemanticValue(yyValue, yyOption1, yyError);
10281: }
10282:
10283: default:
10284: /* No match. */
10285: }
10286: }
10287:
10288: // Done.
10289: yyError = yyError.select("decimal constant expected", yyStart);
10290: return yyError;
10291: }
10292:
10293: // =========================================================================
10294:
10295: /**
10296: * Parse nonterminal xtc.lang.CConstant.HexConstant.
10297: *
10298: * @param yyStart The index.
10299: * @return The result.
10300: * @throws IOException Signals an I/O error.
10301: */
10302: private Result pHexConstant(final int yyStart) throws IOException {
10303: int yyC;
10304: int yyIndex;
10305: Result yyResult;
10306: int yyRepetition1;
10307: boolean yyRepeated1;
10308: int yyOption1;
10309: String yyValue;
10310: ParseError yyError = ParseError.DUMMY;
10311:
10312: // Alternative 1.
10313:
10314: yyResult = pHexPrefix(yyStart);
10315: yyError = yyResult.select(yyError);
10316: if (yyResult.hasValue()) {
10317:
10318: yyRepetition1 = yyResult.index;
10319: yyRepeated1 = false;
10320: while (true) {
10321:
10322: yyC = character(yyRepetition1);
10323: if (-1 != yyC) {
10324: yyIndex = yyRepetition1 + 1;
10325:
10326: switch (yyC) {
10327: case '0':
10328: case '1':
10329: case '2':
10330: case '3':
10331: case '4':
10332: case '5':
10333: case '6':
10334: case '7':
10335: case '8':
10336: case '9':
10337: case 'A':
10338: case 'B':
10339: case 'C':
10340: case 'D':
10341: case 'E':
10342: case 'F':
10343: case 'a':
10344: case 'b':
10345: case 'c':
10346: case 'd':
10347: case 'e':
10348: case 'f': {
10349: yyRepetition1 = yyIndex;
10350: yyRepeated1 = true;
10351: continue;
10352: }
10353:
10354: default:
10355: /* No match. */
10356: }
10357: }
10358: break;
10359: }
10360:
10361: if (yyRepeated1) {
10362:
10363: yyOption1 = yyRepetition1;
10364:
10365: yyResult = pIntegerSuffix(yyOption1);
10366: yyError = yyResult.select(yyError);
10367: if (yyResult.hasValue()) {
10368:
10369: yyOption1 = yyResult.index;
10370: }
10371:
10372: yyValue = difference(yyStart, yyOption1);
10373:
10374: return new SemanticValue(yyValue, yyOption1, yyError);
10375: }
10376: }
10377:
10378: // Done.
10379: yyError = yyError.select("hex constant expected", yyStart);
10380: return yyError;
10381: }
10382:
10383: // =========================================================================
10384:
10385: /**
10386: * Parse nonterminal xtc.lang.CConstant.HexPrefix.
10387: *
10388: * @param yyStart The index.
10389: * @return The result.
10390: * @throws IOException Signals an I/O error.
10391: */
10392: private Result pHexPrefix(final int yyStart) throws IOException {
10393: int yyC;
10394: int yyIndex;
10395: Void yyValue;
10396: ParseError yyError = ParseError.DUMMY;
10397:
10398: // Alternative 1.
10399:
10400: yyC = character(yyStart);
10401: if ('0' == yyC) {
10402: yyIndex = yyStart + 1;
10403:
10404: yyC = character(yyIndex);
10405: if (-1 != yyC) {
10406: yyIndex = yyIndex + 1;
10407:
10408: switch (yyC) {
10409: case 'X':
10410: case 'x': {
10411: yyValue = null;
10412:
10413: return new SemanticValue(yyValue, yyIndex, yyError);
10414: }
10415:
10416: default:
10417: /* No match. */
10418: }
10419: }
10420: }
10421:
10422: // Done.
10423: yyError = yyError.select("hex prefix expected", yyStart);
10424: return yyError;
10425: }
10426:
10427: // =========================================================================
10428:
10429: /**
10430: * Parse nonterminal xtc.lang.CConstant.OctalConstant.
10431: *
10432: * @param yyStart The index.
10433: * @return The result.
10434: * @throws IOException Signals an I/O error.
10435: */
10436: private Result pOctalConstant(final int yyStart) throws IOException {
10437: int yyC;
10438: int yyIndex;
10439: Result yyResult;
10440: int yyRepetition1;
10441: int yyOption1;
10442: String yyValue;
10443: ParseError yyError = ParseError.DUMMY;
10444:
10445: // Alternative 1.
10446:
10447: yyC = character(yyStart);
10448: if ('0' == yyC) {
10449: yyIndex = yyStart + 1;
10450:
10451: yyRepetition1 = yyIndex;
10452: while (true) {
10453:
10454: yyC = character(yyRepetition1);
10455: if (-1 != yyC) {
10456: yyIndex = yyRepetition1 + 1;
10457:
10458: switch (yyC) {
10459: case '0':
10460: case '1':
10461: case '2':
10462: case '3':
10463: case '4':
10464: case '5':
10465: case '6':
10466: case '7': {
10467: yyRepetition1 = yyIndex;
10468: continue;
10469: }
10470:
10471: default:
10472: /* No match. */
10473: }
10474: }
10475: break;
10476: }
10477:
10478: yyOption1 = yyRepetition1;
10479:
10480: yyResult = pIntegerSuffix(yyOption1);
10481: yyError = yyResult.select(yyError);
10482: if (yyResult.hasValue()) {
10483:
10484: yyOption1 = yyResult.index;
10485: }
10486:
10487: yyValue = difference(yyStart, yyOption1);
10488:
10489: return new SemanticValue(yyValue, yyOption1, yyError);
10490: }
10491:
10492: // Done.
10493: yyError = yyError.select("octal constant expected", yyStart);
10494: return yyError;
10495: }
10496:
10497: // =========================================================================
10498:
10499: /**
10500: * Parse nonterminal xtc.lang.CConstant.IntegerSuffix.
10501: *
10502: * @param yyStart The index.
10503: * @return The result.
10504: * @throws IOException Signals an I/O error.
10505: */
10506: private Result pIntegerSuffix(final int yyStart) throws IOException {
10507: int yyC;
10508: int yyIndex;
10509: Result yyResult;
10510: Void yyValue;
10511: ParseError yyError = ParseError.DUMMY;
10512:
10513: // Alternative 1.
10514:
10515: yyResult = pLongLongSuffix(yyStart);
10516: yyError = yyResult.select(yyError);
10517: if (yyResult.hasValue()) {
10518:
10519: final int yyChoice1 = yyResult.index;
10520:
10521: // Nested alternative 1.
10522:
10523: yyC = character(yyChoice1);
10524: if (-1 != yyC) {
10525: yyIndex = yyChoice1 + 1;
10526:
10527: switch (yyC) {
10528: case 'U':
10529: case 'u': {
10530: yyValue = null;
10531:
10532: return new SemanticValue(yyValue, yyIndex, yyError);
10533: }
10534:
10535: default:
10536: /* No match. */
10537: }
10538: }
10539:
10540: // Nested alternative 2.
10541:
10542: yyValue = null;
10543:
10544: return new SemanticValue(yyValue, yyChoice1, yyError);
10545: }
10546:
10547: // Alternative 2.
10548:
10549: yyC = character(yyStart);
10550: if (-1 != yyC) {
10551: yyIndex = yyStart + 1;
10552:
10553: switch (yyC) {
10554: case 'L':
10555: case 'l': {
10556: final int yyChoice1 = yyIndex;
10557:
10558: // Nested alternative 1.
10559:
10560: yyC = character(yyChoice1);
10561: if (-1 != yyC) {
10562: yyIndex = yyChoice1 + 1;
10563:
10564: switch (yyC) {
10565: case 'U':
10566: case 'u': {
10567: yyValue = null;
10568:
10569: return new SemanticValue(yyValue, yyIndex,
10570: yyError);
10571: }
10572:
10573: default:
10574: /* No match. */
10575: }
10576: }
10577:
10578: // Nested alternative 2.
10579:
10580: yyValue = null;
10581:
10582: return new SemanticValue(yyValue, yyChoice1, yyError);
10583: }
10584:
10585: case 'U':
10586: case 'u': {
10587: final int yyChoice1 = yyIndex;
10588:
10589: // Nested alternative 1.
10590:
10591: yyC = character(yyChoice1);
10592: if (-1 != yyC) {
10593: yyIndex = yyChoice1 + 1;
10594:
10595: switch (yyC) {
10596: case 'l': {
10597: yyC = character(yyIndex);
10598: if (-1 != yyC) {
10599: yyIndex = yyIndex + 1;
10600: if ('l' == yyC) {
10601:
10602: yyValue = null;
10603:
10604: return new SemanticValue(yyValue,
10605: yyIndex, yyError);
10606: }
10607: }
10608: }
10609: break;
10610:
10611: case 'L': {
10612: yyC = character(yyIndex);
10613: if (-1 != yyC) {
10614: yyIndex = yyIndex + 1;
10615: if ('L' == yyC) {
10616:
10617: yyValue = null;
10618:
10619: return new SemanticValue(yyValue,
10620: yyIndex, yyError);
10621: }
10622: }
10623: }
10624: break;
10625:
10626: default:
10627: /* No match. */
10628: }
10629: }
10630:
10631: // Nested alternative 2.
10632:
10633: yyC = character(yyChoice1);
10634: if (-1 != yyC) {
10635: yyIndex = yyChoice1 + 1;
10636:
10637: switch (yyC) {
10638: case 'L':
10639: case 'l': {
10640: yyValue = null;
10641:
10642: return new SemanticValue(yyValue, yyIndex,
10643: yyError);
10644: }
10645:
10646: default:
10647: /* No match. */
10648: }
10649: }
10650:
10651: // Nested alternative 3.
10652:
10653: yyValue = null;
10654:
10655: return new SemanticValue(yyValue, yyChoice1, yyError);
10656: }
10657:
10658: default:
10659: /* No match. */
10660: }
10661: }
10662:
10663: // Done.
10664: yyError = yyError.select("integer suffix expected", yyStart);
10665: return yyError;
10666: }
10667:
10668: // =========================================================================
10669:
10670: /**
10671: * Parse nonterminal xtc.lang.CConstant.LongLongSuffix.
10672: *
10673: * @param yyStart The index.
10674: * @return The result.
10675: * @throws IOException Signals an I/O error.
10676: */
10677: private Result pLongLongSuffix(final int yyStart)
10678: throws IOException {
10679: int yyC;
10680: int yyIndex;
10681: Void yyValue;
10682: ParseError yyError = ParseError.DUMMY;
10683:
10684: // Alternative 1.
10685:
10686: yyC = character(yyStart);
10687: if (-1 != yyC) {
10688: yyIndex = yyStart + 1;
10689:
10690: switch (yyC) {
10691: case 'l': {
10692: yyC = character(yyIndex);
10693: if (-1 != yyC) {
10694: yyIndex = yyIndex + 1;
10695: if ('l' == yyC) {
10696:
10697: yyValue = null;
10698:
10699: return new SemanticValue(yyValue, yyIndex,
10700: yyError);
10701: }
10702: }
10703: }
10704: break;
10705:
10706: case 'L': {
10707: yyC = character(yyIndex);
10708: if (-1 != yyC) {
10709: yyIndex = yyIndex + 1;
10710: if ('L' == yyC) {
10711:
10712: yyValue = null;
10713:
10714: return new SemanticValue(yyValue, yyIndex,
10715: yyError);
10716: }
10717: }
10718: }
10719: break;
10720:
10721: default:
10722: /* No match. */
10723: }
10724: }
10725:
10726: // Done.
10727: yyError = yyError.select("long long suffix expected", yyStart);
10728: return yyError;
10729: }
10730:
10731: // =========================================================================
10732:
10733: /**
10734: * Parse nonterminal xtc.lang.CConstant.FloatingConstant.
10735: *
10736: * @param yyStart The index.
10737: * @return The result.
10738: * @throws IOException Signals an I/O error.
10739: */
10740: private Result pFloatingConstant(final int yyStart)
10741: throws IOException {
10742: Result yyResult;
10743: Node yyValue;
10744: ParseError yyError = ParseError.DUMMY;
10745:
10746: // Alternative <Decimal>.
10747:
10748: yyResult = pDecimalFloatingConstant(yyStart);
10749: yyError = yyResult.select(yyError);
10750: if (yyResult.hasValue()) {
10751: final String v$g$1 = yyResult.semanticValue();
10752:
10753: yyValue = GNode.create("FloatingConstant", v$g$1);
10754: yyValue.setLocation(location(yyStart));
10755:
10756: return yyResult.createValue(yyValue, yyError);
10757: }
10758:
10759: // Alternative <Hex>.
10760:
10761: yyResult = pHexFloatingConstant(yyStart);
10762: yyError = yyResult.select(yyError);
10763: if (yyResult.hasValue()) {
10764: final String v$g$2 = yyResult.semanticValue();
10765:
10766: yyValue = GNode.create("FloatingConstant", v$g$2);
10767: yyValue.setLocation(location(yyStart));
10768:
10769: return yyResult.createValue(yyValue, yyError);
10770: }
10771:
10772: // Done.
10773: return yyError;
10774: }
10775:
10776: // =========================================================================
10777:
10778: /**
10779: * Parse nonterminal xtc.lang.CConstant.DecimalFloatingConstant.
10780: *
10781: * @param yyStart The index.
10782: * @return The result.
10783: * @throws IOException Signals an I/O error.
10784: */
10785: private Result pDecimalFloatingConstant(final int yyStart)
10786: throws IOException {
10787:
10788: int yyC;
10789: int yyIndex;
10790: Result yyResult;
10791: int yyRepetition1;
10792: boolean yyRepeated1;
10793: int yyOption1;
10794: String yyValue;
10795: ParseError yyError = ParseError.DUMMY;
10796:
10797: // Alternative 1.
10798:
10799: yyRepetition1 = yyStart;
10800: yyRepeated1 = false;
10801: while (true) {
10802:
10803: yyC = character(yyRepetition1);
10804: if (-1 != yyC) {
10805: yyIndex = yyRepetition1 + 1;
10806:
10807: switch (yyC) {
10808: case '0':
10809: case '1':
10810: case '2':
10811: case '3':
10812: case '4':
10813: case '5':
10814: case '6':
10815: case '7':
10816: case '8':
10817: case '9': {
10818: yyRepetition1 = yyIndex;
10819: yyRepeated1 = true;
10820: continue;
10821: }
10822:
10823: default:
10824: /* No match. */
10825: }
10826: }
10827: break;
10828: }
10829:
10830: if (yyRepeated1) {
10831:
10832: yyC = character(yyRepetition1);
10833: if ('.' == yyC) {
10834: yyIndex = yyRepetition1 + 1;
10835:
10836: yyRepetition1 = yyIndex;
10837: while (true) {
10838:
10839: yyC = character(yyRepetition1);
10840: if (-1 != yyC) {
10841: yyIndex = yyRepetition1 + 1;
10842:
10843: switch (yyC) {
10844: case '0':
10845: case '1':
10846: case '2':
10847: case '3':
10848: case '4':
10849: case '5':
10850: case '6':
10851: case '7':
10852: case '8':
10853: case '9': {
10854: yyRepetition1 = yyIndex;
10855: continue;
10856: }
10857:
10858: default:
10859: /* No match. */
10860: }
10861: }
10862: break;
10863: }
10864:
10865: yyOption1 = yyRepetition1;
10866:
10867: yyResult = pExponent(yyOption1);
10868: yyError = yyResult.select(yyError);
10869: if (yyResult.hasValue()) {
10870:
10871: yyOption1 = yyResult.index;
10872: }
10873:
10874: yyC = character(yyOption1);
10875: if (-1 != yyC) {
10876: yyIndex = yyOption1 + 1;
10877:
10878: switch (yyC) {
10879: case 'F':
10880: case 'L':
10881: case 'f':
10882: case 'l': {
10883: yyOption1 = yyIndex;
10884: }
10885:
10886: default:
10887: /* No match. */
10888: }
10889: }
10890:
10891: yyValue = difference(yyStart, yyOption1);
10892:
10893: return new SemanticValue(yyValue, yyOption1, yyError);
10894: }
10895: }
10896:
10897: // Alternative 2.
10898:
10899: yyC = character(yyStart);
10900: if ('.' == yyC) {
10901: yyIndex = yyStart + 1;
10902:
10903: yyRepetition1 = yyIndex;
10904: yyRepeated1 = false;
10905: while (true) {
10906:
10907: yyC = character(yyRepetition1);
10908: if (-1 != yyC) {
10909: yyIndex = yyRepetition1 + 1;
10910:
10911: switch (yyC) {
10912: case '0':
10913: case '1':
10914: case '2':
10915: case '3':
10916: case '4':
10917: case '5':
10918: case '6':
10919: case '7':
10920: case '8':
10921: case '9': {
10922: yyRepetition1 = yyIndex;
10923: yyRepeated1 = true;
10924: continue;
10925: }
10926:
10927: default:
10928: /* No match. */
10929: }
10930: }
10931: break;
10932: }
10933:
10934: if (yyRepeated1) {
10935:
10936: yyOption1 = yyRepetition1;
10937:
10938: yyResult = pExponent(yyOption1);
10939: yyError = yyResult.select(yyError);
10940: if (yyResult.hasValue()) {
10941:
10942: yyOption1 = yyResult.index;
10943: }
10944:
10945: yyC = character(yyOption1);
10946: if (-1 != yyC) {
10947: yyIndex = yyOption1 + 1;
10948:
10949: switch (yyC) {
10950: case 'F':
10951: case 'L':
10952: case 'f':
10953: case 'l': {
10954: yyOption1 = yyIndex;
10955: }
10956:
10957: default:
10958: /* No match. */
10959: }
10960: }
10961:
10962: yyValue = difference(yyStart, yyOption1);
10963:
10964: return new SemanticValue(yyValue, yyOption1, yyError);
10965: }
10966: }
10967:
10968: // Alternative 3.
10969:
10970: yyRepetition1 = yyStart;
10971: yyRepeated1 = false;
10972: while (true) {
10973:
10974: yyC = character(yyRepetition1);
10975: if (-1 != yyC) {
10976: yyIndex = yyRepetition1 + 1;
10977:
10978: switch (yyC) {
10979: case '0':
10980: case '1':
10981: case '2':
10982: case '3':
10983: case '4':
10984: case '5':
10985: case '6':
10986: case '7':
10987: case '8':
10988: case '9': {
10989: yyRepetition1 = yyIndex;
10990: yyRepeated1 = true;
10991: continue;
10992: }
10993:
10994: default:
10995: /* No match. */
10996: }
10997: }
10998: break;
10999: }
11000:
11001: if (yyRepeated1) {
11002:
11003: yyResult = pExponent(yyRepetition1);
11004: yyError = yyResult.select(yyError);
11005: if (yyResult.hasValue()) {
11006:
11007: yyOption1 = yyResult.index;
11008:
11009: yyC = character(yyOption1);
11010: if (-1 != yyC) {
11011: yyIndex = yyOption1 + 1;
11012:
11013: switch (yyC) {
11014: case 'F':
11015: case 'L':
11016: case 'f':
11017: case 'l': {
11018: yyOption1 = yyIndex;
11019: }
11020:
11021: default:
11022: /* No match. */
11023: }
11024: }
11025:
11026: yyValue = difference(yyStart, yyOption1);
11027:
11028: return new SemanticValue(yyValue, yyOption1, yyError);
11029: }
11030: }
11031:
11032: // Done.
11033: yyError = yyError.select("decimal floating constant expected",
11034: yyStart);
11035: return yyError;
11036: }
11037:
11038: // =========================================================================
11039:
11040: /**
11041: * Parse nonterminal xtc.lang.CConstant.HexFloatingConstant.
11042: *
11043: * @param yyStart The index.
11044: * @return The result.
11045: * @throws IOException Signals an I/O error.
11046: */
11047: private Result pHexFloatingConstant(final int yyStart)
11048: throws IOException {
11049: int yyC;
11050: int yyIndex;
11051: Result yyResult;
11052: int yyRepetition1;
11053: boolean yyRepeated1;
11054: int yyOption1;
11055: String yyValue;
11056: ParseError yyError = ParseError.DUMMY;
11057:
11058: // Alternative 1.
11059:
11060: yyResult = pHexPrefix(yyStart);
11061: yyError = yyResult.select(yyError);
11062: if (yyResult.hasValue()) {
11063:
11064: final int yyChoice1 = yyResult.index;
11065:
11066: // Nested alternative 1.
11067:
11068: yyRepetition1 = yyChoice1;
11069: yyRepeated1 = false;
11070: while (true) {
11071:
11072: yyC = character(yyRepetition1);
11073: if (-1 != yyC) {
11074: yyIndex = yyRepetition1 + 1;
11075:
11076: switch (yyC) {
11077: case '0':
11078: case '1':
11079: case '2':
11080: case '3':
11081: case '4':
11082: case '5':
11083: case '6':
11084: case '7':
11085: case '8':
11086: case '9':
11087: case 'A':
11088: case 'B':
11089: case 'C':
11090: case 'D':
11091: case 'E':
11092: case 'F':
11093: case 'a':
11094: case 'b':
11095: case 'c':
11096: case 'd':
11097: case 'e':
11098: case 'f': {
11099: yyRepetition1 = yyIndex;
11100: yyRepeated1 = true;
11101: continue;
11102: }
11103:
11104: default:
11105: /* No match. */
11106: }
11107: }
11108: break;
11109: }
11110:
11111: if (yyRepeated1) {
11112:
11113: yyC = character(yyRepetition1);
11114: if ('.' == yyC) {
11115: yyIndex = yyRepetition1 + 1;
11116:
11117: yyRepetition1 = yyIndex;
11118: while (true) {
11119:
11120: yyC = character(yyRepetition1);
11121: if (-1 != yyC) {
11122: yyIndex = yyRepetition1 + 1;
11123:
11124: switch (yyC) {
11125: case '0':
11126: case '1':
11127: case '2':
11128: case '3':
11129: case '4':
11130: case '5':
11131: case '6':
11132: case '7':
11133: case '8':
11134: case '9':
11135: case 'A':
11136: case 'B':
11137: case 'C':
11138: case 'D':
11139: case 'E':
11140: case 'F':
11141: case 'a':
11142: case 'b':
11143: case 'c':
11144: case 'd':
11145: case 'e':
11146: case 'f': {
11147: yyRepetition1 = yyIndex;
11148: continue;
11149: }
11150:
11151: default:
11152: /* No match. */
11153: }
11154: }
11155: break;
11156: }
11157:
11158: yyResult = pBinaryExponent(yyRepetition1);
11159: yyError = yyResult.select(yyError);
11160: if (yyResult.hasValue()) {
11161:
11162: yyOption1 = yyResult.index;
11163:
11164: yyC = character(yyOption1);
11165: if (-1 != yyC) {
11166: yyIndex = yyOption1 + 1;
11167:
11168: switch (yyC) {
11169: case 'F':
11170: case 'L':
11171: case 'f':
11172: case 'l': {
11173: yyOption1 = yyIndex;
11174: }
11175:
11176: default:
11177: /* No match. */
11178: }
11179: }
11180:
11181: yyValue = difference(yyStart, yyOption1);
11182:
11183: return new SemanticValue(yyValue, yyOption1,
11184: yyError);
11185: }
11186: }
11187: }
11188:
11189: // Nested alternative 2.
11190:
11191: yyC = character(yyChoice1);
11192: if ('.' == yyC) {
11193: yyIndex = yyChoice1 + 1;
11194:
11195: yyRepetition1 = yyIndex;
11196: yyRepeated1 = false;
11197: while (true) {
11198:
11199: yyC = character(yyRepetition1);
11200: if (-1 != yyC) {
11201: yyIndex = yyRepetition1 + 1;
11202:
11203: switch (yyC) {
11204: case '0':
11205: case '1':
11206: case '2':
11207: case '3':
11208: case '4':
11209: case '5':
11210: case '6':
11211: case '7':
11212: case '8':
11213: case '9':
11214: case 'A':
11215: case 'B':
11216: case 'C':
11217: case 'D':
11218: case 'E':
11219: case 'F':
11220: case 'a':
11221: case 'b':
11222: case 'c':
11223: case 'd':
11224: case 'e':
11225: case 'f': {
11226: yyRepetition1 = yyIndex;
11227: yyRepeated1 = true;
11228: continue;
11229: }
11230:
11231: default:
11232: /* No match. */
11233: }
11234: }
11235: break;
11236: }
11237:
11238: if (yyRepeated1) {
11239:
11240: yyResult = pBinaryExponent(yyRepetition1);
11241: yyError = yyResult.select(yyError);
11242: if (yyResult.hasValue()) {
11243:
11244: yyOption1 = yyResult.index;
11245:
11246: yyC = character(yyOption1);
11247: if (-1 != yyC) {
11248: yyIndex = yyOption1 + 1;
11249:
11250: switch (yyC) {
11251: case 'F':
11252: case 'L':
11253: case 'f':
11254: case 'l': {
11255: yyOption1 = yyIndex;
11256: }
11257:
11258: default:
11259: /* No match. */
11260: }
11261: }
11262:
11263: yyValue = difference(yyStart, yyOption1);
11264:
11265: return new SemanticValue(yyValue, yyOption1,
11266: yyError);
11267: }
11268: }
11269: }
11270:
11271: // Nested alternative 3.
11272:
11273: yyRepetition1 = yyChoice1;
11274: yyRepeated1 = false;
11275: while (true) {
11276:
11277: yyC = character(yyRepetition1);
11278: if (-1 != yyC) {
11279: yyIndex = yyRepetition1 + 1;
11280:
11281: switch (yyC) {
11282: case '0':
11283: case '1':
11284: case '2':
11285: case '3':
11286: case '4':
11287: case '5':
11288: case '6':
11289: case '7':
11290: case '8':
11291: case '9':
11292: case 'A':
11293: case 'B':
11294: case 'C':
11295: case 'D':
11296: case 'E':
11297: case 'F':
11298: case 'a':
11299: case 'b':
11300: case 'c':
11301: case 'd':
11302: case 'e':
11303: case 'f': {
11304: yyRepetition1 = yyIndex;
11305: yyRepeated1 = true;
11306: continue;
11307: }
11308:
11309: default:
11310: /* No match. */
11311: }
11312: }
11313: break;
11314: }
11315:
11316: if (yyRepeated1) {
11317:
11318: yyResult = pBinaryExponent(yyRepetition1);
11319: yyError = yyResult.select(yyError);
11320: if (yyResult.hasValue()) {
11321:
11322: yyOption1 = yyResult.index;
11323:
11324: yyC = character(yyOption1);
11325: if (-1 != yyC) {
11326: yyIndex = yyOption1 + 1;
11327:
11328: switch (yyC) {
11329: case 'F':
11330: case 'L':
11331: case 'f':
11332: case 'l': {
11333: yyOption1 = yyIndex;
11334: }
11335:
11336: default:
11337: /* No match. */
11338: }
11339: }
11340:
11341: yyValue = difference(yyStart, yyOption1);
11342:
11343: return new SemanticValue(yyValue, yyOption1,
11344: yyError);
11345: }
11346: }
11347: }
11348:
11349: // Done.
11350: yyError = yyError.select("hex floating constant expected",
11351: yyStart);
11352: return yyError;
11353: }
11354:
11355: // =========================================================================
11356:
11357: /**
11358: * Parse nonterminal xtc.lang.CConstant.Exponent.
11359: *
11360: * @param yyStart The index.
11361: * @return The result.
11362: * @throws IOException Signals an I/O error.
11363: */
11364: private Result pExponent(final int yyStart) throws IOException {
11365: CParserColumn yyColumn = (CParserColumn) column(yyStart);
11366: if (null == yyColumn.chunk3)
11367: yyColumn.chunk3 = new Chunk3();
11368: if (null == yyColumn.chunk3.fExponent)
11369: yyColumn.chunk3.fExponent = pExponent$1(yyStart);
11370: return yyColumn.chunk3.fExponent;
11371: }
11372:
11373: /** Actually parse xtc.lang.CConstant.Exponent. */
11374: private Result pExponent$1(final int yyStart) throws IOException {
11375: int yyC;
11376: int yyIndex;
11377: Result yyResult;
11378: int yyOption1;
11379: Void yyValue;
11380: ParseError yyError = ParseError.DUMMY;
11381:
11382: // Alternative 1.
11383:
11384: yyC = character(yyStart);
11385: if (-1 != yyC) {
11386: yyIndex = yyStart + 1;
11387:
11388: switch (yyC) {
11389: case 'E':
11390: case 'e': {
11391: yyOption1 = yyIndex;
11392:
11393: yyC = character(yyOption1);
11394: if (-1 != yyC) {
11395: yyIndex = yyOption1 + 1;
11396:
11397: switch (yyC) {
11398: case '+':
11399: case '-': {
11400: yyOption1 = yyIndex;
11401: }
11402:
11403: default:
11404: /* No match. */
11405: }
11406: }
11407:
11408: yyResult = p$$Shared2(yyOption1);
11409: yyError = yyResult.select(yyError);
11410: if (yyResult.hasValue()) {
11411:
11412: yyValue = null;
11413:
11414: return yyResult.createValue(yyValue, yyError);
11415: }
11416: }
11417: break;
11418:
11419: default:
11420: /* No match. */
11421: }
11422: }
11423:
11424: // Done.
11425: yyError = yyError.select("exponent expected", yyStart);
11426: return yyError;
11427: }
11428:
11429: // =========================================================================
11430:
11431: /**
11432: * Parse synthetic nonterminal xtc.lang.C.$$Shared2.
11433: * This nonterminal represents the duplicate productions
11434: * xtc.lang.C.Exponent$$Plus1 and xtc.lang.C.BinaryExponent$$Plus1.
11435: *
11436: * @param yyStart The index.
11437: * @return The result.
11438: * @throws IOException Signals an I/O error.
11439: */
11440: private Result p$$Shared2(final int yyStart) throws IOException {
11441: CParserColumn yyColumn = (CParserColumn) column(yyStart);
11442: if (null == yyColumn.chunk3)
11443: yyColumn.chunk3 = new Chunk3();
11444: if (null == yyColumn.chunk3.f$$Shared2)
11445: yyColumn.chunk3.f$$Shared2 = p$$Shared2$1(yyStart);
11446: return yyColumn.chunk3.f$$Shared2;
11447: }
11448:
11449: /** Actually parse xtc.lang.C.$$Shared2. */
11450: private Result p$$Shared2$1(final int yyStart) throws IOException {
11451: int yyC;
11452: int yyIndex;
11453: Result yyResult;
11454: Void yyValue;
11455: ParseError yyError = ParseError.DUMMY;
11456:
11457: // Alternative 1.
11458:
11459: yyC = character(yyStart);
11460: if (-1 != yyC) {
11461: yyIndex = yyStart + 1;
11462:
11463: switch (yyC) {
11464: case '0':
11465: case '1':
11466: case '2':
11467: case '3':
11468: case '4':
11469: case '5':
11470: case '6':
11471: case '7':
11472: case '8':
11473: case '9': {
11474: final int yyChoice1 = yyIndex;
11475:
11476: // Nested alternative 1.
11477:
11478: yyResult = p$$Shared2(yyChoice1);
11479: yyError = yyResult.select(yyError);
11480: if (yyResult.hasValue()) {
11481:
11482: yyValue = null;
11483:
11484: return yyResult.createValue(yyValue, yyError);
11485: }
11486:
11487: // Nested alternative 2.
11488:
11489: yyValue = null;
11490:
11491: return new SemanticValue(yyValue, yyChoice1, yyError);
11492: }
11493:
11494: default:
11495: /* No match. */
11496: }
11497: }
11498:
11499: // Done.
11500: yyError = yyError.select(" expected", yyStart);
11501: return yyError;
11502: }
11503:
11504: // =========================================================================
11505:
11506: /**
11507: * Parse nonterminal xtc.lang.CConstant.BinaryExponent.
11508: *
11509: * @param yyStart The index.
11510: * @return The result.
11511: * @throws IOException Signals an I/O error.
11512: */
11513: private Result pBinaryExponent(final int yyStart)
11514: throws IOException {
11515: CParserColumn yyColumn = (CParserColumn) column(yyStart);
11516: if (null == yyColumn.chunk4)
11517: yyColumn.chunk4 = new Chunk4();
11518: if (null == yyColumn.chunk4.fBinaryExponent)
11519: yyColumn.chunk4.fBinaryExponent = pBinaryExponent$1(yyStart);
11520: return yyColumn.chunk4.fBinaryExponent;
11521: }
11522:
11523: /** Actually parse xtc.lang.CConstant.BinaryExponent. */
11524: private Result pBinaryExponent$1(final int yyStart)
11525: throws IOException {
11526: int yyC;
11527: int yyIndex;
11528: Result yyResult;
11529: int yyOption1;
11530: Void yyValue;
11531: ParseError yyError = ParseError.DUMMY;
11532:
11533: // Alternative 1.
11534:
11535: yyC = character(yyStart);
11536: if (-1 != yyC) {
11537: yyIndex = yyStart + 1;
11538:
11539: switch (yyC) {
11540: case 'P':
11541: case 'p': {
11542: yyOption1 = yyIndex;
11543:
11544: yyC = character(yyOption1);
11545: if (-1 != yyC) {
11546: yyIndex = yyOption1 + 1;
11547:
11548: switch (yyC) {
11549: case '+':
11550: case '-': {
11551: yyOption1 = yyIndex;
11552: }
11553:
11554: default:
11555: /* No match. */
11556: }
11557: }
11558:
11559: yyResult = p$$Shared2(yyOption1);
11560: yyError = yyResult.select(yyError);
11561: if (yyResult.hasValue()) {
11562:
11563: yyValue = null;
11564:
11565: return yyResult.createValue(yyValue, yyError);
11566: }
11567: }
11568: break;
11569:
11570: default:
11571: /* No match. */
11572: }
11573: }
11574:
11575: // Done.
11576: yyError = yyError.select("binary exponent expected", yyStart);
11577: return yyError;
11578: }
11579:
11580: // =========================================================================
11581:
11582: /**
11583: * Parse nonterminal xtc.lang.CConstant.CharacterConstant.
11584: *
11585: * @param yyStart The index.
11586: * @return The result.
11587: * @throws IOException Signals an I/O error.
11588: */
11589: private Result pCharacterConstant(final int yyStart)
11590: throws IOException {
11591: Result yyResult;
11592: Node yyValue;
11593: ParseError yyError = ParseError.DUMMY;
11594:
11595: // Alternative 1.
11596:
11597: yyResult = pWideCharacterLiteral(yyStart);
11598: yyError = yyResult.select(yyError);
11599: if (yyResult.hasValue()) {
11600: final String v$g$1 = yyResult.semanticValue();
11601:
11602: yyResult = pSpacing(yyResult.index);
11603: yyError = yyResult.select(yyError);
11604: if (yyResult.hasValue()) {
11605:
11606: yyValue = GNode.create("CharacterConstant", v$g$1);
11607: yyValue.setLocation(location(yyStart));
11608:
11609: return yyResult.createValue(yyValue, yyError);
11610: }
11611: }
11612:
11613: // Alternative 2.
11614:
11615: yyResult = pCharacterLiteral(yyStart);
11616: yyError = yyResult.select(yyError);
11617: if (yyResult.hasValue()) {
11618: final String v$g$2 = yyResult.semanticValue();
11619:
11620: yyResult = pSpacing(yyResult.index);
11621: yyError = yyResult.select(yyError);
11622: if (yyResult.hasValue()) {
11623:
11624: yyValue = GNode.create("CharacterConstant", v$g$2);
11625: yyValue.setLocation(location(yyStart));
11626:
11627: return yyResult.createValue(yyValue, yyError);
11628: }
11629: }
11630:
11631: // Done.
11632: return yyError;
11633: }
11634:
11635: // =========================================================================
11636:
11637: /**
11638: * Parse nonterminal xtc.lang.CConstant.WideCharacterLiteral.
11639: *
11640: * @param yyStart The index.
11641: * @return The result.
11642: * @throws IOException Signals an I/O error.
11643: */
11644: private Result pWideCharacterLiteral(final int yyStart)
11645: throws IOException {
11646: int yyC;
11647: int yyIndex;
11648: Result yyResult;
11649: String yyValue;
11650: ParseError yyError = ParseError.DUMMY;
11651:
11652: // Alternative 1.
11653:
11654: yyC = character(yyStart);
11655: if ('L' == yyC) {
11656: yyIndex = yyStart + 1;
11657:
11658: yyResult = pCharacterLiteral(yyIndex);
11659: yyError = yyResult.select(yyError);
11660: if (yyResult.hasValue()) {
11661:
11662: yyValue = difference(yyStart, yyResult.index);
11663:
11664: return yyResult.createValue(yyValue, yyError);
11665: }
11666: }
11667:
11668: // Done.
11669: yyError = yyError.select("wide character literal expected",
11670: yyStart);
11671: return yyError;
11672: }
11673:
11674: // =========================================================================
11675:
11676: /**
11677: * Parse nonterminal xtc.lang.CConstant.CharacterLiteral.
11678: *
11679: * @param yyStart The index.
11680: * @return The result.
11681: * @throws IOException Signals an I/O error.
11682: */
11683: private Result pCharacterLiteral(final int yyStart)
11684: throws IOException {
11685: CParserColumn yyColumn = (CParserColumn) column(yyStart);
11686: if (null == yyColumn.chunk4)
11687: yyColumn.chunk4 = new Chunk4();
11688: if (null == yyColumn.chunk4.fCharacterLiteral)
11689: yyColumn.chunk4.fCharacterLiteral = pCharacterLiteral$1(yyStart);
11690: return yyColumn.chunk4.fCharacterLiteral;
11691: }
11692:
11693: /** Actually parse xtc.lang.CConstant.CharacterLiteral. */
11694: private Result pCharacterLiteral$1(final int yyStart)
11695: throws IOException {
11696: int yyC;
11697: int yyIndex;
11698: Result yyResult;
11699: String yyValue;
11700: ParseError yyError = ParseError.DUMMY;
11701:
11702: // Alternative 1.
11703:
11704: yyC = character(yyStart);
11705: if ('\'' == yyC) {
11706: yyIndex = yyStart + 1;
11707:
11708: yyResult = pCharacterLiteral$$Plus1(yyIndex);
11709: yyError = yyResult.select(yyError);
11710: if (yyResult.hasValue()) {
11711:
11712: yyC = character(yyResult.index);
11713: if ('\'' == yyC) {
11714: yyIndex = yyResult.index + 1;
11715:
11716: yyValue = difference(yyStart, yyIndex);
11717:
11718: return new SemanticValue(yyValue, yyIndex, yyError);
11719: }
11720: }
11721: }
11722:
11723: // Done.
11724: yyError = yyError.select("character literal expected", yyStart);
11725: return yyError;
11726: }
11727:
11728: // =========================================================================
11729:
11730: /**
11731: * Parse synthetic nonterminal xtc.lang.C.CharacterLiteral$$Plus1.
11732: *
11733: * @param yyStart The index.
11734: * @return The result.
11735: * @throws IOException Signals an I/O error.
11736: */
11737: private Result pCharacterLiteral$$Plus1(final int yyStart)
11738: throws IOException {
11739:
11740: CParserColumn yyColumn = (CParserColumn) column(yyStart);
11741: if (null == yyColumn.chunk4)
11742: yyColumn.chunk4 = new Chunk4();
11743: if (null == yyColumn.chunk4.fCharacterLiteral$$Plus1)
11744: yyColumn.chunk4.fCharacterLiteral$$Plus1 = pCharacterLiteral$$Plus1$1(yyStart);
11745: return yyColumn.chunk4.fCharacterLiteral$$Plus1;
11746: }
11747:
11748: /** Actually parse xtc.lang.C.CharacterLiteral$$Plus1. */
11749: private Result pCharacterLiteral$$Plus1$1(final int yyStart)
11750: throws IOException {
11751:
11752: int yyC;
11753: int yyIndex;
11754: Result yyResult;
11755: Void yyValue;
11756: ParseError yyError = ParseError.DUMMY;
11757:
11758: // Alternative 1.
11759:
11760: yyResult = pEscapeCharacter(yyStart);
11761: yyError = yyResult.select(yyError);
11762: if (yyResult.hasValue()) {
11763:
11764: yyResult = pCharacterLiteral$$Plus1(yyResult.index);
11765: yyError = yyResult.select(yyError);
11766: if (yyResult.hasValue()) {
11767:
11768: yyValue = null;
11769:
11770: return yyResult.createValue(yyValue, yyError);
11771: }
11772: }
11773:
11774: // Alternative 2.
11775:
11776: yyC = character(yyStart);
11777: if (-1 != yyC) {
11778: yyIndex = yyStart + 1;
11779:
11780: switch (yyC) {
11781: case '\n':
11782: case '\r':
11783: case '\'':
11784: case '\\':
11785: /* No match. */
11786: break;
11787:
11788: default: {
11789: yyResult = pCharacterLiteral$$Plus1(yyIndex);
11790: yyError = yyResult.select(yyError);
11791: if (yyResult.hasValue()) {
11792:
11793: yyValue = null;
11794:
11795: return yyResult.createValue(yyValue, yyError);
11796: }
11797: }
11798: }
11799: }
11800:
11801: // Alternative 3.
11802:
11803: yyC = character(yyStart);
11804: if (-1 != yyC) {
11805: yyIndex = yyStart + 1;
11806:
11807: switch (yyC) {
11808: case '\\': {
11809: final int yyChoice1 = yyIndex;
11810:
11811: // Nested alternative 1.
11812:
11813: yyResult = pEscapeCode(yyChoice1);
11814: yyError = yyResult.select(yyError);
11815: if (yyResult.hasValue()) {
11816:
11817: yyValue = null;
11818:
11819: return yyResult.createValue(yyValue, yyError);
11820: }
11821:
11822: // Nested alternative 2.
11823:
11824: yyC = character(yyChoice1);
11825: if (-1 != yyC) {
11826: yyIndex = yyChoice1 + 1;
11827:
11828: switch (yyC) {
11829: case 'u': {
11830: yyResult = pHexQuad(yyIndex);
11831: yyError = yyResult.select(yyError);
11832: if (yyResult.hasValue()) {
11833:
11834: yyValue = null;
11835:
11836: return yyResult.createValue(yyValue,
11837: yyError);
11838: }
11839: }
11840: break;
11841:
11842: case 'U': {
11843: yyResult = pHexQuad(yyIndex);
11844: yyError = yyResult.select(yyError);
11845: if (yyResult.hasValue()) {
11846:
11847: yyResult = pHexQuad(yyResult.index);
11848: yyError = yyResult.select(yyError);
11849: if (yyResult.hasValue()) {
11850:
11851: yyValue = null;
11852:
11853: return yyResult.createValue(yyValue,
11854: yyError);
11855: }
11856: }
11857: }
11858: break;
11859:
11860: default:
11861: /* No match. */
11862: }
11863: }
11864: }
11865: break;
11866:
11867: default:
11868: /* No match. */
11869: }
11870: }
11871:
11872: // Alternative 4.
11873:
11874: yyC = character(yyStart);
11875: if (-1 != yyC) {
11876: yyIndex = yyStart + 1;
11877:
11878: switch (yyC) {
11879: case '\n':
11880: case '\r':
11881: case '\'':
11882: case '\\':
11883: /* No match. */
11884: break;
11885:
11886: default: {
11887: yyValue = null;
11888:
11889: return new SemanticValue(yyValue, yyIndex, yyError);
11890: }
11891: }
11892: }
11893:
11894: // Done.
11895: yyError = yyError.select("character literal expected", yyStart);
11896: return yyError;
11897: }
11898:
11899: // =========================================================================
11900:
11901: /**
11902: * Parse nonterminal xtc.lang.CConstant.StringConstant.
11903: *
11904: * @param yyStart The index.
11905: * @return The result.
11906: * @throws IOException Signals an I/O error.
11907: */
11908: private Result pStringConstant(final int yyStart)
11909: throws IOException {
11910: CParserColumn yyColumn = (CParserColumn) column(yyStart);
11911: if (null == yyColumn.chunk4)
11912: yyColumn.chunk4 = new Chunk4();
11913: if (null == yyColumn.chunk4.fStringConstant)
11914: yyColumn.chunk4.fStringConstant = pStringConstant$1(yyStart);
11915: return yyColumn.chunk4.fStringConstant;
11916: }
11917:
11918: /** Actually parse xtc.lang.CConstant.StringConstant. */
11919: private Result pStringConstant$1(final int yyStart)
11920: throws IOException {
11921: Result yyResult;
11922: Node yyValue;
11923: ParseError yyError = ParseError.DUMMY;
11924:
11925: // Alternative 1.
11926:
11927: yyResult = pStringConstant$$Plus1(yyStart);
11928: yyError = yyResult.select(yyError);
11929: if (yyResult.hasValue()) {
11930: final Pair<String> v$g$1 = yyResult.semanticValue();
11931:
11932: yyValue = GNode.createFromPair("StringConstant", v$g$1);
11933: yyValue.setLocation(location(yyStart));
11934:
11935: return yyResult.createValue(yyValue, yyError);
11936: }
11937:
11938: // Done.
11939: return yyError;
11940: }
11941:
11942: // =========================================================================
11943:
11944: /**
11945: * Parse synthetic nonterminal xtc.lang.C.StringConstant$$Choice1.
11946: *
11947: * @param yyStart The index.
11948: * @return The result.
11949: * @throws IOException Signals an I/O error.
11950: */
11951: private Result pStringConstant$$Choice1(final int yyStart)
11952: throws IOException {
11953:
11954: Result yyResult;
11955: String yyValue;
11956: ParseError yyError = ParseError.DUMMY;
11957:
11958: // Alternative 1.
11959:
11960: yyResult = pWideStringLiteral(yyStart);
11961: yyError = yyResult.select(yyError);
11962: if (yyResult.hasValue()) {
11963: yyValue = yyResult.semanticValue();
11964:
11965: yyResult = pSpacing(yyResult.index);
11966: yyError = yyResult.select(yyError);
11967: if (yyResult.hasValue()) {
11968:
11969: return yyResult.createValue(yyValue, yyError);
11970: }
11971: }
11972:
11973: // Alternative 2.
11974:
11975: yyResult = pStringLiteral(yyStart);
11976: yyError = yyResult.select(yyError);
11977: if (yyResult.hasValue()) {
11978: yyValue = yyResult.semanticValue();
11979:
11980: yyResult = pSpacing(yyResult.index);
11981: yyError = yyResult.select(yyError);
11982: if (yyResult.hasValue()) {
11983:
11984: return yyResult.createValue(yyValue, yyError);
11985: }
11986: }
11987:
11988: // Done.
11989: return yyError;
11990: }
11991:
11992: // =========================================================================
11993:
11994: /**
11995: * Parse synthetic nonterminal xtc.lang.C.StringConstant$$Plus1.
11996: *
11997: * @param yyStart The index.
11998: * @return The result.
11999: * @throws IOException Signals an I/O error.
12000: */
12001: private Result pStringConstant$$Plus1(final int yyStart)
12002: throws IOException {
12003:
12004: CParserColumn yyColumn = (CParserColumn) column(yyStart);
12005: if (null == yyColumn.chunk4)
12006: yyColumn.chunk4 = new Chunk4();
12007: if (null == yyColumn.chunk4.fStringConstant$$Plus1)
12008: yyColumn.chunk4.fStringConstant$$Plus1 = pStringConstant$$Plus1$1(yyStart);
12009: return yyColumn.chunk4.fStringConstant$$Plus1;
12010: }
12011:
12012: /** Actually parse xtc.lang.C.StringConstant$$Plus1. */
12013: private Result pStringConstant$$Plus1$1(final int yyStart)
12014: throws IOException {
12015:
12016: Result yyResult;
12017: Pair<String> yyValue;
12018: ParseError yyError = ParseError.DUMMY;
12019:
12020: // Alternative 1.
12021:
12022: yyResult = pStringConstant$$Choice1(yyStart);
12023: yyError = yyResult.select(yyError);
12024: if (yyResult.hasValue()) {
12025: final String v$el$1 = yyResult.semanticValue();
12026:
12027: final int yyChoice1 = yyResult.index;
12028:
12029: // Nested alternative 1.
12030:
12031: yyResult = pStringConstant$$Plus1(yyChoice1);
12032: yyError = yyResult.select(yyError);
12033: if (yyResult.hasValue()) {
12034: final Pair<String> v$4 = yyResult.semanticValue();
12035:
12036: yyValue = new Pair<String>(v$el$1, v$4);
12037:
12038: return yyResult.createValue(yyValue, yyError);
12039: }
12040:
12041: // Nested alternative 2.
12042:
12043: yyValue = new Pair<String>(v$el$1);
12044:
12045: return new SemanticValue(yyValue, yyChoice1, yyError);
12046: }
12047:
12048: // Done.
12049: return yyError;
12050: }
12051:
12052: // =========================================================================
12053:
12054: /**
12055: * Parse nonterminal xtc.lang.CConstant.WideStringLiteral.
12056: *
12057: * @param yyStart The index.
12058: * @return The result.
12059: * @throws IOException Signals an I/O error.
12060: */
12061: private Result pWideStringLiteral(final int yyStart)
12062: throws IOException {
12063: int yyC;
12064: int yyIndex;
12065: Result yyResult;
12066: String yyValue;
12067: ParseError yyError = ParseError.DUMMY;
12068:
12069: // Alternative 1.
12070:
12071: yyC = character(yyStart);
12072: if ('L' == yyC) {
12073: yyIndex = yyStart + 1;
12074:
12075: yyResult = pStringLiteral(yyIndex);
12076: yyError = yyResult.select(yyError);
12077: if (yyResult.hasValue()) {
12078:
12079: yyValue = difference(yyStart, yyResult.index);
12080:
12081: return yyResult.createValue(yyValue, yyError);
12082: }
12083: }
12084:
12085: // Done.
12086: yyError = yyError.select("wide string literal expected",
12087: yyStart);
12088: return yyError;
12089: }
12090:
12091: // =========================================================================
12092:
12093: /**
12094: * Parse nonterminal xtc.lang.CConstant.StringLiteral.
12095: *
12096: * @param yyStart The index.
12097: * @return The result.
12098: * @throws IOException Signals an I/O error.
12099: */
12100: private Result pStringLiteral(final int yyStart) throws IOException {
12101: CParserColumn yyColumn = (CParserColumn) column(yyStart);
12102: if (null == yyColumn.chunk4)
12103: yyColumn.chunk4 = new Chunk4();
12104: if (null == yyColumn.chunk4.fStringLiteral)
12105: yyColumn.chunk4.fStringLiteral = pStringLiteral$1(yyStart);
12106: return yyColumn.chunk4.fStringLiteral;
12107: }
12108:
12109: /** Actually parse xtc.lang.CConstant.StringLiteral. */
12110: private Result pStringLiteral$1(final int yyStart)
12111: throws IOException {
12112: int yyC;
12113: int yyIndex;
12114: Result yyResult;
12115: String yyValue;
12116: ParseError yyError = ParseError.DUMMY;
12117:
12118: // Alternative 1.
12119:
12120: yyC = character(yyStart);
12121: if ('\"' == yyC) {
12122: yyIndex = yyStart + 1;
12123:
12124: yyResult = pStringLiteral$$Star1(yyIndex);
12125: yyError = yyResult.select(yyError);
12126: if (yyResult.hasValue()) {
12127:
12128: yyC = character(yyResult.index);
12129: if ('\"' == yyC) {
12130: yyIndex = yyResult.index + 1;
12131:
12132: yyValue = difference(yyStart, yyIndex);
12133:
12134: return new SemanticValue(yyValue, yyIndex, yyError);
12135: }
12136: }
12137: }
12138:
12139: // Done.
12140: yyError = yyError.select("string literal expected", yyStart);
12141: return yyError;
12142: }
12143:
12144: // =========================================================================
12145:
12146: /**
12147: * Parse synthetic nonterminal xtc.lang.C.StringLiteral$$Star1.
12148: *
12149: * @param yyStart The index.
12150: * @return The result.
12151: * @throws IOException Signals an I/O error.
12152: */
12153: private Result pStringLiteral$$Star1(final int yyStart)
12154: throws IOException {
12155: CParserColumn yyColumn = (CParserColumn) column(yyStart);
12156: if (null == yyColumn.chunk4)
12157: yyColumn.chunk4 = new Chunk4();
12158: if (null == yyColumn.chunk4.fStringLiteral$$Star1)
12159: yyColumn.chunk4.fStringLiteral$$Star1 = pStringLiteral$$Star1$1(yyStart);
12160: return yyColumn.chunk4.fStringLiteral$$Star1;
12161: }
12162:
12163: /** Actually parse xtc.lang.C.StringLiteral$$Star1. */
12164: private Result pStringLiteral$$Star1$1(final int yyStart)
12165: throws IOException {
12166:
12167: int yyC;
12168: int yyIndex;
12169: Result yyResult;
12170: Void yyValue;
12171: ParseError yyError = ParseError.DUMMY;
12172:
12173: // Alternative 1.
12174:
12175: yyResult = pEscapeCharacter(yyStart);
12176: yyError = yyResult.select(yyError);
12177: if (yyResult.hasValue()) {
12178:
12179: yyResult = pStringLiteral$$Star1(yyResult.index);
12180: yyError = yyResult.select(yyError);
12181: if (yyResult.hasValue()) {
12182:
12183: yyValue = null;
12184:
12185: return yyResult.createValue(yyValue, yyError);
12186: }
12187: }
12188:
12189: // Alternative 2.
12190:
12191: yyC = character(yyStart);
12192: if (-1 != yyC) {
12193: yyIndex = yyStart + 1;
12194:
12195: switch (yyC) {
12196: case '\n':
12197: case '\r':
12198: case '\"':
12199: case '\\':
12200: /* No match. */
12201: break;
12202:
12203: default: {
12204: yyResult = pStringLiteral$$Star1(yyIndex);
12205: yyError = yyResult.select(yyError);
12206: if (yyResult.hasValue()) {
12207:
12208: yyValue = null;
12209:
12210: return yyResult.createValue(yyValue, yyError);
12211: }
12212: }
12213: }
12214: }
12215:
12216: // Alternative 3.
12217:
12218: yyValue = null;
12219:
12220: return new SemanticValue(yyValue, yyStart, yyError);
12221: }
12222:
12223: // =========================================================================
12224:
12225: /**
12226: * Parse nonterminal xtc.lang.CConstant.EscapeCharacter.
12227: *
12228: * @param yyStart The index.
12229: * @return The result.
12230: * @throws IOException Signals an I/O error.
12231: */
12232: private Result pEscapeCharacter(final int yyStart)
12233: throws IOException {
12234: int yyC;
12235: int yyIndex;
12236: Result yyResult;
12237: Void yyValue;
12238: ParseError yyError = ParseError.DUMMY;
12239:
12240: // Alternative 1.
12241:
12242: yyC = character(yyStart);
12243: if (-1 != yyC) {
12244: yyIndex = yyStart + 1;
12245: if ('\\' == yyC) {
12246:
12247: final int yyChoice1 = yyIndex;
12248:
12249: // Nested alternative 1.
12250:
12251: yyResult = pEscapeCode(yyChoice1);
12252: yyError = yyResult.select(yyError);
12253: if (yyResult.hasValue()) {
12254:
12255: yyValue = null;
12256:
12257: return yyResult.createValue(yyValue, yyError);
12258: }
12259:
12260: // Nested alternative 2.
12261:
12262: yyC = character(yyChoice1);
12263: if (-1 != yyC) {
12264: yyIndex = yyChoice1 + 1;
12265:
12266: switch (yyC) {
12267: case 'u': {
12268: yyResult = pHexQuad(yyIndex);
12269: yyError = yyResult.select(yyError);
12270: if (yyResult.hasValue()) {
12271:
12272: yyValue = null;
12273:
12274: return yyResult.createValue(yyValue,
12275: yyError);
12276: }
12277: }
12278: break;
12279:
12280: case 'U': {
12281: yyResult = pHexQuad(yyIndex);
12282: yyError = yyResult.select(yyError);
12283: if (yyResult.hasValue()) {
12284:
12285: yyResult = pHexQuad(yyResult.index);
12286: yyError = yyResult.select(yyError);
12287: if (yyResult.hasValue()) {
12288:
12289: yyValue = null;
12290:
12291: return yyResult.createValue(yyValue,
12292: yyError);
12293: }
12294: }
12295: }
12296: break;
12297:
12298: default:
12299: /* No match. */
12300: }
12301: }
12302: }
12303: }
12304:
12305: // Done.
12306: yyError = yyError.select("escape character expected", yyStart);
12307: return yyError;
12308: }
12309:
12310: // =========================================================================
12311:
12312: /**
12313: * Parse nonterminal xtc.lang.CConstant.EscapeCode.
12314: *
12315: * @param yyStart The index.
12316: * @return The result.
12317: * @throws IOException Signals an I/O error.
12318: */
12319: private Result pEscapeCode(final int yyStart) throws IOException {
12320: int yyC;
12321: int yyIndex;
12322: int yyRepetition1;
12323: boolean yyRepeated1;
12324: Void yyValue;
12325: ParseError yyError = ParseError.DUMMY;
12326:
12327: // Alternative 1.
12328:
12329: yyC = character(yyStart);
12330: if (-1 != yyC) {
12331: yyIndex = yyStart + 1;
12332:
12333: switch (yyC) {
12334: case '\"':
12335: case '\'':
12336: case '?':
12337: case '\\':
12338: case 'a':
12339: case 'b':
12340: case 'f':
12341: case 'n':
12342: case 'r':
12343: case 't':
12344: case 'v': {
12345: yyValue = null;
12346:
12347: return new SemanticValue(yyValue, yyIndex, yyError);
12348: }
12349:
12350: case '0':
12351: case '1':
12352: case '2':
12353: case '3':
12354: case '4':
12355: case '5':
12356: case '6':
12357: case '7': {
12358: final int yyChoice1 = yyIndex;
12359:
12360: // Nested alternative 1.
12361:
12362: yyC = character(yyChoice1);
12363: if (-1 != yyC) {
12364: yyIndex = yyChoice1 + 1;
12365:
12366: switch (yyC) {
12367: case '0':
12368: case '1':
12369: case '2':
12370: case '3':
12371: case '4':
12372: case '5':
12373: case '6':
12374: case '7': {
12375: final int yyChoice2 = yyIndex;
12376:
12377: // Nested alternative 1.
12378:
12379: yyC = character(yyChoice2);
12380: if (-1 != yyC) {
12381: yyIndex = yyChoice2 + 1;
12382:
12383: switch (yyC) {
12384: case '0':
12385: case '1':
12386: case '2':
12387: case '3':
12388: case '4':
12389: case '5':
12390: case '6':
12391: case '7': {
12392: yyValue = null;
12393:
12394: return new SemanticValue(yyValue,
12395: yyIndex, yyError);
12396: }
12397:
12398: default:
12399: /* No match. */
12400: }
12401: }
12402:
12403: // Nested alternative 2.
12404:
12405: yyValue = null;
12406:
12407: return new SemanticValue(yyValue, yyChoice2,
12408: yyError);
12409: }
12410:
12411: default:
12412: /* No match. */
12413: }
12414: }
12415:
12416: // Nested alternative 2.
12417:
12418: yyValue = null;
12419:
12420: return new SemanticValue(yyValue, yyChoice1, yyError);
12421: }
12422:
12423: case 'x': {
12424: yyRepetition1 = yyIndex;
12425: yyRepeated1 = false;
12426: while (true) {
12427:
12428: yyC = character(yyRepetition1);
12429: if (-1 != yyC) {
12430: yyIndex = yyRepetition1 + 1;
12431:
12432: switch (yyC) {
12433: case '0':
12434: case '1':
12435: case '2':
12436: case '3':
12437: case '4':
12438: case '5':
12439: case '6':
12440: case '7':
12441: case '8':
12442: case '9':
12443: case 'A':
12444: case 'B':
12445: case 'C':
12446: case 'D':
12447: case 'E':
12448: case 'F':
12449: case 'a':
12450: case 'b':
12451: case 'c':
12452: case 'd':
12453: case 'e':
12454: case 'f': {
12455: yyRepetition1 = yyIndex;
12456: yyRepeated1 = true;
12457: continue;
12458: }
12459:
12460: default:
12461: /* No match. */
12462: }
12463: }
12464: break;
12465: }
12466:
12467: if (yyRepeated1) {
12468:
12469: yyValue = null;
12470:
12471: return new SemanticValue(yyValue, yyRepetition1,
12472: yyError);
12473: }
12474: }
12475: break;
12476:
12477: default:
12478: /* No match. */
12479: }
12480: }
12481:
12482: // Done.
12483: yyError = yyError.select("escape code expected", yyStart);
12484: return yyError;
12485: }
12486:
12487: // =========================================================================
12488:
12489: /**
12490: * Parse nonterminal xtc.lang.CConstant.HexQuad.
12491: *
12492: * @param yyStart The index.
12493: * @return The result.
12494: * @throws IOException Signals an I/O error.
12495: */
12496: private Result pHexQuad(final int yyStart) throws IOException {
12497: int yyC;
12498: int yyIndex;
12499: Void yyValue;
12500: ParseError yyError = ParseError.DUMMY;
12501:
12502: // Alternative 1.
12503:
12504: yyC = character(yyStart);
12505: if (-1 != yyC) {
12506: yyIndex = yyStart + 1;
12507:
12508: switch (yyC) {
12509: case '0':
12510: case '1':
12511: case '2':
12512: case '3':
12513: case '4':
12514: case '5':
12515: case '6':
12516: case '7':
12517: case '8':
12518: case '9':
12519: case 'A':
12520: case 'B':
12521: case 'C':
12522: case 'D':
12523: case 'E':
12524: case 'F':
12525: case 'a':
12526: case 'b':
12527: case 'c':
12528: case 'd':
12529: case 'e':
12530: case 'f': {
12531: yyC = character(yyIndex);
12532: if (-1 != yyC) {
12533: yyIndex = yyIndex + 1;
12534:
12535: switch (yyC) {
12536: case '0':
12537: case '1':
12538: case '2':
12539: case '3':
12540: case '4':
12541: case '5':
12542: case '6':
12543: case '7':
12544: case '8':
12545: case '9':
12546: case 'A':
12547: case 'B':
12548: case 'C':
12549: case 'D':
12550: case 'E':
12551: case 'F':
12552: case 'a':
12553: case 'b':
12554: case 'c':
12555: case 'd':
12556: case 'e':
12557: case 'f': {
12558: yyC = character(yyIndex);
12559: if (-1 != yyC) {
12560: yyIndex = yyIndex + 1;
12561:
12562: switch (yyC) {
12563: case '0':
12564: case '1':
12565: case '2':
12566: case '3':
12567: case '4':
12568: case '5':
12569: case '6':
12570: case '7':
12571: case '8':
12572: case '9':
12573: case 'A':
12574: case 'B':
12575: case 'C':
12576: case 'D':
12577: case 'E':
12578: case 'F':
12579: case 'a':
12580: case 'b':
12581: case 'c':
12582: case 'd':
12583: case 'e':
12584: case 'f': {
12585: yyC = character(yyIndex);
12586: if (-1 != yyC) {
12587: yyIndex = yyIndex + 1;
12588:
12589: switch (yyC) {
12590: case '0':
12591: case '1':
12592: case '2':
12593: case '3':
12594: case '4':
12595: case '5':
12596: case '6':
12597: case '7':
12598: case '8':
12599: case '9':
12600: case 'A':
12601: case 'B':
12602: case 'C':
12603: case 'D':
12604: case 'E':
12605: case 'F':
12606: case 'a':
12607: case 'b':
12608: case 'c':
12609: case 'd':
12610: case 'e':
12611: case 'f': {
12612: yyValue = null;
12613:
12614: return new SemanticValue(
12615: yyValue, yyIndex,
12616: yyError);
12617: }
12618:
12619: default:
12620: /* No match. */
12621: }
12622: }
12623: }
12624: break;
12625:
12626: default:
12627: /* No match. */
12628: }
12629: }
12630: }
12631: break;
12632:
12633: default:
12634: /* No match. */
12635: }
12636: }
12637: }
12638: break;
12639:
12640: default:
12641: /* No match. */
12642: }
12643: }
12644:
12645: // Done.
12646: yyError = yyError.select("hex quad expected", yyStart);
12647: return yyError;
12648: }
12649:
12650: // =========================================================================
12651:
12652: /**
12653: * Parse nonterminal xtc.lang.CIdentifier.Identifier.
12654: *
12655: * @param yyStart The index.
12656: * @return The result.
12657: * @throws IOException Signals an I/O error.
12658: */
12659: private Result pIdentifier(final int yyStart) throws IOException {
12660: CParserColumn yyColumn = (CParserColumn) column(yyStart);
12661: if (null == yyColumn.chunk4)
12662: yyColumn.chunk4 = new Chunk4();
12663: if (null == yyColumn.chunk4.fIdentifier)
12664: yyColumn.chunk4.fIdentifier = pIdentifier$1(yyStart);
12665: return yyColumn.chunk4.fIdentifier;
12666: }
12667:
12668: /** Actually parse xtc.lang.CIdentifier.Identifier. */
12669: private Result pIdentifier$1(final int yyStart) throws IOException {
12670: Result yyResult;
12671: String yyValue;
12672: ParseError yyError = ParseError.DUMMY;
12673:
12674: // Alternative 1.
12675:
12676: yyResult = pWord(yyStart);
12677: yyError = yyResult.select(yyError);
12678: if (yyResult.hasValue()) {
12679: yyValue = yyResult.semanticValue();
12680:
12681: if (!contains(C_KEYWORDS, toText(yyValue))) {
12682:
12683: return yyResult.createValue(yyValue, yyError);
12684: }
12685: }
12686:
12687: // Done.
12688: yyError = yyError.select("identifier expected", yyStart);
12689: return yyError;
12690: }
12691:
12692: // =========================================================================
12693:
12694: /**
12695: * Parse nonterminal xtc.lang.CIdentifier.Keyword.
12696: *
12697: * @param yyStart The index.
12698: * @return The result.
12699: * @throws IOException Signals an I/O error.
12700: */
12701: private Result pKeyword(final int yyStart) throws IOException {
12702: CParserColumn yyColumn = (CParserColumn) column(yyStart);
12703: if (null == yyColumn.chunk4)
12704: yyColumn.chunk4 = new Chunk4();
12705: if (null == yyColumn.chunk4.fKeyword)
12706: yyColumn.chunk4.fKeyword = pKeyword$1(yyStart);
12707: return yyColumn.chunk4.fKeyword;
12708: }
12709:
12710: /** Actually parse xtc.lang.CIdentifier.Keyword. */
12711: private Result pKeyword$1(final int yyStart) throws IOException {
12712: Result yyResult;
12713: String yyValue;
12714: ParseError yyError = ParseError.DUMMY;
12715:
12716: // Alternative 1.
12717:
12718: yyResult = pWord(yyStart);
12719: yyError = yyResult.select(yyError);
12720: if (yyResult.hasValue()) {
12721: yyValue = yyResult.semanticValue();
12722:
12723: if (contains(C_KEYWORDS, toText(yyValue))) {
12724:
12725: return yyResult.createValue(yyValue, yyError);
12726: }
12727: }
12728:
12729: // Done.
12730: yyError = yyError.select("keyword expected", yyStart);
12731: return yyError;
12732: }
12733:
12734: // =========================================================================
12735:
12736: /**
12737: * Parse nonterminal xtc.lang.CIdentifier.Word.
12738: *
12739: * @param yyStart The index.
12740: * @return The result.
12741: * @throws IOException Signals an I/O error.
12742: */
12743: private Result pWord(final int yyStart) throws IOException {
12744: CParserColumn yyColumn = (CParserColumn) column(yyStart);
12745: if (null == yyColumn.chunk4)
12746: yyColumn.chunk4 = new Chunk4();
12747: if (null == yyColumn.chunk4.fWord)
12748: yyColumn.chunk4.fWord = pWord$1(yyStart);
12749: return yyColumn.chunk4.fWord;
12750: }
12751:
12752: /** Actually parse xtc.lang.CIdentifier.Word. */
12753: private Result pWord$1(final int yyStart) throws IOException {
12754: Result yyResult;
12755: String yyValue;
12756: ParseError yyError = ParseError.DUMMY;
12757:
12758: // Alternative 1.
12759:
12760: yyResult = pWordCharacters(yyStart);
12761: yyError = yyResult.select(yyError);
12762: if (yyResult.hasValue()) {
12763: yyValue = yyResult.semanticValue();
12764:
12765: yyResult = pSpacing(yyResult.index);
12766: yyError = yyResult.select(yyError);
12767: if (yyResult.hasValue()) {
12768:
12769: return yyResult.createValue(yyValue, yyError);
12770: }
12771: }
12772:
12773: // Done.
12774: return yyError;
12775: }
12776:
12777: // =========================================================================
12778:
12779: /**
12780: * Parse nonterminal xtc.lang.CIdentifier.WordCharacters.
12781: *
12782: * @param yyStart The index.
12783: * @return The result.
12784: * @throws IOException Signals an I/O error.
12785: */
12786: private Result pWordCharacters(final int yyStart)
12787: throws IOException {
12788: int yyC;
12789: int yyIndex;
12790: int yyRepetition1;
12791: String yyValue;
12792: ParseError yyError = ParseError.DUMMY;
12793:
12794: // Alternative 1.
12795:
12796: yyC = character(yyStart);
12797: if (-1 != yyC) {
12798: yyIndex = yyStart + 1;
12799: if ((('A' <= yyC) && (yyC <= 'Z')) || ('_' == yyC)
12800: || (('a' <= yyC) && (yyC <= 'z'))) {
12801:
12802: yyRepetition1 = yyIndex;
12803: while (true) {
12804:
12805: yyC = character(yyRepetition1);
12806: if (-1 != yyC) {
12807: yyIndex = yyRepetition1 + 1;
12808: if ((('0' <= yyC) && (yyC <= '9'))
12809: || (('A' <= yyC) && (yyC <= 'Z'))
12810: || ('_' == yyC)
12811: || (('a' <= yyC) && (yyC <= 'z'))) {
12812:
12813: yyRepetition1 = yyIndex;
12814: continue;
12815: }
12816: }
12817: break;
12818: }
12819:
12820: yyValue = difference(yyStart, yyRepetition1);
12821:
12822: return new SemanticValue(yyValue, yyRepetition1,
12823: yyError);
12824: }
12825: }
12826:
12827: // Done.
12828: yyError = yyError.select("word characters expected", yyStart);
12829: return yyError;
12830: }
12831:
12832: // =========================================================================
12833:
12834: /**
12835: * Parse nonterminal xtc.lang.CSymbol.Symbol.
12836: *
12837: * @param yyStart The index.
12838: * @return The result.
12839: * @throws IOException Signals an I/O error.
12840: */
12841: private Result pSymbol(final int yyStart) throws IOException {
12842: CParserColumn yyColumn = (CParserColumn) column(yyStart);
12843: if (null == yyColumn.chunk5)
12844: yyColumn.chunk5 = new Chunk5();
12845: if (null == yyColumn.chunk5.fSymbol)
12846: yyColumn.chunk5.fSymbol = pSymbol$1(yyStart);
12847: return yyColumn.chunk5.fSymbol;
12848: }
12849:
12850: /** Actually parse xtc.lang.CSymbol.Symbol. */
12851: private Result pSymbol$1(final int yyStart) throws IOException {
12852: Result yyResult;
12853: String yyValue;
12854: ParseError yyError = ParseError.DUMMY;
12855:
12856: // Alternative 1.
12857:
12858: yyResult = pSymbolCharacters(yyStart);
12859: yyError = yyResult.select(yyError);
12860: if (yyResult.hasValue()) {
12861: yyValue = yyResult.semanticValue();
12862:
12863: yyResult = pSpacing(yyResult.index);
12864: yyError = yyResult.select(yyError);
12865: if (yyResult.hasValue()) {
12866:
12867: return yyResult.createValue(yyValue, yyError);
12868: }
12869: }
12870:
12871: // Done.
12872: return yyError;
12873: }
12874:
12875: // =========================================================================
12876:
12877: /**
12878: * Parse nonterminal xtc.lang.CSymbol.SymbolCharacters.
12879: *
12880: * @param yyStart The index.
12881: * @return The result.
12882: * @throws IOException Signals an I/O error.
12883: */
12884: private Result pSymbolCharacters(final int yyStart)
12885: throws IOException {
12886: int yyC;
12887: int yyIndex;
12888: String yyValue;
12889: ParseError yyError = ParseError.DUMMY;
12890:
12891: // Alternative 1.
12892:
12893: yyC = character(yyStart);
12894: if (-1 != yyC) {
12895: yyIndex = yyStart + 1;
12896:
12897: switch (yyC) {
12898: case '>': {
12899: final int yyChoice1 = yyIndex;
12900:
12901: // Nested alternative 1.
12902:
12903: yyC = character(yyChoice1);
12904: if (-1 != yyC) {
12905: yyIndex = yyChoice1 + 1;
12906:
12907: switch (yyC) {
12908: case '>': {
12909: final int yyChoice2 = yyIndex;
12910:
12911: // Nested alternative 1.
12912:
12913: yyC = character(yyChoice2);
12914: if (-1 != yyC) {
12915: yyIndex = yyChoice2 + 1;
12916: if ('=' == yyC) {
12917:
12918: yyValue = ">>=";
12919:
12920: return new SemanticValue(yyValue,
12921: yyIndex, yyError);
12922: }
12923: }
12924:
12925: // Nested alternative 2.
12926:
12927: yyValue = ">>";
12928:
12929: return new SemanticValue(yyValue, yyChoice2,
12930: yyError);
12931: }
12932:
12933: case '=': {
12934: yyValue = ">=";
12935:
12936: return new SemanticValue(yyValue, yyIndex,
12937: yyError);
12938: }
12939:
12940: default:
12941: /* No match. */
12942: }
12943: }
12944:
12945: // Nested alternative 2.
12946:
12947: yyValue = ">";
12948:
12949: return new SemanticValue(yyValue, yyChoice1, yyError);
12950: }
12951:
12952: case '<': {
12953: final int yyChoice1 = yyIndex;
12954:
12955: // Nested alternative 1.
12956:
12957: yyC = character(yyChoice1);
12958: if (-1 != yyC) {
12959: yyIndex = yyChoice1 + 1;
12960:
12961: switch (yyC) {
12962: case '<': {
12963: final int yyChoice2 = yyIndex;
12964:
12965: // Nested alternative 1.
12966:
12967: yyC = character(yyChoice2);
12968: if (-1 != yyC) {
12969: yyIndex = yyChoice2 + 1;
12970: if ('=' == yyC) {
12971:
12972: yyValue = "<<=";
12973:
12974: return new SemanticValue(yyValue,
12975: yyIndex, yyError);
12976: }
12977: }
12978:
12979: // Nested alternative 2.
12980:
12981: yyValue = "<<";
12982:
12983: return new SemanticValue(yyValue, yyChoice2,
12984: yyError);
12985: }
12986:
12987: case '=': {
12988: yyValue = "<=";
12989:
12990: return new SemanticValue(yyValue, yyIndex,
12991: yyError);
12992: }
12993:
12994: default:
12995: /* No match. */
12996: }
12997: }
12998:
12999: // Nested alternative 2.
13000:
13001: yyValue = "<";
13002:
13003: return new SemanticValue(yyValue, yyChoice1, yyError);
13004: }
13005:
13006: case '.': {
13007: final int yyChoice1 = yyIndex;
13008:
13009: // Nested alternative 1.
13010:
13011: yyC = character(yyChoice1);
13012: if (-1 != yyC) {
13013: yyIndex = yyChoice1 + 1;
13014: if ('.' == yyC) {
13015:
13016: yyC = character(yyIndex);
13017: if (-1 != yyC) {
13018: yyIndex = yyIndex + 1;
13019: if ('.' == yyC) {
13020:
13021: yyValue = "...";
13022:
13023: return new SemanticValue(yyValue,
13024: yyIndex, yyError);
13025: }
13026: }
13027: }
13028: }
13029:
13030: // Nested alternative 2.
13031:
13032: yyValue = ".";
13033:
13034: return new SemanticValue(yyValue, yyChoice1, yyError);
13035: }
13036:
13037: case '+': {
13038: final int yyChoice1 = yyIndex;
13039:
13040: // Nested alternative 1.
13041:
13042: yyC = character(yyChoice1);
13043: if (-1 != yyC) {
13044: yyIndex = yyChoice1 + 1;
13045:
13046: switch (yyC) {
13047: case '=': {
13048: yyValue = "+=";
13049:
13050: return new SemanticValue(yyValue, yyIndex,
13051: yyError);
13052: }
13053:
13054: case '+': {
13055: yyValue = "++";
13056:
13057: return new SemanticValue(yyValue, yyIndex,
13058: yyError);
13059: }
13060:
13061: default:
13062: /* No match. */
13063: }
13064: }
13065:
13066: // Nested alternative 2.
13067:
13068: yyValue = "+";
13069:
13070: return new SemanticValue(yyValue, yyChoice1, yyError);
13071: }
13072:
13073: case '-': {
13074: final int yyChoice1 = yyIndex;
13075:
13076: // Nested alternative 1.
13077:
13078: yyC = character(yyChoice1);
13079: if (-1 != yyC) {
13080: yyIndex = yyChoice1 + 1;
13081:
13082: switch (yyC) {
13083: case '=': {
13084: yyValue = "-=";
13085:
13086: return new SemanticValue(yyValue, yyIndex,
13087: yyError);
13088: }
13089:
13090: case '-': {
13091: yyValue = "--";
13092:
13093: return new SemanticValue(yyValue, yyIndex,
13094: yyError);
13095: }
13096:
13097: case '>': {
13098: yyValue = "->";
13099:
13100: return new SemanticValue(yyValue, yyIndex,
13101: yyError);
13102: }
13103:
13104: default:
13105: /* No match. */
13106: }
13107: }
13108:
13109: // Nested alternative 2.
13110:
13111: yyValue = "-";
13112:
13113: return new SemanticValue(yyValue, yyChoice1, yyError);
13114: }
13115:
13116: case '*': {
13117: final int yyChoice1 = yyIndex;
13118:
13119: // Nested alternative 1.
13120:
13121: yyC = character(yyChoice1);
13122: if (-1 != yyC) {
13123: yyIndex = yyChoice1 + 1;
13124: if ('=' == yyC) {
13125:
13126: yyValue = "*=";
13127:
13128: return new SemanticValue(yyValue, yyIndex,
13129: yyError);
13130: }
13131: }
13132:
13133: // Nested alternative 2.
13134:
13135: yyValue = "*";
13136:
13137: return new SemanticValue(yyValue, yyChoice1, yyError);
13138: }
13139:
13140: case '/': {
13141: final int yyChoice1 = yyIndex;
13142:
13143: // Nested alternative 1.
13144:
13145: yyC = character(yyChoice1);
13146: if (-1 != yyC) {
13147: yyIndex = yyChoice1 + 1;
13148: if ('=' == yyC) {
13149:
13150: yyValue = "/=";
13151:
13152: return new SemanticValue(yyValue, yyIndex,
13153: yyError);
13154: }
13155: }
13156:
13157: // Nested alternative 2.
13158:
13159: yyValue = "/";
13160:
13161: return new SemanticValue(yyValue, yyChoice1, yyError);
13162: }
13163:
13164: case '%': {
13165: final int yyChoice1 = yyIndex;
13166:
13167: // Nested alternative 1.
13168:
13169: yyC = character(yyChoice1);
13170: if (-1 != yyC) {
13171: yyIndex = yyChoice1 + 1;
13172: if ('=' == yyC) {
13173:
13174: yyValue = "%=";
13175:
13176: return new SemanticValue(yyValue, yyIndex,
13177: yyError);
13178: }
13179: }
13180:
13181: // Nested alternative 2.
13182:
13183: yyValue = "%";
13184:
13185: return new SemanticValue(yyValue, yyChoice1, yyError);
13186: }
13187:
13188: case '&': {
13189: final int yyChoice1 = yyIndex;
13190:
13191: // Nested alternative 1.
13192:
13193: yyC = character(yyChoice1);
13194: if (-1 != yyC) {
13195: yyIndex = yyChoice1 + 1;
13196:
13197: switch (yyC) {
13198: case '=': {
13199: yyValue = "&=";
13200:
13201: return new SemanticValue(yyValue, yyIndex,
13202: yyError);
13203: }
13204:
13205: case '&': {
13206: yyValue = "&&";
13207:
13208: return new SemanticValue(yyValue, yyIndex,
13209: yyError);
13210: }
13211:
13212: default:
13213: /* No match. */
13214: }
13215: }
13216:
13217: // Nested alternative 2.
13218:
13219: yyValue = "&";
13220:
13221: return new SemanticValue(yyValue, yyChoice1, yyError);
13222: }
13223:
13224: case '^': {
13225: final int yyChoice1 = yyIndex;
13226:
13227: // Nested alternative 1.
13228:
13229: yyC = character(yyChoice1);
13230: if (-1 != yyC) {
13231: yyIndex = yyChoice1 + 1;
13232: if ('=' == yyC) {
13233:
13234: yyValue = "^=";
13235:
13236: return new SemanticValue(yyValue, yyIndex,
13237: yyError);
13238: }
13239: }
13240:
13241: // Nested alternative 2.
13242:
13243: yyValue = "^";
13244:
13245: return new SemanticValue(yyValue, yyChoice1, yyError);
13246: }
13247:
13248: case '|': {
13249: final int yyChoice1 = yyIndex;
13250:
13251: // Nested alternative 1.
13252:
13253: yyC = character(yyChoice1);
13254: if (-1 != yyC) {
13255: yyIndex = yyChoice1 + 1;
13256:
13257: switch (yyC) {
13258: case '=': {
13259: yyValue = "|=";
13260:
13261: return new SemanticValue(yyValue, yyIndex,
13262: yyError);
13263: }
13264:
13265: case '|': {
13266: yyValue = "||";
13267:
13268: return new SemanticValue(yyValue, yyIndex,
13269: yyError);
13270: }
13271:
13272: default:
13273: /* No match. */
13274: }
13275: }
13276:
13277: // Nested alternative 2.
13278:
13279: yyValue = "|";
13280:
13281: return new SemanticValue(yyValue, yyChoice1, yyError);
13282: }
13283:
13284: case '=': {
13285: final int yyChoice1 = yyIndex;
13286:
13287: // Nested alternative 1.
13288:
13289: yyC = character(yyChoice1);
13290: if (-1 != yyC) {
13291: yyIndex = yyChoice1 + 1;
13292: if ('=' == yyC) {
13293:
13294: yyValue = "==";
13295:
13296: return new SemanticValue(yyValue, yyIndex,
13297: yyError);
13298: }
13299: }
13300:
13301: // Nested alternative 2.
13302:
13303: yyValue = "=";
13304:
13305: return new SemanticValue(yyValue, yyChoice1, yyError);
13306: }
13307:
13308: case '!': {
13309: final int yyChoice1 = yyIndex;
13310:
13311: // Nested alternative 1.
13312:
13313: yyC = character(yyChoice1);
13314: if (-1 != yyC) {
13315: yyIndex = yyChoice1 + 1;
13316: if ('=' == yyC) {
13317:
13318: yyValue = "!=";
13319:
13320: return new SemanticValue(yyValue, yyIndex,
13321: yyError);
13322: }
13323: }
13324:
13325: // Nested alternative 2.
13326:
13327: yyValue = "!";
13328:
13329: return new SemanticValue(yyValue, yyChoice1, yyError);
13330: }
13331:
13332: case ';': {
13333: yyValue = ";";
13334:
13335: return new SemanticValue(yyValue, yyIndex, yyError);
13336: }
13337:
13338: case ':': {
13339: yyValue = ":";
13340:
13341: return new SemanticValue(yyValue, yyIndex, yyError);
13342: }
13343:
13344: case ',': {
13345: yyValue = ",";
13346:
13347: return new SemanticValue(yyValue, yyIndex, yyError);
13348: }
13349:
13350: case '{': {
13351: yyValue = "{";
13352:
13353: return new SemanticValue(yyValue, yyIndex, yyError);
13354: }
13355:
13356: case '}': {
13357: yyValue = "}";
13358:
13359: return new SemanticValue(yyValue, yyIndex, yyError);
13360: }
13361:
13362: case '(': {
13363: yyValue = "(";
13364:
13365: return new SemanticValue(yyValue, yyIndex, yyError);
13366: }
13367:
13368: case ')': {
13369: yyValue = ")";
13370:
13371: return new SemanticValue(yyValue, yyIndex, yyError);
13372: }
13373:
13374: case '[': {
13375: yyValue = "[";
13376:
13377: return new SemanticValue(yyValue, yyIndex, yyError);
13378: }
13379:
13380: case ']': {
13381: yyValue = "]";
13382:
13383: return new SemanticValue(yyValue, yyIndex, yyError);
13384: }
13385:
13386: case '~': {
13387: yyValue = "~";
13388:
13389: return new SemanticValue(yyValue, yyIndex, yyError);
13390: }
13391:
13392: case '?': {
13393: yyValue = "?";
13394:
13395: return new SemanticValue(yyValue, yyIndex, yyError);
13396: }
13397:
13398: default:
13399: /* No match. */
13400: }
13401: }
13402:
13403: // Done.
13404: yyError = yyError.select("symbol characters expected", yyStart);
13405: return yyError;
13406: }
13407:
13408: // =========================================================================
13409:
13410: /**
13411: * Parse nonterminal xtc.lang.CSpacing.Spacing.
13412: *
13413: * @param yyStart The index.
13414: * @return The result.
13415: * @throws IOException Signals an I/O error.
13416: */
13417: private Result pSpacing(final int yyStart) throws IOException {
13418: int yyC;
13419: int yyIndex;
13420: Result yyResult;
13421: Result yyPredResult;
13422: boolean yyPredMatched;
13423: int yyBase;
13424: int yyRepetition1;
13425: int yyRepetition2;
13426: Void yyValue;
13427: ParseError yyError = ParseError.DUMMY;
13428:
13429: // Alternative 1.
13430:
13431: yyRepetition1 = yyStart;
13432: while (true) {
13433:
13434: final int yyChoice1 = yyRepetition1;
13435:
13436: // Nested alternative 1.
13437:
13438: yyC = character(yyChoice1);
13439: if (-1 != yyC) {
13440: yyIndex = yyChoice1 + 1;
13441:
13442: switch (yyC) {
13443: case ' ': {
13444: yyRepetition1 = yyIndex;
13445: continue;
13446: }
13447:
13448: case '\t': {
13449: yyRepetition1 = yyIndex;
13450: continue;
13451: }
13452:
13453: case '\f': {
13454: yyRepetition1 = yyIndex;
13455: continue;
13456: }
13457:
13458: case '/': {
13459: yyC = character(yyIndex);
13460: if (-1 != yyC) {
13461: yyIndex = yyIndex + 1;
13462:
13463: switch (yyC) {
13464: case '*': {
13465: yyRepetition2 = yyIndex;
13466: while (true) {
13467:
13468: final int yyChoice2 = yyRepetition2;
13469:
13470: // Nested alternative 1.
13471:
13472: yyC = character(yyChoice2);
13473: if (-1 != yyC) {
13474: yyIndex = yyChoice2 + 1;
13475:
13476: switch (yyC) {
13477: case '*': {
13478: yyPredMatched = false;
13479:
13480: yyC = character(yyIndex);
13481: if ('/' == yyC) {
13482:
13483: yyPredMatched = true;
13484: }
13485:
13486: if (!yyPredMatched) {
13487:
13488: yyRepetition2 = yyIndex;
13489: continue;
13490: } else {
13491: yyError = yyError.select(
13492: "spacing expected",
13493: yyStart);
13494: }
13495: }
13496: break;
13497:
13498: default: {
13499: yyRepetition2 = yyIndex;
13500: continue;
13501: }
13502: }
13503: }
13504: break;
13505: }
13506:
13507: yyBase = yyRepetition2;
13508: yyC = character(yyBase);
13509: if ('*' == yyC) {
13510: yyIndex = yyRepetition2 + 1;
13511:
13512: yyC = character(yyIndex);
13513: if ('/' == yyC) {
13514: yyIndex = yyIndex + 1;
13515:
13516: yyRepetition1 = yyIndex;
13517: continue;
13518: } else {
13519: yyError = yyError.select(
13520: "\"*/\" expected", yyBase);
13521: }
13522: } else {
13523: yyError = yyError.select(
13524: "\"*/\" expected", yyBase);
13525: }
13526: }
13527: break;
13528:
13529: case '/': {
13530: yyRepetition2 = yyIndex;
13531: while (true) {
13532:
13533: yyC = character(yyRepetition2);
13534: if (-1 != yyC) {
13535: yyIndex = yyRepetition2 + 1;
13536:
13537: switch (yyC) {
13538: case '\n':
13539: case '\r':
13540: /* No match. */
13541: break;
13542:
13543: default: {
13544: yyRepetition2 = yyIndex;
13545: continue;
13546: }
13547: }
13548: }
13549: break;
13550: }
13551:
13552: yyPredResult = pLineTerminator(yyRepetition2);
13553: yyError = yyPredResult.select(yyError);
13554: if (yyPredResult.hasValue()) {
13555:
13556: yyRepetition1 = yyRepetition2;
13557: continue;
13558: }
13559: }
13560: break;
13561:
13562: default:
13563: /* No match. */
13564: }
13565: }
13566: }
13567: break;
13568:
13569: case '\r': {
13570: final int yyChoice2 = yyIndex;
13571:
13572: // Nested alternative 1.
13573:
13574: yyC = character(yyChoice2);
13575: if ('\n' == yyC) {
13576: yyIndex = yyChoice2 + 1;
13577:
13578: yyResult = pDirective(yyIndex);
13579: yyError = yyResult.select(yyError);
13580: if (yyResult.hasValue()) {
13581:
13582: yyRepetition1 = yyResult.index;
13583: continue;
13584: }
13585: }
13586:
13587: // Nested alternative 2.
13588:
13589: yyResult = pDirective(yyChoice2);
13590: yyError = yyResult.select(yyError);
13591: if (yyResult.hasValue()) {
13592:
13593: yyRepetition1 = yyResult.index;
13594: continue;
13595: }
13596: }
13597: break;
13598:
13599: case '\n': {
13600: yyResult = pDirective(yyIndex);
13601: yyError = yyResult.select(yyError);
13602: if (yyResult.hasValue()) {
13603:
13604: yyRepetition1 = yyResult.index;
13605: continue;
13606: }
13607: }
13608: break;
13609:
13610: default:
13611: /* No match. */
13612: }
13613: }
13614: break;
13615: }
13616:
13617: yyValue = null;
13618:
13619: return new SemanticValue(yyValue, yyRepetition1, yyError);
13620: }
13621:
13622: // =========================================================================
13623:
13624: /**
13625: * Parse nonterminal xtc.lang.CSpacing.Space.
13626: *
13627: * @param yyStart The index.
13628: * @return The result.
13629: * @throws IOException Signals an I/O error.
13630: */
13631: private Result pSpace(final int yyStart) throws IOException {
13632: int yyC;
13633: int yyIndex;
13634: Void yyValue;
13635: ParseError yyError = ParseError.DUMMY;
13636:
13637: // Alternative 1.
13638:
13639: yyC = character(yyStart);
13640: if (-1 != yyC) {
13641: yyIndex = yyStart + 1;
13642:
13643: switch (yyC) {
13644: case ' ': {
13645: yyValue = null;
13646:
13647: return new SemanticValue(yyValue, yyIndex, yyError);
13648: }
13649:
13650: case '\t': {
13651: yyValue = null;
13652:
13653: return new SemanticValue(yyValue, yyIndex, yyError);
13654: }
13655:
13656: case '\f': {
13657: yyValue = null;
13658:
13659: return new SemanticValue(yyValue, yyIndex, yyError);
13660: }
13661:
13662: default:
13663: /* No match. */
13664: }
13665: }
13666:
13667: // Done.
13668: yyError = yyError.select("space expected", yyStart);
13669: return yyError;
13670: }
13671:
13672: // =========================================================================
13673:
13674: /**
13675: * Parse nonterminal xtc.lang.CSpacing.LineTerminator.
13676: *
13677: * @param yyStart The index.
13678: * @return The result.
13679: * @throws IOException Signals an I/O error.
13680: */
13681: private Result pLineTerminator(final int yyStart)
13682: throws IOException {
13683: int yyC;
13684: int yyIndex;
13685: Void yyValue;
13686: ParseError yyError = ParseError.DUMMY;
13687:
13688: // Alternative 1.
13689:
13690: yyC = character(yyStart);
13691: if (-1 != yyC) {
13692: yyIndex = yyStart + 1;
13693:
13694: switch (yyC) {
13695: case '\r': {
13696: final int yyChoice1 = yyIndex;
13697:
13698: // Nested alternative 1.
13699:
13700: yyC = character(yyChoice1);
13701: if ('\n' == yyC) {
13702: yyIndex = yyChoice1 + 1;
13703:
13704: yyValue = null;
13705:
13706: return new SemanticValue(yyValue, yyIndex, yyError);
13707: }
13708:
13709: // Nested alternative 2.
13710:
13711: yyValue = null;
13712:
13713: return new SemanticValue(yyValue, yyChoice1, yyError);
13714: }
13715:
13716: case '\n': {
13717: yyValue = null;
13718:
13719: return new SemanticValue(yyValue, yyIndex, yyError);
13720: }
13721:
13722: default:
13723: /* No match. */
13724: }
13725: }
13726:
13727: // Done.
13728: yyError = yyError.select("line terminator expected", yyStart);
13729: return yyError;
13730: }
13731:
13732: // =========================================================================
13733:
13734: /**
13735: * Parse nonterminal xtc.lang.CSpacing.EndOfFile.
13736: *
13737: * @param yyStart The index.
13738: * @return The result.
13739: * @throws IOException Signals an I/O error.
13740: */
13741: private Result pEndOfFile(final int yyStart) throws IOException {
13742: int yyC;
13743: boolean yyPredMatched;
13744: Void yyValue;
13745: ParseError yyError = ParseError.DUMMY;
13746:
13747: // Alternative 1.
13748:
13749: yyPredMatched = false;
13750:
13751: yyC = character(yyStart);
13752: if (-1 != yyC) {
13753:
13754: yyPredMatched = true;
13755: }
13756:
13757: if (!yyPredMatched) {
13758:
13759: yyValue = null;
13760:
13761: return new SemanticValue(yyValue, yyStart, yyError);
13762: } else {
13763: yyError = yyError.select("end of file expected", yyStart);
13764: }
13765:
13766: // Done.
13767: return yyError;
13768: }
13769:
13770: // =========================================================================
13771:
13772: /**
13773: * Parse nonterminal xtc.lang.CSpacing.Directive.
13774: *
13775: * @param yyStart The index.
13776: * @return The result.
13777: * @throws IOException Signals an I/O error.
13778: */
13779: private Result pDirective(final int yyStart) throws IOException {
13780: int yyC;
13781: int yyIndex;
13782: Result yyResult;
13783: Result yyPredResult;
13784: int yyBase;
13785: int yyRepetition1;
13786: boolean yyRepeated1;
13787: int yyOption1;
13788: String yyOpValue1;
13789: Void yyValue;
13790: ParseError yyError = ParseError.DUMMY;
13791:
13792: // Alternative 1.
13793:
13794: yyC = character(yyStart);
13795: if ('#' == yyC) {
13796: yyIndex = yyStart + 1;
13797:
13798: final int yyChoice1 = yyIndex;
13799:
13800: // Nested alternative 1.
13801:
13802: yyC = character(yyChoice1);
13803: if (' ' == yyC) {
13804: yyIndex = yyChoice1 + 1;
13805:
13806: yyResult = pLineNumber(yyIndex);
13807: yyError = yyResult.select(yyError);
13808: if (yyResult.hasValue()) {
13809: final String line = yyResult.semanticValue();
13810:
13811: yyC = character(yyResult.index);
13812: if (' ' == yyC) {
13813: yyIndex = yyResult.index + 1;
13814:
13815: yyC = character(yyIndex);
13816: if ('\"' == yyC) {
13817: yyIndex = yyIndex + 1;
13818:
13819: yyResult = pFileName(yyIndex);
13820: yyError = yyResult.select(yyError);
13821: if (yyResult.hasValue()) {
13822: final String file = yyResult
13823: .semanticValue();
13824:
13825: yyC = character(yyResult.index);
13826: if ('\"' == yyC) {
13827: yyIndex = yyResult.index + 1;
13828:
13829: yyOption1 = yyIndex;
13830: yyOpValue1 = null;
13831:
13832: yyBase = yyOption1;
13833: yyC = character(yyBase);
13834: if (' ' == yyC) {
13835: yyIndex = yyOption1 + 1;
13836:
13837: yyC = character(yyIndex);
13838: if ('1' == yyC) {
13839: yyIndex = yyIndex + 1;
13840: final String v$el$1 = " 1";
13841:
13842: yyOption1 = yyIndex;
13843: yyOpValue1 = v$el$1;
13844: } else {
13845: yyError = yyError.select(
13846: "\" 1\" expected",
13847: yyBase);
13848: }
13849: } else {
13850: yyError = yyError.select(
13851: "\" 1\" expected",
13852: yyBase);
13853: }
13854: { // Start scope for f1.
13855: final String f1 = yyOpValue1;
13856:
13857: yyOpValue1 = null;
13858:
13859: yyBase = yyOption1;
13860: yyC = character(yyBase);
13861: if (' ' == yyC) {
13862: yyIndex = yyOption1 + 1;
13863:
13864: yyC = character(yyIndex);
13865: if ('2' == yyC) {
13866: yyIndex = yyIndex + 1;
13867: final String v$el$2 = " 2";
13868:
13869: yyOption1 = yyIndex;
13870: yyOpValue1 = v$el$2;
13871: } else {
13872: yyError = yyError
13873: .select(
13874: "\" 2\" expected",
13875: yyBase);
13876: }
13877: } else {
13878: yyError = yyError.select(
13879: "\" 2\" expected",
13880: yyBase);
13881: }
13882: { // Start scope for f2.
13883: final String f2 = yyOpValue1;
13884:
13885: yyOpValue1 = null;
13886:
13887: yyBase = yyOption1;
13888: yyC = character(yyBase);
13889: if (' ' == yyC) {
13890: yyIndex = yyOption1 + 1;
13891:
13892: yyC = character(yyIndex);
13893: if ('3' == yyC) {
13894: yyIndex = yyIndex + 1;
13895: final String v$el$3 = " 3";
13896:
13897: yyOption1 = yyIndex;
13898: yyOpValue1 = v$el$3;
13899: } else {
13900: yyError = yyError
13901: .select(
13902: "\" 3\" expected",
13903: yyBase);
13904: }
13905: } else {
13906: yyError = yyError
13907: .select(
13908: "\" 3\" expected",
13909: yyBase);
13910: }
13911: { // Start scope for f3.
13912: final String f3 = yyOpValue1;
13913:
13914: yyOpValue1 = null;
13915:
13916: yyBase = yyOption1;
13917: yyC = character(yyBase);
13918: if (' ' == yyC) {
13919: yyIndex = yyOption1 + 1;
13920:
13921: yyC = character(yyIndex);
13922: if ('4' == yyC) {
13923: yyIndex = yyIndex + 1;
13924: final String v$el$4 = " 4";
13925:
13926: yyOption1 = yyIndex;
13927: yyOpValue1 = v$el$4;
13928: } else {
13929: yyError = yyError
13930: .select(
13931: "\" 4\" expected",
13932: yyBase);
13933: }
13934: } else {
13935: yyError = yyError
13936: .select(
13937: "\" 4\" expected",
13938: yyBase);
13939: }
13940: { // Start scope for f4.
13941: final String f4 = yyOpValue1;
13942:
13943: yyPredResult = pLineTerminator(yyOption1);
13944: yyError = yyPredResult
13945: .select(yyError);
13946: if (yyPredResult
13947: .hasValue()) {
13948:
13949: final int lineNo = Integer
13950: .parseInt(line);
13951: if (RELOCATE)
13952: setLocation(
13953: yyStart,
13954: file,
13955: lineNo - 1,
13956: FIRST_COLUMN);
13957: yyState
13958: .lineMarker(
13959: file,
13960: lineNo,
13961: f1,
13962: f2,
13963: f3,
13964: f4,
13965: location(yyStart));
13966:
13967: yyValue = null;
13968:
13969: return new SemanticValue(
13970: yyValue,
13971: yyOption1,
13972: yyError);
13973: }
13974: } // End scope for f4.
13975: } // End scope for f3.
13976: } // End scope for f2.
13977: } // End scope for f1.
13978: }
13979: }
13980: }
13981: }
13982: }
13983: }
13984:
13985: // Nested alternative 2.
13986:
13987: yyRepetition1 = yyChoice1;
13988: while (true) {
13989:
13990: yyResult = pSpace(yyRepetition1);
13991: yyError = yyResult.select(yyError);
13992: if (yyResult.hasValue()) {
13993:
13994: yyRepetition1 = yyResult.index;
13995: continue;
13996: }
13997: break;
13998: }
13999: { // Start scope for nested choice.
14000:
14001: final int yyChoice2 = yyRepetition1;
14002:
14003: // Nested alternative 1.
14004:
14005: yyC = character(yyChoice2);
14006: if (-1 != yyC) {
14007: yyIndex = yyChoice2 + 1;
14008:
14009: switch (yyC) {
14010: case 'p': {
14011: yyC = character(yyIndex);
14012: if (-1 != yyC) {
14013: yyIndex = yyIndex + 1;
14014: if ('r' == yyC) {
14015:
14016: yyC = character(yyIndex);
14017: if (-1 != yyC) {
14018: yyIndex = yyIndex + 1;
14019: if ('a' == yyC) {
14020:
14021: yyC = character(yyIndex);
14022: if (-1 != yyC) {
14023: yyIndex = yyIndex + 1;
14024: if ('g' == yyC) {
14025:
14026: yyC = character(yyIndex);
14027: if (-1 != yyC) {
14028: yyIndex = yyIndex + 1;
14029: if ('m' == yyC) {
14030:
14031: yyC = character(yyIndex);
14032: if (-1 != yyC) {
14033: yyIndex = yyIndex + 1;
14034: if ('a' == yyC) {
14035:
14036: yyC = character(yyIndex);
14037: if (-1 != yyC) {
14038: yyIndex = yyIndex + 1;
14039: if (' ' == yyC) {
14040:
14041: yyResult = pPragma(yyIndex);
14042: yyError = yyResult
14043: .select(yyError);
14044: if (yyResult
14045: .hasValue()) {
14046: final String pragma = yyResult
14047: .semanticValue();
14048:
14049: yyPredResult = pLineTerminator(yyResult.index);
14050: yyError = yyPredResult
14051: .select(yyError);
14052: if (yyPredResult
14053: .hasValue()) {
14054:
14055: yyState
14056: .pragma(
14057: pragma,
14058: location(yyStart));
14059:
14060: yyValue = null;
14061:
14062: return yyResult
14063: .createValue(
14064: yyValue,
14065: yyError);
14066: }
14067: }
14068: }
14069: }
14070: }
14071: }
14072: }
14073: }
14074: }
14075: }
14076: }
14077: }
14078: }
14079: }
14080: }
14081: break;
14082:
14083: case 'i': {
14084: yyC = character(yyIndex);
14085: if (-1 != yyC) {
14086: yyIndex = yyIndex + 1;
14087: if ('d' == yyC) {
14088:
14089: yyC = character(yyIndex);
14090: if (-1 != yyC) {
14091: yyIndex = yyIndex + 1;
14092: if ('e' == yyC) {
14093:
14094: yyC = character(yyIndex);
14095: if (-1 != yyC) {
14096: yyIndex = yyIndex + 1;
14097: if ('n' == yyC) {
14098:
14099: yyC = character(yyIndex);
14100: if (-1 != yyC) {
14101: yyIndex = yyIndex + 1;
14102: if ('t' == yyC) {
14103:
14104: yyRepetition1 = yyIndex;
14105: yyRepeated1 = false;
14106: while (true) {
14107:
14108: yyResult = pSpace(yyRepetition1);
14109: yyError = yyResult
14110: .select(yyError);
14111: if (yyResult
14112: .hasValue()) {
14113:
14114: yyRepetition1 = yyResult.index;
14115: yyRepeated1 = true;
14116: continue;
14117: }
14118: break;
14119: }
14120:
14121: if (yyRepeated1) {
14122:
14123: yyC = character(yyRepetition1);
14124: if ('\"' == yyC) {
14125: yyIndex = yyRepetition1 + 1;
14126:
14127: yyResult = pFileName(yyIndex);
14128: yyError = yyResult
14129: .select(yyError);
14130: if (yyResult
14131: .hasValue()) {
14132: final String s = yyResult
14133: .semanticValue();
14134:
14135: yyC = character(yyResult.index);
14136: if ('\"' == yyC) {
14137: yyIndex = yyResult.index + 1;
14138:
14139: yyPredResult = pLineTerminator(yyIndex);
14140: yyError = yyPredResult
14141: .select(yyError);
14142: if (yyPredResult
14143: .hasValue()) {
14144:
14145: yyState
14146: .ident(
14147: s,
14148: location(yyStart));
14149:
14150: yyValue = null;
14151:
14152: return new SemanticValue(
14153: yyValue,
14154: yyIndex,
14155: yyError);
14156: }
14157: }
14158: }
14159: }
14160: }
14161: }
14162: }
14163: }
14164: }
14165: }
14166: }
14167: }
14168: }
14169: }
14170: break;
14171:
14172: default:
14173: /* No match. */
14174: }
14175: }
14176: } // End scope for nested choice.
14177: }
14178:
14179: // Alternative 2.
14180:
14181: yyValue = null;
14182:
14183: return new SemanticValue(yyValue, yyStart, yyError);
14184: }
14185:
14186: // =========================================================================
14187:
14188: /**
14189: * Parse nonterminal xtc.lang.CSpacing.LineNumber.
14190: *
14191: * @param yyStart The index.
14192: * @return The result.
14193: * @throws IOException Signals an I/O error.
14194: */
14195: private Result pLineNumber(final int yyStart) throws IOException {
14196: int yyC;
14197: int yyIndex;
14198: int yyRepetition1;
14199: String yyValue;
14200: ParseError yyError = ParseError.DUMMY;
14201:
14202: // Alternative 1.
14203:
14204: yyC = character(yyStart);
14205: if (-1 != yyC) {
14206: yyIndex = yyStart + 1;
14207:
14208: switch (yyC) {
14209: case '1':
14210: case '2':
14211: case '3':
14212: case '4':
14213: case '5':
14214: case '6':
14215: case '7':
14216: case '8':
14217: case '9': {
14218: yyRepetition1 = yyIndex;
14219: while (true) {
14220:
14221: yyC = character(yyRepetition1);
14222: if (-1 != yyC) {
14223: yyIndex = yyRepetition1 + 1;
14224:
14225: switch (yyC) {
14226: case '0':
14227: case '1':
14228: case '2':
14229: case '3':
14230: case '4':
14231: case '5':
14232: case '6':
14233: case '7':
14234: case '8':
14235: case '9': {
14236: yyRepetition1 = yyIndex;
14237: continue;
14238: }
14239:
14240: default:
14241: /* No match. */
14242: }
14243: }
14244: break;
14245: }
14246:
14247: yyValue = difference(yyStart, yyRepetition1);
14248:
14249: return new SemanticValue(yyValue, yyRepetition1,
14250: yyError);
14251: }
14252:
14253: default:
14254: /* No match. */
14255: }
14256: }
14257:
14258: // Done.
14259: yyError = yyError.select("line number expected", yyStart);
14260: return yyError;
14261: }
14262:
14263: // =========================================================================
14264:
14265: /**
14266: * Parse nonterminal xtc.lang.CSpacing.FileName.
14267: *
14268: * @param yyStart The index.
14269: * @return The result.
14270: * @throws IOException Signals an I/O error.
14271: */
14272: private Result pFileName(final int yyStart) throws IOException {
14273: int yyC;
14274: int yyIndex;
14275: int yyRepetition1;
14276: String yyValue;
14277: ParseError yyError = ParseError.DUMMY;
14278:
14279: // Alternative 1.
14280:
14281: yyRepetition1 = yyStart;
14282: while (true) {
14283:
14284: final int yyChoice1 = yyRepetition1;
14285:
14286: // Nested alternative 1.
14287:
14288: yyC = character(yyChoice1);
14289: if (-1 != yyC) {
14290: yyIndex = yyChoice1 + 1;
14291:
14292: switch (yyC) {
14293: case '\\': {
14294: yyC = character(yyIndex);
14295: if (-1 != yyC) {
14296: yyIndex = yyIndex + 1;
14297:
14298: yyRepetition1 = yyIndex;
14299: continue;
14300: }
14301: }
14302: break;
14303:
14304: default:
14305: /* No match. */
14306: }
14307: }
14308:
14309: // Nested alternative 2.
14310:
14311: yyC = character(yyChoice1);
14312: if (-1 != yyC) {
14313: yyIndex = yyChoice1 + 1;
14314:
14315: switch (yyC) {
14316: case '\"':
14317: case '\\':
14318: /* No match. */
14319: break;
14320:
14321: default: {
14322: yyRepetition1 = yyIndex;
14323: continue;
14324: }
14325: }
14326: }
14327: break;
14328: }
14329:
14330: yyValue = difference(yyStart, yyRepetition1);
14331:
14332: return new SemanticValue(yyValue, yyRepetition1, yyError);
14333: }
14334:
14335: // =========================================================================
14336:
14337: /**
14338: * Parse nonterminal xtc.lang.CSpacing.Pragma.
14339: *
14340: * @param yyStart The index.
14341: * @return The result.
14342: * @throws IOException Signals an I/O error.
14343: */
14344: private Result pPragma(final int yyStart) throws IOException {
14345: int yyC;
14346: int yyIndex;
14347: int yyRepetition1;
14348: String yyValue;
14349: ParseError yyError = ParseError.DUMMY;
14350:
14351: // Alternative 1.
14352:
14353: yyRepetition1 = yyStart;
14354: while (true) {
14355:
14356: yyC = character(yyRepetition1);
14357: if (-1 != yyC) {
14358: yyIndex = yyRepetition1 + 1;
14359:
14360: switch (yyC) {
14361: case '\n':
14362: case '\r':
14363: /* No match. */
14364: break;
14365:
14366: default: {
14367: yyRepetition1 = yyIndex;
14368: continue;
14369: }
14370: }
14371: }
14372: break;
14373: }
14374:
14375: yyValue = difference(yyStart, yyRepetition1);
14376:
14377: return new SemanticValue(yyValue, yyRepetition1, yyError);
14378: }
14379:
14380: // =========================================================================
14381:
14382: /**
14383: * Parse nonterminal xtc.lang.CContext.TypedefContext.
14384: *
14385: * @param yyStart The index.
14386: * @return The result.
14387: * @throws IOException Signals an I/O error.
14388: */
14389: private Result pTypedefContext(final int yyStart)
14390: throws IOException {
14391: Void yyValue;
14392: ParseError yyError = ParseError.DUMMY;
14393:
14394: // Alternative 1.
14395:
14396: yyState.typedef();
14397:
14398: yyValue = null;
14399:
14400: return new SemanticValue(yyValue, yyStart, yyError);
14401: }
14402:
14403: // =========================================================================
14404:
14405: /**
14406: * Parse nonterminal xtc.lang.CContext.ParameterContext.
14407: *
14408: * @param yyStart The index.
14409: * @return The result.
14410: * @throws IOException Signals an I/O error.
14411: */
14412: private Result pParameterContext(final int yyStart)
14413: throws IOException {
14414: Void yyValue;
14415: ParseError yyError = ParseError.DUMMY;
14416:
14417: // Alternative 1.
14418:
14419: yyState.parameters();
14420:
14421: yyValue = null;
14422:
14423: return new SemanticValue(yyValue, yyStart, yyError);
14424: }
14425:
14426: // =========================================================================
14427:
14428: /**
14429: * Parse nonterminal xtc.lang.CContext.FunctionDeclaratorContext.
14430: *
14431: * @param yyStart The index.
14432: * @return The result.
14433: * @throws IOException Signals an I/O error.
14434: */
14435: private Result pFunctionDeclaratorContext(final int yyStart)
14436: throws IOException {
14437:
14438: Void yyValue;
14439: ParseError yyError = ParseError.DUMMY;
14440:
14441: // Alternative 1.
14442:
14443: yyState.functionDeclarator();
14444:
14445: yyValue = null;
14446:
14447: return new SemanticValue(yyValue, yyStart, yyError);
14448: }
14449:
14450: // =========================================================================
14451:
14452: /**
14453: * Parse nonterminal xtc.lang.CContext.TypeSpecContext.
14454: *
14455: * @param yyStart The index.
14456: * @return The result.
14457: * @throws IOException Signals an I/O error.
14458: */
14459: private Result pTypeSpecContext(final int yyStart)
14460: throws IOException {
14461: Void yyValue;
14462: ParseError yyError = ParseError.DUMMY;
14463:
14464: // Alternative 1.
14465:
14466: yyState.typeSpecifier();
14467:
14468: yyValue = null;
14469:
14470: return new SemanticValue(yyValue, yyStart, yyError);
14471: }
14472:
14473: // =========================================================================
14474:
14475: /**
14476: * Parse nonterminal xtc.lang.CContext.PushScope.
14477: *
14478: * @param yyStart The index.
14479: * @return The result.
14480: * @throws IOException Signals an I/O error.
14481: */
14482: private Result pPushScope(final int yyStart) throws IOException {
14483: Void yyValue;
14484: ParseError yyError = ParseError.DUMMY;
14485:
14486: // Alternative 1.
14487:
14488: yyState.pushScope();
14489:
14490: yyValue = null;
14491:
14492: return new SemanticValue(yyValue, yyStart, yyError);
14493: }
14494:
14495: // =========================================================================
14496:
14497: /**
14498: * Parse nonterminal xtc.lang.CContext.PopScope.
14499: *
14500: * @param yyStart The index.
14501: * @return The result.
14502: * @throws IOException Signals an I/O error.
14503: */
14504: private Result pPopScope(final int yyStart) throws IOException {
14505: Void yyValue;
14506: ParseError yyError = ParseError.DUMMY;
14507:
14508: // Alternative 1.
14509:
14510: yyState.popScope();
14511:
14512: yyValue = null;
14513:
14514: return new SemanticValue(yyValue, yyStart, yyError);
14515: }
14516:
14517: // =========================================================================
14518:
14519: /**
14520: * Parse nonterminal xtc.lang.CContext.EnterStructure.
14521: *
14522: * @param yyStart The index.
14523: * @return The result.
14524: * @throws IOException Signals an I/O error.
14525: */
14526: private Result pEnterStructure(final int yyStart)
14527: throws IOException {
14528: Void yyValue;
14529: ParseError yyError = ParseError.DUMMY;
14530:
14531: // Alternative 1.
14532:
14533: yyState.enterStructure();
14534:
14535: yyValue = null;
14536:
14537: return new SemanticValue(yyValue, yyStart, yyError);
14538: }
14539:
14540: // =========================================================================
14541:
14542: /**
14543: * Parse nonterminal xtc.lang.CContext.ExitStructure.
14544: *
14545: * @param yyStart The index.
14546: * @return The result.
14547: * @throws IOException Signals an I/O error.
14548: */
14549: private Result pExitStructure(final int yyStart) throws IOException {
14550: Void yyValue;
14551: ParseError yyError = ParseError.DUMMY;
14552:
14553: // Alternative 1.
14554:
14555: yyState.exitStructure();
14556:
14557: yyValue = null;
14558:
14559: return new SemanticValue(yyValue, yyStart, yyError);
14560: }
14561:
14562: // =========================================================================
14563:
14564: static {
14565: add(C_KEYWORDS, new String[] { "auto", "break", "case", "char",
14566: "const", "continue", "default", "do", "double", "else",
14567: "enum", "extern", "float", "for", "goto", "if", "int",
14568: "long", "register", "return", "short", "signed",
14569: "sizeof", "static", "struct", "switch", "typedef",
14570: "union", "unsigned", "void", "volatile", "while" });
14571:
14572: if (C99)
14573: add(C_KEYWORDS, new String[] { "_Bool", "_Complex",
14574: "inline", "restrict" });
14575:
14576: if (GCC)
14577: add(C_KEYWORDS, new String[] { "__alignof", "__alignof__",
14578: "asm", "__asm", "__asm__", "__attribute",
14579: "__attribute__", "__builtin_offsetof",
14580: "__builtin_types_compatible_p", "__builtin_va_arg",
14581: "__builtin_va_list", "__complex__", "__const",
14582: "__const__", "__extension__", "__inline",
14583: "__inline__", "__label__", "__restrict",
14584: "__restrict__", "__signed", "__signed__", "typeof",
14585: "__typeof", "__typeof__", "__volatile",
14586: "__volatile__" });
14587:
14588: }
14589:
14590: // =========================================================================
14591:
14592: /**
14593: * Get the specified text.
14594: *
14595: * @param s The text.
14596: * @return The text.
14597: */
14598: protected static final String toText(String s) {
14599: return s;
14600: }
14601:
14602: // =========================================================================
14603:
14604: /**
14605: * Add the specified values to the specified set.
14606: *
14607: * @param set The set.
14608: * @param values The new values.
14609: */
14610: protected static final <T> void add(Set<T> set, T[] values) {
14611: for (T v : values)
14612: set.add(v);
14613: }
14614:
14615: /**
14616: * Check whether the specified set contains the specified value.
14617: *
14618: * @param set The set.
14619: * @param value The value.
14620: * @return <code>true</code> if the set contains the value.
14621: */
14622: protected static final <T> boolean contains(Set<T> set, T value) {
14623: return set.contains(value);
14624: }
14625:
14626: }
|