0001: // ===========================================================================
0002: // This file has been generated by
0003: // Rats! Parser Generator, version 1.13.1,
0004: // (C) 2004-2007 Robert Grimm,
0005: // on Wednesday, October 3, 2007 at 11:58:57 AM.
0006: // Edit at your own risk.
0007: // ===========================================================================
0008:
0009: package xtc.parser;
0010:
0011: import java.io.Reader;
0012: import java.io.IOException;
0013:
0014: import xtc.util.Pair;
0015:
0016: import xtc.tree.Locatable;
0017:
0018: import xtc.parser.ParserBase;
0019: import xtc.parser.Column;
0020: import xtc.parser.Result;
0021: import xtc.parser.SemanticValue;
0022: import xtc.parser.ParseError;
0023:
0024: import java.util.ArrayList;
0025: import java.util.List;
0026:
0027: import xtc.Constants;
0028:
0029: import xtc.tree.Attribute;
0030: import xtc.tree.Comment;
0031:
0032: import xtc.util.Utilities;
0033:
0034: /**
0035: * Packrat parser for grammar <code>xtc.parser.PGrammar</code>.
0036: *
0037: * <p />This class has been generated by the <i>Rats!</i> parser
0038: * generator, version 1.13.1, (C) 2004-2007 Robert Grimm.
0039: */
0040: public final class PParser extends ParserBase {
0041:
0042: // =========================================================================
0043:
0044: /** Chunk 1 of memoized results. */
0045: static final class Chunk1 {
0046: Result fModuleList;
0047: Result fModuleList$$Star1;
0048: Result fModuleTarget;
0049: Result fModuleName;
0050: Result fProductionAttributes;
0051: Result fChoice;
0052: Result fChoice$$Star1;
0053: Result fSequence;
0054: Result fSequence$$Star1;
0055: Result fSequenceName;
0056: }
0057:
0058: /** Chunk 2 of memoized results. */
0059: static final class Chunk2 {
0060: Result fVoided;
0061: Result fSuffix;
0062: Result fPrimary;
0063: Result fUnqualifiedNonTerminal;
0064: Result fAction;
0065: Result fAttribute;
0066: Result fTypeName;
0067: Result fTypeNameCharacters;
0068: Result fTypeNameCharacters$$Star1;
0069: Result fName;
0070: }
0071:
0072: /** Chunk 3 of memoized results. */
0073: static final class Chunk3 {
0074: Result fWord;
0075: Result fNameCharacters;
0076: Result fNameCharacters$$Star1;
0077: Result fWordCharacters;
0078: Result fWordCharacters$$Plus1;
0079: Result fWordCharacters$$Star1;
0080: Result fCharacterLiteral;
0081: Result fStringLiteral;
0082: Result fStringLiteral$$Star1;
0083: Result fClassChar;
0084: }
0085:
0086: /** Chunk 4 of memoized results. */
0087: static final class Chunk4 {
0088: Result fSymbol;
0089: }
0090:
0091: // =========================================================================
0092:
0093: /** Memoization table column. */
0094: static final class PParserColumn extends Column {
0095: Chunk1 chunk1;
0096: Chunk2 chunk2;
0097: Chunk3 chunk3;
0098: Chunk4 chunk4;
0099: }
0100:
0101: // =========================================================================
0102:
0103: /** The global state object. */
0104: protected final PParserState yyState;
0105:
0106: // =========================================================================
0107:
0108: /**
0109: * Create a new packrat parser.
0110: *
0111: * @param reader The reader.
0112: * @param file The file name.
0113: */
0114: public PParser(final Reader reader, final String file) {
0115: super (reader, file);
0116: yyState = new PParserState();
0117: }
0118:
0119: /**
0120: * Create a new packrat parser.
0121: *
0122: * @param reader The file reader.
0123: * @param file The file name.
0124: * @param size The file size.
0125: */
0126: public PParser(final Reader reader, final String file,
0127: final int size) {
0128: super (reader, file, size);
0129: yyState = new PParserState();
0130: }
0131:
0132: // =========================================================================
0133:
0134: protected Column newColumn() {
0135: return new PParserColumn();
0136: }
0137:
0138: // =========================================================================
0139:
0140: /**
0141: * Parse nonterminal xtc.parser.PGrammar.Module.
0142: *
0143: * @param yyStart The index.
0144: * @return The result.
0145: * @throws IOException Signals an I/O error.
0146: */
0147: public Result pModule(final int yyStart) throws IOException {
0148: Result yyResult;
0149: int yyBase;
0150: int yyRepetition1;
0151: Pair<Object> yyRepValue1;
0152: int yyOption1;
0153: Object yyOpValue1;
0154: Module yyValue;
0155: ParseError yyError = ParseError.DUMMY;
0156:
0157: // Reset the global state object.
0158: yyState.reset(column(yyStart).file);
0159:
0160: // Alternative 1.
0161:
0162: yyResult = pSpacing(yyStart);
0163: yyError = yyResult.select(yyError);
0164: if (yyResult.hasValue()) {
0165:
0166: yyOption1 = yyResult.index;
0167: yyOpValue1 = null;
0168:
0169: yyResult = pCodeComment(yyOption1);
0170: yyError = yyResult.select(yyError);
0171: if (yyResult.hasValue()) {
0172: final String v$el$1 = yyResult.semanticValue();
0173:
0174: yyOption1 = yyResult.index;
0175: yyOpValue1 = v$el$1;
0176: }
0177: { // Start scope for documentation.
0178: final String documentation = cast(yyOpValue1);
0179:
0180: yyResult = pSpacing(yyOption1);
0181: yyError = yyResult.select(yyError);
0182: if (yyResult.hasValue()) {
0183:
0184: yyBase = yyResult.index;
0185: yyResult = pWord(yyBase);
0186: yyError = yyResult.select(yyError);
0187: if (yyResult.hasValue("module")) {
0188:
0189: yyResult = pModuleName(yyResult.index);
0190: yyError = yyResult.select(yyError);
0191: if (yyResult.hasValue()) {
0192: final ModuleName name = yyResult
0193: .semanticValue();
0194:
0195: yyOption1 = yyResult.index;
0196: yyOpValue1 = null;
0197:
0198: yyResult = pModuleList(yyOption1);
0199: yyError = yyResult.select(yyError);
0200: if (yyResult.hasValue()) {
0201: final ModuleList v$el$2 = yyResult
0202: .semanticValue();
0203:
0204: yyOption1 = yyResult.index;
0205: yyOpValue1 = v$el$2;
0206: }
0207: { // Start scope for params.
0208: final ModuleList params = cast(yyOpValue1);
0209:
0210: yyBase = yyOption1;
0211: yyResult = pSymbol(yyBase);
0212: yyError = yyResult.select(yyError);
0213: if (yyResult.hasValue(";")) {
0214:
0215: yyRepetition1 = yyResult.index;
0216: yyRepValue1 = Pair.empty();
0217: while (true) {
0218:
0219: yyResult = pModuleDependency(yyRepetition1);
0220: yyError = yyResult
0221: .select(yyError);
0222: if (yyResult.hasValue()) {
0223: final ModuleDependency v$el$3 = yyResult
0224: .semanticValue();
0225:
0226: yyRepetition1 = yyResult.index;
0227: yyRepValue1 = new Pair<Object>(
0228: v$el$3, yyRepValue1);
0229: continue;
0230: }
0231: break;
0232: }
0233: { // Start scope for deps.
0234: final Pair<ModuleDependency> deps = cast(yyRepValue1
0235: .reverse());
0236:
0237: yyOption1 = yyRepetition1;
0238: yyOpValue1 = null;
0239:
0240: yyResult = pHeader(yyOption1);
0241: yyError = yyResult
0242: .select(yyError);
0243: if (yyResult.hasValue()) {
0244: final Action v$el$4 = yyResult
0245: .semanticValue();
0246:
0247: yyOption1 = yyResult.index;
0248: yyOpValue1 = v$el$4;
0249: }
0250: { // Start scope for header.
0251: final Action header = cast(yyOpValue1);
0252:
0253: yyOpValue1 = null;
0254:
0255: yyResult = pBody(yyOption1);
0256: yyError = yyResult
0257: .select(yyError);
0258: if (yyResult.hasValue()) {
0259: final Action v$el$5 = yyResult
0260: .semanticValue();
0261:
0262: yyOption1 = yyResult.index;
0263: yyOpValue1 = v$el$5;
0264: }
0265: { // Start scope for body.
0266: final Action body = cast(yyOpValue1);
0267:
0268: yyOpValue1 = null;
0269:
0270: yyResult = pFooter(yyOption1);
0271: yyError = yyResult
0272: .select(yyError);
0273: if (yyResult.hasValue()) {
0274: final Action v$el$6 = yyResult
0275: .semanticValue();
0276:
0277: yyOption1 = yyResult.index;
0278: yyOpValue1 = v$el$6;
0279: }
0280: { // Start scope for footer.
0281: final Action footer = cast(yyOpValue1);
0282:
0283: yyOpValue1 = null;
0284:
0285: yyResult = pOptions(yyOption1);
0286: yyError = yyResult
0287: .select(yyError);
0288: if (yyResult
0289: .hasValue()) {
0290: final List<Attribute> v$el$7 = yyResult
0291: .semanticValue();
0292:
0293: yyOption1 = yyResult.index;
0294: yyOpValue1 = v$el$7;
0295: }
0296: { // Start scope for options.
0297: final List<Attribute> options = cast(yyOpValue1);
0298:
0299: yyRepetition1 = yyOption1;
0300: yyRepValue1 = Pair
0301: .empty();
0302: while (true) {
0303:
0304: yyResult = pProduction(yyRepetition1);
0305: yyError = yyResult
0306: .select(yyError);
0307: if (yyResult
0308: .hasValue()) {
0309: final Production v$el$8 = yyResult
0310: .semanticValue();
0311:
0312: yyRepetition1 = yyResult.index;
0313: yyRepValue1 = new Pair<Object>(
0314: v$el$8,
0315: yyRepValue1);
0316: continue;
0317: }
0318: break;
0319: }
0320: { // Start scope for productions.
0321: final Pair<Production> productions = cast(yyRepValue1
0322: .reverse());
0323:
0324: yyResult = pEndOfFile(yyRepetition1);
0325: yyError = yyResult
0326: .select(yyError);
0327: if (yyResult
0328: .hasValue()) {
0329:
0330: yyValue = new Module(
0331: Comment
0332: .documentation(documentation),
0333: name,
0334: params,
0335: deps
0336: .list(),
0337: header,
0338: body,
0339: footer,
0340: options,
0341: productions
0342: .list());
0343:
0344: setLocation(
0345: yyValue,
0346: yyStart);
0347: return yyResult
0348: .createValue(
0349: yyValue,
0350: yyError);
0351: }
0352: } // End scope for productions.
0353: } // End scope for options.
0354: } // End scope for footer.
0355: } // End scope for body.
0356: } // End scope for header.
0357: } // End scope for deps.
0358: } else {
0359: yyError = yyError.select(
0360: "\";\" expected", yyBase);
0361: }
0362: } // End scope for params.
0363: }
0364: } else {
0365: yyError = yyError.select("\"module\" expected",
0366: yyBase);
0367: }
0368: }
0369: } // End scope for documentation.
0370: }
0371:
0372: // Done.
0373: return yyError;
0374: }
0375:
0376: // =========================================================================
0377:
0378: /**
0379: * Parse nonterminal xtc.parser.PGrammar.ModuleDependency.
0380: *
0381: * @param yyStart The index.
0382: * @return The result.
0383: * @throws IOException Signals an I/O error.
0384: */
0385: private Result pModuleDependency(final int yyStart)
0386: throws IOException {
0387: Result yyResult;
0388: ModuleDependency yyValue;
0389: ParseError yyError = ParseError.DUMMY;
0390:
0391: // Alternative <Modification>.
0392:
0393: yyResult = pModuleModification(yyStart);
0394: yyError = yyResult.select(yyError);
0395: if (yyResult.hasValue()) {
0396: yyValue = yyResult.semanticValue();
0397:
0398: return yyResult.createValue(yyValue, yyError);
0399: }
0400:
0401: // Alternative <Instantiation>.
0402:
0403: yyResult = pModuleInstantiation(yyStart);
0404: yyError = yyResult.select(yyError);
0405: if (yyResult.hasValue()) {
0406: yyValue = yyResult.semanticValue();
0407:
0408: return yyResult.createValue(yyValue, yyError);
0409: }
0410:
0411: // Alternative <Import>.
0412:
0413: yyResult = pModuleImport(yyStart);
0414: yyError = yyResult.select(yyError);
0415: if (yyResult.hasValue()) {
0416: yyValue = yyResult.semanticValue();
0417:
0418: return yyResult.createValue(yyValue, yyError);
0419: }
0420:
0421: // Done.
0422: return yyError;
0423: }
0424:
0425: // =========================================================================
0426:
0427: /**
0428: * Parse nonterminal xtc.parser.PGrammar.ModuleModification.
0429: *
0430: * @param yyStart The index.
0431: * @return The result.
0432: * @throws IOException Signals an I/O error.
0433: */
0434: private Result pModuleModification(final int yyStart)
0435: throws IOException {
0436: Result yyResult;
0437: int yyBase;
0438: int yyOption1;
0439: Object yyOpValue1;
0440: ModuleModification yyValue;
0441: ParseError yyError = ParseError.DUMMY;
0442:
0443: // Alternative 1.
0444:
0445: yyResult = pWord(yyStart);
0446: yyError = yyResult.select(yyError);
0447: if (yyResult.hasValue("modify")) {
0448:
0449: yyResult = pModuleName(yyResult.index);
0450: yyError = yyResult.select(yyError);
0451: if (yyResult.hasValue()) {
0452: final ModuleName name = yyResult.semanticValue();
0453:
0454: yyOption1 = yyResult.index;
0455: yyOpValue1 = null;
0456:
0457: yyResult = pModuleList(yyOption1);
0458: yyError = yyResult.select(yyError);
0459: if (yyResult.hasValue()) {
0460: final ModuleList v$el$1 = yyResult.semanticValue();
0461:
0462: yyOption1 = yyResult.index;
0463: yyOpValue1 = v$el$1;
0464: }
0465: { // Start scope for args.
0466: final ModuleList args = cast(yyOpValue1);
0467:
0468: yyOpValue1 = null;
0469:
0470: yyResult = pModuleTarget(yyOption1);
0471: yyError = yyResult.select(yyError);
0472: if (yyResult.hasValue()) {
0473: final ModuleName v$el$2 = yyResult
0474: .semanticValue();
0475:
0476: yyOption1 = yyResult.index;
0477: yyOpValue1 = v$el$2;
0478: }
0479: { // Start scope for target.
0480: final ModuleName target = cast(yyOpValue1);
0481:
0482: yyBase = yyOption1;
0483: yyResult = pSymbol(yyBase);
0484: yyError = yyResult.select(yyError);
0485: if (yyResult.hasValue(";")) {
0486:
0487: yyValue = new ModuleModification(name,
0488: args, target);
0489:
0490: setLocation(yyValue, yyStart);
0491: return yyResult.createValue(yyValue,
0492: yyError);
0493: } else {
0494: yyError = yyError.select("\";\" expected",
0495: yyBase);
0496: }
0497: } // End scope for target.
0498: } // End scope for args.
0499: }
0500: }
0501:
0502: // Done.
0503: yyError = yyError.select("module modification expected",
0504: yyStart);
0505: return yyError;
0506: }
0507:
0508: // =========================================================================
0509:
0510: /**
0511: * Parse nonterminal xtc.parser.PGrammar.ModuleInstantiation.
0512: *
0513: * @param yyStart The index.
0514: * @return The result.
0515: * @throws IOException Signals an I/O error.
0516: */
0517: private Result pModuleInstantiation(final int yyStart)
0518: throws IOException {
0519: Result yyResult;
0520: int yyBase;
0521: int yyOption1;
0522: Object yyOpValue1;
0523: ModuleInstantiation yyValue;
0524: ParseError yyError = ParseError.DUMMY;
0525:
0526: // Alternative 1.
0527:
0528: yyResult = pWord(yyStart);
0529: yyError = yyResult.select(yyError);
0530: if (yyResult.hasValue("instantiate")) {
0531:
0532: yyResult = pModuleName(yyResult.index);
0533: yyError = yyResult.select(yyError);
0534: if (yyResult.hasValue()) {
0535: final ModuleName name = yyResult.semanticValue();
0536:
0537: yyOption1 = yyResult.index;
0538: yyOpValue1 = null;
0539:
0540: yyResult = pModuleList(yyOption1);
0541: yyError = yyResult.select(yyError);
0542: if (yyResult.hasValue()) {
0543: final ModuleList v$el$1 = yyResult.semanticValue();
0544:
0545: yyOption1 = yyResult.index;
0546: yyOpValue1 = v$el$1;
0547: }
0548: { // Start scope for args.
0549: final ModuleList args = cast(yyOpValue1);
0550:
0551: yyOpValue1 = null;
0552:
0553: yyResult = pModuleTarget(yyOption1);
0554: yyError = yyResult.select(yyError);
0555: if (yyResult.hasValue()) {
0556: final ModuleName v$el$2 = yyResult
0557: .semanticValue();
0558:
0559: yyOption1 = yyResult.index;
0560: yyOpValue1 = v$el$2;
0561: }
0562: { // Start scope for target.
0563: final ModuleName target = cast(yyOpValue1);
0564:
0565: yyBase = yyOption1;
0566: yyResult = pSymbol(yyBase);
0567: yyError = yyResult.select(yyError);
0568: if (yyResult.hasValue(";")) {
0569:
0570: yyValue = new ModuleInstantiation(name,
0571: args, target);
0572:
0573: setLocation(yyValue, yyStart);
0574: return yyResult.createValue(yyValue,
0575: yyError);
0576: } else {
0577: yyError = yyError.select("\";\" expected",
0578: yyBase);
0579: }
0580: } // End scope for target.
0581: } // End scope for args.
0582: }
0583: }
0584:
0585: // Done.
0586: yyError = yyError.select("module instantiation expected",
0587: yyStart);
0588: return yyError;
0589: }
0590:
0591: // =========================================================================
0592:
0593: /**
0594: * Parse nonterminal xtc.parser.PGrammar.ModuleImport.
0595: *
0596: * @param yyStart The index.
0597: * @return The result.
0598: * @throws IOException Signals an I/O error.
0599: */
0600: private Result pModuleImport(final int yyStart) throws IOException {
0601: Result yyResult;
0602: int yyBase;
0603: int yyOption1;
0604: Object yyOpValue1;
0605: ModuleImport yyValue;
0606: ParseError yyError = ParseError.DUMMY;
0607:
0608: // Alternative 1.
0609:
0610: yyResult = pWord(yyStart);
0611: yyError = yyResult.select(yyError);
0612: if (yyResult.hasValue("import")) {
0613:
0614: yyResult = pModuleName(yyResult.index);
0615: yyError = yyResult.select(yyError);
0616: if (yyResult.hasValue()) {
0617: final ModuleName name = yyResult.semanticValue();
0618:
0619: yyOption1 = yyResult.index;
0620: yyOpValue1 = null;
0621:
0622: yyResult = pModuleList(yyOption1);
0623: yyError = yyResult.select(yyError);
0624: if (yyResult.hasValue()) {
0625: final ModuleList v$el$1 = yyResult.semanticValue();
0626:
0627: yyOption1 = yyResult.index;
0628: yyOpValue1 = v$el$1;
0629: }
0630: { // Start scope for args.
0631: final ModuleList args = cast(yyOpValue1);
0632:
0633: yyOpValue1 = null;
0634:
0635: yyResult = pModuleTarget(yyOption1);
0636: yyError = yyResult.select(yyError);
0637: if (yyResult.hasValue()) {
0638: final ModuleName v$el$2 = yyResult
0639: .semanticValue();
0640:
0641: yyOption1 = yyResult.index;
0642: yyOpValue1 = v$el$2;
0643: }
0644: { // Start scope for target.
0645: final ModuleName target = cast(yyOpValue1);
0646:
0647: yyBase = yyOption1;
0648: yyResult = pSymbol(yyBase);
0649: yyError = yyResult.select(yyError);
0650: if (yyResult.hasValue(";")) {
0651:
0652: yyValue = new ModuleImport(name, args,
0653: target);
0654:
0655: setLocation(yyValue, yyStart);
0656: return yyResult.createValue(yyValue,
0657: yyError);
0658: } else {
0659: yyError = yyError.select("\";\" expected",
0660: yyBase);
0661: }
0662: } // End scope for target.
0663: } // End scope for args.
0664: }
0665: }
0666:
0667: // Done.
0668: yyError = yyError.select("module import expected", yyStart);
0669: return yyError;
0670: }
0671:
0672: // =========================================================================
0673:
0674: /**
0675: * Parse nonterminal xtc.parser.PGrammar.ModuleList.
0676: *
0677: * @param yyStart The index.
0678: * @return The result.
0679: * @throws IOException Signals an I/O error.
0680: */
0681: private Result pModuleList(final int yyStart) throws IOException {
0682: PParserColumn yyColumn = (PParserColumn) column(yyStart);
0683: if (null == yyColumn.chunk1)
0684: yyColumn.chunk1 = new Chunk1();
0685: if (null == yyColumn.chunk1.fModuleList)
0686: yyColumn.chunk1.fModuleList = pModuleList$1(yyStart);
0687: return yyColumn.chunk1.fModuleList;
0688: }
0689:
0690: /** Actually parse xtc.parser.PGrammar.ModuleList. */
0691: private Result pModuleList$1(final int yyStart) throws IOException {
0692: Result yyResult;
0693: int yyBase;
0694: ModuleList yyValue;
0695: ParseError yyError = ParseError.DUMMY;
0696:
0697: // Alternative 1.
0698:
0699: yyResult = pSymbol(yyStart);
0700: yyError = yyResult.select(yyError);
0701: if (yyResult.hasValue("(")) {
0702:
0703: final int yyChoice1 = yyResult.index;
0704:
0705: // Nested alternative 1.
0706:
0707: yyResult = pModuleName(yyChoice1);
0708: yyError = yyResult.select(yyError);
0709: if (yyResult.hasValue()) {
0710: final ModuleName name = yyResult.semanticValue();
0711:
0712: yyResult = pModuleList$$Star1(yyResult.index);
0713: yyError = yyResult.select(yyError);
0714: if (yyResult.hasValue()) {
0715: final Pair<ModuleName> names = yyResult
0716: .semanticValue();
0717:
0718: yyBase = yyResult.index;
0719: yyResult = pSymbol(yyBase);
0720: yyError = yyResult.select(yyError);
0721: if (yyResult.hasValue(")")) {
0722:
0723: yyValue = new ModuleList(new Pair<ModuleName>(
0724: name, names).list());
0725:
0726: setLocation(yyValue, yyStart);
0727: return yyResult.createValue(yyValue, yyError);
0728: } else {
0729: yyError = yyError.select("\")\" expected",
0730: yyBase);
0731: }
0732: }
0733: }
0734:
0735: // Nested alternative 2.
0736:
0737: yyBase = yyChoice1;
0738: yyResult = pSymbol(yyBase);
0739: yyError = yyResult.select(yyError);
0740: if (yyResult.hasValue(")")) {
0741:
0742: yyValue = new ModuleList(new ArrayList<ModuleName>(0));
0743:
0744: setLocation(yyValue, yyStart);
0745: return yyResult.createValue(yyValue, yyError);
0746: } else {
0747: yyError = yyError.select("\")\" expected", yyBase);
0748: }
0749: }
0750:
0751: // Done.
0752: yyError = yyError.select("module list expected", yyStart);
0753: return yyError;
0754: }
0755:
0756: // =========================================================================
0757:
0758: /**
0759: * Parse synthetic nonterminal xtc.parser.PGrammar.ModuleList$$Star1.
0760: *
0761: * @param yyStart The index.
0762: * @return The result.
0763: * @throws IOException Signals an I/O error.
0764: */
0765: private Result pModuleList$$Star1(final int yyStart)
0766: throws IOException {
0767: PParserColumn yyColumn = (PParserColumn) column(yyStart);
0768: if (null == yyColumn.chunk1)
0769: yyColumn.chunk1 = new Chunk1();
0770: if (null == yyColumn.chunk1.fModuleList$$Star1)
0771: yyColumn.chunk1.fModuleList$$Star1 = pModuleList$$Star1$1(yyStart);
0772: return yyColumn.chunk1.fModuleList$$Star1;
0773: }
0774:
0775: /** Actually parse xtc.parser.PGrammar.ModuleList$$Star1. */
0776: private Result pModuleList$$Star1$1(final int yyStart)
0777: throws IOException {
0778: Result yyResult;
0779: Pair<ModuleName> yyValue;
0780: ParseError yyError = ParseError.DUMMY;
0781:
0782: // Alternative 1.
0783:
0784: yyResult = pSymbol(yyStart);
0785: yyError = yyResult.select(yyError);
0786: if (yyResult.hasValue(",")) {
0787:
0788: yyResult = pModuleName(yyResult.index);
0789: yyError = yyResult.select(yyError);
0790: if (yyResult.hasValue()) {
0791: final ModuleName v$el$1 = yyResult.semanticValue();
0792:
0793: yyResult = pModuleList$$Star1(yyResult.index);
0794: yyError = yyResult.select(yyError);
0795: if (yyResult.hasValue()) {
0796: final Pair<ModuleName> v$2 = yyResult
0797: .semanticValue();
0798:
0799: yyValue = new Pair<ModuleName>(v$el$1, v$2);
0800:
0801: return yyResult.createValue(yyValue, yyError);
0802: }
0803: }
0804: }
0805:
0806: // Alternative 2.
0807:
0808: yyValue = Pair.empty();
0809:
0810: return new SemanticValue(yyValue, yyStart, yyError);
0811: }
0812:
0813: // =========================================================================
0814:
0815: /**
0816: * Parse nonterminal xtc.parser.PGrammar.ModuleTarget.
0817: *
0818: * @param yyStart The index.
0819: * @return The result.
0820: * @throws IOException Signals an I/O error.
0821: */
0822: private Result pModuleTarget(final int yyStart) throws IOException {
0823: PParserColumn yyColumn = (PParserColumn) column(yyStart);
0824: if (null == yyColumn.chunk1)
0825: yyColumn.chunk1 = new Chunk1();
0826: if (null == yyColumn.chunk1.fModuleTarget)
0827: yyColumn.chunk1.fModuleTarget = pModuleTarget$1(yyStart);
0828: return yyColumn.chunk1.fModuleTarget;
0829: }
0830:
0831: /** Actually parse xtc.parser.PGrammar.ModuleTarget. */
0832: private Result pModuleTarget$1(final int yyStart)
0833: throws IOException {
0834: Result yyResult;
0835: ModuleName yyValue;
0836: ParseError yyError = ParseError.DUMMY;
0837:
0838: // Alternative 1.
0839:
0840: yyResult = pWord(yyStart);
0841: yyError = yyResult.select(yyError);
0842: if (yyResult.hasValue("as")) {
0843:
0844: yyResult = pModuleName(yyResult.index);
0845: yyError = yyResult.select(yyError);
0846: if (yyResult.hasValue()) {
0847: yyValue = yyResult.semanticValue();
0848:
0849: return yyResult.createValue(yyValue, yyError);
0850: }
0851: }
0852:
0853: // Done.
0854: yyError = yyError.select("module target expected", yyStart);
0855: return yyError;
0856: }
0857:
0858: // =========================================================================
0859:
0860: /**
0861: * Parse nonterminal xtc.parser.PGrammar.ModuleName.
0862: *
0863: * @param yyStart The index.
0864: * @return The result.
0865: * @throws IOException Signals an I/O error.
0866: */
0867: private Result pModuleName(final int yyStart) throws IOException {
0868: PParserColumn yyColumn = (PParserColumn) column(yyStart);
0869: if (null == yyColumn.chunk1)
0870: yyColumn.chunk1 = new Chunk1();
0871: if (null == yyColumn.chunk1.fModuleName)
0872: yyColumn.chunk1.fModuleName = pModuleName$1(yyStart);
0873: return yyColumn.chunk1.fModuleName;
0874: }
0875:
0876: /** Actually parse xtc.parser.PGrammar.ModuleName. */
0877: private Result pModuleName$1(final int yyStart) throws IOException {
0878: Result yyResult;
0879: ModuleName yyValue;
0880: ParseError yyError = ParseError.DUMMY;
0881:
0882: // Alternative 1.
0883:
0884: yyResult = pName(yyStart);
0885: yyError = yyResult.select(yyError);
0886: if (yyResult.hasValue()) {
0887: final String name = yyResult.semanticValue();
0888:
0889: yyValue = new ModuleName(name);
0890:
0891: setLocation(yyValue, yyStart);
0892: return yyResult.createValue(yyValue, yyError);
0893: }
0894:
0895: // Done.
0896: return yyError;
0897: }
0898:
0899: // =========================================================================
0900:
0901: /**
0902: * Parse nonterminal xtc.parser.PGrammar.Header.
0903: *
0904: * @param yyStart The index.
0905: * @return The result.
0906: * @throws IOException Signals an I/O error.
0907: */
0908: private Result pHeader(final int yyStart) throws IOException {
0909: Result yyResult;
0910: Action yyValue;
0911: ParseError yyError = ParseError.DUMMY;
0912:
0913: // Alternative 1.
0914:
0915: yyResult = pWord(yyStart);
0916: yyError = yyResult.select(yyError);
0917: if (yyResult.hasValue("header")) {
0918:
0919: yyResult = pAction(yyResult.index);
0920: yyError = yyResult.select(yyError);
0921: if (yyResult.hasValue()) {
0922: yyValue = yyResult.semanticValue();
0923:
0924: return yyResult.createValue(yyValue, yyError);
0925: }
0926: }
0927:
0928: // Done.
0929: yyError = yyError.select("header expected", yyStart);
0930: return yyError;
0931: }
0932:
0933: // =========================================================================
0934:
0935: /**
0936: * Parse nonterminal xtc.parser.PGrammar.Body.
0937: *
0938: * @param yyStart The index.
0939: * @return The result.
0940: * @throws IOException Signals an I/O error.
0941: */
0942: private Result pBody(final int yyStart) throws IOException {
0943: Result yyResult;
0944: Action yyValue;
0945: ParseError yyError = ParseError.DUMMY;
0946:
0947: // Alternative 1.
0948:
0949: yyResult = pWord(yyStart);
0950: yyError = yyResult.select(yyError);
0951: if (yyResult.hasValue("body")) {
0952:
0953: yyResult = pAction(yyResult.index);
0954: yyError = yyResult.select(yyError);
0955: if (yyResult.hasValue()) {
0956: yyValue = yyResult.semanticValue();
0957:
0958: return yyResult.createValue(yyValue, yyError);
0959: }
0960: }
0961:
0962: // Done.
0963: yyError = yyError.select("body expected", yyStart);
0964: return yyError;
0965: }
0966:
0967: // =========================================================================
0968:
0969: /**
0970: * Parse nonterminal xtc.parser.PGrammar.Footer.
0971: *
0972: * @param yyStart The index.
0973: * @return The result.
0974: * @throws IOException Signals an I/O error.
0975: */
0976: private Result pFooter(final int yyStart) throws IOException {
0977: Result yyResult;
0978: Action yyValue;
0979: ParseError yyError = ParseError.DUMMY;
0980:
0981: // Alternative 1.
0982:
0983: yyResult = pWord(yyStart);
0984: yyError = yyResult.select(yyError);
0985: if (yyResult.hasValue("footer")) {
0986:
0987: yyResult = pAction(yyResult.index);
0988: yyError = yyResult.select(yyError);
0989: if (yyResult.hasValue()) {
0990: yyValue = yyResult.semanticValue();
0991:
0992: return yyResult.createValue(yyValue, yyError);
0993: }
0994: }
0995:
0996: // Done.
0997: yyError = yyError.select("footer expected", yyStart);
0998: return yyError;
0999: }
1000:
1001: // =========================================================================
1002:
1003: /**
1004: * Parse nonterminal xtc.parser.PGrammar.Options.
1005: *
1006: * @param yyStart The index.
1007: * @return The result.
1008: * @throws IOException Signals an I/O error.
1009: */
1010: private Result pOptions(final int yyStart) throws IOException {
1011: Result yyResult;
1012: int yyBase;
1013: int yyRepetition1;
1014: Pair<Attribute> yyRepValue1;
1015: List<Attribute> yyValue;
1016: ParseError yyError = ParseError.DUMMY;
1017:
1018: // Alternative 1.
1019:
1020: yyResult = pWord(yyStart);
1021: yyError = yyResult.select(yyError);
1022: if (yyResult.hasValue("option")) {
1023:
1024: yyResult = pAttribute(yyResult.index);
1025: yyError = yyResult.select(yyError);
1026: if (yyResult.hasValue()) {
1027: final Attribute att = yyResult.semanticValue();
1028:
1029: yyRepetition1 = yyResult.index;
1030: yyRepValue1 = Pair.empty();
1031: while (true) {
1032:
1033: yyBase = yyRepetition1;
1034: yyResult = pSymbol(yyBase);
1035: yyError = yyResult.select(yyError);
1036: if (yyResult.hasValue(",")) {
1037:
1038: yyResult = pAttribute(yyResult.index);
1039: yyError = yyResult.select(yyError);
1040: if (yyResult.hasValue()) {
1041: final Attribute v$el$1 = yyResult
1042: .semanticValue();
1043:
1044: yyRepetition1 = yyResult.index;
1045: yyRepValue1 = new Pair<Attribute>(v$el$1,
1046: yyRepValue1);
1047: continue;
1048: }
1049: } else {
1050: yyError = yyError.select("\",\" expected",
1051: yyBase);
1052: }
1053: break;
1054: }
1055: { // Start scope for atts.
1056: final Pair<Attribute> atts = yyRepValue1.reverse();
1057:
1058: yyBase = yyRepetition1;
1059: yyResult = pSymbol(yyBase);
1060: yyError = yyResult.select(yyError);
1061: if (yyResult.hasValue(";")) {
1062:
1063: yyValue = new ArrayList<Attribute>(
1064: atts.size() + 1);
1065: new Pair<Attribute>(att, atts).addTo(yyValue);
1066:
1067: return yyResult.createValue(yyValue, yyError);
1068: } else {
1069: yyError = yyError.select("\";\" expected",
1070: yyBase);
1071: }
1072: } // End scope for atts.
1073: }
1074: }
1075:
1076: // Done.
1077: yyError = yyError.select("options expected", yyStart);
1078: return yyError;
1079: }
1080:
1081: // =========================================================================
1082:
1083: /**
1084: * Parse nonterminal xtc.parser.PGrammar.Production.
1085: *
1086: * @param yyStart The index.
1087: * @return The result.
1088: * @throws IOException Signals an I/O error.
1089: */
1090: private Result pProduction(final int yyStart) throws IOException {
1091: Result yyResult;
1092: Production yyValue;
1093: ParseError yyError = ParseError.DUMMY;
1094:
1095: // Alternative <Full>.
1096:
1097: yyResult = pFullProduction(yyStart);
1098: yyError = yyResult.select(yyError);
1099: if (yyResult.hasValue()) {
1100: yyValue = yyResult.semanticValue();
1101:
1102: return yyResult.createValue(yyValue, yyError);
1103: }
1104:
1105: // Alternative <Addition>.
1106:
1107: yyResult = pAlternativeAddition(yyStart);
1108: yyError = yyResult.select(yyError);
1109: if (yyResult.hasValue()) {
1110: yyValue = yyResult.semanticValue();
1111:
1112: return yyResult.createValue(yyValue, yyError);
1113: }
1114:
1115: // Alternative <Removal>.
1116:
1117: yyResult = pAlternativeRemoval(yyStart);
1118: yyError = yyResult.select(yyError);
1119: if (yyResult.hasValue()) {
1120: yyValue = yyResult.semanticValue();
1121:
1122: return yyResult.createValue(yyValue, yyError);
1123: }
1124:
1125: // Alternative <Override>.
1126:
1127: yyResult = pProductionOverride(yyStart);
1128: yyError = yyResult.select(yyError);
1129: if (yyResult.hasValue()) {
1130: yyValue = yyResult.semanticValue();
1131:
1132: return yyResult.createValue(yyValue, yyError);
1133: }
1134:
1135: // Done.
1136: return yyError;
1137: }
1138:
1139: // =========================================================================
1140:
1141: /**
1142: * Parse nonterminal xtc.parser.PGrammar.FullProduction.
1143: *
1144: * @param yyStart The index.
1145: * @return The result.
1146: * @throws IOException Signals an I/O error.
1147: */
1148: private Result pFullProduction(final int yyStart)
1149: throws IOException {
1150: Result yyResult;
1151: int yyBase;
1152: FullProduction yyValue;
1153: ParseError yyError = ParseError.DUMMY;
1154:
1155: // Alternative 1.
1156:
1157: yyResult = pProductionAttributes(yyStart);
1158: yyError = yyResult.select(yyError);
1159: if (yyResult.hasValue()) {
1160: final Pair<Attribute> attributes = yyResult.semanticValue();
1161:
1162: yyResult = pTypeName(yyResult.index);
1163: yyError = yyResult.select(yyError);
1164: if (yyResult.hasValue()) {
1165: final String type = yyResult.semanticValue();
1166:
1167: yyResult = pUnqualifiedNonTerminal(yyResult.index);
1168: yyError = yyResult.select(yyError);
1169: if (yyResult.hasValue()) {
1170: final NonTerminal nt = yyResult.semanticValue();
1171:
1172: yyBase = yyResult.index;
1173: yyResult = pSymbol(yyBase);
1174: yyError = yyResult.select(yyError);
1175: if (yyResult.hasValue("=")) {
1176:
1177: yyResult = pChoice(yyResult.index);
1178: yyError = yyResult.select(yyError);
1179: if (yyResult.hasValue()) {
1180: final OrderedChoice choice = yyResult
1181: .semanticValue();
1182:
1183: yyBase = yyResult.index;
1184: yyResult = pSymbol(yyBase);
1185: yyError = yyResult.select(yyError);
1186: if (yyResult.hasValue(";")) {
1187:
1188: List<Attribute> list = new ArrayList<Attribute>(
1189: attributes.size());
1190: attributes.addTo(list);
1191: yyValue = new FullProduction(list,
1192: type, nt, choice);
1193:
1194: setLocation(yyValue, yyStart);
1195: return yyResult.createValue(yyValue,
1196: yyError);
1197: } else {
1198: yyError = yyError.select(
1199: "\";\" expected", yyBase);
1200: }
1201: }
1202: } else {
1203: yyError = yyError.select("\"=\" expected",
1204: yyBase);
1205: }
1206: }
1207: }
1208: }
1209:
1210: // Done.
1211: return yyError;
1212: }
1213:
1214: // =========================================================================
1215:
1216: /**
1217: * Parse nonterminal xtc.parser.PGrammar.AlternativeAddition.
1218: *
1219: * @param yyStart The index.
1220: * @return The result.
1221: * @throws IOException Signals an I/O error.
1222: */
1223: private Result pAlternativeAddition(final int yyStart)
1224: throws IOException {
1225: Result yyResult;
1226: int yyBase;
1227: AlternativeAddition yyValue;
1228: ParseError yyError = ParseError.DUMMY;
1229:
1230: // Alternative 1.
1231:
1232: yyResult = pTypeName(yyStart);
1233: yyError = yyResult.select(yyError);
1234: if (yyResult.hasValue()) {
1235: final String type = yyResult.semanticValue();
1236:
1237: yyResult = pUnqualifiedNonTerminal(yyResult.index);
1238: yyError = yyResult.select(yyError);
1239: if (yyResult.hasValue()) {
1240: final NonTerminal nt = yyResult.semanticValue();
1241:
1242: yyBase = yyResult.index;
1243: yyResult = pSymbol(yyBase);
1244: yyError = yyResult.select(yyError);
1245: if (yyResult.hasValue("+=")) {
1246:
1247: final int yyChoice1 = yyResult.index;
1248:
1249: // Nested alternative 1.
1250:
1251: yyResult = pSequenceName(yyChoice1);
1252: yyError = yyResult.select(yyError);
1253: if (yyResult.hasValue()) {
1254: final SequenceName s = yyResult.semanticValue();
1255:
1256: yyBase = yyResult.index;
1257: yyResult = pSymbol(yyBase);
1258: yyError = yyResult.select(yyError);
1259: if (yyResult.hasValue("...")) {
1260:
1261: yyBase = yyResult.index;
1262: yyResult = pSymbol(yyBase);
1263: yyError = yyResult.select(yyError);
1264: if (yyResult.hasValue("/")) {
1265:
1266: yyResult = pChoice(yyResult.index);
1267: yyError = yyResult.select(yyError);
1268: if (yyResult.hasValue()) {
1269: final OrderedChoice choice = yyResult
1270: .semanticValue();
1271:
1272: yyBase = yyResult.index;
1273: yyResult = pSymbol(yyBase);
1274: yyError = yyResult.select(yyError);
1275: if (yyResult.hasValue(";")) {
1276:
1277: yyValue = new AlternativeAddition(
1278: type, nt, choice, s,
1279: false);
1280:
1281: setLocation(yyValue, yyStart);
1282: return yyResult.createValue(
1283: yyValue, yyError);
1284: } else {
1285: yyError = yyError.select(
1286: "\";\" expected",
1287: yyBase);
1288: }
1289: }
1290: } else {
1291: yyError = yyError.select(
1292: "\"/\" expected", yyBase);
1293: }
1294: } else {
1295: yyError = yyError.select(
1296: "\"...\" expected", yyBase);
1297: }
1298: }
1299:
1300: // Nested alternative 2.
1301:
1302: yyResult = pChoice(yyChoice1);
1303: yyError = yyResult.select(yyError);
1304: if (yyResult.hasValue()) {
1305: final OrderedChoice choice = yyResult
1306: .semanticValue();
1307:
1308: yyBase = yyResult.index;
1309: yyResult = pSymbol(yyBase);
1310: yyError = yyResult.select(yyError);
1311: if (yyResult.hasValue("/")) {
1312:
1313: yyResult = pSequenceName(yyResult.index);
1314: yyError = yyResult.select(yyError);
1315: if (yyResult.hasValue()) {
1316: final SequenceName s = yyResult
1317: .semanticValue();
1318:
1319: yyBase = yyResult.index;
1320: yyResult = pSymbol(yyBase);
1321: yyError = yyResult.select(yyError);
1322: if (yyResult.hasValue("...")) {
1323:
1324: yyBase = yyResult.index;
1325: yyResult = pSymbol(yyBase);
1326: yyError = yyResult.select(yyError);
1327: if (yyResult.hasValue(";")) {
1328:
1329: yyValue = new AlternativeAddition(
1330: type, nt, choice, s,
1331: true);
1332:
1333: setLocation(yyValue, yyStart);
1334: return yyResult.createValue(
1335: yyValue, yyError);
1336: } else {
1337: yyError = yyError.select(
1338: "\";\" expected",
1339: yyBase);
1340: }
1341: } else {
1342: yyError = yyError.select(
1343: "\"...\" expected", yyBase);
1344: }
1345: }
1346: } else {
1347: yyError = yyError.select("\"/\" expected",
1348: yyBase);
1349: }
1350: }
1351: } else {
1352: yyError = yyError.select("\"+=\" expected", yyBase);
1353: }
1354: }
1355: }
1356:
1357: // Done.
1358: return yyError;
1359: }
1360:
1361: // =========================================================================
1362:
1363: /**
1364: * Parse nonterminal xtc.parser.PGrammar.AlternativeRemoval.
1365: *
1366: * @param yyStart The index.
1367: * @return The result.
1368: * @throws IOException Signals an I/O error.
1369: */
1370: private Result pAlternativeRemoval(final int yyStart)
1371: throws IOException {
1372: Result yyResult;
1373: int yyBase;
1374: int yyRepetition1;
1375: Pair<SequenceName> yyRepValue1;
1376: AlternativeRemoval yyValue;
1377: ParseError yyError = ParseError.DUMMY;
1378:
1379: // Alternative 1.
1380:
1381: yyResult = pTypeName(yyStart);
1382: yyError = yyResult.select(yyError);
1383: if (yyResult.hasValue()) {
1384: final String type = yyResult.semanticValue();
1385:
1386: yyResult = pUnqualifiedNonTerminal(yyResult.index);
1387: yyError = yyResult.select(yyError);
1388: if (yyResult.hasValue()) {
1389: final NonTerminal nt = yyResult.semanticValue();
1390:
1391: yyBase = yyResult.index;
1392: yyResult = pSymbol(yyBase);
1393: yyError = yyResult.select(yyError);
1394: if (yyResult.hasValue("-=")) {
1395:
1396: yyResult = pSequenceName(yyResult.index);
1397: yyError = yyResult.select(yyError);
1398: if (yyResult.hasValue()) {
1399: final SequenceName s = yyResult.semanticValue();
1400:
1401: yyRepetition1 = yyResult.index;
1402: yyRepValue1 = Pair.empty();
1403: while (true) {
1404:
1405: yyBase = yyRepetition1;
1406: yyResult = pSymbol(yyBase);
1407: yyError = yyResult.select(yyError);
1408: if (yyResult.hasValue(",")) {
1409:
1410: yyResult = pSequenceName(yyResult.index);
1411: yyError = yyResult.select(yyError);
1412: if (yyResult.hasValue()) {
1413: final SequenceName v$el$1 = yyResult
1414: .semanticValue();
1415:
1416: yyRepetition1 = yyResult.index;
1417: yyRepValue1 = new Pair<SequenceName>(
1418: v$el$1, yyRepValue1);
1419: continue;
1420: }
1421: } else {
1422: yyError = yyError.select(
1423: "\",\" expected", yyBase);
1424: }
1425: break;
1426: }
1427: { // Start scope for ss.
1428: final Pair<SequenceName> ss = yyRepValue1
1429: .reverse();
1430:
1431: yyBase = yyRepetition1;
1432: yyResult = pSymbol(yyBase);
1433: yyError = yyResult.select(yyError);
1434: if (yyResult.hasValue(";")) {
1435:
1436: yyValue = new AlternativeRemoval(type,
1437: nt, new Pair<SequenceName>(s,
1438: ss).list());
1439:
1440: setLocation(yyValue, yyStart);
1441: return yyResult.createValue(yyValue,
1442: yyError);
1443: } else {
1444: yyError = yyError.select(
1445: "\";\" expected", yyBase);
1446: }
1447: } // End scope for ss.
1448: }
1449: } else {
1450: yyError = yyError.select("\"-=\" expected", yyBase);
1451: }
1452: }
1453: }
1454:
1455: // Done.
1456: return yyError;
1457: }
1458:
1459: // =========================================================================
1460:
1461: /**
1462: * Parse nonterminal xtc.parser.PGrammar.ProductionOverride.
1463: *
1464: * @param yyStart The index.
1465: * @return The result.
1466: * @throws IOException Signals an I/O error.
1467: */
1468: private Result pProductionOverride(final int yyStart)
1469: throws IOException {
1470: Result yyResult;
1471: int yyBase;
1472: ProductionOverride yyValue;
1473: ParseError yyError = ParseError.DUMMY;
1474:
1475: // Alternative 1.
1476:
1477: yyResult = pTypeName(yyStart);
1478: yyError = yyResult.select(yyError);
1479: if (yyResult.hasValue()) {
1480: final String type = yyResult.semanticValue();
1481:
1482: yyResult = pUnqualifiedNonTerminal(yyResult.index);
1483: yyError = yyResult.select(yyError);
1484: if (yyResult.hasValue()) {
1485: final NonTerminal nt = yyResult.semanticValue();
1486:
1487: yyBase = yyResult.index;
1488: yyResult = pSymbol(yyBase);
1489: yyError = yyResult.select(yyError);
1490: if (yyResult.hasValue(":=")) {
1491:
1492: final int yyChoice1 = yyResult.index;
1493:
1494: // Nested alternative 1.
1495:
1496: yyResult = pChoice(yyChoice1);
1497: yyError = yyResult.select(yyError);
1498: if (yyResult.hasValue()) {
1499: final OrderedChoice choice = yyResult
1500: .semanticValue();
1501:
1502: yyBase = yyResult.index;
1503: yyResult = pSymbol(yyBase);
1504: yyError = yyResult.select(yyError);
1505: if (yyResult.hasValue(";")) {
1506:
1507: yyValue = new ProductionOverride(type, nt,
1508: choice, true);
1509:
1510: setLocation(yyValue, yyStart);
1511: return yyResult.createValue(yyValue,
1512: yyError);
1513: } else {
1514: yyError = yyError.select("\";\" expected",
1515: yyBase);
1516: }
1517: }
1518:
1519: // Nested alternative 2.
1520:
1521: yyBase = yyChoice1;
1522: yyResult = pSymbol(yyBase);
1523: yyError = yyResult.select(yyError);
1524: if (yyResult.hasValue("...")) {
1525:
1526: yyBase = yyResult.index;
1527: yyResult = pSymbol(yyBase);
1528: yyError = yyResult.select(yyError);
1529: if (yyResult.hasValue("/")) {
1530:
1531: yyResult = pChoice(yyResult.index);
1532: yyError = yyResult.select(yyError);
1533: if (yyResult.hasValue()) {
1534: final OrderedChoice choice = yyResult
1535: .semanticValue();
1536:
1537: yyBase = yyResult.index;
1538: yyResult = pSymbol(yyBase);
1539: yyError = yyResult.select(yyError);
1540: if (yyResult.hasValue(";")) {
1541:
1542: yyValue = new ProductionOverride(
1543: type, nt, choice, false);
1544:
1545: setLocation(yyValue, yyStart);
1546: return yyResult.createValue(
1547: yyValue, yyError);
1548: } else {
1549: yyError = yyError.select(
1550: "\";\" expected", yyBase);
1551: }
1552: }
1553: } else {
1554: yyError = yyError.select("\"/\" expected",
1555: yyBase);
1556: }
1557: } else {
1558: yyError = yyError.select("\"...\" expected",
1559: yyBase);
1560: }
1561:
1562: // Nested alternative 3.
1563:
1564: yyResult = pChoice(yyChoice1);
1565: yyError = yyResult.select(yyError);
1566: if (yyResult.hasValue()) {
1567: final OrderedChoice choice = yyResult
1568: .semanticValue();
1569:
1570: yyBase = yyResult.index;
1571: yyResult = pSymbol(yyBase);
1572: yyError = yyResult.select(yyError);
1573: if (yyResult.hasValue("/")) {
1574:
1575: yyBase = yyResult.index;
1576: yyResult = pSymbol(yyBase);
1577: yyError = yyResult.select(yyError);
1578: if (yyResult.hasValue("...")) {
1579:
1580: yyBase = yyResult.index;
1581: yyResult = pSymbol(yyBase);
1582: yyError = yyResult.select(yyError);
1583: if (yyResult.hasValue(";")) {
1584:
1585: yyValue = new ProductionOverride(
1586: type, nt, choice, false);
1587:
1588: setLocation(yyValue, yyStart);
1589: return yyResult.createValue(
1590: yyValue, yyError);
1591: } else {
1592: yyError = yyError.select(
1593: "\";\" expected", yyBase);
1594: }
1595: } else {
1596: yyError = yyError.select(
1597: "\"...\" expected", yyBase);
1598: }
1599: } else {
1600: yyError = yyError.select("\"/\" expected",
1601: yyBase);
1602: }
1603: }
1604: } else {
1605: yyError = yyError.select("\":=\" expected", yyBase);
1606: }
1607: }
1608: }
1609:
1610: // Alternative 2.
1611:
1612: yyResult = pProductionAttributes(yyStart);
1613: yyError = yyResult.select(yyError);
1614: if (yyResult.hasValue()) {
1615: final Pair<Attribute> attributes = yyResult.semanticValue();
1616:
1617: yyResult = pTypeName(yyResult.index);
1618: yyError = yyResult.select(yyError);
1619: if (yyResult.hasValue()) {
1620: final String type = yyResult.semanticValue();
1621:
1622: yyResult = pUnqualifiedNonTerminal(yyResult.index);
1623: yyError = yyResult.select(yyError);
1624: if (yyResult.hasValue()) {
1625: final NonTerminal nt = yyResult.semanticValue();
1626:
1627: yyBase = yyResult.index;
1628: yyResult = pSymbol(yyBase);
1629: yyError = yyResult.select(yyError);
1630: if (yyResult.hasValue(":=")) {
1631:
1632: yyBase = yyResult.index;
1633: yyResult = pSymbol(yyBase);
1634: yyError = yyResult.select(yyError);
1635: if (yyResult.hasValue("...")) {
1636:
1637: yyBase = yyResult.index;
1638: yyResult = pSymbol(yyBase);
1639: yyError = yyResult.select(yyError);
1640: if (yyResult.hasValue(";")) {
1641:
1642: List<Attribute> list = new ArrayList<Attribute>(
1643: attributes.size());
1644: attributes.addTo(list);
1645: yyValue = new ProductionOverride(list,
1646: type, nt);
1647:
1648: setLocation(yyValue, yyStart);
1649: return yyResult.createValue(yyValue,
1650: yyError);
1651: } else {
1652: yyError = yyError.select(
1653: "\";\" expected", yyBase);
1654: }
1655: } else {
1656: yyError = yyError.select(
1657: "\"...\" expected", yyBase);
1658: }
1659: } else {
1660: yyError = yyError.select("\":=\" expected",
1661: yyBase);
1662: }
1663: }
1664: }
1665: }
1666:
1667: // Done.
1668: return yyError;
1669: }
1670:
1671: // =========================================================================
1672:
1673: /**
1674: * Parse nonterminal xtc.parser.PGrammar.ProductionAttributes.
1675: *
1676: * @param yyStart The index.
1677: * @return The result.
1678: * @throws IOException Signals an I/O error.
1679: */
1680: private Result pProductionAttributes(final int yyStart)
1681: throws IOException {
1682: PParserColumn yyColumn = (PParserColumn) column(yyStart);
1683: if (null == yyColumn.chunk1)
1684: yyColumn.chunk1 = new Chunk1();
1685: if (null == yyColumn.chunk1.fProductionAttributes)
1686: yyColumn.chunk1.fProductionAttributes = pProductionAttributes$1(yyStart);
1687: return yyColumn.chunk1.fProductionAttributes;
1688: }
1689:
1690: /** Actually parse xtc.parser.PGrammar.ProductionAttributes. */
1691: private Result pProductionAttributes$1(final int yyStart)
1692: throws IOException {
1693:
1694: Result yyResult;
1695: Result yyPredResult;
1696: Pair<Attribute> yyValue;
1697: ParseError yyError = ParseError.DUMMY;
1698:
1699: // Alternative 1.
1700:
1701: yyPredResult = pTypeName(yyStart);
1702: yyError = yyPredResult.select(yyError);
1703: if (yyPredResult.hasValue()) {
1704:
1705: yyPredResult = pUnqualifiedNonTerminal(yyPredResult.index);
1706: yyError = yyPredResult.select(yyError);
1707: if (yyPredResult.hasValue()) {
1708:
1709: yyPredResult = pSymbol(yyPredResult.index);
1710: yyError = yyPredResult.select(yyError);
1711: if (yyPredResult.hasValue()) {
1712: final String s = yyPredResult.semanticValue();
1713:
1714: if ("=".equals(s) || ":=".equals(s)) {
1715:
1716: yyValue = Pair.empty();
1717:
1718: return new SemanticValue(yyValue, yyStart,
1719: yyError);
1720: }
1721: }
1722: }
1723: }
1724:
1725: // Alternative 2.
1726:
1727: yyResult = pAttribute(yyStart);
1728: yyError = yyResult.select(yyError);
1729: if (yyResult.hasValue()) {
1730: final Attribute att = yyResult.semanticValue();
1731:
1732: yyResult = pProductionAttributes(yyResult.index);
1733: yyError = yyResult.select(yyError);
1734: if (yyResult.hasValue()) {
1735: final Pair<Attribute> atts = yyResult.semanticValue();
1736:
1737: yyValue = new Pair<Attribute>(att, atts);
1738:
1739: return yyResult.createValue(yyValue, yyError);
1740: }
1741: }
1742:
1743: // Done.
1744: yyError = yyError.select("production attributes expected",
1745: yyStart);
1746: return yyError;
1747: }
1748:
1749: // =========================================================================
1750:
1751: /**
1752: * Parse nonterminal xtc.parser.PGrammar.Choice.
1753: *
1754: * @param yyStart The index.
1755: * @return The result.
1756: * @throws IOException Signals an I/O error.
1757: */
1758: private Result pChoice(final int yyStart) throws IOException {
1759: PParserColumn yyColumn = (PParserColumn) column(yyStart);
1760: if (null == yyColumn.chunk1)
1761: yyColumn.chunk1 = new Chunk1();
1762: if (null == yyColumn.chunk1.fChoice)
1763: yyColumn.chunk1.fChoice = pChoice$1(yyStart);
1764: return yyColumn.chunk1.fChoice;
1765: }
1766:
1767: /** Actually parse xtc.parser.PGrammar.Choice. */
1768: private Result pChoice$1(final int yyStart) throws IOException {
1769: Result yyResult;
1770: OrderedChoice yyValue;
1771: ParseError yyError = ParseError.DUMMY;
1772:
1773: // Alternative 1.
1774:
1775: yyResult = pSequence(yyStart);
1776: yyError = yyResult.select(yyError);
1777: if (yyResult.hasValue()) {
1778: final Sequence s = yyResult.semanticValue();
1779:
1780: yyResult = pChoice$$Star1(yyResult.index);
1781: yyError = yyResult.select(yyError);
1782: if (yyResult.hasValue()) {
1783: final Pair<Sequence> ss = yyResult.semanticValue();
1784:
1785: yyValue = new OrderedChoice(new Pair<Sequence>(s, ss)
1786: .list());
1787:
1788: setLocation(yyValue, yyStart);
1789: return yyResult.createValue(yyValue, yyError);
1790: }
1791: }
1792:
1793: // Done.
1794: return yyError;
1795: }
1796:
1797: // =========================================================================
1798:
1799: /**
1800: * Parse synthetic nonterminal xtc.parser.PGrammar.Choice$$Star1.
1801: *
1802: * @param yyStart The index.
1803: * @return The result.
1804: * @throws IOException Signals an I/O error.
1805: */
1806: private Result pChoice$$Star1(final int yyStart) throws IOException {
1807: PParserColumn yyColumn = (PParserColumn) column(yyStart);
1808: if (null == yyColumn.chunk1)
1809: yyColumn.chunk1 = new Chunk1();
1810: if (null == yyColumn.chunk1.fChoice$$Star1)
1811: yyColumn.chunk1.fChoice$$Star1 = pChoice$$Star1$1(yyStart);
1812: return yyColumn.chunk1.fChoice$$Star1;
1813: }
1814:
1815: /** Actually parse xtc.parser.PGrammar.Choice$$Star1. */
1816: private Result pChoice$$Star1$1(final int yyStart)
1817: throws IOException {
1818: Result yyResult;
1819: Pair<Sequence> yyValue;
1820: ParseError yyError = ParseError.DUMMY;
1821:
1822: // Alternative 1.
1823:
1824: yyResult = pSymbol(yyStart);
1825: yyError = yyResult.select(yyError);
1826: if (yyResult.hasValue("/")) {
1827:
1828: yyResult = pSequence(yyResult.index);
1829: yyError = yyResult.select(yyError);
1830: if (yyResult.hasValue()) {
1831: final Sequence v$el$1 = yyResult.semanticValue();
1832:
1833: yyResult = pChoice$$Star1(yyResult.index);
1834: yyError = yyResult.select(yyError);
1835: if (yyResult.hasValue()) {
1836: final Pair<Sequence> v$2 = yyResult.semanticValue();
1837:
1838: yyValue = new Pair<Sequence>(v$el$1, v$2);
1839:
1840: return yyResult.createValue(yyValue, yyError);
1841: }
1842: }
1843: }
1844:
1845: // Alternative 2.
1846:
1847: yyValue = Pair.empty();
1848:
1849: return new SemanticValue(yyValue, yyStart, yyError);
1850: }
1851:
1852: // =========================================================================
1853:
1854: /**
1855: * Parse nonterminal xtc.parser.PGrammar.Sequence.
1856: *
1857: * @param yyStart The index.
1858: * @return The result.
1859: * @throws IOException Signals an I/O error.
1860: */
1861: private Result pSequence(final int yyStart) throws IOException {
1862: PParserColumn yyColumn = (PParserColumn) column(yyStart);
1863: if (null == yyColumn.chunk1)
1864: yyColumn.chunk1 = new Chunk1();
1865: if (null == yyColumn.chunk1.fSequence)
1866: yyColumn.chunk1.fSequence = pSequence$1(yyStart);
1867: return yyColumn.chunk1.fSequence;
1868: }
1869:
1870: /** Actually parse xtc.parser.PGrammar.Sequence. */
1871: private Result pSequence$1(final int yyStart) throws IOException {
1872: Result yyResult;
1873: Result yyPredResult;
1874: boolean yyPredMatched;
1875: int yyOption1;
1876: SequenceName yyOpValue1;
1877: Sequence yyValue;
1878: ParseError yyError = ParseError.DUMMY;
1879:
1880: // Alternative 1.
1881:
1882: yyPredMatched = false;
1883:
1884: yyPredResult = pEllipsis(yyStart);
1885: if (yyPredResult.hasValue()) {
1886:
1887: yyPredMatched = true;
1888: }
1889:
1890: if (!yyPredMatched) {
1891:
1892: yyOption1 = yyStart;
1893: yyOpValue1 = null;
1894:
1895: yyResult = pSequenceName(yyOption1);
1896: yyError = yyResult.select(yyError);
1897: if (yyResult.hasValue()) {
1898: final SequenceName v$el$1 = yyResult.semanticValue();
1899:
1900: yyOption1 = yyResult.index;
1901: yyOpValue1 = v$el$1;
1902: }
1903: { // Start scope for n.
1904: final SequenceName n = yyOpValue1;
1905:
1906: yyResult = pSequence$$Star1(yyOption1);
1907: yyError = yyResult.select(yyError);
1908: if (yyResult.hasValue()) {
1909: final Pair<Element> l = yyResult.semanticValue();
1910:
1911: yyValue = new Sequence(n, l.list());
1912:
1913: setLocation(yyValue, yyStart);
1914: return yyResult.createValue(yyValue, yyError);
1915: }
1916: } // End scope for n.
1917: } else {
1918: yyError = yyError.select("sequence expected", yyStart);
1919: }
1920:
1921: // Done.
1922: return yyError;
1923: }
1924:
1925: // =========================================================================
1926:
1927: /**
1928: * Parse synthetic nonterminal xtc.parser.PGrammar.Sequence$$Star1.
1929: *
1930: * @param yyStart The index.
1931: * @return The result.
1932: * @throws IOException Signals an I/O error.
1933: */
1934: private Result pSequence$$Star1(final int yyStart)
1935: throws IOException {
1936: PParserColumn yyColumn = (PParserColumn) column(yyStart);
1937: if (null == yyColumn.chunk1)
1938: yyColumn.chunk1 = new Chunk1();
1939: if (null == yyColumn.chunk1.fSequence$$Star1)
1940: yyColumn.chunk1.fSequence$$Star1 = pSequence$$Star1$1(yyStart);
1941: return yyColumn.chunk1.fSequence$$Star1;
1942: }
1943:
1944: /** Actually parse xtc.parser.PGrammar.Sequence$$Star1. */
1945: private Result pSequence$$Star1$1(final int yyStart)
1946: throws IOException {
1947: Result yyResult;
1948: Pair<Element> yyValue;
1949: ParseError yyError = ParseError.DUMMY;
1950:
1951: // Alternative 1.
1952:
1953: yyResult = pVoided(yyStart);
1954: yyError = yyResult.select(yyError);
1955: if (yyResult.hasValue()) {
1956: final Element v$el$2 = yyResult.semanticValue();
1957:
1958: yyResult = pSequence$$Star1(yyResult.index);
1959: yyError = yyResult.select(yyError);
1960: if (yyResult.hasValue()) {
1961: final Pair<Element> v$3 = yyResult.semanticValue();
1962:
1963: yyValue = new Pair<Element>(v$el$2, v$3);
1964:
1965: return yyResult.createValue(yyValue, yyError);
1966: }
1967: }
1968:
1969: // Alternative 2.
1970:
1971: yyValue = Pair.empty();
1972:
1973: return new SemanticValue(yyValue, yyStart, yyError);
1974: }
1975:
1976: // =========================================================================
1977:
1978: /**
1979: * Parse nonterminal xtc.parser.PGrammar.SequenceName.
1980: *
1981: * @param yyStart The index.
1982: * @return The result.
1983: * @throws IOException Signals an I/O error.
1984: */
1985: private Result pSequenceName(final int yyStart) throws IOException {
1986: PParserColumn yyColumn = (PParserColumn) column(yyStart);
1987: if (null == yyColumn.chunk1)
1988: yyColumn.chunk1 = new Chunk1();
1989: if (null == yyColumn.chunk1.fSequenceName)
1990: yyColumn.chunk1.fSequenceName = pSequenceName$1(yyStart);
1991: return yyColumn.chunk1.fSequenceName;
1992: }
1993:
1994: /** Actually parse xtc.parser.PGrammar.SequenceName. */
1995: private Result pSequenceName$1(final int yyStart)
1996: throws IOException {
1997: int yyC;
1998: int yyIndex;
1999: Result yyResult;
2000: int yyBase;
2001: SequenceName yyValue;
2002: ParseError yyError = ParseError.DUMMY;
2003:
2004: // Alternative 1.
2005:
2006: yyC = character(yyStart);
2007: if ('<' == yyC) {
2008: yyIndex = yyStart + 1;
2009:
2010: yyResult = pWordCharacters(yyIndex);
2011: yyError = yyResult.select(yyError);
2012: if (yyResult.hasValue()) {
2013: final String name = yyResult.semanticValue();
2014:
2015: yyBase = yyResult.index;
2016: yyResult = pSymbol(yyBase);
2017: yyError = yyResult.select(yyError);
2018: if (yyResult.hasValue(">")) {
2019:
2020: yyValue = new SequenceName(name);
2021:
2022: setLocation(yyValue, yyStart);
2023: return yyResult.createValue(yyValue, yyError);
2024: } else {
2025: yyError = yyError.select("\">\" expected", yyBase);
2026: }
2027: }
2028: }
2029:
2030: // Done.
2031: yyError = yyError.select("sequence name expected", yyStart);
2032: return yyError;
2033: }
2034:
2035: // =========================================================================
2036:
2037: /**
2038: * Parse nonterminal xtc.parser.PGrammar.Ellipsis.
2039: *
2040: * @param yyStart The index.
2041: * @return The result.
2042: * @throws IOException Signals an I/O error.
2043: */
2044: private Result pEllipsis(final int yyStart) throws IOException {
2045: Result yyResult;
2046: int yyBase;
2047: Void yyValue;
2048: ParseError yyError = ParseError.DUMMY;
2049:
2050: // Alternative 1.
2051:
2052: yyResult = pSequenceName(yyStart);
2053: yyError = yyResult.select(yyError);
2054: if (yyResult.hasValue()) {
2055:
2056: yyBase = yyResult.index;
2057: yyResult = pSymbol(yyBase);
2058: yyError = yyResult.select(yyError);
2059: if (yyResult.hasValue("...")) {
2060:
2061: yyValue = null;
2062:
2063: return yyResult.createValue(yyValue, yyError);
2064: } else {
2065: yyError = yyError.select("\"...\" expected", yyBase);
2066: }
2067: }
2068:
2069: // Alternative 2.
2070:
2071: yyResult = pSymbol(yyStart);
2072: yyError = yyResult.select(yyError);
2073: if (yyResult.hasValue("...")) {
2074:
2075: yyValue = null;
2076:
2077: return yyResult.createValue(yyValue, yyError);
2078: }
2079:
2080: // Done.
2081: yyError = yyError.select("ellipsis expected", yyStart);
2082: return yyError;
2083: }
2084:
2085: // =========================================================================
2086:
2087: /**
2088: * Parse nonterminal xtc.parser.PGrammar.Voided.
2089: *
2090: * @param yyStart The index.
2091: * @return The result.
2092: * @throws IOException Signals an I/O error.
2093: */
2094: private Result pVoided(final int yyStart) throws IOException {
2095: PParserColumn yyColumn = (PParserColumn) column(yyStart);
2096: if (null == yyColumn.chunk2)
2097: yyColumn.chunk2 = new Chunk2();
2098: if (null == yyColumn.chunk2.fVoided)
2099: yyColumn.chunk2.fVoided = pVoided$1(yyStart);
2100: return yyColumn.chunk2.fVoided;
2101: }
2102:
2103: /** Actually parse xtc.parser.PGrammar.Voided. */
2104: private Result pVoided$1(final int yyStart) throws IOException {
2105: Result yyResult;
2106: int yyBase;
2107: Element yyValue;
2108: ParseError yyError = ParseError.DUMMY;
2109:
2110: // Alternative 1.
2111:
2112: yyResult = pWord(yyStart);
2113: yyError = yyResult.select(yyError);
2114: if (yyResult.hasValue("void")) {
2115:
2116: yyBase = yyResult.index;
2117: yyResult = pSymbol(yyBase);
2118: yyError = yyResult.select(yyError);
2119: if (yyResult.hasValue(":")) {
2120:
2121: yyResult = pVoided(yyResult.index);
2122: yyError = yyResult.select(yyError);
2123: if (yyResult.hasValue()) {
2124: final Element p = yyResult.semanticValue();
2125:
2126: yyValue = new VoidedElement(p);
2127:
2128: setLocation(yyValue, yyStart);
2129: return yyResult.createValue(yyValue, yyError);
2130: }
2131: } else {
2132: yyError = yyError.select("\":\" expected", yyBase);
2133: }
2134: }
2135:
2136: // Alternative 2.
2137:
2138: yyResult = pPrefix(yyStart);
2139: yyError = yyResult.select(yyError);
2140: if (yyResult.hasValue()) {
2141: yyValue = yyResult.semanticValue();
2142:
2143: return yyResult.createValue(yyValue, yyError);
2144: }
2145:
2146: // Done.
2147: yyError = yyError.select("voided expected", yyStart);
2148: return yyError;
2149: }
2150:
2151: // =========================================================================
2152:
2153: /**
2154: * Parse nonterminal xtc.parser.PGrammar.Prefix.
2155: *
2156: * @param yyStart The index.
2157: * @return The result.
2158: * @throws IOException Signals an I/O error.
2159: */
2160: private Result pPrefix(final int yyStart) throws IOException {
2161: Result yyResult;
2162: int yyBase;
2163: Element yyValue;
2164: ParseError yyError = ParseError.DUMMY;
2165:
2166: // Alternative 1.
2167:
2168: yyResult = pSymbol(yyStart);
2169: yyError = yyResult.select(yyError);
2170: if (yyResult.hasValue("&")) {
2171:
2172: yyResult = pSuffix(yyResult.index);
2173: yyError = yyResult.select(yyError);
2174: if (yyResult.hasValue()) {
2175: final Element s = yyResult.semanticValue();
2176:
2177: if (s instanceof Action) {
2178: yyValue = new SemanticPredicate((Action) s);
2179: } else {
2180: yyValue = new FollowedBy(s);
2181: }
2182:
2183: setLocation(yyValue, yyStart);
2184: return yyResult.createValue(yyValue, yyError);
2185: }
2186: }
2187:
2188: // Alternative 2.
2189:
2190: yyResult = pSymbol(yyStart);
2191: yyError = yyResult.select(yyError);
2192: if (yyResult.hasValue("!")) {
2193:
2194: yyResult = pSuffix(yyResult.index);
2195: yyError = yyResult.select(yyError);
2196: if (yyResult.hasValue()) {
2197: final Element s = yyResult.semanticValue();
2198:
2199: yyValue = new NotFollowedBy(s);
2200:
2201: setLocation(yyValue, yyStart);
2202: return yyResult.createValue(yyValue, yyError);
2203: }
2204: }
2205:
2206: // Alternative 3.
2207:
2208: yyResult = pSymbol(yyStart);
2209: yyError = yyResult.select(yyError);
2210: if (yyResult.hasValue("^")) {
2211:
2212: yyResult = pSuffix(yyResult.index);
2213: yyError = yyResult.select(yyError);
2214: if (yyResult.hasValue()) {
2215: final Element s = yyResult.semanticValue();
2216:
2217: if (s instanceof Action) {
2218:
2219: yyValue = new ParserAction((Action) s);
2220:
2221: setLocation(yyValue, yyStart);
2222: return yyResult.createValue(yyValue, yyError);
2223: }
2224: }
2225: }
2226:
2227: // Alternative 4.
2228:
2229: yyResult = pWord(yyStart);
2230: yyError = yyResult.select(yyError);
2231: if (yyResult.hasValue()) {
2232: final String id = yyResult.semanticValue();
2233:
2234: yyBase = yyResult.index;
2235: yyResult = pSymbol(yyBase);
2236: yyError = yyResult.select(yyError);
2237: if (yyResult.hasValue(":")) {
2238:
2239: yyResult = pSuffix(yyResult.index);
2240: yyError = yyResult.select(yyError);
2241: if (yyResult.hasValue()) {
2242: final Element s = yyResult.semanticValue();
2243:
2244: yyValue = new Binding(id, s);
2245:
2246: setLocation(yyValue, yyStart);
2247: return yyResult.createValue(yyValue, yyError);
2248: }
2249: } else {
2250: yyError = yyError.select("\":\" expected", yyBase);
2251: }
2252: }
2253:
2254: // Alternative 5.
2255:
2256: yyResult = pStringLiteral(yyStart);
2257: yyError = yyResult.select(yyError);
2258: if (yyResult.hasValue()) {
2259: final String text = yyResult.semanticValue();
2260:
2261: yyResult = pSpacing(yyResult.index);
2262: yyError = yyResult.select(yyError);
2263: if (yyResult.hasValue()) {
2264:
2265: yyBase = yyResult.index;
2266: yyResult = pSymbol(yyBase);
2267: yyError = yyResult.select(yyError);
2268: if (yyResult.hasValue(":")) {
2269:
2270: yyResult = pSuffix(yyResult.index);
2271: yyError = yyResult.select(yyError);
2272: if (yyResult.hasValue()) {
2273: final Element s = yyResult.semanticValue();
2274:
2275: yyValue = new StringMatch(text.substring(1,
2276: text.length() - 1), s);
2277:
2278: setLocation(yyValue, yyStart);
2279: return yyResult.createValue(yyValue, yyError);
2280: }
2281: } else {
2282: yyError = yyError.select("\":\" expected", yyBase);
2283: }
2284: }
2285: }
2286:
2287: // Alternative 6.
2288:
2289: yyResult = pSuffix(yyStart);
2290: yyError = yyResult.select(yyError);
2291: if (yyResult.hasValue()) {
2292: yyValue = yyResult.semanticValue();
2293:
2294: return yyResult.createValue(yyValue, yyError);
2295: }
2296:
2297: // Done.
2298: yyError = yyError.select("prefix expected", yyStart);
2299: return yyError;
2300: }
2301:
2302: // =========================================================================
2303:
2304: /**
2305: * Parse nonterminal xtc.parser.PGrammar.Suffix.
2306: *
2307: * @param yyStart The index.
2308: * @return The result.
2309: * @throws IOException Signals an I/O error.
2310: */
2311: private Result pSuffix(final int yyStart) throws IOException {
2312: PParserColumn yyColumn = (PParserColumn) column(yyStart);
2313: if (null == yyColumn.chunk2)
2314: yyColumn.chunk2 = new Chunk2();
2315: if (null == yyColumn.chunk2.fSuffix)
2316: yyColumn.chunk2.fSuffix = pSuffix$1(yyStart);
2317: return yyColumn.chunk2.fSuffix;
2318: }
2319:
2320: /** Actually parse xtc.parser.PGrammar.Suffix. */
2321: private Result pSuffix$1(final int yyStart) throws IOException {
2322: Result yyResult;
2323: int yyBase;
2324: Element yyValue;
2325: ParseError yyError = ParseError.DUMMY;
2326:
2327: // Alternative 1.
2328:
2329: yyResult = pPrimary(yyStart);
2330: yyError = yyResult.select(yyError);
2331: if (yyResult.hasValue()) {
2332: final Element p = yyResult.semanticValue();
2333:
2334: final int yyChoice1 = yyResult.index;
2335:
2336: // Nested alternative 1.
2337:
2338: yyBase = yyChoice1;
2339: yyResult = pSymbol(yyBase);
2340: yyError = yyResult.select(yyError);
2341: if (yyResult.hasValue("?")) {
2342:
2343: yyValue = new Option(p);
2344:
2345: setLocation(yyValue, yyStart);
2346: return yyResult.createValue(yyValue, yyError);
2347: } else {
2348: yyError = yyError.select("\"?\" expected", yyBase);
2349: }
2350:
2351: // Nested alternative 2.
2352:
2353: yyBase = yyChoice1;
2354: yyResult = pSymbol(yyBase);
2355: yyError = yyResult.select(yyError);
2356: if (yyResult.hasValue("*")) {
2357:
2358: yyValue = new Repetition(false, p);
2359:
2360: setLocation(yyValue, yyStart);
2361: return yyResult.createValue(yyValue, yyError);
2362: } else {
2363: yyError = yyError.select("\"*\" expected", yyBase);
2364: }
2365:
2366: // Nested alternative 3.
2367:
2368: yyBase = yyChoice1;
2369: yyResult = pSymbol(yyBase);
2370: yyError = yyResult.select(yyError);
2371: if (yyResult.hasValue("+")) {
2372:
2373: yyValue = new Repetition(true, p);
2374:
2375: setLocation(yyValue, yyStart);
2376: return yyResult.createValue(yyValue, yyError);
2377: } else {
2378: yyError = yyError.select("\"+\" expected", yyBase);
2379: }
2380: }
2381:
2382: // Alternative 2.
2383:
2384: yyResult = pPrimary(yyStart);
2385: yyError = yyResult.select(yyError);
2386: if (yyResult.hasValue()) {
2387: yyValue = yyResult.semanticValue();
2388:
2389: return yyResult.createValue(yyValue, yyError);
2390: }
2391:
2392: // Done.
2393: return yyError;
2394: }
2395:
2396: // =========================================================================
2397:
2398: /**
2399: * Parse nonterminal xtc.parser.PGrammar.Primary.
2400: *
2401: * @param yyStart The index.
2402: * @return The result.
2403: * @throws IOException Signals an I/O error.
2404: */
2405: private Result pPrimary(final int yyStart) throws IOException {
2406: PParserColumn yyColumn = (PParserColumn) column(yyStart);
2407: if (null == yyColumn.chunk2)
2408: yyColumn.chunk2 = new Chunk2();
2409: if (null == yyColumn.chunk2.fPrimary)
2410: yyColumn.chunk2.fPrimary = pPrimary$1(yyStart);
2411: return yyColumn.chunk2.fPrimary;
2412: }
2413:
2414: /** Actually parse xtc.parser.PGrammar.Primary. */
2415: private Result pPrimary$1(final int yyStart) throws IOException {
2416: Result yyResult;
2417: int yyBase;
2418: Element yyValue;
2419: ParseError yyError = ParseError.DUMMY;
2420:
2421: // Alternative 1.
2422:
2423: yyResult = pNullLiteral(yyStart);
2424: yyError = yyResult.select(yyError);
2425: if (yyResult.hasValue()) {
2426: yyValue = yyResult.semanticValue();
2427:
2428: return yyResult.createValue(yyValue, yyError);
2429: }
2430:
2431: // Alternative 2.
2432:
2433: yyResult = pNonTerminal(yyStart);
2434: yyError = yyResult.select(yyError);
2435: if (yyResult.hasValue()) {
2436: yyValue = yyResult.semanticValue();
2437:
2438: return yyResult.createValue(yyValue, yyError);
2439: }
2440:
2441: // Alternative 3.
2442:
2443: yyResult = pTerminal(yyStart);
2444: yyError = yyResult.select(yyError);
2445: if (yyResult.hasValue()) {
2446: yyValue = yyResult.semanticValue();
2447:
2448: return yyResult.createValue(yyValue, yyError);
2449: }
2450:
2451: // Alternative 4.
2452:
2453: yyResult = pNodeMarker(yyStart);
2454: yyError = yyResult.select(yyError);
2455: if (yyResult.hasValue()) {
2456: yyValue = yyResult.semanticValue();
2457:
2458: return yyResult.createValue(yyValue, yyError);
2459: }
2460:
2461: // Alternative 5.
2462:
2463: yyResult = pAction(yyStart);
2464: yyError = yyResult.select(yyError);
2465: if (yyResult.hasValue()) {
2466: yyValue = yyResult.semanticValue();
2467:
2468: return yyResult.createValue(yyValue, yyError);
2469: }
2470:
2471: // Alternative 6.
2472:
2473: yyResult = pSymbol(yyStart);
2474: yyError = yyResult.select(yyError);
2475: if (yyResult.hasValue("(")) {
2476:
2477: yyResult = pChoice(yyResult.index);
2478: yyError = yyResult.select(yyError);
2479: if (yyResult.hasValue()) {
2480: yyValue = yyResult.semanticValue();
2481:
2482: yyBase = yyResult.index;
2483: yyResult = pSymbol(yyBase);
2484: yyError = yyResult.select(yyError);
2485: if (yyResult.hasValue(")")) {
2486:
2487: return yyResult.createValue(yyValue, yyError);
2488: } else {
2489: yyError = yyError.select("\")\" expected", yyBase);
2490: }
2491: }
2492: }
2493:
2494: // Done.
2495: yyError = yyError.select("primary expected", yyStart);
2496: return yyError;
2497: }
2498:
2499: // =========================================================================
2500:
2501: /**
2502: * Parse nonterminal xtc.parser.PGrammar.NullLiteral.
2503: *
2504: * @param yyStart The index.
2505: * @return The result.
2506: * @throws IOException Signals an I/O error.
2507: */
2508: private Result pNullLiteral(final int yyStart) throws IOException {
2509: Result yyResult;
2510: NullLiteral yyValue;
2511: ParseError yyError = ParseError.DUMMY;
2512:
2513: // Alternative 1.
2514:
2515: yyResult = pName(yyStart);
2516: yyError = yyResult.select(yyError);
2517: if (yyResult.hasValue("null")) {
2518:
2519: yyValue = new NullLiteral();
2520:
2521: setLocation(yyValue, yyStart);
2522: return yyResult.createValue(yyValue, yyError);
2523: }
2524:
2525: // Done.
2526: yyError = yyError.select("null literal expected", yyStart);
2527: return yyError;
2528: }
2529:
2530: // =========================================================================
2531:
2532: /**
2533: * Parse nonterminal xtc.parser.PGrammar.NonTerminal.
2534: *
2535: * @param yyStart The index.
2536: * @return The result.
2537: * @throws IOException Signals an I/O error.
2538: */
2539: private Result pNonTerminal(final int yyStart) throws IOException {
2540: Result yyResult;
2541: NonTerminal yyValue;
2542: ParseError yyError = ParseError.DUMMY;
2543:
2544: // Alternative 1.
2545:
2546: yyResult = pName(yyStart);
2547: yyError = yyResult.select(yyError);
2548: if (yyResult.hasValue()) {
2549: final String name = yyResult.semanticValue();
2550:
2551: yyValue = new NonTerminal(name);
2552:
2553: setLocation(yyValue, yyStart);
2554: return yyResult.createValue(yyValue, yyError);
2555: }
2556:
2557: // Done.
2558: return yyError;
2559: }
2560:
2561: // =========================================================================
2562:
2563: /**
2564: * Parse nonterminal xtc.parser.PGrammar.UnqualifiedNonTerminal.
2565: *
2566: * @param yyStart The index.
2567: * @return The result.
2568: * @throws IOException Signals an I/O error.
2569: */
2570: private Result pUnqualifiedNonTerminal(final int yyStart)
2571: throws IOException {
2572:
2573: PParserColumn yyColumn = (PParserColumn) column(yyStart);
2574: if (null == yyColumn.chunk2)
2575: yyColumn.chunk2 = new Chunk2();
2576: if (null == yyColumn.chunk2.fUnqualifiedNonTerminal)
2577: yyColumn.chunk2.fUnqualifiedNonTerminal = pUnqualifiedNonTerminal$1(yyStart);
2578: return yyColumn.chunk2.fUnqualifiedNonTerminal;
2579: }
2580:
2581: /** Actually parse xtc.parser.PGrammar.UnqualifiedNonTerminal. */
2582: private Result pUnqualifiedNonTerminal$1(final int yyStart)
2583: throws IOException {
2584:
2585: Result yyResult;
2586: NonTerminal yyValue;
2587: ParseError yyError = ParseError.DUMMY;
2588:
2589: // Alternative 1.
2590:
2591: yyResult = pWord(yyStart);
2592: yyError = yyResult.select(yyError);
2593: if (yyResult.hasValue()) {
2594: final String name = yyResult.semanticValue();
2595:
2596: yyValue = new NonTerminal(name);
2597:
2598: setLocation(yyValue, yyStart);
2599: return yyResult.createValue(yyValue, yyError);
2600: }
2601:
2602: // Done.
2603: return yyError;
2604: }
2605:
2606: // =========================================================================
2607:
2608: /**
2609: * Parse nonterminal xtc.parser.PGrammar.Terminal.
2610: *
2611: * @param yyStart The index.
2612: * @return The result.
2613: * @throws IOException Signals an I/O error.
2614: */
2615: private Result pTerminal(final int yyStart) throws IOException {
2616: int yyC;
2617: int yyIndex;
2618: Result yyResult;
2619: int yyRepetition1;
2620: Pair<CharRange> yyRepValue1;
2621: Terminal yyValue;
2622: ParseError yyError = ParseError.DUMMY;
2623:
2624: // Alternative 1.
2625:
2626: yyC = character(yyStart);
2627: if ('_' == yyC) {
2628: yyIndex = yyStart + 1;
2629:
2630: yyResult = pSpacing(yyIndex);
2631: yyError = yyResult.select(yyError);
2632: if (yyResult.hasValue()) {
2633:
2634: yyValue = AnyChar.ANY;
2635:
2636: setLocation(yyValue, yyStart);
2637: return yyResult.createValue(yyValue, yyError);
2638: }
2639: }
2640:
2641: // Alternative 2.
2642:
2643: yyResult = pCharacterLiteral(yyStart);
2644: yyError = yyResult.select(yyError);
2645: if (yyResult.hasValue()) {
2646: final String c = yyResult.semanticValue();
2647:
2648: yyResult = pSpacing(yyResult.index);
2649: yyError = yyResult.select(yyError);
2650: if (yyResult.hasValue()) {
2651:
2652: yyValue = new CharLiteral(Utilities.unescape(c).charAt(
2653: 1));
2654:
2655: setLocation(yyValue, yyStart);
2656: return yyResult.createValue(yyValue, yyError);
2657: }
2658: }
2659:
2660: // Alternative 3.
2661:
2662: yyC = character(yyStart);
2663: if ('[' == yyC) {
2664: yyIndex = yyStart + 1;
2665:
2666: yyRepetition1 = yyIndex;
2667: yyRepValue1 = Pair.empty();
2668: while (true) {
2669:
2670: yyResult = pRange(yyRepetition1);
2671: yyError = yyResult.select(yyError);
2672: if (yyResult.hasValue()) {
2673: final CharRange v$el$1 = yyResult.semanticValue();
2674:
2675: yyRepetition1 = yyResult.index;
2676: yyRepValue1 = new Pair<CharRange>(v$el$1,
2677: yyRepValue1);
2678: continue;
2679: }
2680: break;
2681: }
2682: { // Start scope for l.
2683: final Pair<CharRange> l = yyRepValue1.reverse();
2684:
2685: yyC = character(yyRepetition1);
2686: if (']' == yyC) {
2687: yyIndex = yyRepetition1 + 1;
2688:
2689: yyResult = pSpacing(yyIndex);
2690: yyError = yyResult.select(yyError);
2691: if (yyResult.hasValue()) {
2692:
2693: yyValue = new CharClass(l.list());
2694:
2695: setLocation(yyValue, yyStart);
2696: return yyResult.createValue(yyValue, yyError);
2697: }
2698: }
2699: } // End scope for l.
2700: }
2701:
2702: // Alternative 4.
2703:
2704: yyResult = pStringLiteral(yyStart);
2705: yyError = yyResult.select(yyError);
2706: if (yyResult.hasValue()) {
2707: final String s1 = yyResult.semanticValue();
2708:
2709: yyResult = pSpacing(yyResult.index);
2710: yyError = yyResult.select(yyError);
2711: if (yyResult.hasValue()) {
2712:
2713: String s2 = Utilities.unescape(s1);
2714: yyValue = new StringLiteral(s2.substring(1,
2715: s2.length() - 1));
2716:
2717: setLocation(yyValue, yyStart);
2718: return yyResult.createValue(yyValue, yyError);
2719: }
2720: }
2721:
2722: // Done.
2723: yyError = yyError.select("terminal expected", yyStart);
2724: return yyError;
2725: }
2726:
2727: // =========================================================================
2728:
2729: /**
2730: * Parse nonterminal xtc.parser.PGrammar.Range.
2731: *
2732: * @param yyStart The index.
2733: * @return The result.
2734: * @throws IOException Signals an I/O error.
2735: */
2736: private Result pRange(final int yyStart) throws IOException {
2737: int yyC;
2738: int yyIndex;
2739: Result yyResult;
2740: CharRange yyValue;
2741: ParseError yyError = ParseError.DUMMY;
2742:
2743: // Alternative 1.
2744:
2745: yyResult = pClassChar(yyStart);
2746: yyError = yyResult.select(yyError);
2747: if (yyResult.hasValue()) {
2748: final String c1 = yyResult.semanticValue();
2749:
2750: final int yyChoice1 = yyResult.index;
2751:
2752: // Nested alternative 1.
2753:
2754: yyC = character(yyChoice1);
2755: if ('-' == yyC) {
2756: yyIndex = yyChoice1 + 1;
2757:
2758: yyResult = pClassChar(yyIndex);
2759: yyError = yyResult.select(yyError);
2760: if (yyResult.hasValue()) {
2761: final String c2 = yyResult.semanticValue();
2762:
2763: yyValue = new CharRange(Utilities.unescape(c1)
2764: .charAt(0), Utilities.unescape(c2)
2765: .charAt(0));
2766:
2767: setLocation(yyValue, yyStart);
2768: return yyResult.createValue(yyValue, yyError);
2769: }
2770: }
2771:
2772: // Nested alternative 2.
2773:
2774: yyValue = new CharRange(Utilities.unescape(c1).charAt(0));
2775:
2776: setLocation(yyValue, yyStart);
2777: return new SemanticValue(yyValue, yyChoice1, yyError);
2778: }
2779:
2780: // Done.
2781: yyError = yyError.select("range expected", yyStart);
2782: return yyError;
2783: }
2784:
2785: // =========================================================================
2786:
2787: /**
2788: * Parse nonterminal xtc.parser.PGrammar.NodeMarker.
2789: *
2790: * @param yyStart The index.
2791: * @return The result.
2792: * @throws IOException Signals an I/O error.
2793: */
2794: private Result pNodeMarker(final int yyStart) throws IOException {
2795: int yyC;
2796: int yyIndex;
2797: Result yyResult;
2798: NodeMarker yyValue;
2799: ParseError yyError = ParseError.DUMMY;
2800:
2801: // Alternative 1.
2802:
2803: yyC = character(yyStart);
2804: if ('@' == yyC) {
2805: yyIndex = yyStart + 1;
2806:
2807: yyResult = pWord(yyIndex);
2808: yyError = yyResult.select(yyError);
2809: if (yyResult.hasValue()) {
2810: final String name = yyResult.semanticValue();
2811:
2812: yyValue = new NodeMarker(name);
2813:
2814: setLocation(yyValue, yyStart);
2815: return yyResult.createValue(yyValue, yyError);
2816: }
2817: }
2818:
2819: // Done.
2820: yyError = yyError.select("node marker expected", yyStart);
2821: return yyError;
2822: }
2823:
2824: // =========================================================================
2825:
2826: /**
2827: * Parse nonterminal xtc.parser.PGrammar.Action.
2828: *
2829: * @param yyStart The index.
2830: * @return The result.
2831: * @throws IOException Signals an I/O error.
2832: */
2833: private Result pAction(final int yyStart) throws IOException {
2834: PParserColumn yyColumn = (PParserColumn) column(yyStart);
2835: if (null == yyColumn.chunk2)
2836: yyColumn.chunk2 = new Chunk2();
2837: if (null == yyColumn.chunk2.fAction)
2838: yyColumn.chunk2.fAction = pAction$1(yyStart);
2839: return yyColumn.chunk2.fAction;
2840: }
2841:
2842: /** Actually parse xtc.parser.PGrammar.Action. */
2843: private Result pAction$1(final int yyStart) throws IOException {
2844: int yyC;
2845: int yyIndex;
2846: Result yyResult;
2847: Action yyValue;
2848: ParseError yyError = ParseError.DUMMY;
2849:
2850: // Alternative 1.
2851:
2852: yyC = character(yyStart);
2853: if ('{' == yyC) {
2854: yyIndex = yyStart + 1;
2855:
2856: yyResult = pActionBody(yyIndex);
2857: yyError = yyResult.select(yyError);
2858: if (yyResult.hasValue()) {
2859: final String s = yyResult.semanticValue();
2860:
2861: yyC = character(yyResult.index);
2862: if ('}' == yyC) {
2863: yyIndex = yyResult.index + 1;
2864:
2865: yyResult = pSpacing(yyIndex);
2866: yyError = yyResult.select(yyError);
2867: if (yyResult.hasValue()) {
2868:
2869: yyValue = new Action(s, yyState.indentations());
2870:
2871: setLocation(yyValue, yyStart);
2872: return yyResult.createValue(yyValue, yyError);
2873: }
2874: }
2875: }
2876: }
2877:
2878: // Done.
2879: yyError = yyError.select("action expected", yyStart);
2880: return yyError;
2881: }
2882:
2883: // =========================================================================
2884:
2885: /**
2886: * Parse nonterminal xtc.parser.PGrammar.ActionBody.
2887: *
2888: * @param yyStart The index.
2889: * @return The result.
2890: * @throws IOException Signals an I/O error.
2891: */
2892: private Result pActionBody(final int yyStart) throws IOException {
2893: Result yyResult;
2894: String yyValue;
2895: ParseError yyError = ParseError.DUMMY;
2896:
2897: // Start a state modification.
2898: yyState.start();
2899:
2900: // Alternative 1.
2901:
2902: yyResult = pActionText(yyStart);
2903: yyError = yyResult.select(yyError);
2904: if (yyResult.hasValue()) {
2905:
2906: yyValue = difference(yyStart, yyResult.index);
2907:
2908: // Commit the state modification.
2909: yyState.commit();
2910:
2911: return yyResult.createValue(yyValue, yyError);
2912: }
2913:
2914: // Abort the state modification.
2915: yyState.abort();
2916:
2917: // Done.
2918: return yyError;
2919: }
2920:
2921: // =========================================================================
2922:
2923: /**
2924: * Parse nonterminal xtc.parser.PGrammar.ActionText.
2925: *
2926: * @param yyStart The index.
2927: * @return The result.
2928: * @throws IOException Signals an I/O error.
2929: */
2930: private Result pActionText(final int yyStart) throws IOException {
2931: int yyC;
2932: int yyIndex;
2933: Result yyResult;
2934: int yyRepetition1;
2935: int yyRepetition2;
2936: Void yyValue;
2937: ParseError yyError = ParseError.DUMMY;
2938:
2939: // Alternative 1.
2940:
2941: yyRepetition1 = yyStart;
2942: while (true) {
2943:
2944: final int yyChoice1 = yyRepetition1;
2945:
2946: // Nested alternative 1.
2947:
2948: yyC = character(yyChoice1);
2949: if ('{' == yyC) {
2950: yyIndex = yyChoice1 + 1;
2951:
2952: yyState.open();
2953:
2954: yyResult = pActionText(yyIndex);
2955: yyError = yyResult.select(yyError);
2956: if (yyResult.hasValue()) {
2957:
2958: yyC = character(yyResult.index);
2959: if ('}' == yyC) {
2960: yyIndex = yyResult.index + 1;
2961:
2962: yyState.close();
2963:
2964: yyRepetition1 = yyIndex;
2965: continue;
2966: }
2967: }
2968: }
2969:
2970: // Nested alternative 2.
2971:
2972: yyResult = pCharacterLiteral(yyChoice1);
2973: yyError = yyResult.select(yyError);
2974: if (yyResult.hasValue()) {
2975:
2976: yyState.content();
2977:
2978: yyRepetition1 = yyResult.index;
2979: continue;
2980: }
2981:
2982: // Nested alternative 3.
2983:
2984: yyResult = pStringLiteral(yyChoice1);
2985: yyError = yyResult.select(yyError);
2986: if (yyResult.hasValue()) {
2987:
2988: yyState.content();
2989:
2990: yyRepetition1 = yyResult.index;
2991: continue;
2992: }
2993:
2994: // Nested alternative 4.
2995:
2996: yyResult = pCodeComment(yyChoice1);
2997: yyError = yyResult.select(yyError);
2998: if (yyResult.hasValue()) {
2999:
3000: yyState.content();
3001:
3002: yyRepetition1 = yyResult.index;
3003: continue;
3004: }
3005:
3006: // Nested alternative 5.
3007:
3008: yyResult = pTraditionalComment(yyChoice1);
3009: yyError = yyResult.select(yyError);
3010: if (yyResult.hasValue()) {
3011:
3012: yyState.content();
3013:
3014: yyRepetition1 = yyResult.index;
3015: continue;
3016: }
3017:
3018: // Nested alternative 6.
3019:
3020: yyC = character(yyChoice1);
3021: if (-1 != yyC) {
3022: yyIndex = yyChoice1 + 1;
3023:
3024: switch (yyC) {
3025: case '/': {
3026: yyC = character(yyIndex);
3027: if (-1 != yyC) {
3028: yyIndex = yyIndex + 1;
3029: if ('/' == yyC) {
3030:
3031: yyRepetition2 = yyIndex;
3032: while (true) {
3033:
3034: yyC = character(yyRepetition2);
3035: if (-1 != yyC) {
3036: yyIndex = yyRepetition2 + 1;
3037:
3038: switch (yyC) {
3039: case '\n':
3040: case '\r':
3041: /* No match. */
3042: break;
3043:
3044: default: {
3045: yyRepetition2 = yyIndex;
3046: continue;
3047: }
3048: }
3049: }
3050: break;
3051: }
3052:
3053: yyResult = pLineTerminator(yyRepetition2);
3054: yyError = yyResult.select(yyError);
3055: if (yyResult.hasValue()) {
3056:
3057: yyRepetition1 = yyResult.index;
3058: continue;
3059: }
3060: }
3061: }
3062: }
3063: break;
3064:
3065: case '\r': {
3066: final int yyChoice2 = yyIndex;
3067:
3068: // Nested alternative 1.
3069:
3070: yyC = character(yyChoice2);
3071: if ('\n' == yyC) {
3072: yyIndex = yyChoice2 + 1;
3073:
3074: yyState.newline();
3075:
3076: yyRepetition1 = yyIndex;
3077: continue;
3078: }
3079:
3080: // Nested alternative 2.
3081:
3082: yyState.newline();
3083:
3084: yyRepetition1 = yyChoice2;
3085: continue;
3086: }
3087:
3088: case '\n': {
3089: yyState.newline();
3090:
3091: yyRepetition1 = yyIndex;
3092: continue;
3093: }
3094:
3095: case ' ': {
3096: yyRepetition1 = yyIndex;
3097: continue;
3098: }
3099:
3100: case '\t': {
3101: yyRepetition1 = yyIndex;
3102: continue;
3103: }
3104:
3105: case '\f': {
3106: yyRepetition1 = yyIndex;
3107: continue;
3108: }
3109:
3110: default:
3111: /* No match. */
3112: }
3113: }
3114:
3115: // Nested alternative 7.
3116:
3117: yyC = character(yyChoice1);
3118: if (-1 != yyC) {
3119: yyIndex = yyChoice1 + 1;
3120:
3121: switch (yyC) {
3122: case '\t':
3123: case '\n':
3124: case '\f':
3125: case '\r':
3126: case ' ':
3127: case '}':
3128: /* No match. */
3129: break;
3130:
3131: default: {
3132: yyState.content();
3133:
3134: yyRepetition1 = yyIndex;
3135: continue;
3136: }
3137: }
3138: }
3139: break;
3140: }
3141:
3142: yyValue = null;
3143:
3144: return new SemanticValue(yyValue, yyRepetition1, yyError);
3145: }
3146:
3147: // =========================================================================
3148:
3149: /**
3150: * Parse nonterminal xtc.parser.PGrammar.Attribute.
3151: *
3152: * @param yyStart The index.
3153: * @return The result.
3154: * @throws IOException Signals an I/O error.
3155: */
3156: public Result pAttribute(final int yyStart) throws IOException {
3157: PParserColumn yyColumn = (PParserColumn) column(yyStart);
3158: if (null == yyColumn.chunk2)
3159: yyColumn.chunk2 = new Chunk2();
3160: if (null == yyColumn.chunk2.fAttribute)
3161: yyColumn.chunk2.fAttribute = pAttribute$1(yyStart);
3162: return yyColumn.chunk2.fAttribute;
3163: }
3164:
3165: /** Actually parse xtc.parser.PGrammar.Attribute. */
3166: private Result pAttribute$1(final int yyStart) throws IOException {
3167: Result yyResult;
3168: int yyBase;
3169: int yyOption1;
3170: Object yyOpValue1;
3171: Attribute yyValue;
3172: ParseError yyError = ParseError.DUMMY;
3173:
3174: // Alternative 1.
3175:
3176: yyResult = pWord(yyStart);
3177: yyError = yyResult.select(yyError);
3178: if (yyResult.hasValue("public")) {
3179:
3180: yyValue = Constants.ATT_PUBLIC;
3181:
3182: setLocation(yyValue, yyStart);
3183: return yyResult.createValue(yyValue, yyError);
3184: }
3185:
3186: // Alternative 2.
3187:
3188: yyResult = pWord(yyStart);
3189: yyError = yyResult.select(yyError);
3190: if (yyResult.hasValue("protected")) {
3191:
3192: yyValue = Constants.ATT_PROTECTED;
3193:
3194: setLocation(yyValue, yyStart);
3195: return yyResult.createValue(yyValue, yyError);
3196: }
3197:
3198: // Alternative 3.
3199:
3200: yyResult = pWord(yyStart);
3201: yyError = yyResult.select(yyError);
3202: if (yyResult.hasValue("private")) {
3203:
3204: yyValue = Constants.ATT_PRIVATE;
3205:
3206: setLocation(yyValue, yyStart);
3207: return yyResult.createValue(yyValue, yyError);
3208: }
3209:
3210: // Alternative 4.
3211:
3212: yyResult = pWord(yyStart);
3213: yyError = yyResult.select(yyError);
3214: if (yyResult.hasValue()) {
3215: final String name = yyResult.semanticValue();
3216:
3217: yyOption1 = yyResult.index;
3218: yyOpValue1 = null;
3219:
3220: yyBase = yyOption1;
3221: yyResult = pSymbol(yyBase);
3222: yyError = yyResult.select(yyError);
3223: if (yyResult.hasValue("(")) {
3224:
3225: yyResult = pAttributeValue(yyResult.index);
3226: yyError = yyResult.select(yyError);
3227: if (yyResult.hasValue()) {
3228: final Object v$el$1 = yyResult.semanticValue();
3229:
3230: yyBase = yyResult.index;
3231: yyResult = pSymbol(yyBase);
3232: yyError = yyResult.select(yyError);
3233: if (yyResult.hasValue(")")) {
3234:
3235: yyOption1 = yyResult.index;
3236: yyOpValue1 = v$el$1;
3237: } else {
3238: yyError = yyError.select("\")\" expected",
3239: yyBase);
3240: }
3241: }
3242: } else {
3243: yyError = yyError.select("\"(\" expected", yyBase);
3244: }
3245: { // Start scope for value.
3246: final Object value = yyOpValue1;
3247:
3248: yyValue = new Attribute(name, value);
3249:
3250: setLocation(yyValue, yyStart);
3251: return new SemanticValue(yyValue, yyOption1, yyError);
3252: } // End scope for value.
3253: }
3254:
3255: // Done.
3256: yyError = yyError.select("attribute expected", yyStart);
3257: return yyError;
3258: }
3259:
3260: // =========================================================================
3261:
3262: /**
3263: * Parse nonterminal xtc.parser.PGrammar.AttributeValue.
3264: *
3265: * @param yyStart The index.
3266: * @return The result.
3267: * @throws IOException Signals an I/O error.
3268: */
3269: private Result pAttributeValue(final int yyStart)
3270: throws IOException {
3271: Result yyResult;
3272: Object yyValue;
3273: ParseError yyError = ParseError.DUMMY;
3274:
3275: // Alternative 1.
3276:
3277: yyResult = pIntegerLiteral(yyStart);
3278: yyError = yyResult.select(yyError);
3279: if (yyResult.hasValue()) {
3280: final String lit = yyResult.semanticValue();
3281:
3282: yyResult = pSpacing(yyResult.index);
3283: yyError = yyResult.select(yyError);
3284: if (yyResult.hasValue()) {
3285:
3286: try {
3287: yyValue = Integer.decode(lit);
3288: } catch (NumberFormatException x) {
3289: yyValue = null; // Cannot happen.
3290: }
3291:
3292: if (yyValue instanceof Locatable) {
3293: setLocation((Locatable) yyValue, yyStart);
3294: }
3295: return yyResult.createValue(yyValue, yyError);
3296: }
3297: }
3298:
3299: // Alternative 2.
3300:
3301: yyResult = pName(yyStart);
3302: yyError = yyResult.select(yyError);
3303: if (yyResult.hasValue()) {
3304: yyValue = yyResult.semanticValue();
3305:
3306: return yyResult.createValue(yyValue, yyError);
3307: }
3308:
3309: // Alternative 3.
3310:
3311: yyResult = pStringLiteral(yyStart);
3312: yyError = yyResult.select(yyError);
3313: if (yyResult.hasValue()) {
3314: yyValue = yyResult.semanticValue();
3315:
3316: yyResult = pSpacing(yyResult.index);
3317: yyError = yyResult.select(yyError);
3318: if (yyResult.hasValue()) {
3319:
3320: return yyResult.createValue(yyValue, yyError);
3321: }
3322: }
3323:
3324: // Done.
3325: return yyError;
3326: }
3327:
3328: // =========================================================================
3329:
3330: /**
3331: * Parse nonterminal xtc.parser.PGrammar.TypeName.
3332: *
3333: * @param yyStart The index.
3334: * @return The result.
3335: * @throws IOException Signals an I/O error.
3336: */
3337: private Result pTypeName(final int yyStart) throws IOException {
3338: PParserColumn yyColumn = (PParserColumn) column(yyStart);
3339: if (null == yyColumn.chunk2)
3340: yyColumn.chunk2 = new Chunk2();
3341: if (null == yyColumn.chunk2.fTypeName)
3342: yyColumn.chunk2.fTypeName = pTypeName$1(yyStart);
3343: return yyColumn.chunk2.fTypeName;
3344: }
3345:
3346: /** Actually parse xtc.parser.PGrammar.TypeName. */
3347: private Result pTypeName$1(final int yyStart) throws IOException {
3348: Result yyResult;
3349: String yyValue;
3350: ParseError yyError = ParseError.DUMMY;
3351:
3352: // Alternative 1.
3353:
3354: yyResult = pTypeNameCharacters(yyStart);
3355: yyError = yyResult.select(yyError);
3356: if (yyResult.hasValue()) {
3357: yyValue = yyResult.semanticValue();
3358:
3359: yyResult = pSpacing(yyResult.index);
3360: yyError = yyResult.select(yyError);
3361: if (yyResult.hasValue()) {
3362:
3363: return yyResult.createValue(yyValue, yyError);
3364: }
3365: }
3366:
3367: // Done.
3368: return yyError;
3369: }
3370:
3371: // =========================================================================
3372:
3373: /**
3374: * Parse nonterminal xtc.parser.PGrammar.TypeNameCharacters.
3375: *
3376: * @param yyStart The index.
3377: * @return The result.
3378: * @throws IOException Signals an I/O error.
3379: */
3380: private Result pTypeNameCharacters(final int yyStart)
3381: throws IOException {
3382: PParserColumn yyColumn = (PParserColumn) column(yyStart);
3383: if (null == yyColumn.chunk2)
3384: yyColumn.chunk2 = new Chunk2();
3385: if (null == yyColumn.chunk2.fTypeNameCharacters)
3386: yyColumn.chunk2.fTypeNameCharacters = pTypeNameCharacters$1(yyStart);
3387: return yyColumn.chunk2.fTypeNameCharacters;
3388: }
3389:
3390: /** Actually parse xtc.parser.PGrammar.TypeNameCharacters. */
3391: private Result pTypeNameCharacters$1(final int yyStart)
3392: throws IOException {
3393: int yyC;
3394: int yyIndex;
3395: Result yyResult;
3396: int yyOption1;
3397: String yyValue;
3398: ParseError yyError = ParseError.DUMMY;
3399:
3400: // Alternative 1.
3401:
3402: yyResult = pNameCharacters(yyStart);
3403: yyError = yyResult.select(yyError);
3404: if (yyResult.hasValue()) {
3405:
3406: yyOption1 = yyResult.index;
3407:
3408: yyResult = pSimpleSpacing(yyOption1);
3409: yyError = yyResult.select(yyError);
3410: if (yyResult.hasValue()) {
3411:
3412: yyC = character(yyResult.index);
3413: if ('<' == yyC) {
3414: yyIndex = yyResult.index + 1;
3415:
3416: yyResult = pSimpleSpacing(yyIndex);
3417: yyError = yyResult.select(yyError);
3418: if (yyResult.hasValue()) {
3419:
3420: yyResult = pTypeNameCharacters(yyResult.index);
3421: yyError = yyResult.select(yyError);
3422: if (yyResult.hasValue()) {
3423:
3424: yyResult = pSimpleSpacing(yyResult.index);
3425: yyError = yyResult.select(yyError);
3426: if (yyResult.hasValue()) {
3427:
3428: yyResult = pTypeNameCharacters$$Star1(yyResult.index);
3429: yyError = yyResult.select(yyError);
3430: if (yyResult.hasValue()) {
3431:
3432: yyC = character(yyResult.index);
3433: if ('>' == yyC) {
3434: yyIndex = yyResult.index + 1;
3435:
3436: yyOption1 = yyIndex;
3437: }
3438: }
3439: }
3440: }
3441: }
3442: }
3443: }
3444:
3445: yyValue = difference(yyStart, yyOption1);
3446:
3447: return new SemanticValue(yyValue, yyOption1, yyError);
3448: }
3449:
3450: // Done.
3451: yyError = yyError.select("type name characters expected",
3452: yyStart);
3453: return yyError;
3454: }
3455:
3456: // =========================================================================
3457:
3458: /**
3459: * Parse synthetic nonterminal
3460: * xtc.parser.PGrammar.TypeNameCharacters$$Star1.
3461: *
3462: * @param yyStart The index.
3463: * @return The result.
3464: * @throws IOException Signals an I/O error.
3465: */
3466: private Result pTypeNameCharacters$$Star1(final int yyStart)
3467: throws IOException {
3468:
3469: PParserColumn yyColumn = (PParserColumn) column(yyStart);
3470: if (null == yyColumn.chunk2)
3471: yyColumn.chunk2 = new Chunk2();
3472: if (null == yyColumn.chunk2.fTypeNameCharacters$$Star1)
3473: yyColumn.chunk2.fTypeNameCharacters$$Star1 = pTypeNameCharacters$$Star1$1(yyStart);
3474: return yyColumn.chunk2.fTypeNameCharacters$$Star1;
3475: }
3476:
3477: /** Actually parse xtc.parser.PGrammar.TypeNameCharacters$$Star1. */
3478: private Result pTypeNameCharacters$$Star1$1(final int yyStart)
3479: throws IOException {
3480:
3481: int yyC;
3482: int yyIndex;
3483: Result yyResult;
3484: Void yyValue;
3485: ParseError yyError = ParseError.DUMMY;
3486:
3487: // Alternative 1.
3488:
3489: yyC = character(yyStart);
3490: if (',' == yyC) {
3491: yyIndex = yyStart + 1;
3492:
3493: yyResult = pSimpleSpacing(yyIndex);
3494: yyError = yyResult.select(yyError);
3495: if (yyResult.hasValue()) {
3496:
3497: yyResult = pTypeNameCharacters(yyResult.index);
3498: yyError = yyResult.select(yyError);
3499: if (yyResult.hasValue()) {
3500:
3501: yyResult = pSimpleSpacing(yyResult.index);
3502: yyError = yyResult.select(yyError);
3503: if (yyResult.hasValue()) {
3504:
3505: yyResult = pTypeNameCharacters$$Star1(yyResult.index);
3506: yyError = yyResult.select(yyError);
3507: if (yyResult.hasValue()) {
3508:
3509: yyValue = null;
3510:
3511: return yyResult.createValue(yyValue,
3512: yyError);
3513: }
3514: }
3515: }
3516: }
3517: }
3518:
3519: // Alternative 2.
3520:
3521: yyValue = null;
3522:
3523: return new SemanticValue(yyValue, yyStart, yyError);
3524: }
3525:
3526: // =========================================================================
3527:
3528: /**
3529: * Parse nonterminal xtc.parser.PGrammar.Name.
3530: *
3531: * @param yyStart The index.
3532: * @return The result.
3533: * @throws IOException Signals an I/O error.
3534: */
3535: private Result pName(final int yyStart) throws IOException {
3536: PParserColumn yyColumn = (PParserColumn) column(yyStart);
3537: if (null == yyColumn.chunk2)
3538: yyColumn.chunk2 = new Chunk2();
3539: if (null == yyColumn.chunk2.fName)
3540: yyColumn.chunk2.fName = pName$1(yyStart);
3541: return yyColumn.chunk2.fName;
3542: }
3543:
3544: /** Actually parse xtc.parser.PGrammar.Name. */
3545: private Result pName$1(final int yyStart) throws IOException {
3546: Result yyResult;
3547: String yyValue;
3548: ParseError yyError = ParseError.DUMMY;
3549:
3550: // Alternative 1.
3551:
3552: yyResult = pNameCharacters(yyStart);
3553: yyError = yyResult.select(yyError);
3554: if (yyResult.hasValue()) {
3555: yyValue = yyResult.semanticValue();
3556:
3557: yyResult = pSpacing(yyResult.index);
3558: yyError = yyResult.select(yyError);
3559: if (yyResult.hasValue()) {
3560:
3561: return yyResult.createValue(yyValue, yyError);
3562: }
3563: }
3564:
3565: // Done.
3566: return yyError;
3567: }
3568:
3569: // =========================================================================
3570:
3571: /**
3572: * Parse nonterminal xtc.parser.PGrammar.Word.
3573: *
3574: * @param yyStart The index.
3575: * @return The result.
3576: * @throws IOException Signals an I/O error.
3577: */
3578: private Result pWord(final int yyStart) throws IOException {
3579: PParserColumn yyColumn = (PParserColumn) column(yyStart);
3580: if (null == yyColumn.chunk3)
3581: yyColumn.chunk3 = new Chunk3();
3582: if (null == yyColumn.chunk3.fWord)
3583: yyColumn.chunk3.fWord = pWord$1(yyStart);
3584: return yyColumn.chunk3.fWord;
3585: }
3586:
3587: /** Actually parse xtc.parser.PGrammar.Word. */
3588: private Result pWord$1(final int yyStart) throws IOException {
3589: Result yyResult;
3590: String yyValue;
3591: ParseError yyError = ParseError.DUMMY;
3592:
3593: // Alternative 1.
3594:
3595: yyResult = pWordCharacters(yyStart);
3596: yyError = yyResult.select(yyError);
3597: if (yyResult.hasValue()) {
3598: yyValue = yyResult.semanticValue();
3599:
3600: yyResult = pSpacing(yyResult.index);
3601: yyError = yyResult.select(yyError);
3602: if (yyResult.hasValue()) {
3603:
3604: return yyResult.createValue(yyValue, yyError);
3605: }
3606: }
3607:
3608: // Done.
3609: return yyError;
3610: }
3611:
3612: // =========================================================================
3613:
3614: /**
3615: * Parse nonterminal xtc.parser.PGrammar.NameCharacters.
3616: *
3617: * @param yyStart The index.
3618: * @return The result.
3619: * @throws IOException Signals an I/O error.
3620: */
3621: private Result pNameCharacters(final int yyStart)
3622: throws IOException {
3623: PParserColumn yyColumn = (PParserColumn) column(yyStart);
3624: if (null == yyColumn.chunk3)
3625: yyColumn.chunk3 = new Chunk3();
3626: if (null == yyColumn.chunk3.fNameCharacters)
3627: yyColumn.chunk3.fNameCharacters = pNameCharacters$1(yyStart);
3628: return yyColumn.chunk3.fNameCharacters;
3629: }
3630:
3631: /** Actually parse xtc.parser.PGrammar.NameCharacters. */
3632: private Result pNameCharacters$1(final int yyStart)
3633: throws IOException {
3634: Result yyResult;
3635: String yyValue;
3636: ParseError yyError = ParseError.DUMMY;
3637:
3638: // Alternative 1.
3639:
3640: yyResult = pWordCharacters(yyStart);
3641: yyError = yyResult.select(yyError);
3642: if (yyResult.hasValue()) {
3643:
3644: yyResult = pNameCharacters$$Star1(yyResult.index);
3645: yyError = yyResult.select(yyError);
3646: if (yyResult.hasValue()) {
3647:
3648: yyValue = difference(yyStart, yyResult.index);
3649:
3650: return yyResult.createValue(yyValue, yyError);
3651: }
3652: }
3653:
3654: // Done.
3655: return yyError;
3656: }
3657:
3658: // =========================================================================
3659:
3660: /**
3661: * Parse synthetic nonterminal xtc.parser.PGrammar.NameCharacters$$Star1.
3662: *
3663: * @param yyStart The index.
3664: * @return The result.
3665: * @throws IOException Signals an I/O error.
3666: */
3667: private Result pNameCharacters$$Star1(final int yyStart)
3668: throws IOException {
3669:
3670: PParserColumn yyColumn = (PParserColumn) column(yyStart);
3671: if (null == yyColumn.chunk3)
3672: yyColumn.chunk3 = new Chunk3();
3673: if (null == yyColumn.chunk3.fNameCharacters$$Star1)
3674: yyColumn.chunk3.fNameCharacters$$Star1 = pNameCharacters$$Star1$1(yyStart);
3675: return yyColumn.chunk3.fNameCharacters$$Star1;
3676: }
3677:
3678: /** Actually parse xtc.parser.PGrammar.NameCharacters$$Star1. */
3679: private Result pNameCharacters$$Star1$1(final int yyStart)
3680: throws IOException {
3681:
3682: int yyC;
3683: int yyIndex;
3684: Result yyResult;
3685: Void yyValue;
3686: ParseError yyError = ParseError.DUMMY;
3687:
3688: // Alternative 1.
3689:
3690: yyC = character(yyStart);
3691: if ('.' == yyC) {
3692: yyIndex = yyStart + 1;
3693:
3694: yyResult = pWordCharacters(yyIndex);
3695: yyError = yyResult.select(yyError);
3696: if (yyResult.hasValue()) {
3697:
3698: yyResult = pNameCharacters$$Star1(yyResult.index);
3699: yyError = yyResult.select(yyError);
3700: if (yyResult.hasValue()) {
3701:
3702: yyValue = null;
3703:
3704: return yyResult.createValue(yyValue, yyError);
3705: }
3706: }
3707: }
3708:
3709: // Alternative 2.
3710:
3711: yyValue = null;
3712:
3713: return new SemanticValue(yyValue, yyStart, yyError);
3714: }
3715:
3716: // =========================================================================
3717:
3718: /**
3719: * Parse nonterminal xtc.parser.PGrammar.WordCharacters.
3720: *
3721: * @param yyStart The index.
3722: * @return The result.
3723: * @throws IOException Signals an I/O error.
3724: */
3725: private Result pWordCharacters(final int yyStart)
3726: throws IOException {
3727: PParserColumn yyColumn = (PParserColumn) column(yyStart);
3728: if (null == yyColumn.chunk3)
3729: yyColumn.chunk3 = new Chunk3();
3730: if (null == yyColumn.chunk3.fWordCharacters)
3731: yyColumn.chunk3.fWordCharacters = pWordCharacters$1(yyStart);
3732: return yyColumn.chunk3.fWordCharacters;
3733: }
3734:
3735: /** Actually parse xtc.parser.PGrammar.WordCharacters. */
3736: private Result pWordCharacters$1(final int yyStart)
3737: throws IOException {
3738: int yyC;
3739: int yyIndex;
3740: Result yyResult;
3741: String yyValue;
3742: ParseError yyError = ParseError.DUMMY;
3743:
3744: // Alternative 1.
3745:
3746: yyC = character(yyStart);
3747: if (-1 != yyC) {
3748: yyIndex = yyStart + 1;
3749: if ((('A' <= yyC) && (yyC <= 'Z'))
3750: || (('a' <= yyC) && (yyC <= 'z'))) {
3751:
3752: yyResult = pWordCharacters$$Star1(yyIndex);
3753: yyError = yyResult.select(yyError);
3754: if (yyResult.hasValue()) {
3755:
3756: yyValue = difference(yyStart, yyResult.index);
3757:
3758: return yyResult.createValue(yyValue, yyError);
3759: }
3760: }
3761: }
3762:
3763: // Done.
3764: yyError = yyError.select("word characters expected", yyStart);
3765: return yyError;
3766: }
3767:
3768: // =========================================================================
3769:
3770: /**
3771: * Parse synthetic nonterminal xtc.parser.PGrammar.WordCharacters$$Plus1.
3772: *
3773: * @param yyStart The index.
3774: * @return The result.
3775: * @throws IOException Signals an I/O error.
3776: */
3777: private Result pWordCharacters$$Plus1(final int yyStart)
3778: throws IOException {
3779:
3780: PParserColumn yyColumn = (PParserColumn) column(yyStart);
3781: if (null == yyColumn.chunk3)
3782: yyColumn.chunk3 = new Chunk3();
3783: if (null == yyColumn.chunk3.fWordCharacters$$Plus1)
3784: yyColumn.chunk3.fWordCharacters$$Plus1 = pWordCharacters$$Plus1$1(yyStart);
3785: return yyColumn.chunk3.fWordCharacters$$Plus1;
3786: }
3787:
3788: /** Actually parse xtc.parser.PGrammar.WordCharacters$$Plus1. */
3789: private Result pWordCharacters$$Plus1$1(final int yyStart)
3790: throws IOException {
3791:
3792: int yyC;
3793: int yyIndex;
3794: Result yyResult;
3795: Void yyValue;
3796: ParseError yyError = ParseError.DUMMY;
3797:
3798: // Alternative 1.
3799:
3800: yyC = character(yyStart);
3801: if (-1 != yyC) {
3802: yyIndex = yyStart + 1;
3803: if ('_' == yyC) {
3804:
3805: final int yyChoice1 = yyIndex;
3806:
3807: // Nested alternative 1.
3808:
3809: yyResult = pWordCharacters$$Plus1(yyChoice1);
3810: yyError = yyResult.select(yyError);
3811: if (yyResult.hasValue()) {
3812:
3813: yyValue = null;
3814:
3815: return yyResult.createValue(yyValue, yyError);
3816: }
3817:
3818: // Nested alternative 2.
3819:
3820: yyValue = null;
3821:
3822: return new SemanticValue(yyValue, yyChoice1, yyError);
3823: }
3824: }
3825:
3826: // Done.
3827: yyError = yyError.select("word characters expected", yyStart);
3828: return yyError;
3829: }
3830:
3831: // =========================================================================
3832:
3833: /**
3834: * Parse synthetic nonterminal xtc.parser.PGrammar.WordCharacters$$Star1.
3835: *
3836: * @param yyStart The index.
3837: * @return The result.
3838: * @throws IOException Signals an I/O error.
3839: */
3840: private Result pWordCharacters$$Star1(final int yyStart)
3841: throws IOException {
3842:
3843: PParserColumn yyColumn = (PParserColumn) column(yyStart);
3844: if (null == yyColumn.chunk3)
3845: yyColumn.chunk3 = new Chunk3();
3846: if (null == yyColumn.chunk3.fWordCharacters$$Star1)
3847: yyColumn.chunk3.fWordCharacters$$Star1 = pWordCharacters$$Star1$1(yyStart);
3848: return yyColumn.chunk3.fWordCharacters$$Star1;
3849: }
3850:
3851: /** Actually parse xtc.parser.PGrammar.WordCharacters$$Star1. */
3852: private Result pWordCharacters$$Star1$1(final int yyStart)
3853: throws IOException {
3854:
3855: int yyC;
3856: int yyIndex;
3857: Result yyResult;
3858: Void yyValue;
3859: ParseError yyError = ParseError.DUMMY;
3860:
3861: // Alternative 1.
3862:
3863: yyResult = pWordCharacters$$Plus1(yyStart);
3864: yyError = yyResult.select(yyError);
3865: if (yyResult.hasValue()) {
3866:
3867: yyC = character(yyResult.index);
3868: if (-1 != yyC) {
3869: yyIndex = yyResult.index + 1;
3870: if ((('0' <= yyC) && (yyC <= '9'))
3871: || (('A' <= yyC) && (yyC <= 'Z'))
3872: || (('a' <= yyC) && (yyC <= 'z'))) {
3873:
3874: yyResult = pWordCharacters$$Star1(yyIndex);
3875: yyError = yyResult.select(yyError);
3876: if (yyResult.hasValue()) {
3877:
3878: yyValue = null;
3879:
3880: return yyResult.createValue(yyValue, yyError);
3881: }
3882: }
3883: }
3884: }
3885:
3886: // Alternative 2.
3887:
3888: yyC = character(yyStart);
3889: if (-1 != yyC) {
3890: yyIndex = yyStart + 1;
3891: if ((('0' <= yyC) && (yyC <= '9'))
3892: || (('A' <= yyC) && (yyC <= 'Z'))
3893: || (('a' <= yyC) && (yyC <= 'z'))) {
3894:
3895: yyResult = pWordCharacters$$Star1(yyIndex);
3896: yyError = yyResult.select(yyError);
3897: if (yyResult.hasValue()) {
3898:
3899: yyValue = null;
3900:
3901: return yyResult.createValue(yyValue, yyError);
3902: }
3903: }
3904: }
3905:
3906: // Alternative 3.
3907:
3908: yyValue = null;
3909:
3910: return new SemanticValue(yyValue, yyStart, yyError);
3911: }
3912:
3913: // =========================================================================
3914:
3915: /**
3916: * Parse nonterminal xtc.parser.PGrammar.CharacterLiteral.
3917: *
3918: * @param yyStart The index.
3919: * @return The result.
3920: * @throws IOException Signals an I/O error.
3921: */
3922: private Result pCharacterLiteral(final int yyStart)
3923: throws IOException {
3924: PParserColumn yyColumn = (PParserColumn) column(yyStart);
3925: if (null == yyColumn.chunk3)
3926: yyColumn.chunk3 = new Chunk3();
3927: if (null == yyColumn.chunk3.fCharacterLiteral)
3928: yyColumn.chunk3.fCharacterLiteral = pCharacterLiteral$1(yyStart);
3929: return yyColumn.chunk3.fCharacterLiteral;
3930: }
3931:
3932: /** Actually parse xtc.parser.PGrammar.CharacterLiteral. */
3933: private Result pCharacterLiteral$1(final int yyStart)
3934: throws IOException {
3935: int yyC;
3936: int yyIndex;
3937: Result yyResult;
3938: String yyValue;
3939: ParseError yyError = ParseError.DUMMY;
3940:
3941: // Alternative 1.
3942:
3943: yyC = character(yyStart);
3944: if ('\'' == yyC) {
3945: yyIndex = yyStart + 1;
3946:
3947: yyResult = pCharacterLiteral$$Choice1(yyIndex);
3948: yyError = yyResult.select(yyError);
3949: if (yyResult.hasValue()) {
3950:
3951: yyC = character(yyResult.index);
3952: if ('\'' == yyC) {
3953: yyIndex = yyResult.index + 1;
3954:
3955: yyValue = difference(yyStart, yyIndex);
3956:
3957: return new SemanticValue(yyValue, yyIndex, yyError);
3958: }
3959: }
3960: }
3961:
3962: // Done.
3963: yyError = yyError.select("character literal expected", yyStart);
3964: return yyError;
3965: }
3966:
3967: // =========================================================================
3968:
3969: /**
3970: * Parse synthetic nonterminal
3971: * xtc.parser.PGrammar.CharacterLiteral$$Choice1.
3972: *
3973: * @param yyStart The index.
3974: * @return The result.
3975: * @throws IOException Signals an I/O error.
3976: */
3977: private Result pCharacterLiteral$$Choice1(final int yyStart)
3978: throws IOException {
3979:
3980: int yyC;
3981: int yyIndex;
3982: Result yyResult;
3983: Void yyValue;
3984: ParseError yyError = ParseError.DUMMY;
3985:
3986: // Alternative 1.
3987:
3988: yyC = character(yyStart);
3989: if (-1 != yyC) {
3990: yyIndex = yyStart + 1;
3991:
3992: switch (yyC) {
3993: case '\\': {
3994: final int yyChoice1 = yyIndex;
3995:
3996: // Nested alternative 1.
3997:
3998: yyC = character(yyChoice1);
3999: if (-1 != yyC) {
4000: yyIndex = yyChoice1 + 1;
4001:
4002: switch (yyC) {
4003: case '\"':
4004: case '\'':
4005: case '-':
4006: case '[':
4007: case '\\':
4008: case ']':
4009: case 'b':
4010: case 'f':
4011: case 'n':
4012: case 'r':
4013: case 't': {
4014: yyValue = null;
4015:
4016: return new SemanticValue(yyValue, yyIndex,
4017: yyError);
4018: }
4019:
4020: case 'u': {
4021: yyResult = pHexQuad(yyIndex);
4022: yyError = yyResult.select(yyError);
4023: if (yyResult.hasValue()) {
4024:
4025: yyValue = null;
4026:
4027: return yyResult.createValue(yyValue,
4028: yyError);
4029: }
4030: }
4031: break;
4032:
4033: default:
4034: /* No match. */
4035: }
4036: }
4037:
4038: // Nested alternative 2.
4039: { // Start scope for nested choice.
4040:
4041: final int yyChoice2 = yyChoice1;
4042:
4043: // Nested alternative 1.
4044:
4045: yyC = character(yyChoice2);
4046: if (-1 != yyC) {
4047: yyIndex = yyChoice2 + 1;
4048:
4049: switch (yyC) {
4050: case '0':
4051: case '1':
4052: case '2':
4053: case '3': {
4054: yyC = character(yyIndex);
4055: if (-1 != yyC) {
4056: yyIndex = yyIndex + 1;
4057:
4058: switch (yyC) {
4059: case '0':
4060: case '1':
4061: case '2':
4062: case '3':
4063: case '4':
4064: case '5':
4065: case '6':
4066: case '7': {
4067: yyC = character(yyIndex);
4068: if (-1 != yyC) {
4069: yyIndex = yyIndex + 1;
4070:
4071: switch (yyC) {
4072: case '0':
4073: case '1':
4074: case '2':
4075: case '3':
4076: case '4':
4077: case '5':
4078: case '6':
4079: case '7': {
4080: yyValue = null;
4081:
4082: return new SemanticValue(
4083: yyValue, yyIndex,
4084: yyError);
4085: }
4086:
4087: default:
4088: /* No match. */
4089: }
4090: }
4091: }
4092: break;
4093:
4094: default:
4095: /* No match. */
4096: }
4097: }
4098: }
4099: break;
4100:
4101: default:
4102: /* No match. */
4103: }
4104: }
4105:
4106: // Nested alternative 2.
4107:
4108: yyC = character(yyChoice2);
4109: if (-1 != yyC) {
4110: yyIndex = yyChoice2 + 1;
4111:
4112: switch (yyC) {
4113: case '0':
4114: case '1':
4115: case '2':
4116: case '3':
4117: case '4':
4118: case '5':
4119: case '6':
4120: case '7': {
4121: final int yyChoice3 = yyIndex;
4122:
4123: // Nested alternative 1.
4124:
4125: yyC = character(yyChoice3);
4126: if (-1 != yyC) {
4127: yyIndex = yyChoice3 + 1;
4128:
4129: switch (yyC) {
4130: case '0':
4131: case '1':
4132: case '2':
4133: case '3':
4134: case '4':
4135: case '5':
4136: case '6':
4137: case '7': {
4138: yyValue = null;
4139:
4140: return new SemanticValue(yyValue,
4141: yyIndex, yyError);
4142: }
4143:
4144: default:
4145: /* No match. */
4146: }
4147: }
4148:
4149: // Nested alternative 2.
4150:
4151: yyValue = null;
4152:
4153: return new SemanticValue(yyValue,
4154: yyChoice3, yyError);
4155: }
4156:
4157: default:
4158: /* No match. */
4159: }
4160: }
4161: } // End scope for nested choice.
4162: }
4163: break;
4164:
4165: default:
4166: /* No match. */
4167: }
4168: }
4169:
4170: // Alternative 2.
4171:
4172: yyC = character(yyStart);
4173: if (-1 != yyC) {
4174: yyIndex = yyStart + 1;
4175:
4176: switch (yyC) {
4177: case '\'':
4178: case '\\':
4179: /* No match. */
4180: break;
4181:
4182: default: {
4183: yyValue = null;
4184:
4185: return new SemanticValue(yyValue, yyIndex, yyError);
4186: }
4187: }
4188: }
4189:
4190: // Done.
4191: yyError = yyError.select("character literal expected", yyStart);
4192: return yyError;
4193: }
4194:
4195: // =========================================================================
4196:
4197: /**
4198: * Parse nonterminal xtc.parser.PGrammar.StringLiteral.
4199: *
4200: * @param yyStart The index.
4201: * @return The result.
4202: * @throws IOException Signals an I/O error.
4203: */
4204: private Result pStringLiteral(final int yyStart) throws IOException {
4205: PParserColumn yyColumn = (PParserColumn) column(yyStart);
4206: if (null == yyColumn.chunk3)
4207: yyColumn.chunk3 = new Chunk3();
4208: if (null == yyColumn.chunk3.fStringLiteral)
4209: yyColumn.chunk3.fStringLiteral = pStringLiteral$1(yyStart);
4210: return yyColumn.chunk3.fStringLiteral;
4211: }
4212:
4213: /** Actually parse xtc.parser.PGrammar.StringLiteral. */
4214: private Result pStringLiteral$1(final int yyStart)
4215: throws IOException {
4216: int yyC;
4217: int yyIndex;
4218: Result yyResult;
4219: String yyValue;
4220: ParseError yyError = ParseError.DUMMY;
4221:
4222: // Alternative 1.
4223:
4224: yyC = character(yyStart);
4225: if ('\"' == yyC) {
4226: yyIndex = yyStart + 1;
4227:
4228: yyResult = pStringLiteral$$Star1(yyIndex);
4229: yyError = yyResult.select(yyError);
4230: if (yyResult.hasValue()) {
4231:
4232: yyC = character(yyResult.index);
4233: if ('\"' == yyC) {
4234: yyIndex = yyResult.index + 1;
4235:
4236: yyValue = difference(yyStart, yyIndex);
4237:
4238: return new SemanticValue(yyValue, yyIndex, yyError);
4239: }
4240: }
4241: }
4242:
4243: // Done.
4244: yyError = yyError.select("string literal expected", yyStart);
4245: return yyError;
4246: }
4247:
4248: // =========================================================================
4249:
4250: /**
4251: * Parse synthetic nonterminal xtc.parser.PGrammar.StringLiteral$$Star1.
4252: *
4253: * @param yyStart The index.
4254: * @return The result.
4255: * @throws IOException Signals an I/O error.
4256: */
4257: private Result pStringLiteral$$Star1(final int yyStart)
4258: throws IOException {
4259: PParserColumn yyColumn = (PParserColumn) column(yyStart);
4260: if (null == yyColumn.chunk3)
4261: yyColumn.chunk3 = new Chunk3();
4262: if (null == yyColumn.chunk3.fStringLiteral$$Star1)
4263: yyColumn.chunk3.fStringLiteral$$Star1 = pStringLiteral$$Star1$1(yyStart);
4264: return yyColumn.chunk3.fStringLiteral$$Star1;
4265: }
4266:
4267: /** Actually parse xtc.parser.PGrammar.StringLiteral$$Star1. */
4268: private Result pStringLiteral$$Star1$1(final int yyStart)
4269: throws IOException {
4270:
4271: int yyC;
4272: int yyIndex;
4273: Result yyResult;
4274: Void yyValue;
4275: ParseError yyError = ParseError.DUMMY;
4276:
4277: // Alternative 1.
4278:
4279: yyResult = pEscapeSequence(yyStart);
4280: yyError = yyResult.select(yyError);
4281: if (yyResult.hasValue()) {
4282:
4283: yyResult = pStringLiteral$$Star1(yyResult.index);
4284: yyError = yyResult.select(yyError);
4285: if (yyResult.hasValue()) {
4286:
4287: yyValue = null;
4288:
4289: return yyResult.createValue(yyValue, yyError);
4290: }
4291: }
4292:
4293: // Alternative 2.
4294:
4295: yyC = character(yyStart);
4296: if (-1 != yyC) {
4297: yyIndex = yyStart + 1;
4298:
4299: switch (yyC) {
4300: case '\"':
4301: case '\\':
4302: /* No match. */
4303: break;
4304:
4305: default: {
4306: yyResult = pStringLiteral$$Star1(yyIndex);
4307: yyError = yyResult.select(yyError);
4308: if (yyResult.hasValue()) {
4309:
4310: yyValue = null;
4311:
4312: return yyResult.createValue(yyValue, yyError);
4313: }
4314: }
4315: }
4316: }
4317:
4318: // Alternative 3.
4319:
4320: yyValue = null;
4321:
4322: return new SemanticValue(yyValue, yyStart, yyError);
4323: }
4324:
4325: // =========================================================================
4326:
4327: /**
4328: * Parse nonterminal xtc.parser.PGrammar.ClassChar.
4329: *
4330: * @param yyStart The index.
4331: * @return The result.
4332: * @throws IOException Signals an I/O error.
4333: */
4334: private Result pClassChar(final int yyStart) throws IOException {
4335: PParserColumn yyColumn = (PParserColumn) column(yyStart);
4336: if (null == yyColumn.chunk3)
4337: yyColumn.chunk3 = new Chunk3();
4338: if (null == yyColumn.chunk3.fClassChar)
4339: yyColumn.chunk3.fClassChar = pClassChar$1(yyStart);
4340: return yyColumn.chunk3.fClassChar;
4341: }
4342:
4343: /** Actually parse xtc.parser.PGrammar.ClassChar. */
4344: private Result pClassChar$1(final int yyStart) throws IOException {
4345: int yyC;
4346: int yyIndex;
4347: Result yyResult;
4348: String yyValue;
4349: ParseError yyError = ParseError.DUMMY;
4350:
4351: // Alternative 1.
4352:
4353: yyC = character(yyStart);
4354: if (-1 != yyC) {
4355: yyIndex = yyStart + 1;
4356:
4357: switch (yyC) {
4358: case '\\': {
4359: final int yyChoice1 = yyIndex;
4360:
4361: // Nested alternative 1.
4362:
4363: yyC = character(yyChoice1);
4364: if (-1 != yyC) {
4365: yyIndex = yyChoice1 + 1;
4366:
4367: switch (yyC) {
4368: case '\"':
4369: case '\'':
4370: case '-':
4371: case '[':
4372: case '\\':
4373: case ']':
4374: case 'b':
4375: case 'f':
4376: case 'n':
4377: case 'r':
4378: case 't': {
4379: yyValue = difference(yyStart, yyIndex);
4380:
4381: return new SemanticValue(yyValue, yyIndex,
4382: yyError);
4383: }
4384:
4385: case 'u': {
4386: yyResult = pHexQuad(yyIndex);
4387: yyError = yyResult.select(yyError);
4388: if (yyResult.hasValue()) {
4389:
4390: yyValue = difference(yyStart,
4391: yyResult.index);
4392:
4393: return yyResult.createValue(yyValue,
4394: yyError);
4395: }
4396: }
4397: break;
4398:
4399: default:
4400: /* No match. */
4401: }
4402: }
4403:
4404: // Nested alternative 2.
4405: { // Start scope for nested choice.
4406:
4407: final int yyChoice2 = yyChoice1;
4408:
4409: // Nested alternative 1.
4410:
4411: yyC = character(yyChoice2);
4412: if (-1 != yyC) {
4413: yyIndex = yyChoice2 + 1;
4414:
4415: switch (yyC) {
4416: case '0':
4417: case '1':
4418: case '2':
4419: case '3': {
4420: yyC = character(yyIndex);
4421: if (-1 != yyC) {
4422: yyIndex = yyIndex + 1;
4423:
4424: switch (yyC) {
4425: case '0':
4426: case '1':
4427: case '2':
4428: case '3':
4429: case '4':
4430: case '5':
4431: case '6':
4432: case '7': {
4433: yyC = character(yyIndex);
4434: if (-1 != yyC) {
4435: yyIndex = yyIndex + 1;
4436:
4437: switch (yyC) {
4438: case '0':
4439: case '1':
4440: case '2':
4441: case '3':
4442: case '4':
4443: case '5':
4444: case '6':
4445: case '7': {
4446: yyValue = difference(
4447: yyStart, yyIndex);
4448:
4449: return new SemanticValue(
4450: yyValue, yyIndex,
4451: yyError);
4452: }
4453:
4454: default:
4455: /* No match. */
4456: }
4457: }
4458: }
4459: break;
4460:
4461: default:
4462: /* No match. */
4463: }
4464: }
4465: }
4466: break;
4467:
4468: default:
4469: /* No match. */
4470: }
4471: }
4472:
4473: // Nested alternative 2.
4474:
4475: yyC = character(yyChoice2);
4476: if (-1 != yyC) {
4477: yyIndex = yyChoice2 + 1;
4478:
4479: switch (yyC) {
4480: case '0':
4481: case '1':
4482: case '2':
4483: case '3':
4484: case '4':
4485: case '5':
4486: case '6':
4487: case '7': {
4488: final int yyChoice3 = yyIndex;
4489:
4490: // Nested alternative 1.
4491:
4492: yyC = character(yyChoice3);
4493: if (-1 != yyC) {
4494: yyIndex = yyChoice3 + 1;
4495:
4496: switch (yyC) {
4497: case '0':
4498: case '1':
4499: case '2':
4500: case '3':
4501: case '4':
4502: case '5':
4503: case '6':
4504: case '7': {
4505: yyValue = difference(yyStart,
4506: yyIndex);
4507:
4508: return new SemanticValue(yyValue,
4509: yyIndex, yyError);
4510: }
4511:
4512: default:
4513: /* No match. */
4514: }
4515: }
4516:
4517: // Nested alternative 2.
4518:
4519: yyValue = difference(yyStart, yyChoice3);
4520:
4521: return new SemanticValue(yyValue,
4522: yyChoice3, yyError);
4523: }
4524:
4525: default:
4526: /* No match. */
4527: }
4528: }
4529: } // End scope for nested choice.
4530: }
4531: break;
4532:
4533: default:
4534: /* No match. */
4535: }
4536: }
4537:
4538: // Alternative 2.
4539:
4540: yyC = character(yyStart);
4541: if (-1 != yyC) {
4542: yyIndex = yyStart + 1;
4543:
4544: switch (yyC) {
4545: case '-':
4546: case '\\':
4547: case ']':
4548: /* No match. */
4549: break;
4550:
4551: default: {
4552: yyValue = difference(yyStart, yyIndex);
4553:
4554: return new SemanticValue(yyValue, yyIndex, yyError);
4555: }
4556: }
4557: }
4558:
4559: // Done.
4560: yyError = yyError.select("class char expected", yyStart);
4561: return yyError;
4562: }
4563:
4564: // =========================================================================
4565:
4566: /**
4567: * Parse nonterminal xtc.parser.PGrammar.EscapeSequence.
4568: *
4569: * @param yyStart The index.
4570: * @return The result.
4571: * @throws IOException Signals an I/O error.
4572: */
4573: private Result pEscapeSequence(final int yyStart)
4574: throws IOException {
4575: int yyC;
4576: int yyIndex;
4577: Result yyResult;
4578: Void yyValue;
4579: ParseError yyError = ParseError.DUMMY;
4580:
4581: // Alternative 1.
4582:
4583: yyC = character(yyStart);
4584: if (-1 != yyC) {
4585: yyIndex = yyStart + 1;
4586: if ('\\' == yyC) {
4587:
4588: final int yyChoice1 = yyIndex;
4589:
4590: // Nested alternative 1.
4591:
4592: yyC = character(yyChoice1);
4593: if (-1 != yyC) {
4594: yyIndex = yyChoice1 + 1;
4595:
4596: switch (yyC) {
4597: case '\"':
4598: case '\'':
4599: case '-':
4600: case '[':
4601: case '\\':
4602: case ']':
4603: case 'b':
4604: case 'f':
4605: case 'n':
4606: case 'r':
4607: case 't': {
4608: yyValue = null;
4609:
4610: return new SemanticValue(yyValue, yyIndex,
4611: yyError);
4612: }
4613:
4614: case 'u': {
4615: yyResult = pHexQuad(yyIndex);
4616: yyError = yyResult.select(yyError);
4617: if (yyResult.hasValue()) {
4618:
4619: yyValue = null;
4620:
4621: return yyResult.createValue(yyValue,
4622: yyError);
4623: }
4624: }
4625: break;
4626:
4627: default:
4628: /* No match. */
4629: }
4630: }
4631:
4632: // Nested alternative 2.
4633: { // Start scope for nested choice.
4634:
4635: final int yyChoice2 = yyChoice1;
4636:
4637: // Nested alternative 1.
4638:
4639: yyC = character(yyChoice2);
4640: if (-1 != yyC) {
4641: yyIndex = yyChoice2 + 1;
4642:
4643: switch (yyC) {
4644: case '0':
4645: case '1':
4646: case '2':
4647: case '3': {
4648: yyC = character(yyIndex);
4649: if (-1 != yyC) {
4650: yyIndex = yyIndex + 1;
4651:
4652: switch (yyC) {
4653: case '0':
4654: case '1':
4655: case '2':
4656: case '3':
4657: case '4':
4658: case '5':
4659: case '6':
4660: case '7': {
4661: yyC = character(yyIndex);
4662: if (-1 != yyC) {
4663: yyIndex = yyIndex + 1;
4664:
4665: switch (yyC) {
4666: case '0':
4667: case '1':
4668: case '2':
4669: case '3':
4670: case '4':
4671: case '5':
4672: case '6':
4673: case '7': {
4674: yyValue = null;
4675:
4676: return new SemanticValue(
4677: yyValue, yyIndex,
4678: yyError);
4679: }
4680:
4681: default:
4682: /* No match. */
4683: }
4684: }
4685: }
4686: break;
4687:
4688: default:
4689: /* No match. */
4690: }
4691: }
4692: }
4693: break;
4694:
4695: default:
4696: /* No match. */
4697: }
4698: }
4699:
4700: // Nested alternative 2.
4701:
4702: yyC = character(yyChoice2);
4703: if (-1 != yyC) {
4704: yyIndex = yyChoice2 + 1;
4705:
4706: switch (yyC) {
4707: case '0':
4708: case '1':
4709: case '2':
4710: case '3':
4711: case '4':
4712: case '5':
4713: case '6':
4714: case '7': {
4715: final int yyChoice3 = yyIndex;
4716:
4717: // Nested alternative 1.
4718:
4719: yyC = character(yyChoice3);
4720: if (-1 != yyC) {
4721: yyIndex = yyChoice3 + 1;
4722:
4723: switch (yyC) {
4724: case '0':
4725: case '1':
4726: case '2':
4727: case '3':
4728: case '4':
4729: case '5':
4730: case '6':
4731: case '7': {
4732: yyValue = null;
4733:
4734: return new SemanticValue(yyValue,
4735: yyIndex, yyError);
4736: }
4737:
4738: default:
4739: /* No match. */
4740: }
4741: }
4742:
4743: // Nested alternative 2.
4744:
4745: yyValue = null;
4746:
4747: return new SemanticValue(yyValue,
4748: yyChoice3, yyError);
4749: }
4750:
4751: default:
4752: /* No match. */
4753: }
4754: }
4755: } // End scope for nested choice.
4756: }
4757: }
4758:
4759: // Done.
4760: yyError = yyError.select("escape sequence expected", yyStart);
4761: return yyError;
4762: }
4763:
4764: // =========================================================================
4765:
4766: /**
4767: * Parse nonterminal xtc.parser.PGrammar.IntegerLiteral.
4768: *
4769: * @param yyStart The index.
4770: * @return The result.
4771: * @throws IOException Signals an I/O error.
4772: */
4773: private Result pIntegerLiteral(final int yyStart)
4774: throws IOException {
4775: int yyC;
4776: int yyIndex;
4777: int yyRepetition1;
4778: boolean yyRepeated1;
4779: String yyValue;
4780: ParseError yyError = ParseError.DUMMY;
4781:
4782: // Alternative 1.
4783:
4784: yyC = character(yyStart);
4785: if (-1 != yyC) {
4786: yyIndex = yyStart + 1;
4787:
4788: switch (yyC) {
4789: case '0': {
4790: final int yyChoice1 = yyIndex;
4791:
4792: // Nested alternative 1.
4793:
4794: yyC = character(yyChoice1);
4795: if (-1 != yyC) {
4796: yyIndex = yyChoice1 + 1;
4797:
4798: switch (yyC) {
4799: case 'X':
4800: case 'x': {
4801: yyRepetition1 = yyIndex;
4802: yyRepeated1 = false;
4803: while (true) {
4804:
4805: yyC = character(yyRepetition1);
4806: if (-1 != yyC) {
4807: yyIndex = yyRepetition1 + 1;
4808:
4809: switch (yyC) {
4810: case '0':
4811: case '1':
4812: case '2':
4813: case '3':
4814: case '4':
4815: case '5':
4816: case '6':
4817: case '7':
4818: case '8':
4819: case '9':
4820: case 'A':
4821: case 'B':
4822: case 'C':
4823: case 'D':
4824: case 'E':
4825: case 'F':
4826: case 'a':
4827: case 'b':
4828: case 'c':
4829: case 'd':
4830: case 'e':
4831: case 'f': {
4832: yyRepetition1 = yyIndex;
4833: yyRepeated1 = true;
4834: continue;
4835: }
4836:
4837: default:
4838: /* No match. */
4839: }
4840: }
4841: break;
4842: }
4843:
4844: if (yyRepeated1) {
4845:
4846: yyValue = difference(yyStart, yyRepetition1);
4847:
4848: return new SemanticValue(yyValue,
4849: yyRepetition1, yyError);
4850: }
4851: }
4852: break;
4853:
4854: default:
4855: /* No match. */
4856: }
4857: }
4858:
4859: // Nested alternative 2.
4860:
4861: yyRepetition1 = yyChoice1;
4862: yyRepeated1 = false;
4863: while (true) {
4864:
4865: yyC = character(yyRepetition1);
4866: if (-1 != yyC) {
4867: yyIndex = yyRepetition1 + 1;
4868:
4869: switch (yyC) {
4870: case '0':
4871: case '1':
4872: case '2':
4873: case '3':
4874: case '4':
4875: case '5':
4876: case '6':
4877: case '7': {
4878: yyRepetition1 = yyIndex;
4879: yyRepeated1 = true;
4880: continue;
4881: }
4882:
4883: default:
4884: /* No match. */
4885: }
4886: }
4887: break;
4888: }
4889:
4890: if (yyRepeated1) {
4891:
4892: yyValue = difference(yyStart, yyRepetition1);
4893:
4894: return new SemanticValue(yyValue, yyRepetition1,
4895: yyError);
4896: }
4897:
4898: // Nested alternative 3.
4899:
4900: yyValue = "0";
4901:
4902: return new SemanticValue(yyValue, yyChoice1, yyError);
4903: }
4904:
4905: case '1':
4906: case '2':
4907: case '3':
4908: case '4':
4909: case '5':
4910: case '6':
4911: case '7':
4912: case '8':
4913: case '9': {
4914: yyRepetition1 = yyIndex;
4915: while (true) {
4916:
4917: yyC = character(yyRepetition1);
4918: if (-1 != yyC) {
4919: yyIndex = yyRepetition1 + 1;
4920:
4921: switch (yyC) {
4922: case '0':
4923: case '1':
4924: case '2':
4925: case '3':
4926: case '4':
4927: case '5':
4928: case '6':
4929: case '7':
4930: case '8':
4931: case '9': {
4932: yyRepetition1 = yyIndex;
4933: continue;
4934: }
4935:
4936: default:
4937: /* No match. */
4938: }
4939: }
4940: break;
4941: }
4942:
4943: yyValue = difference(yyStart, yyRepetition1);
4944:
4945: return new SemanticValue(yyValue, yyRepetition1,
4946: yyError);
4947: }
4948:
4949: default:
4950: /* No match. */
4951: }
4952: }
4953:
4954: // Done.
4955: yyError = yyError.select("integer literal expected", yyStart);
4956: return yyError;
4957: }
4958:
4959: // =========================================================================
4960:
4961: /**
4962: * Parse nonterminal xtc.parser.PGrammar.HexQuad.
4963: *
4964: * @param yyStart The index.
4965: * @return The result.
4966: * @throws IOException Signals an I/O error.
4967: */
4968: private Result pHexQuad(final int yyStart) throws IOException {
4969: int yyC;
4970: int yyIndex;
4971: Void yyValue;
4972: ParseError yyError = ParseError.DUMMY;
4973:
4974: // Alternative 1.
4975:
4976: yyC = character(yyStart);
4977: if (-1 != yyC) {
4978: yyIndex = yyStart + 1;
4979:
4980: switch (yyC) {
4981: case '0':
4982: case '1':
4983: case '2':
4984: case '3':
4985: case '4':
4986: case '5':
4987: case '6':
4988: case '7':
4989: case '8':
4990: case '9':
4991: case 'A':
4992: case 'B':
4993: case 'C':
4994: case 'D':
4995: case 'E':
4996: case 'F':
4997: case 'a':
4998: case 'b':
4999: case 'c':
5000: case 'd':
5001: case 'e':
5002: case 'f': {
5003: yyC = character(yyIndex);
5004: if (-1 != yyC) {
5005: yyIndex = yyIndex + 1;
5006:
5007: switch (yyC) {
5008: case '0':
5009: case '1':
5010: case '2':
5011: case '3':
5012: case '4':
5013: case '5':
5014: case '6':
5015: case '7':
5016: case '8':
5017: case '9':
5018: case 'A':
5019: case 'B':
5020: case 'C':
5021: case 'D':
5022: case 'E':
5023: case 'F':
5024: case 'a':
5025: case 'b':
5026: case 'c':
5027: case 'd':
5028: case 'e':
5029: case 'f': {
5030: yyC = character(yyIndex);
5031: if (-1 != yyC) {
5032: yyIndex = yyIndex + 1;
5033:
5034: switch (yyC) {
5035: case '0':
5036: case '1':
5037: case '2':
5038: case '3':
5039: case '4':
5040: case '5':
5041: case '6':
5042: case '7':
5043: case '8':
5044: case '9':
5045: case 'A':
5046: case 'B':
5047: case 'C':
5048: case 'D':
5049: case 'E':
5050: case 'F':
5051: case 'a':
5052: case 'b':
5053: case 'c':
5054: case 'd':
5055: case 'e':
5056: case 'f': {
5057: yyC = character(yyIndex);
5058: if (-1 != yyC) {
5059: yyIndex = yyIndex + 1;
5060:
5061: switch (yyC) {
5062: case '0':
5063: case '1':
5064: case '2':
5065: case '3':
5066: case '4':
5067: case '5':
5068: case '6':
5069: case '7':
5070: case '8':
5071: case '9':
5072: case 'A':
5073: case 'B':
5074: case 'C':
5075: case 'D':
5076: case 'E':
5077: case 'F':
5078: case 'a':
5079: case 'b':
5080: case 'c':
5081: case 'd':
5082: case 'e':
5083: case 'f': {
5084: yyValue = null;
5085:
5086: return new SemanticValue(
5087: yyValue, yyIndex,
5088: yyError);
5089: }
5090:
5091: default:
5092: /* No match. */
5093: }
5094: }
5095: }
5096: break;
5097:
5098: default:
5099: /* No match. */
5100: }
5101: }
5102: }
5103: break;
5104:
5105: default:
5106: /* No match. */
5107: }
5108: }
5109: }
5110: break;
5111:
5112: default:
5113: /* No match. */
5114: }
5115: }
5116:
5117: // Done.
5118: yyError = yyError.select("hex quad expected", yyStart);
5119: return yyError;
5120: }
5121:
5122: // =========================================================================
5123:
5124: /**
5125: * Parse nonterminal xtc.parser.PGrammar.Symbol.
5126: *
5127: * @param yyStart The index.
5128: * @return The result.
5129: * @throws IOException Signals an I/O error.
5130: */
5131: private Result pSymbol(final int yyStart) throws IOException {
5132: PParserColumn yyColumn = (PParserColumn) column(yyStart);
5133: if (null == yyColumn.chunk4)
5134: yyColumn.chunk4 = new Chunk4();
5135: if (null == yyColumn.chunk4.fSymbol)
5136: yyColumn.chunk4.fSymbol = pSymbol$1(yyStart);
5137: return yyColumn.chunk4.fSymbol;
5138: }
5139:
5140: /** Actually parse xtc.parser.PGrammar.Symbol. */
5141: private Result pSymbol$1(final int yyStart) throws IOException {
5142: Result yyResult;
5143: String yyValue;
5144: ParseError yyError = ParseError.DUMMY;
5145:
5146: // Alternative 1.
5147:
5148: yyResult = pSymbolCharacters(yyStart);
5149: yyError = yyResult.select(yyError);
5150: if (yyResult.hasValue()) {
5151: yyValue = yyResult.semanticValue();
5152:
5153: yyResult = pSpacing(yyResult.index);
5154: yyError = yyResult.select(yyError);
5155: if (yyResult.hasValue()) {
5156:
5157: return yyResult.createValue(yyValue, yyError);
5158: }
5159: }
5160:
5161: // Done.
5162: return yyError;
5163: }
5164:
5165: // =========================================================================
5166:
5167: /**
5168: * Parse nonterminal xtc.parser.PGrammar.SymbolCharacters.
5169: *
5170: * @param yyStart The index.
5171: * @return The result.
5172: * @throws IOException Signals an I/O error.
5173: */
5174: private Result pSymbolCharacters(final int yyStart)
5175: throws IOException {
5176: int yyC;
5177: int yyIndex;
5178: boolean yyPredMatched;
5179: String yyValue;
5180: ParseError yyError = ParseError.DUMMY;
5181:
5182: // Alternative 1.
5183:
5184: yyC = character(yyStart);
5185: if (-1 != yyC) {
5186: yyIndex = yyStart + 1;
5187:
5188: switch (yyC) {
5189: case '.': {
5190: yyC = character(yyIndex);
5191: if (-1 != yyC) {
5192: yyIndex = yyIndex + 1;
5193: if ('.' == yyC) {
5194:
5195: yyC = character(yyIndex);
5196: if (-1 != yyC) {
5197: yyIndex = yyIndex + 1;
5198: if ('.' == yyC) {
5199:
5200: yyValue = "...";
5201:
5202: return new SemanticValue(yyValue,
5203: yyIndex, yyError);
5204: }
5205: }
5206: }
5207: }
5208: }
5209: break;
5210:
5211: case '+': {
5212: final int yyChoice1 = yyIndex;
5213:
5214: // Nested alternative 1.
5215:
5216: yyC = character(yyChoice1);
5217: if (-1 != yyC) {
5218: yyIndex = yyChoice1 + 1;
5219: if ('=' == yyC) {
5220:
5221: yyValue = "+=";
5222:
5223: return new SemanticValue(yyValue, yyIndex,
5224: yyError);
5225: }
5226: }
5227:
5228: // Nested alternative 2.
5229:
5230: yyValue = "+";
5231:
5232: return new SemanticValue(yyValue, yyChoice1, yyError);
5233: }
5234:
5235: case '-': {
5236: yyC = character(yyIndex);
5237: if (-1 != yyC) {
5238: yyIndex = yyIndex + 1;
5239: if ('=' == yyC) {
5240:
5241: yyValue = "-=";
5242:
5243: return new SemanticValue(yyValue, yyIndex,
5244: yyError);
5245: }
5246: }
5247: }
5248: break;
5249:
5250: case ':': {
5251: final int yyChoice1 = yyIndex;
5252:
5253: // Nested alternative 1.
5254:
5255: yyC = character(yyChoice1);
5256: if (-1 != yyC) {
5257: yyIndex = yyChoice1 + 1;
5258: if ('=' == yyC) {
5259:
5260: yyValue = ":=";
5261:
5262: return new SemanticValue(yyValue, yyIndex,
5263: yyError);
5264: }
5265: }
5266:
5267: // Nested alternative 2.
5268:
5269: yyValue = ":";
5270:
5271: return new SemanticValue(yyValue, yyChoice1, yyError);
5272: }
5273:
5274: case ',': {
5275: yyValue = ",";
5276:
5277: return new SemanticValue(yyValue, yyIndex, yyError);
5278: }
5279:
5280: case '=': {
5281: yyValue = "=";
5282:
5283: return new SemanticValue(yyValue, yyIndex, yyError);
5284: }
5285:
5286: case '/': {
5287: yyPredMatched = false;
5288:
5289: yyC = character(yyIndex);
5290: if (-1 != yyC) {
5291: if (('*' == yyC) || ('/' == yyC)) {
5292:
5293: yyPredMatched = true;
5294: }
5295: }
5296:
5297: if (!yyPredMatched) {
5298:
5299: yyValue = "/";
5300:
5301: return new SemanticValue(yyValue, yyIndex, yyError);
5302: } else {
5303: yyError = yyError.select(
5304: "symbol characters expected", yyStart);
5305: }
5306: }
5307: break;
5308:
5309: case '&': {
5310: yyValue = "&";
5311:
5312: return new SemanticValue(yyValue, yyIndex, yyError);
5313: }
5314:
5315: case '!': {
5316: yyValue = "!";
5317:
5318: return new SemanticValue(yyValue, yyIndex, yyError);
5319: }
5320:
5321: case '^': {
5322: yyValue = "^";
5323:
5324: return new SemanticValue(yyValue, yyIndex, yyError);
5325: }
5326:
5327: case '?': {
5328: yyValue = "?";
5329:
5330: return new SemanticValue(yyValue, yyIndex, yyError);
5331: }
5332:
5333: case '*': {
5334: yyValue = "*";
5335:
5336: return new SemanticValue(yyValue, yyIndex, yyError);
5337: }
5338:
5339: case '(': {
5340: yyValue = "(";
5341:
5342: return new SemanticValue(yyValue, yyIndex, yyError);
5343: }
5344:
5345: case ')': {
5346: yyValue = ")";
5347:
5348: return new SemanticValue(yyValue, yyIndex, yyError);
5349: }
5350:
5351: case ';': {
5352: yyValue = ";";
5353:
5354: return new SemanticValue(yyValue, yyIndex, yyError);
5355: }
5356:
5357: case '<': {
5358: yyValue = "<";
5359:
5360: return new SemanticValue(yyValue, yyIndex, yyError);
5361: }
5362:
5363: case '>': {
5364: yyValue = ">";
5365:
5366: return new SemanticValue(yyValue, yyIndex, yyError);
5367: }
5368:
5369: default:
5370: /* No match. */
5371: }
5372: }
5373:
5374: // Done.
5375: yyError = yyError.select("symbol characters expected", yyStart);
5376: return yyError;
5377: }
5378:
5379: // =========================================================================
5380:
5381: /**
5382: * Parse nonterminal xtc.parser.PGrammar.Spacing.
5383: *
5384: * @param yyStart The index.
5385: * @return The result.
5386: * @throws IOException Signals an I/O error.
5387: */
5388: private Result pSpacing(final int yyStart) throws IOException {
5389: int yyC;
5390: int yyIndex;
5391: Result yyResult;
5392: boolean yyPredMatched;
5393: int yyBase;
5394: int yyRepetition1;
5395: int yyRepetition2;
5396: Void yyValue;
5397: ParseError yyError = ParseError.DUMMY;
5398:
5399: // Alternative 1.
5400:
5401: yyRepetition1 = yyStart;
5402: while (true) {
5403:
5404: final int yyChoice1 = yyRepetition1;
5405:
5406: // Nested alternative 1.
5407:
5408: yyC = character(yyChoice1);
5409: if (-1 != yyC) {
5410: yyIndex = yyChoice1 + 1;
5411:
5412: switch (yyC) {
5413: case ' ': {
5414: yyRepetition1 = yyIndex;
5415: continue;
5416: }
5417:
5418: case '\t': {
5419: yyRepetition1 = yyIndex;
5420: continue;
5421: }
5422:
5423: case '\f': {
5424: yyRepetition1 = yyIndex;
5425: continue;
5426: }
5427:
5428: case '\r': {
5429: final int yyChoice2 = yyIndex;
5430:
5431: // Nested alternative 1.
5432:
5433: yyC = character(yyChoice2);
5434: if ('\n' == yyC) {
5435: yyIndex = yyChoice2 + 1;
5436:
5437: yyState.newline();
5438:
5439: yyRepetition1 = yyIndex;
5440: continue;
5441: }
5442:
5443: // Nested alternative 2.
5444:
5445: yyState.newline();
5446:
5447: yyRepetition1 = yyChoice2;
5448: continue;
5449: }
5450:
5451: case '\n': {
5452: yyState.newline();
5453:
5454: yyRepetition1 = yyIndex;
5455: continue;
5456: }
5457:
5458: case '/': {
5459: yyC = character(yyIndex);
5460: if (-1 != yyC) {
5461: yyIndex = yyIndex + 1;
5462:
5463: switch (yyC) {
5464: case '*': {
5465: yyPredMatched = false;
5466:
5467: yyC = character(yyIndex);
5468: if ('*' == yyC) {
5469:
5470: yyPredMatched = true;
5471: }
5472:
5473: if (!yyPredMatched) {
5474:
5475: yyResult = pCommentBody(yyIndex);
5476: yyError = yyResult.select(yyError);
5477: if (yyResult.hasValue()) {
5478:
5479: yyBase = yyResult.index;
5480: yyC = character(yyBase);
5481: if ('*' == yyC) {
5482: yyIndex = yyResult.index + 1;
5483:
5484: yyC = character(yyIndex);
5485: if ('/' == yyC) {
5486: yyIndex = yyIndex + 1;
5487:
5488: yyRepetition1 = yyIndex;
5489: continue;
5490: } else {
5491: yyError = yyError.select(
5492: "\"*/\" expected",
5493: yyBase);
5494: }
5495: } else {
5496: yyError = yyError.select(
5497: "\"*/\" expected",
5498: yyBase);
5499: }
5500: }
5501: } else {
5502: yyError = yyError.select(
5503: "spacing expected", yyStart);
5504: }
5505: }
5506: break;
5507:
5508: case '/': {
5509: yyRepetition2 = yyIndex;
5510: while (true) {
5511:
5512: yyC = character(yyRepetition2);
5513: if (-1 != yyC) {
5514: yyIndex = yyRepetition2 + 1;
5515:
5516: switch (yyC) {
5517: case '\n':
5518: case '\r':
5519: /* No match. */
5520: break;
5521:
5522: default: {
5523: yyRepetition2 = yyIndex;
5524: continue;
5525: }
5526: }
5527: }
5528: break;
5529: }
5530:
5531: yyResult = pLineTerminator(yyRepetition2);
5532: yyError = yyResult.select(yyError);
5533: if (yyResult.hasValue()) {
5534:
5535: yyRepetition1 = yyResult.index;
5536: continue;
5537: }
5538: }
5539: break;
5540:
5541: default:
5542: /* No match. */
5543: }
5544: }
5545: }
5546: break;
5547:
5548: default:
5549: /* No match. */
5550: }
5551: }
5552: break;
5553: }
5554:
5555: yyValue = null;
5556:
5557: return new SemanticValue(yyValue, yyRepetition1, yyError);
5558: }
5559:
5560: // =========================================================================
5561:
5562: /**
5563: * Parse nonterminal xtc.parser.PGrammar.SimpleSpacing.
5564: *
5565: * @param yyStart The index.
5566: * @return The result.
5567: * @throws IOException Signals an I/O error.
5568: */
5569: private Result pSimpleSpacing(final int yyStart) throws IOException {
5570: int yyC;
5571: int yyIndex;
5572: int yyRepetition1;
5573: Void yyValue;
5574: ParseError yyError = ParseError.DUMMY;
5575:
5576: // Alternative 1.
5577:
5578: yyRepetition1 = yyStart;
5579: while (true) {
5580:
5581: final int yyChoice1 = yyRepetition1;
5582:
5583: // Nested alternative 1.
5584:
5585: yyC = character(yyChoice1);
5586: if (-1 != yyC) {
5587: yyIndex = yyChoice1 + 1;
5588:
5589: switch (yyC) {
5590: case '\r': {
5591: final int yyChoice2 = yyIndex;
5592:
5593: // Nested alternative 1.
5594:
5595: yyC = character(yyChoice2);
5596: if ('\n' == yyC) {
5597: yyIndex = yyChoice2 + 1;
5598:
5599: yyState.newline();
5600:
5601: yyRepetition1 = yyIndex;
5602: continue;
5603: }
5604:
5605: // Nested alternative 2.
5606:
5607: yyState.newline();
5608:
5609: yyRepetition1 = yyChoice2;
5610: continue;
5611: }
5612:
5613: case '\n': {
5614: yyState.newline();
5615:
5616: yyRepetition1 = yyIndex;
5617: continue;
5618: }
5619:
5620: case ' ': {
5621: yyRepetition1 = yyIndex;
5622: continue;
5623: }
5624:
5625: case '\t': {
5626: yyRepetition1 = yyIndex;
5627: continue;
5628: }
5629:
5630: case '\f': {
5631: yyRepetition1 = yyIndex;
5632: continue;
5633: }
5634:
5635: default:
5636: /* No match. */
5637: }
5638: }
5639: break;
5640: }
5641:
5642: yyValue = null;
5643:
5644: return new SemanticValue(yyValue, yyRepetition1, yyError);
5645: }
5646:
5647: // =========================================================================
5648:
5649: /**
5650: * Parse nonterminal xtc.parser.PGrammar.CodeComment.
5651: *
5652: * @param yyStart The index.
5653: * @return The result.
5654: * @throws IOException Signals an I/O error.
5655: */
5656: private Result pCodeComment(final int yyStart) throws IOException {
5657: int yyC;
5658: int yyIndex;
5659: Result yyResult;
5660: int yyBase;
5661: String yyValue;
5662: ParseError yyError = ParseError.DUMMY;
5663:
5664: // Alternative 1.
5665:
5666: yyC = character(yyStart);
5667: if ('/' == yyC) {
5668: yyIndex = yyStart + 1;
5669:
5670: yyC = character(yyIndex);
5671: if ('*' == yyC) {
5672: yyIndex = yyIndex + 1;
5673:
5674: yyC = character(yyIndex);
5675: if ('*' == yyC) {
5676: yyIndex = yyIndex + 1;
5677:
5678: yyResult = pCommentBody(yyIndex);
5679: yyError = yyResult.select(yyError);
5680: if (yyResult.hasValue()) {
5681:
5682: yyBase = yyResult.index;
5683: yyC = character(yyBase);
5684: if ('*' == yyC) {
5685: yyIndex = yyResult.index + 1;
5686:
5687: yyC = character(yyIndex);
5688: if ('/' == yyC) {
5689: yyIndex = yyIndex + 1;
5690:
5691: yyValue = difference(yyStart, yyIndex);
5692:
5693: return new SemanticValue(yyValue,
5694: yyIndex, yyError);
5695: } else {
5696: yyError = yyError.select(
5697: "\"*/\" expected", yyBase);
5698: }
5699: } else {
5700: yyError = yyError.select("\"*/\" expected",
5701: yyBase);
5702: }
5703: }
5704: }
5705: }
5706: }
5707:
5708: // Done.
5709: yyError = yyError.select("code comment expected", yyStart);
5710: return yyError;
5711: }
5712:
5713: // =========================================================================
5714:
5715: /**
5716: * Parse nonterminal xtc.parser.PGrammar.TraditionalComment.
5717: *
5718: * @param yyStart The index.
5719: * @return The result.
5720: * @throws IOException Signals an I/O error.
5721: */
5722: private Result pTraditionalComment(final int yyStart)
5723: throws IOException {
5724: int yyC;
5725: int yyIndex;
5726: Result yyResult;
5727: boolean yyPredMatched;
5728: int yyBase;
5729: Void yyValue;
5730: ParseError yyError = ParseError.DUMMY;
5731:
5732: // Alternative 1.
5733:
5734: yyC = character(yyStart);
5735: if ('/' == yyC) {
5736: yyIndex = yyStart + 1;
5737:
5738: yyC = character(yyIndex);
5739: if ('*' == yyC) {
5740: yyIndex = yyIndex + 1;
5741:
5742: yyPredMatched = false;
5743:
5744: yyC = character(yyIndex);
5745: if ('*' == yyC) {
5746:
5747: yyPredMatched = true;
5748: }
5749:
5750: if (!yyPredMatched) {
5751:
5752: yyResult = pCommentBody(yyIndex);
5753: yyError = yyResult.select(yyError);
5754: if (yyResult.hasValue()) {
5755:
5756: yyBase = yyResult.index;
5757: yyC = character(yyBase);
5758: if ('*' == yyC) {
5759: yyIndex = yyResult.index + 1;
5760:
5761: yyC = character(yyIndex);
5762: if ('/' == yyC) {
5763: yyIndex = yyIndex + 1;
5764:
5765: yyValue = null;
5766:
5767: return new SemanticValue(yyValue,
5768: yyIndex, yyError);
5769: } else {
5770: yyError = yyError.select(
5771: "\"*/\" expected", yyBase);
5772: }
5773: } else {
5774: yyError = yyError.select("\"*/\" expected",
5775: yyBase);
5776: }
5777: }
5778: } else {
5779: yyError = yyError.select(
5780: "traditional comment expected", yyStart);
5781: }
5782: }
5783: }
5784:
5785: // Done.
5786: yyError = yyError.select("traditional comment expected",
5787: yyStart);
5788: return yyError;
5789: }
5790:
5791: // =========================================================================
5792:
5793: /**
5794: * Parse nonterminal xtc.parser.PGrammar.EndOfFile.
5795: *
5796: * @param yyStart The index.
5797: * @return The result.
5798: * @throws IOException Signals an I/O error.
5799: */
5800: private Result pEndOfFile(final int yyStart) throws IOException {
5801: int yyC;
5802: boolean yyPredMatched;
5803: Void yyValue;
5804: ParseError yyError = ParseError.DUMMY;
5805:
5806: // Alternative 1.
5807:
5808: yyPredMatched = false;
5809:
5810: yyC = character(yyStart);
5811: if (-1 != yyC) {
5812:
5813: yyPredMatched = true;
5814: }
5815:
5816: if (!yyPredMatched) {
5817:
5818: yyValue = null;
5819:
5820: return new SemanticValue(yyValue, yyStart, yyError);
5821: } else {
5822: yyError = yyError.select("end of file expected", yyStart);
5823: }
5824:
5825: // Done.
5826: return yyError;
5827: }
5828:
5829: // =========================================================================
5830:
5831: /**
5832: * Parse nonterminal xtc.parser.PGrammar.CommentBody.
5833: *
5834: * @param yyStart The index.
5835: * @return The result.
5836: * @throws IOException Signals an I/O error.
5837: */
5838: private Result pCommentBody(final int yyStart) throws IOException {
5839: int yyC;
5840: int yyIndex;
5841: boolean yyPredMatched;
5842: int yyRepetition1;
5843: Void yyValue;
5844: ParseError yyError = ParseError.DUMMY;
5845:
5846: // Alternative 1.
5847:
5848: yyRepetition1 = yyStart;
5849: while (true) {
5850:
5851: final int yyChoice1 = yyRepetition1;
5852:
5853: // Nested alternative 1.
5854:
5855: yyC = character(yyChoice1);
5856: if (-1 != yyC) {
5857: yyIndex = yyChoice1 + 1;
5858:
5859: switch (yyC) {
5860: case '*': {
5861: yyPredMatched = false;
5862:
5863: yyC = character(yyIndex);
5864: if ('/' == yyC) {
5865:
5866: yyPredMatched = true;
5867: }
5868:
5869: if (!yyPredMatched) {
5870:
5871: yyRepetition1 = yyIndex;
5872: continue;
5873: } else {
5874: yyError = yyError.select(
5875: "comment body expected", yyStart);
5876: }
5877: }
5878: break;
5879:
5880: case '\r': {
5881: final int yyChoice2 = yyIndex;
5882:
5883: // Nested alternative 1.
5884:
5885: yyC = character(yyChoice2);
5886: if ('\n' == yyC) {
5887: yyIndex = yyChoice2 + 1;
5888:
5889: yyState.newline();
5890:
5891: yyRepetition1 = yyIndex;
5892: continue;
5893: }
5894:
5895: // Nested alternative 2.
5896:
5897: yyState.newline();
5898:
5899: yyRepetition1 = yyChoice2;
5900: continue;
5901: }
5902:
5903: case '\n': {
5904: yyState.newline();
5905:
5906: yyRepetition1 = yyIndex;
5907: continue;
5908: }
5909:
5910: default:
5911: /* No match. */
5912: }
5913: }
5914:
5915: // Nested alternative 2.
5916:
5917: yyC = character(yyChoice1);
5918: if (-1 != yyC) {
5919: yyIndex = yyChoice1 + 1;
5920:
5921: switch (yyC) {
5922: case '\n':
5923: case '\r':
5924: case '*':
5925: /* No match. */
5926: break;
5927:
5928: default: {
5929: yyRepetition1 = yyIndex;
5930: continue;
5931: }
5932: }
5933: }
5934: break;
5935: }
5936:
5937: yyValue = null;
5938:
5939: return new SemanticValue(yyValue, yyRepetition1, yyError);
5940: }
5941:
5942: // =========================================================================
5943:
5944: /**
5945: * Parse nonterminal xtc.parser.PGrammar.LineTerminator.
5946: *
5947: * @param yyStart The index.
5948: * @return The result.
5949: * @throws IOException Signals an I/O error.
5950: */
5951: private Result pLineTerminator(final int yyStart)
5952: throws IOException {
5953: int yyC;
5954: int yyIndex;
5955: Void yyValue;
5956: ParseError yyError = ParseError.DUMMY;
5957:
5958: // Alternative 1.
5959:
5960: yyC = character(yyStart);
5961: if (-1 != yyC) {
5962: yyIndex = yyStart + 1;
5963:
5964: switch (yyC) {
5965: case '\r': {
5966: final int yyChoice1 = yyIndex;
5967:
5968: // Nested alternative 1.
5969:
5970: yyC = character(yyChoice1);
5971: if ('\n' == yyC) {
5972: yyIndex = yyChoice1 + 1;
5973:
5974: yyState.newline();
5975:
5976: yyValue = null;
5977:
5978: return new SemanticValue(yyValue, yyIndex, yyError);
5979: }
5980:
5981: // Nested alternative 2.
5982:
5983: yyState.newline();
5984:
5985: yyValue = null;
5986:
5987: return new SemanticValue(yyValue, yyChoice1, yyError);
5988: }
5989:
5990: case '\n': {
5991: yyState.newline();
5992:
5993: yyValue = null;
5994:
5995: return new SemanticValue(yyValue, yyIndex, yyError);
5996: }
5997:
5998: default:
5999: /* No match. */
6000: }
6001: }
6002:
6003: // Done.
6004: yyError = yyError.select("line terminator expected", yyStart);
6005: return yyError;
6006: }
6007:
6008: }
|