0001: // ===========================================================================
0002: // This file has been generated by
0003: // Rats! Parser Generator, version 1.13.1,
0004: // (C) 2004-2007 Robert Grimm,
0005: // on Monday, October 15, 2007 at 8:27:57 PM.
0006: // Edit at your own risk.
0007: // ===========================================================================
0008:
0009: package xtc.typical;
0010:
0011: import java.io.Reader;
0012: import java.io.IOException;
0013:
0014: import java.util.HashSet;
0015: import java.util.Set;
0016:
0017: import xtc.util.Action;
0018: import xtc.util.Pair;
0019:
0020: import xtc.tree.Node;
0021: import xtc.tree.GNode;
0022:
0023: import xtc.parser.ParserBase;
0024: import xtc.parser.Column;
0025: import xtc.parser.Result;
0026: import xtc.parser.SemanticValue;
0027: import xtc.parser.ParseError;
0028:
0029: /**
0030: * Packrat parser for grammar <code>xtc.typical.Typical</code>.
0031: *
0032: * <p />This class has been generated by the <i>Rats!</i> parser
0033: * generator, version 1.13.1, (C) 2004-2007 Robert Grimm.
0034: */
0035: public final class TypicalParser extends ParserBase {
0036:
0037: /** The TYPICAL_KEYWORDS set. */
0038: public static final Set<String> TYPICAL_KEYWORDS = new HashSet<String>();
0039:
0040: // =========================================================================
0041:
0042: /** Chunk 1 of memoized results. */
0043: static final class Chunk1 {
0044: Result fNameSpaceStructure;
0045: Result fEqualStructure;
0046: Result fEqualStructure$$Star1;
0047: Result fPatternMatching;
0048: Result fPatternMatching$$Star1;
0049: Result fPatternMatch;
0050: Result fPatterns;
0051: Result fPatterns$$Star1;
0052: Result fPattern;
0053: Result fWhenPattern;
0054: }
0055:
0056: /** Chunk 2 of memoized results. */
0057: static final class Chunk2 {
0058: Result fConsPattern;
0059: Result fAtomicPattern;
0060: Result fVariable;
0061: Result fFieldPattern;
0062: Result fExpression;
0063: Result fLogicalOrExpression;
0064: Result fConsExpression;
0065: Result fFunctionApplication;
0066: Result fArguments;
0067: Result fArguments$$Plus1;
0068: }
0069:
0070: /** Chunk 3 of memoized results. */
0071: static final class Chunk3 {
0072: Result fFieldExpression;
0073: Result fPrimaryExpression;
0074: Result fLetBinding;
0075: Result fRequireArgs;
0076: Result fMessageTag;
0077: Result fErrorClause;
0078: Result fFieldAssignment;
0079: Result fLiteral;
0080: Result fLowerID;
0081: Result fUpperID;
0082: }
0083:
0084: /** Chunk 4 of memoized results. */
0085: static final class Chunk4 {
0086: Result fAliasedType;
0087: Result fFunctionType;
0088: Result fTupleType;
0089: Result fTupleType$$Plus1;
0090: Result fConstructedType;
0091: Result fTypeConstructor;
0092: Result fFieldType;
0093: Result fPolyTypeConstructor;
0094: Result fExponent;
0095: Result fExponent$$Plus1;
0096: }
0097:
0098: /** Chunk 5 of memoized results. */
0099: static final class Chunk5 {
0100: Result fLowerIdentifier;
0101: Result fUpperIdentifier;
0102: Result fIdentifier;
0103: Result fWord;
0104: Result fWord$$Star1;
0105: Result fKeyword;
0106: Result fSymbol;
0107: }
0108:
0109: // =========================================================================
0110:
0111: /** Memoization table column. */
0112: static final class TypicalParserColumn extends Column {
0113: Chunk1 chunk1;
0114: Chunk2 chunk2;
0115: Chunk3 chunk3;
0116: Chunk4 chunk4;
0117: Chunk5 chunk5;
0118: }
0119:
0120: // =========================================================================
0121:
0122: /**
0123: * Create a new packrat parser.
0124: *
0125: * @param reader The reader.
0126: * @param file The file name.
0127: */
0128: public TypicalParser(final Reader reader, final String file) {
0129: super (reader, file);
0130: }
0131:
0132: /**
0133: * Create a new packrat parser.
0134: *
0135: * @param reader The file reader.
0136: * @param file The file name.
0137: * @param size The file size.
0138: */
0139: public TypicalParser(final Reader reader, final String file,
0140: final int size) {
0141: super (reader, file, size);
0142: }
0143:
0144: // =========================================================================
0145:
0146: protected Column newColumn() {
0147: return new TypicalParserColumn();
0148: }
0149:
0150: // =========================================================================
0151:
0152: /**
0153: * Parse nonterminal xtc.typical.Typical.Module.
0154: *
0155: * @param yyStart The index.
0156: * @return The result.
0157: * @throws IOException Signals an I/O error.
0158: */
0159: public Result pModule(final int yyStart) throws IOException {
0160: Result yyResult;
0161: int yyBase;
0162: int yyRepetition1;
0163: Pair<Node> yyRepValue1;
0164: Node yyValue;
0165: ParseError yyError = ParseError.DUMMY;
0166:
0167: // Alternative 1.
0168:
0169: yyResult = pSpacing(yyStart);
0170: yyError = yyResult.select(yyError);
0171: if (yyResult.hasValue()) {
0172:
0173: yyResult = pModuleDeclaration(yyResult.index);
0174: yyError = yyResult.select(yyError);
0175: if (yyResult.hasValue()) {
0176: final Node v$g$1 = yyResult.semanticValue();
0177:
0178: yyRepetition1 = yyResult.index;
0179: yyRepValue1 = Pair.empty();
0180: while (true) {
0181:
0182: yyResult = pDefinition(yyRepetition1);
0183: yyError = yyResult.select(yyError);
0184: if (yyResult.hasValue()) {
0185: final Node v$el$1 = yyResult.semanticValue();
0186:
0187: yyBase = yyResult.index;
0188: yyResult = pSymbol(yyBase);
0189: yyError = yyResult.select(yyError);
0190: if (yyResult.hasValue(";")) {
0191:
0192: yyRepetition1 = yyResult.index;
0193: yyRepValue1 = new Pair<Node>(v$el$1,
0194: yyRepValue1);
0195: continue;
0196: } else {
0197: yyError = yyError.select("\";\" expected",
0198: yyBase);
0199: }
0200: }
0201: break;
0202: }
0203: { // Start scope for v$g$2.
0204: final Pair<Node> v$g$2 = yyRepValue1.reverse();
0205:
0206: yyResult = pEndOfFile(yyRepetition1);
0207: yyError = yyResult.select(yyError);
0208: if (yyResult.hasValue()) {
0209:
0210: yyValue = GNode.createFromPair("Module", v$g$1,
0211: v$g$2);
0212: yyValue.setLocation(location(yyStart));
0213:
0214: return yyResult.createValue(yyValue, yyError);
0215: }
0216: } // End scope for v$g$2.
0217: }
0218: }
0219:
0220: // Done.
0221: return yyError;
0222: }
0223:
0224: // =========================================================================
0225:
0226: /**
0227: * Parse nonterminal xtc.typical.Typical.Definition.
0228: *
0229: * @param yyStart The index.
0230: * @return The result.
0231: * @throws IOException Signals an I/O error.
0232: */
0233: private Result pDefinition(final int yyStart) throws IOException {
0234: Result yyResult;
0235: int yyBase;
0236: int yyRepetition1;
0237: Pair<Node> yyRepValue1;
0238: int yyOption1;
0239: Node yyOpValue1;
0240: Node yyValue;
0241: ParseError yyError = ParseError.DUMMY;
0242:
0243: // Alternative 1.
0244:
0245: yyResult = pKeyword(yyStart);
0246: yyError = yyResult.select(yyError);
0247: if (yyResult.hasValue("scope")) {
0248:
0249: yyResult = pPatternMatching(yyResult.index);
0250: yyError = yyResult.select(yyError);
0251: if (yyResult.hasValue()) {
0252: final Node v$g$1 = yyResult.semanticValue();
0253:
0254: yyValue = GNode.create("ScopeDefinition", v$g$1);
0255: yyValue.setLocation(location(yyStart));
0256:
0257: return yyResult.createValue(yyValue, yyError);
0258: }
0259: }
0260:
0261: // Alternative 2.
0262:
0263: yyResult = pNameSpaceDefinition(yyStart);
0264: yyError = yyResult.select(yyError);
0265: if (yyResult.hasValue()) {
0266: yyValue = yyResult.semanticValue();
0267:
0268: return yyResult.createValue(yyValue, yyError);
0269: }
0270:
0271: // Alternative 3.
0272:
0273: yyResult = pKeyword(yyStart);
0274: yyError = yyResult.select(yyError);
0275: if (yyResult.hasValue("attribute")) {
0276:
0277: yyResult = pLowerIdentifier(yyResult.index);
0278: yyError = yyResult.select(yyError);
0279: if (yyResult.hasValue()) {
0280: final String v$g$1 = yyResult.semanticValue();
0281:
0282: yyBase = yyResult.index;
0283: yyResult = pSymbol(yyBase);
0284: yyError = yyResult.select(yyError);
0285: if (yyResult.hasValue(":")) {
0286:
0287: yyResult = pAliasedType(yyResult.index);
0288: yyError = yyResult.select(yyError);
0289: if (yyResult.hasValue()) {
0290: final Node v$g$2 = yyResult.semanticValue();
0291:
0292: yyValue = GNode.create("AttributeDefinition",
0293: v$g$1, v$g$2);
0294: yyValue.setLocation(location(yyStart));
0295:
0296: return yyResult.createValue(yyValue, yyError);
0297: }
0298: } else {
0299: yyError = yyError.select("\":\" expected", yyBase);
0300: }
0301: }
0302: }
0303:
0304: // Alternative 4.
0305:
0306: yyResult = pKeyword(yyStart);
0307: yyError = yyResult.select(yyError);
0308: if (yyResult.hasValue("eqattribute")) {
0309:
0310: yyResult = pLowerIdentifier(yyResult.index);
0311: yyError = yyResult.select(yyError);
0312: if (yyResult.hasValue()) {
0313: final String v$g$1 = yyResult.semanticValue();
0314:
0315: yyBase = yyResult.index;
0316: yyResult = pSymbol(yyBase);
0317: yyError = yyResult.select(yyError);
0318: if (yyResult.hasValue(":")) {
0319:
0320: yyResult = pAliasedType(yyResult.index);
0321: yyError = yyResult.select(yyError);
0322: if (yyResult.hasValue()) {
0323: final Node v$g$2 = yyResult.semanticValue();
0324:
0325: yyValue = GNode.create(
0326: "EqualAttributeDefinition", v$g$1,
0327: v$g$2);
0328: yyValue.setLocation(location(yyStart));
0329:
0330: return yyResult.createValue(yyValue, yyError);
0331: }
0332: } else {
0333: yyError = yyError.select("\":\" expected", yyBase);
0334: }
0335: }
0336: }
0337:
0338: // Alternative 5.
0339:
0340: yyResult = pKeyword(yyStart);
0341: yyError = yyResult.select(yyError);
0342: if (yyResult.hasValue("equality")) {
0343:
0344: yyResult = pLowerIdentifier(yyResult.index);
0345: yyError = yyResult.select(yyError);
0346: if (yyResult.hasValue()) {
0347: final String v$g$1 = yyResult.semanticValue();
0348:
0349: yyBase = yyResult.index;
0350: yyResult = pSymbol(yyBase);
0351: yyError = yyResult.select(yyError);
0352: if (yyResult.hasValue("=")) {
0353:
0354: yyResult = pEqualStructure(yyResult.index);
0355: yyError = yyResult.select(yyError);
0356: if (yyResult.hasValue()) {
0357: final Node v$g$2 = yyResult.semanticValue();
0358:
0359: yyRepetition1 = yyResult.index;
0360: yyRepValue1 = Pair.empty();
0361: while (true) {
0362:
0363: yyBase = yyRepetition1;
0364: yyResult = pSymbol(yyBase);
0365: yyError = yyResult.select(yyError);
0366: if (yyResult.hasValue("|")) {
0367:
0368: yyResult = pEqualStructure(yyResult.index);
0369: yyError = yyResult.select(yyError);
0370: if (yyResult.hasValue()) {
0371: final Node v$el$1 = yyResult
0372: .semanticValue();
0373:
0374: yyRepetition1 = yyResult.index;
0375: yyRepValue1 = new Pair<Node>(
0376: v$el$1, yyRepValue1);
0377: continue;
0378: }
0379: } else {
0380: yyError = yyError.select(
0381: "\"|\" expected", yyBase);
0382: }
0383: break;
0384: }
0385: { // Start scope for v$g$3.
0386: final Pair<Node> v$g$3 = yyRepValue1
0387: .reverse();
0388:
0389: yyValue = GNode.create(
0390: "EqualityDefinition",
0391: v$g$3.size() + 2).add(v$g$1).add(
0392: v$g$2).addAll(v$g$3);
0393: yyValue.setLocation(location(yyStart));
0394:
0395: return new SemanticValue(yyValue,
0396: yyRepetition1, yyError);
0397: } // End scope for v$g$3.
0398: }
0399: } else {
0400: yyError = yyError.select("\"=\" expected", yyBase);
0401: }
0402: }
0403: }
0404:
0405: // Alternative 6.
0406:
0407: yyResult = pKeyword(yyStart);
0408: yyError = yyResult.select(yyError);
0409: if (yyResult.hasValue("mltype")) {
0410:
0411: yyOption1 = yyResult.index;
0412: yyOpValue1 = null;
0413:
0414: yyResult = pTypeParameters(yyOption1);
0415: yyError = yyResult.select(yyError);
0416: if (yyResult.hasValue()) {
0417: final Node v$el$1 = yyResult.semanticValue();
0418:
0419: yyOption1 = yyResult.index;
0420: yyOpValue1 = v$el$1;
0421: }
0422: { // Start scope for v$g$1.
0423: final Node v$g$1 = yyOpValue1;
0424:
0425: yyResult = pLowerIdentifier(yyOption1);
0426: yyError = yyResult.select(yyError);
0427: if (yyResult.hasValue()) {
0428: final String v$g$2 = yyResult.semanticValue();
0429:
0430: yyBase = yyResult.index;
0431: yyResult = pSymbol(yyBase);
0432: yyError = yyResult.select(yyError);
0433: if (yyResult.hasValue("=")) {
0434:
0435: yyResult = pTypeInformation(yyResult.index);
0436: yyError = yyResult.select(yyError);
0437: if (yyResult.hasValue()) {
0438: final Node v$g$3 = yyResult.semanticValue();
0439:
0440: yyValue = GNode.create("TypeDefinition",
0441: v$g$1, v$g$2, v$g$3);
0442: yyValue.setLocation(location(yyStart));
0443:
0444: return yyResult.createValue(yyValue,
0445: yyError);
0446: }
0447: } else {
0448: yyError = yyError.select("\"=\" expected",
0449: yyBase);
0450: }
0451: }
0452: } // End scope for v$g$1.
0453: }
0454:
0455: // Alternative 7.
0456:
0457: yyResult = pKeyword(yyStart);
0458: yyError = yyResult.select(yyError);
0459: if (yyResult.hasValue("mlvalue")) {
0460:
0461: yyResult = pLowerIdentifier(yyResult.index);
0462: yyError = yyResult.select(yyError);
0463: if (yyResult.hasValue()) {
0464: final String v$g$1 = yyResult.semanticValue();
0465:
0466: yyResult = pParameters(yyResult.index);
0467: yyError = yyResult.select(yyError);
0468: if (yyResult.hasValue()) {
0469: final Node v$g$2 = yyResult.semanticValue();
0470:
0471: yyBase = yyResult.index;
0472: yyResult = pSymbol(yyBase);
0473: yyError = yyResult.select(yyError);
0474: if (yyResult.hasValue("=")) {
0475:
0476: yyResult = pExpression(yyResult.index);
0477: yyError = yyResult.select(yyError);
0478: if (yyResult.hasValue()) {
0479: final Node v$g$3 = yyResult.semanticValue();
0480:
0481: yyValue = GNode.create("ValueDefinition",
0482: v$g$1, v$g$2, v$g$3);
0483: yyValue.setLocation(location(yyStart));
0484:
0485: return yyResult.createValue(yyValue,
0486: yyError);
0487: }
0488: } else {
0489: yyError = yyError.select("\"=\" expected",
0490: yyBase);
0491: }
0492: }
0493: }
0494: }
0495:
0496: // Done.
0497: yyError = yyError.select("definition expected", yyStart);
0498: return yyError;
0499: }
0500:
0501: // =========================================================================
0502:
0503: /**
0504: * Parse nonterminal xtc.typical.Typical.NameSpaceDefinition.
0505: *
0506: * @param yyStart The index.
0507: * @return The result.
0508: * @throws IOException Signals an I/O error.
0509: */
0510: private Result pNameSpaceDefinition(final int yyStart)
0511: throws IOException {
0512: Result yyResult;
0513: int yyBase;
0514: int yyRepetition1;
0515: Pair<Node> yyRepValue1;
0516: Node yyValue;
0517: ParseError yyError = ParseError.DUMMY;
0518:
0519: // Alternative 1.
0520:
0521: yyResult = pKeyword(yyStart);
0522: yyError = yyResult.select(yyError);
0523: if (yyResult.hasValue("namespace")) {
0524:
0525: yyResult = pNameSpaceStructure(yyResult.index);
0526: yyError = yyResult.select(yyError);
0527: if (yyResult.hasValue()) {
0528: final Node v$g$1 = yyResult.semanticValue();
0529:
0530: yyRepetition1 = yyResult.index;
0531: yyRepValue1 = Pair.empty();
0532: while (true) {
0533:
0534: yyBase = yyRepetition1;
0535: yyResult = pKeyword(yyBase);
0536: yyError = yyResult.select(yyError);
0537: if (yyResult.hasValue("and")) {
0538:
0539: yyResult = pNameSpaceStructure(yyResult.index);
0540: yyError = yyResult.select(yyError);
0541: if (yyResult.hasValue()) {
0542: final Node v$el$1 = yyResult
0543: .semanticValue();
0544:
0545: yyRepetition1 = yyResult.index;
0546: yyRepValue1 = new Pair<Node>(v$el$1,
0547: yyRepValue1);
0548: continue;
0549: }
0550: } else {
0551: yyError = yyError.select("\"and\" expected",
0552: yyBase);
0553: }
0554: break;
0555: }
0556: { // Start scope for v$g$2.
0557: final Pair<Node> v$g$2 = yyRepValue1.reverse();
0558:
0559: yyValue = GNode.createFromPair(
0560: "NameSpaceDefinition", v$g$1, v$g$2);
0561: yyValue.setLocation(location(yyStart));
0562:
0563: return new SemanticValue(yyValue, yyRepetition1,
0564: yyError);
0565: } // End scope for v$g$2.
0566: }
0567: }
0568:
0569: // Done.
0570: yyError = yyError.select("name space definition expected",
0571: yyStart);
0572: return yyError;
0573: }
0574:
0575: // =========================================================================
0576:
0577: /**
0578: * Parse nonterminal xtc.typical.Typical.ModuleDeclaration.
0579: *
0580: * @param yyStart The index.
0581: * @return The result.
0582: * @throws IOException Signals an I/O error.
0583: */
0584: private Result pModuleDeclaration(final int yyStart)
0585: throws IOException {
0586: Result yyResult;
0587: int yyBase;
0588: int yyRepetition1;
0589: Pair<String> yyRepValue1;
0590: Node yyValue;
0591: ParseError yyError = ParseError.DUMMY;
0592:
0593: // Alternative 1.
0594:
0595: yyResult = pKeyword(yyStart);
0596: yyError = yyResult.select(yyError);
0597: if (yyResult.hasValue("module")) {
0598:
0599: yyResult = pIdentifier(yyResult.index);
0600: yyError = yyResult.select(yyError);
0601: if (yyResult.hasValue()) {
0602: final String v$g$1 = yyResult.semanticValue();
0603:
0604: yyRepetition1 = yyResult.index;
0605: yyRepValue1 = Pair.empty();
0606: while (true) {
0607:
0608: yyBase = yyRepetition1;
0609: yyResult = pSymbol(yyBase);
0610: yyError = yyResult.select(yyError);
0611: if (yyResult.hasValue(".")) {
0612:
0613: yyResult = pIdentifier(yyResult.index);
0614: yyError = yyResult.select(yyError);
0615: if (yyResult.hasValue()) {
0616: final String v$el$1 = yyResult
0617: .semanticValue();
0618:
0619: yyRepetition1 = yyResult.index;
0620: yyRepValue1 = new Pair<String>(v$el$1,
0621: yyRepValue1);
0622: continue;
0623: }
0624: } else {
0625: yyError = yyError.select("\".\" expected",
0626: yyBase);
0627: }
0628: break;
0629: }
0630: { // Start scope for v$g$2.
0631: final Pair<String> v$g$2 = yyRepValue1.reverse();
0632:
0633: yyBase = yyRepetition1;
0634: yyResult = pSymbol(yyBase);
0635: yyError = yyResult.select(yyError);
0636: if (yyResult.hasValue(";")) {
0637:
0638: yyValue = GNode.createFromPair(
0639: "ModuleDeclaration", v$g$1, v$g$2);
0640: yyValue.setLocation(location(yyStart));
0641:
0642: return yyResult.createValue(yyValue, yyError);
0643: } else {
0644: yyError = yyError.select("\";\" expected",
0645: yyBase);
0646: }
0647: } // End scope for v$g$2.
0648: }
0649: }
0650:
0651: // Done.
0652: yyError = yyError
0653: .select("module declaration expected", yyStart);
0654: return yyError;
0655: }
0656:
0657: // =========================================================================
0658:
0659: /**
0660: * Parse nonterminal xtc.typical.Typical.NameSpaceStructure.
0661: *
0662: * @param yyStart The index.
0663: * @return The result.
0664: * @throws IOException Signals an I/O error.
0665: */
0666: private Result pNameSpaceStructure(final int yyStart)
0667: throws IOException {
0668: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
0669: if (null == yyColumn.chunk1)
0670: yyColumn.chunk1 = new Chunk1();
0671: if (null == yyColumn.chunk1.fNameSpaceStructure)
0672: yyColumn.chunk1.fNameSpaceStructure = pNameSpaceStructure$1(yyStart);
0673: return yyColumn.chunk1.fNameSpaceStructure;
0674: }
0675:
0676: /** Actually parse xtc.typical.Typical.NameSpaceStructure. */
0677: private Result pNameSpaceStructure$1(final int yyStart)
0678: throws IOException {
0679: Result yyResult;
0680: int yyBase;
0681: Node yyValue;
0682: ParseError yyError = ParseError.DUMMY;
0683:
0684: // Alternative 1.
0685:
0686: yyResult = pNameSpaceStructure$$Choice1(yyStart);
0687: yyError = yyResult.select(yyError);
0688: if (yyResult.hasValue()) {
0689: final String v$g$1 = yyResult.semanticValue();
0690:
0691: yyBase = yyResult.index;
0692: yyResult = pSymbol(yyBase);
0693: yyError = yyResult.select(yyError);
0694: if (yyResult.hasValue(":")) {
0695:
0696: yyResult = pLowerIdentifier(yyResult.index);
0697: yyError = yyResult.select(yyError);
0698: if (yyResult.hasValue()) {
0699: final String v$g$2 = yyResult.semanticValue();
0700:
0701: yyBase = yyResult.index;
0702: yyResult = pSymbol(yyBase);
0703: yyError = yyResult.select(yyError);
0704: if (yyResult.hasValue("=")) {
0705:
0706: yyResult = pPatternMatching(yyResult.index);
0707: yyError = yyResult.select(yyError);
0708: if (yyResult.hasValue()) {
0709: final Node v$g$3 = yyResult.semanticValue();
0710:
0711: yyValue = GNode.create(
0712: "NameSpaceStructure", v$g$1, v$g$2,
0713: v$g$3);
0714: yyValue.setLocation(location(yyStart));
0715:
0716: return yyResult.createValue(yyValue,
0717: yyError);
0718: }
0719: } else {
0720: yyError = yyError.select("\"=\" expected",
0721: yyBase);
0722: }
0723: }
0724: } else {
0725: yyError = yyError.select("\":\" expected", yyBase);
0726: }
0727: }
0728:
0729: // Done.
0730: return yyError;
0731: }
0732:
0733: // =========================================================================
0734:
0735: /**
0736: * Parse synthetic nonterminal
0737: * xtc.typical.Typical.NameSpaceStructure$$Choice1.
0738: *
0739: * @param yyStart The index.
0740: * @return The result.
0741: * @throws IOException Signals an I/O error.
0742: */
0743: private Result pNameSpaceStructure$$Choice1(final int yyStart)
0744: throws IOException {
0745:
0746: Result yyResult;
0747: String yyValue;
0748: ParseError yyError = ParseError.DUMMY;
0749:
0750: // Alternative 1.
0751:
0752: yyResult = pKeyword(yyStart);
0753: yyError = yyResult.select(yyError);
0754: if (yyResult.hasValue("default")) {
0755: yyValue = "default";
0756:
0757: return yyResult.createValue(yyValue, yyError);
0758: }
0759:
0760: // Alternative 2.
0761:
0762: yyResult = pLowerIdentifier(yyStart);
0763: yyError = yyResult.select(yyError);
0764: if (yyResult.hasValue()) {
0765: yyValue = yyResult.semanticValue();
0766:
0767: return yyResult.createValue(yyValue, yyError);
0768: }
0769:
0770: // Done.
0771: yyError = yyError.select("name space structure expected",
0772: yyStart);
0773: return yyError;
0774: }
0775:
0776: // =========================================================================
0777:
0778: /**
0779: * Parse nonterminal xtc.typical.Typical.EqualStructure.
0780: *
0781: * @param yyStart The index.
0782: * @return The result.
0783: * @throws IOException Signals an I/O error.
0784: */
0785: private Result pEqualStructure(final int yyStart)
0786: throws IOException {
0787: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
0788: if (null == yyColumn.chunk1)
0789: yyColumn.chunk1 = new Chunk1();
0790: if (null == yyColumn.chunk1.fEqualStructure)
0791: yyColumn.chunk1.fEqualStructure = pEqualStructure$1(yyStart);
0792: return yyColumn.chunk1.fEqualStructure;
0793: }
0794:
0795: /** Actually parse xtc.typical.Typical.EqualStructure. */
0796: private Result pEqualStructure$1(final int yyStart)
0797: throws IOException {
0798: Result yyResult;
0799: int yyBase;
0800: Node yyValue;
0801: ParseError yyError = ParseError.DUMMY;
0802:
0803: // Alternative 1.
0804:
0805: yyResult = pUpperID(yyStart);
0806: yyError = yyResult.select(yyError);
0807: if (yyResult.hasValue()) {
0808: final Node v$g$1 = yyResult.semanticValue();
0809:
0810: yyBase = yyResult.index;
0811: yyResult = pSymbol(yyBase);
0812: yyError = yyResult.select(yyError);
0813: if (yyResult.hasValue("(")) {
0814:
0815: yyResult = pEqualStructure$$Choice1(yyResult.index);
0816: yyError = yyResult.select(yyError);
0817: if (yyResult.hasValue()) {
0818: final Node v$g$2 = yyResult.semanticValue();
0819:
0820: yyResult = pEqualStructure$$Star1(yyResult.index);
0821: yyError = yyResult.select(yyError);
0822: if (yyResult.hasValue()) {
0823: final Pair<Node> v$g$3 = yyResult
0824: .semanticValue();
0825:
0826: yyBase = yyResult.index;
0827: yyResult = pSymbol(yyBase);
0828: yyError = yyResult.select(yyError);
0829: if (yyResult.hasValue(")")) {
0830:
0831: yyValue = GNode.create("EqualStructure",
0832: v$g$3.size() + 2).add(v$g$1).add(
0833: v$g$2).addAll(v$g$3);
0834: yyValue.setLocation(location(yyStart));
0835:
0836: return yyResult.createValue(yyValue,
0837: yyError);
0838: } else {
0839: yyError = yyError.select("\")\" expected",
0840: yyBase);
0841: }
0842: }
0843: }
0844: } else {
0845: yyError = yyError.select("\"(\" expected", yyBase);
0846: }
0847: }
0848:
0849: // Done.
0850: return yyError;
0851: }
0852:
0853: // =========================================================================
0854:
0855: /**
0856: * Parse synthetic nonterminal xtc.typical.Typical.EqualStructure$$Choice1.
0857: *
0858: * @param yyStart The index.
0859: * @return The result.
0860: * @throws IOException Signals an I/O error.
0861: */
0862: private Result pEqualStructure$$Choice1(final int yyStart)
0863: throws IOException {
0864:
0865: Result yyResult;
0866: Node yyValue;
0867: ParseError yyError = ParseError.DUMMY;
0868:
0869: // Alternative 1.
0870:
0871: yyResult = pKeyword(yyStart);
0872: yyError = yyResult.select(yyError);
0873: if (yyResult.hasValue("_")) {
0874:
0875: yyValue = GNode.create("WildCard", false);
0876: yyValue.setLocation(location(yyStart));
0877:
0878: return yyResult.createValue(yyValue, yyError);
0879: }
0880:
0881: // Alternative 2.
0882:
0883: yyResult = pVariable(yyStart);
0884: yyError = yyResult.select(yyError);
0885: if (yyResult.hasValue()) {
0886: yyValue = yyResult.semanticValue();
0887:
0888: return yyResult.createValue(yyValue, yyError);
0889: }
0890:
0891: // Done.
0892: yyError = yyError.select("equal structure expected", yyStart);
0893: return yyError;
0894: }
0895:
0896: // =========================================================================
0897:
0898: /**
0899: * Parse synthetic nonterminal xtc.typical.Typical.EqualStructure$$Choice2.
0900: *
0901: * @param yyStart The index.
0902: * @return The result.
0903: * @throws IOException Signals an I/O error.
0904: */
0905: private Result pEqualStructure$$Choice2(final int yyStart)
0906: throws IOException {
0907:
0908: Result yyResult;
0909: Node yyValue;
0910: ParseError yyError = ParseError.DUMMY;
0911:
0912: // Alternative 1.
0913:
0914: yyResult = pSymbol(yyStart);
0915: yyError = yyResult.select(yyError);
0916: if (yyResult.hasValue(",")) {
0917:
0918: final int yyChoice1 = yyResult.index;
0919:
0920: // Nested alternative 1.
0921:
0922: yyResult = pWildCard(yyChoice1);
0923: yyError = yyResult.select(yyError);
0924: if (yyResult.hasValue()) {
0925: yyValue = yyResult.semanticValue();
0926:
0927: return yyResult.createValue(yyValue, yyError);
0928: }
0929:
0930: // Nested alternative 2.
0931:
0932: yyResult = pVariable(yyChoice1);
0933: yyError = yyResult.select(yyError);
0934: if (yyResult.hasValue()) {
0935: yyValue = yyResult.semanticValue();
0936:
0937: return yyResult.createValue(yyValue, yyError);
0938: }
0939: }
0940:
0941: // Done.
0942: yyError = yyError.select("equal structure expected", yyStart);
0943: return yyError;
0944: }
0945:
0946: // =========================================================================
0947:
0948: /**
0949: * Parse synthetic nonterminal xtc.typical.Typical.EqualStructure$$Star1.
0950: *
0951: * @param yyStart The index.
0952: * @return The result.
0953: * @throws IOException Signals an I/O error.
0954: */
0955: private Result pEqualStructure$$Star1(final int yyStart)
0956: throws IOException {
0957:
0958: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
0959: if (null == yyColumn.chunk1)
0960: yyColumn.chunk1 = new Chunk1();
0961: if (null == yyColumn.chunk1.fEqualStructure$$Star1)
0962: yyColumn.chunk1.fEqualStructure$$Star1 = pEqualStructure$$Star1$1(yyStart);
0963: return yyColumn.chunk1.fEqualStructure$$Star1;
0964: }
0965:
0966: /** Actually parse xtc.typical.Typical.EqualStructure$$Star1. */
0967: private Result pEqualStructure$$Star1$1(final int yyStart)
0968: throws IOException {
0969:
0970: Result yyResult;
0971: Pair<Node> yyValue;
0972: ParseError yyError = ParseError.DUMMY;
0973:
0974: // Alternative 1.
0975:
0976: yyResult = pEqualStructure$$Choice2(yyStart);
0977: yyError = yyResult.select(yyError);
0978: if (yyResult.hasValue()) {
0979: final Node v$el$3 = yyResult.semanticValue();
0980:
0981: yyResult = pEqualStructure$$Star1(yyResult.index);
0982: yyError = yyResult.select(yyError);
0983: if (yyResult.hasValue()) {
0984: final Pair<Node> v$6 = yyResult.semanticValue();
0985:
0986: yyValue = new Pair<Node>(v$el$3, v$6);
0987:
0988: return yyResult.createValue(yyValue, yyError);
0989: }
0990: }
0991:
0992: // Alternative 2.
0993:
0994: yyValue = Pair.empty();
0995:
0996: return new SemanticValue(yyValue, yyStart, yyError);
0997: }
0998:
0999: // =========================================================================
1000:
1001: /**
1002: * Parse nonterminal xtc.typical.Typical.Parameters.
1003: *
1004: * @param yyStart The index.
1005: * @return The result.
1006: * @throws IOException Signals an I/O error.
1007: */
1008: private Result pParameters(final int yyStart) throws IOException {
1009: Result yyResult;
1010: int yyRepetition1;
1011: Pair<Node> yyRepValue1;
1012: Node yyValue;
1013: ParseError yyError = ParseError.DUMMY;
1014:
1015: // Alternative 1.
1016:
1017: yyRepetition1 = yyStart;
1018: yyRepValue1 = Pair.empty();
1019: while (true) {
1020:
1021: yyResult = pParameter(yyRepetition1);
1022: yyError = yyResult.select(yyError);
1023: if (yyResult.hasValue()) {
1024: final Node v$el$1 = yyResult.semanticValue();
1025:
1026: yyRepetition1 = yyResult.index;
1027: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
1028: continue;
1029: }
1030: break;
1031: }
1032: { // Start scope for v$g$1.
1033: final Pair<Node> v$g$1 = yyRepValue1.reverse();
1034:
1035: yyValue = GNode.createFromPair("Parameters", v$g$1);
1036: yyValue.setLocation(location(yyStart));
1037:
1038: return new SemanticValue(yyValue, yyRepetition1, yyError);
1039: } // End scope for v$g$1.
1040: }
1041:
1042: // =========================================================================
1043:
1044: /**
1045: * Parse nonterminal xtc.typical.Typical.Parameter.
1046: *
1047: * @param yyStart The index.
1048: * @return The result.
1049: * @throws IOException Signals an I/O error.
1050: */
1051: private Result pParameter(final int yyStart) throws IOException {
1052: Result yyResult;
1053: int yyBase;
1054: int yyOption1;
1055: Node yyOpValue1;
1056: Node yyValue;
1057: ParseError yyError = ParseError.DUMMY;
1058:
1059: // Alternative 1.
1060:
1061: yyResult = pSymbol(yyStart);
1062: yyError = yyResult.select(yyError);
1063: if (yyResult.hasValue("(")) {
1064:
1065: yyResult = pLowerIdentifier(yyResult.index);
1066: yyError = yyResult.select(yyError);
1067: if (yyResult.hasValue()) {
1068: final String v$g$1 = yyResult.semanticValue();
1069:
1070: yyOption1 = yyResult.index;
1071: yyOpValue1 = null;
1072:
1073: yyBase = yyOption1;
1074: yyResult = pSymbol(yyBase);
1075: yyError = yyResult.select(yyError);
1076: if (yyResult.hasValue(":")) {
1077:
1078: yyResult = pAliasedType(yyResult.index);
1079: yyError = yyResult.select(yyError);
1080: if (yyResult.hasValue()) {
1081: final Node v$el$1 = yyResult.semanticValue();
1082:
1083: yyOption1 = yyResult.index;
1084: yyOpValue1 = v$el$1;
1085: }
1086: } else {
1087: yyError = yyError.select("\":\" expected", yyBase);
1088: }
1089: { // Start scope for v$g$2.
1090: final Node v$g$2 = yyOpValue1;
1091:
1092: yyBase = yyOption1;
1093: yyResult = pSymbol(yyBase);
1094: yyError = yyResult.select(yyError);
1095: if (yyResult.hasValue(")")) {
1096:
1097: yyValue = GNode.create("Parameter", v$g$1,
1098: v$g$2);
1099: yyValue.setLocation(location(yyStart));
1100:
1101: return yyResult.createValue(yyValue, yyError);
1102: } else {
1103: yyError = yyError.select("\")\" expected",
1104: yyBase);
1105: }
1106: } // End scope for v$g$2.
1107: }
1108: }
1109:
1110: // Alternative 2.
1111:
1112: yyResult = pLowerIdentifier(yyStart);
1113: yyError = yyResult.select(yyError);
1114: if (yyResult.hasValue()) {
1115: final String v$g$3 = yyResult.semanticValue();
1116:
1117: yyOption1 = yyResult.index;
1118: yyOpValue1 = null;
1119:
1120: yyBase = yyOption1;
1121: yyResult = pSymbol(yyBase);
1122: yyError = yyResult.select(yyError);
1123: if (yyResult.hasValue(":")) {
1124:
1125: yyResult = pAliasedType(yyResult.index);
1126: yyError = yyResult.select(yyError);
1127: if (yyResult.hasValue()) {
1128: final Node v$el$2 = yyResult.semanticValue();
1129:
1130: yyOption1 = yyResult.index;
1131: yyOpValue1 = v$el$2;
1132: }
1133: } else {
1134: yyError = yyError.select("\":\" expected", yyBase);
1135: }
1136: { // Start scope for v$g$4.
1137: final Node v$g$4 = yyOpValue1;
1138:
1139: yyValue = GNode.create("Parameter", v$g$3, v$g$4);
1140: yyValue.setLocation(location(yyStart));
1141:
1142: return new SemanticValue(yyValue, yyOption1, yyError);
1143: } // End scope for v$g$4.
1144: }
1145:
1146: // Done.
1147: yyError = yyError.select("parameter expected", yyStart);
1148: return yyError;
1149: }
1150:
1151: // =========================================================================
1152:
1153: /**
1154: * Parse nonterminal xtc.typical.Typical.PatternMatching.
1155: *
1156: * @param yyStart The index.
1157: * @return The result.
1158: * @throws IOException Signals an I/O error.
1159: */
1160: private Result pPatternMatching(final int yyStart)
1161: throws IOException {
1162: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
1163: if (null == yyColumn.chunk1)
1164: yyColumn.chunk1 = new Chunk1();
1165: if (null == yyColumn.chunk1.fPatternMatching)
1166: yyColumn.chunk1.fPatternMatching = pPatternMatching$1(yyStart);
1167: return yyColumn.chunk1.fPatternMatching;
1168: }
1169:
1170: /** Actually parse xtc.typical.Typical.PatternMatching. */
1171: private Result pPatternMatching$1(final int yyStart)
1172: throws IOException {
1173: Result yyResult;
1174: int yyBase;
1175: int yyOption1;
1176: Node yyValue;
1177: ParseError yyError = ParseError.DUMMY;
1178:
1179: // Alternative 1.
1180:
1181: yyOption1 = yyStart;
1182:
1183: yyBase = yyOption1;
1184: yyResult = pSymbol(yyBase);
1185: yyError = yyResult.select(yyError);
1186: if (yyResult.hasValue("|")) {
1187:
1188: yyOption1 = yyResult.index;
1189: } else {
1190: yyError = yyError.select("\"|\" expected", yyBase);
1191: }
1192:
1193: yyResult = pPatternMatch(yyOption1);
1194: yyError = yyResult.select(yyError);
1195: if (yyResult.hasValue()) {
1196: final Node v$g$1 = yyResult.semanticValue();
1197:
1198: yyResult = pPatternMatching$$Star1(yyResult.index);
1199: yyError = yyResult.select(yyError);
1200: if (yyResult.hasValue()) {
1201: final Pair<Node> v$g$2 = yyResult.semanticValue();
1202:
1203: yyValue = GNode.createFromPair("PatternMatching",
1204: v$g$1, v$g$2);
1205: yyValue.setLocation(location(yyStart));
1206:
1207: return yyResult.createValue(yyValue, yyError);
1208: }
1209: }
1210:
1211: // Done.
1212: return yyError;
1213: }
1214:
1215: // =========================================================================
1216:
1217: /**
1218: * Parse synthetic nonterminal xtc.typical.Typical.PatternMatching$$Star1.
1219: *
1220: * @param yyStart The index.
1221: * @return The result.
1222: * @throws IOException Signals an I/O error.
1223: */
1224: private Result pPatternMatching$$Star1(final int yyStart)
1225: throws IOException {
1226:
1227: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
1228: if (null == yyColumn.chunk1)
1229: yyColumn.chunk1 = new Chunk1();
1230: if (null == yyColumn.chunk1.fPatternMatching$$Star1)
1231: yyColumn.chunk1.fPatternMatching$$Star1 = pPatternMatching$$Star1$1(yyStart);
1232: return yyColumn.chunk1.fPatternMatching$$Star1;
1233: }
1234:
1235: /** Actually parse xtc.typical.Typical.PatternMatching$$Star1. */
1236: private Result pPatternMatching$$Star1$1(final int yyStart)
1237: throws IOException {
1238:
1239: Result yyResult;
1240: Pair<Node> yyValue;
1241: ParseError yyError = ParseError.DUMMY;
1242:
1243: // Alternative 1.
1244:
1245: yyResult = pSymbol(yyStart);
1246: yyError = yyResult.select(yyError);
1247: if (yyResult.hasValue("|")) {
1248:
1249: yyResult = pPatternMatch(yyResult.index);
1250: yyError = yyResult.select(yyError);
1251: if (yyResult.hasValue()) {
1252: final Node v$el$1 = yyResult.semanticValue();
1253:
1254: yyResult = pPatternMatching$$Star1(yyResult.index);
1255: yyError = yyResult.select(yyError);
1256: if (yyResult.hasValue()) {
1257: final Pair<Node> v$2 = yyResult.semanticValue();
1258:
1259: yyValue = new Pair<Node>(v$el$1, v$2);
1260:
1261: return yyResult.createValue(yyValue, yyError);
1262: }
1263: }
1264: }
1265:
1266: // Alternative 2.
1267:
1268: yyValue = Pair.empty();
1269:
1270: return new SemanticValue(yyValue, yyStart, yyError);
1271: }
1272:
1273: // =========================================================================
1274:
1275: /**
1276: * Parse nonterminal xtc.typical.Typical.PatternMatch.
1277: *
1278: * @param yyStart The index.
1279: * @return The result.
1280: * @throws IOException Signals an I/O error.
1281: */
1282: private Result pPatternMatch(final int yyStart) throws IOException {
1283: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
1284: if (null == yyColumn.chunk1)
1285: yyColumn.chunk1 = new Chunk1();
1286: if (null == yyColumn.chunk1.fPatternMatch)
1287: yyColumn.chunk1.fPatternMatch = pPatternMatch$1(yyStart);
1288: return yyColumn.chunk1.fPatternMatch;
1289: }
1290:
1291: /** Actually parse xtc.typical.Typical.PatternMatch. */
1292: private Result pPatternMatch$1(final int yyStart)
1293: throws IOException {
1294: Result yyResult;
1295: int yyBase;
1296: Node yyValue;
1297: ParseError yyError = ParseError.DUMMY;
1298:
1299: // Alternative 1.
1300:
1301: yyResult = pPatterns(yyStart);
1302: yyError = yyResult.select(yyError);
1303: if (yyResult.hasValue()) {
1304: final Node v$g$1 = yyResult.semanticValue();
1305:
1306: yyBase = yyResult.index;
1307: yyResult = pSymbol(yyBase);
1308: yyError = yyResult.select(yyError);
1309: if (yyResult.hasValue("->")) {
1310:
1311: yyResult = pExpression(yyResult.index);
1312: yyError = yyResult.select(yyError);
1313: if (yyResult.hasValue()) {
1314: final Node v$g$2 = yyResult.semanticValue();
1315:
1316: yyResult = pSpacing(yyResult.index);
1317: yyError = yyResult.select(yyError);
1318: if (yyResult.hasValue()) {
1319:
1320: yyValue = GNode.create("PatternMatch", v$g$1,
1321: v$g$2);
1322: yyValue.setLocation(location(yyStart));
1323:
1324: return yyResult.createValue(yyValue, yyError);
1325: }
1326: }
1327: } else {
1328: yyError = yyError.select("\"->\" expected", yyBase);
1329: }
1330: }
1331:
1332: // Done.
1333: return yyError;
1334: }
1335:
1336: // =========================================================================
1337:
1338: /**
1339: * Parse nonterminal xtc.typical.Typical.Patterns.
1340: *
1341: * @param yyStart The index.
1342: * @return The result.
1343: * @throws IOException Signals an I/O error.
1344: */
1345: private Result pPatterns(final int yyStart) throws IOException {
1346: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
1347: if (null == yyColumn.chunk1)
1348: yyColumn.chunk1 = new Chunk1();
1349: if (null == yyColumn.chunk1.fPatterns)
1350: yyColumn.chunk1.fPatterns = pPatterns$1(yyStart);
1351: return yyColumn.chunk1.fPatterns;
1352: }
1353:
1354: /** Actually parse xtc.typical.Typical.Patterns. */
1355: private Result pPatterns$1(final int yyStart) throws IOException {
1356: Result yyResult;
1357: Node yyValue;
1358: ParseError yyError = ParseError.DUMMY;
1359:
1360: // Alternative 1.
1361:
1362: yyResult = pPattern(yyStart);
1363: yyError = yyResult.select(yyError);
1364: if (yyResult.hasValue()) {
1365: final Node v$g$1 = yyResult.semanticValue();
1366:
1367: yyResult = pPatterns$$Star1(yyResult.index);
1368: yyError = yyResult.select(yyError);
1369: if (yyResult.hasValue()) {
1370: final Pair<Node> v$g$2 = yyResult.semanticValue();
1371:
1372: yyValue = GNode
1373: .createFromPair("Patterns", v$g$1, v$g$2);
1374: yyValue.setLocation(location(yyStart));
1375:
1376: return yyResult.createValue(yyValue, yyError);
1377: }
1378: }
1379:
1380: // Done.
1381: return yyError;
1382: }
1383:
1384: // =========================================================================
1385:
1386: /**
1387: * Parse synthetic nonterminal xtc.typical.Typical.Patterns$$Star1.
1388: *
1389: * @param yyStart The index.
1390: * @return The result.
1391: * @throws IOException Signals an I/O error.
1392: */
1393: private Result pPatterns$$Star1(final int yyStart)
1394: throws IOException {
1395: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
1396: if (null == yyColumn.chunk1)
1397: yyColumn.chunk1 = new Chunk1();
1398: if (null == yyColumn.chunk1.fPatterns$$Star1)
1399: yyColumn.chunk1.fPatterns$$Star1 = pPatterns$$Star1$1(yyStart);
1400: return yyColumn.chunk1.fPatterns$$Star1;
1401: }
1402:
1403: /** Actually parse xtc.typical.Typical.Patterns$$Star1. */
1404: private Result pPatterns$$Star1$1(final int yyStart)
1405: throws IOException {
1406: Result yyResult;
1407: Pair<Node> yyValue;
1408: ParseError yyError = ParseError.DUMMY;
1409:
1410: // Alternative 1.
1411:
1412: yyResult = pSymbol(yyStart);
1413: yyError = yyResult.select(yyError);
1414: if (yyResult.hasValue("|")) {
1415:
1416: yyResult = pPattern(yyResult.index);
1417: yyError = yyResult.select(yyError);
1418: if (yyResult.hasValue()) {
1419: final Node v$el$1 = yyResult.semanticValue();
1420:
1421: yyResult = pPatterns$$Star1(yyResult.index);
1422: yyError = yyResult.select(yyError);
1423: if (yyResult.hasValue()) {
1424: final Pair<Node> v$2 = yyResult.semanticValue();
1425:
1426: yyValue = new Pair<Node>(v$el$1, v$2);
1427:
1428: return yyResult.createValue(yyValue, yyError);
1429: }
1430: }
1431: }
1432:
1433: // Alternative 2.
1434:
1435: yyValue = Pair.empty();
1436:
1437: return new SemanticValue(yyValue, yyStart, yyError);
1438: }
1439:
1440: // =========================================================================
1441:
1442: /**
1443: * Parse nonterminal xtc.typical.Typical.Pattern.
1444: *
1445: * @param yyStart The index.
1446: * @return The result.
1447: * @throws IOException Signals an I/O error.
1448: */
1449: private Result pPattern(final int yyStart) throws IOException {
1450: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
1451: if (null == yyColumn.chunk1)
1452: yyColumn.chunk1 = new Chunk1();
1453: if (null == yyColumn.chunk1.fPattern)
1454: yyColumn.chunk1.fPattern = pPattern$1(yyStart);
1455: return yyColumn.chunk1.fPattern;
1456: }
1457:
1458: /** Actually parse xtc.typical.Typical.Pattern. */
1459: private Result pPattern$1(final int yyStart) throws IOException {
1460: Result yyResult;
1461: Node yyValue;
1462: ParseError yyError = ParseError.DUMMY;
1463:
1464: // Alternative 1.
1465:
1466: yyResult = pTuplePattern(yyStart);
1467: yyError = yyResult.select(yyError);
1468: if (yyResult.hasValue()) {
1469: yyValue = yyResult.semanticValue();
1470:
1471: return yyResult.createValue(yyValue, yyError);
1472: }
1473:
1474: // Done.
1475: return yyError;
1476: }
1477:
1478: // =========================================================================
1479:
1480: /**
1481: * Parse nonterminal xtc.typical.Typical.TuplePattern.
1482: *
1483: * @param yyStart The index.
1484: * @return The result.
1485: * @throws IOException Signals an I/O error.
1486: */
1487: private Result pTuplePattern(final int yyStart) throws IOException {
1488: Result yyResult;
1489: int yyBase;
1490: int yyRepetition1;
1491: boolean yyRepeated1;
1492: Pair<Node> yyRepValue1;
1493: Node yyValue;
1494: ParseError yyError = ParseError.DUMMY;
1495:
1496: // Alternative <Recursion>.
1497:
1498: yyResult = pWhenPattern(yyStart);
1499: yyError = yyResult.select(yyError);
1500: if (yyResult.hasValue()) {
1501: final Node v$g$1 = yyResult.semanticValue();
1502:
1503: yyRepetition1 = yyResult.index;
1504: yyRepeated1 = false;
1505: yyRepValue1 = Pair.empty();
1506: while (true) {
1507:
1508: yyBase = yyRepetition1;
1509: yyResult = pSymbol(yyBase);
1510: yyError = yyResult.select(yyError);
1511: if (yyResult.hasValue(",")) {
1512:
1513: yyResult = pWhenPattern(yyResult.index);
1514: yyError = yyResult.select(yyError);
1515: if (yyResult.hasValue()) {
1516: final Node v$el$1 = yyResult.semanticValue();
1517:
1518: yyRepetition1 = yyResult.index;
1519: yyRepeated1 = true;
1520: yyRepValue1 = new Pair<Node>(v$el$1,
1521: yyRepValue1);
1522: continue;
1523: }
1524: } else {
1525: yyError = yyError.select("\",\" expected", yyBase);
1526: }
1527: break;
1528: }
1529:
1530: if (yyRepeated1) {
1531: final Pair<Node> v$g$2 = yyRepValue1.reverse();
1532:
1533: yyValue = GNode.createFromPair("TuplePattern", v$g$1,
1534: v$g$2);
1535: yyValue.setLocation(location(yyStart));
1536:
1537: return new SemanticValue(yyValue, yyRepetition1,
1538: yyError);
1539: }
1540: }
1541:
1542: // Alternative <Base>.
1543:
1544: yyResult = pWhenPattern(yyStart);
1545: yyError = yyResult.select(yyError);
1546: if (yyResult.hasValue()) {
1547: yyValue = yyResult.semanticValue();
1548:
1549: return yyResult.createValue(yyValue, yyError);
1550: }
1551:
1552: // Done.
1553: return yyError;
1554: }
1555:
1556: // =========================================================================
1557:
1558: /**
1559: * Parse nonterminal xtc.typical.Typical.WhenPattern.
1560: *
1561: * @param yyStart The index.
1562: * @return The result.
1563: * @throws IOException Signals an I/O error.
1564: */
1565: private Result pWhenPattern(final int yyStart) throws IOException {
1566: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
1567: if (null == yyColumn.chunk1)
1568: yyColumn.chunk1 = new Chunk1();
1569: if (null == yyColumn.chunk1.fWhenPattern)
1570: yyColumn.chunk1.fWhenPattern = pWhenPattern$1(yyStart);
1571: return yyColumn.chunk1.fWhenPattern;
1572: }
1573:
1574: /** Actually parse xtc.typical.Typical.WhenPattern. */
1575: private Result pWhenPattern$1(final int yyStart) throws IOException {
1576: Result yyResult;
1577: int yyRepetition1;
1578: Pair<Action<Node>> yyRepValue1;
1579: Node yyValue;
1580: ParseError yyError = ParseError.DUMMY;
1581:
1582: // Alternative <Base>.
1583:
1584: yyResult = pAsPattern(yyStart);
1585: yyError = yyResult.select(yyError);
1586: if (yyResult.hasValue()) {
1587: final Node v$3 = yyResult.semanticValue();
1588:
1589: yyRepetition1 = yyResult.index;
1590: yyRepValue1 = Pair.empty();
1591: while (true) {
1592:
1593: yyResult = pWhenPattern$$Tail1(yyRepetition1);
1594: yyError = yyResult.select(yyError);
1595: if (yyResult.hasValue()) {
1596: final Action<Node> v$4 = yyResult.semanticValue();
1597:
1598: yyRepetition1 = yyResult.index;
1599: yyRepValue1 = new Pair<Action<Node>>(v$4,
1600: yyRepValue1);
1601: continue;
1602: }
1603: break;
1604: }
1605: { // Start scope for v$5.
1606: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
1607:
1608: yyValue = apply(v$5, v$3, yyStart);
1609:
1610: return new SemanticValue(yyValue, yyRepetition1,
1611: yyError);
1612: } // End scope for v$5.
1613: }
1614:
1615: // Done.
1616: return yyError;
1617: }
1618:
1619: // =========================================================================
1620:
1621: /**
1622: * Parse synthetic nonterminal xtc.typical.Typical.WhenPattern$$Tail1.
1623: *
1624: * @param yyStart The index.
1625: * @return The result.
1626: * @throws IOException Signals an I/O error.
1627: */
1628: private Result pWhenPattern$$Tail1(final int yyStart)
1629: throws IOException {
1630: Result yyResult;
1631: Action<Node> yyValue;
1632: ParseError yyError = ParseError.DUMMY;
1633:
1634: // Alternative <Recursion>.
1635:
1636: yyResult = pKeyword(yyStart);
1637: yyError = yyResult.select(yyError);
1638: if (yyResult.hasValue("when")) {
1639:
1640: yyResult = pExpression(yyResult.index);
1641: yyError = yyResult.select(yyError);
1642: if (yyResult.hasValue()) {
1643: final Node v$g$2 = yyResult.semanticValue();
1644:
1645: yyValue = new Action<Node>() {
1646: public Node run(Node v$1) {
1647: return GNode.create("WhenPattern", v$1, v$g$2);
1648: }
1649: };
1650:
1651: return yyResult.createValue(yyValue, yyError);
1652: }
1653: }
1654:
1655: // Done.
1656: yyError = yyError.select("when pattern expected", yyStart);
1657: return yyError;
1658: }
1659:
1660: // =========================================================================
1661:
1662: /**
1663: * Parse nonterminal xtc.typical.Typical.AsPattern.
1664: *
1665: * @param yyStart The index.
1666: * @return The result.
1667: * @throws IOException Signals an I/O error.
1668: */
1669: private Result pAsPattern(final int yyStart) throws IOException {
1670: Result yyResult;
1671: int yyRepetition1;
1672: Pair<Action<Node>> yyRepValue1;
1673: Node yyValue;
1674: ParseError yyError = ParseError.DUMMY;
1675:
1676: // Alternative <Base>.
1677:
1678: yyResult = pTypedPattern(yyStart);
1679: yyError = yyResult.select(yyError);
1680: if (yyResult.hasValue()) {
1681: final Node v$3 = yyResult.semanticValue();
1682:
1683: yyRepetition1 = yyResult.index;
1684: yyRepValue1 = Pair.empty();
1685: while (true) {
1686:
1687: yyResult = pAsPattern$$Tail1(yyRepetition1);
1688: yyError = yyResult.select(yyError);
1689: if (yyResult.hasValue()) {
1690: final Action<Node> v$4 = yyResult.semanticValue();
1691:
1692: yyRepetition1 = yyResult.index;
1693: yyRepValue1 = new Pair<Action<Node>>(v$4,
1694: yyRepValue1);
1695: continue;
1696: }
1697: break;
1698: }
1699: { // Start scope for v$5.
1700: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
1701:
1702: yyValue = apply(v$5, v$3, yyStart);
1703:
1704: return new SemanticValue(yyValue, yyRepetition1,
1705: yyError);
1706: } // End scope for v$5.
1707: }
1708:
1709: // Done.
1710: return yyError;
1711: }
1712:
1713: // =========================================================================
1714:
1715: /**
1716: * Parse synthetic nonterminal xtc.typical.Typical.AsPattern$$Tail1.
1717: *
1718: * @param yyStart The index.
1719: * @return The result.
1720: * @throws IOException Signals an I/O error.
1721: */
1722: private Result pAsPattern$$Tail1(final int yyStart)
1723: throws IOException {
1724: Result yyResult;
1725: Action<Node> yyValue;
1726: ParseError yyError = ParseError.DUMMY;
1727:
1728: // Alternative <Recursion>.
1729:
1730: yyResult = pKeyword(yyStart);
1731: yyError = yyResult.select(yyError);
1732: if (yyResult.hasValue("as")) {
1733:
1734: yyResult = pLowerIdentifier(yyResult.index);
1735: yyError = yyResult.select(yyError);
1736: if (yyResult.hasValue()) {
1737: final String v$g$2 = yyResult.semanticValue();
1738:
1739: yyValue = new Action<Node>() {
1740: public Node run(Node v$1) {
1741: return GNode.create("AsPattern", v$1, v$g$2);
1742: }
1743: };
1744:
1745: return yyResult.createValue(yyValue, yyError);
1746: }
1747: }
1748:
1749: // Done.
1750: yyError = yyError.select("as pattern expected", yyStart);
1751: return yyError;
1752: }
1753:
1754: // =========================================================================
1755:
1756: /**
1757: * Parse nonterminal xtc.typical.Typical.TypedPattern.
1758: *
1759: * @param yyStart The index.
1760: * @return The result.
1761: * @throws IOException Signals an I/O error.
1762: */
1763: private Result pTypedPattern(final int yyStart) throws IOException {
1764: Result yyResult;
1765: int yyRepetition1;
1766: Pair<Action<Node>> yyRepValue1;
1767: Node yyValue;
1768: ParseError yyError = ParseError.DUMMY;
1769:
1770: // Alternative <Base>.
1771:
1772: yyResult = pConsPattern(yyStart);
1773: yyError = yyResult.select(yyError);
1774: if (yyResult.hasValue()) {
1775: final Node v$3 = yyResult.semanticValue();
1776:
1777: yyRepetition1 = yyResult.index;
1778: yyRepValue1 = Pair.empty();
1779: while (true) {
1780:
1781: yyResult = pTypedPattern$$Tail1(yyRepetition1);
1782: yyError = yyResult.select(yyError);
1783: if (yyResult.hasValue()) {
1784: final Action<Node> v$4 = yyResult.semanticValue();
1785:
1786: yyRepetition1 = yyResult.index;
1787: yyRepValue1 = new Pair<Action<Node>>(v$4,
1788: yyRepValue1);
1789: continue;
1790: }
1791: break;
1792: }
1793: { // Start scope for v$5.
1794: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
1795:
1796: yyValue = apply(v$5, v$3, yyStart);
1797:
1798: return new SemanticValue(yyValue, yyRepetition1,
1799: yyError);
1800: } // End scope for v$5.
1801: }
1802:
1803: // Done.
1804: return yyError;
1805: }
1806:
1807: // =========================================================================
1808:
1809: /**
1810: * Parse synthetic nonterminal xtc.typical.Typical.TypedPattern$$Tail1.
1811: *
1812: * @param yyStart The index.
1813: * @return The result.
1814: * @throws IOException Signals an I/O error.
1815: */
1816: private Result pTypedPattern$$Tail1(final int yyStart)
1817: throws IOException {
1818: Result yyResult;
1819: Action<Node> yyValue;
1820: ParseError yyError = ParseError.DUMMY;
1821:
1822: // Alternative <Recursive>.
1823:
1824: yyResult = pSymbol(yyStart);
1825: yyError = yyResult.select(yyError);
1826: if (yyResult.hasValue(":")) {
1827:
1828: yyResult = pAliasedType(yyResult.index);
1829: yyError = yyResult.select(yyError);
1830: if (yyResult.hasValue()) {
1831: final Node v$g$2 = yyResult.semanticValue();
1832:
1833: yyValue = new Action<Node>() {
1834: public Node run(Node v$1) {
1835: return GNode.create("TypedPattern", v$1, v$g$2);
1836: }
1837: };
1838:
1839: return yyResult.createValue(yyValue, yyError);
1840: }
1841: }
1842:
1843: // Done.
1844: yyError = yyError.select("typed pattern expected", yyStart);
1845: return yyError;
1846: }
1847:
1848: // =========================================================================
1849:
1850: /**
1851: * Parse nonterminal xtc.typical.Typical.ConsPattern.
1852: *
1853: * @param yyStart The index.
1854: * @return The result.
1855: * @throws IOException Signals an I/O error.
1856: */
1857: private Result pConsPattern(final int yyStart) throws IOException {
1858: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
1859: if (null == yyColumn.chunk2)
1860: yyColumn.chunk2 = new Chunk2();
1861: if (null == yyColumn.chunk2.fConsPattern)
1862: yyColumn.chunk2.fConsPattern = pConsPattern$1(yyStart);
1863: return yyColumn.chunk2.fConsPattern;
1864: }
1865:
1866: /** Actually parse xtc.typical.Typical.ConsPattern. */
1867: private Result pConsPattern$1(final int yyStart) throws IOException {
1868: Result yyResult;
1869: int yyBase;
1870: Node yyValue;
1871: ParseError yyError = ParseError.DUMMY;
1872:
1873: // Alternative <Recursion>.
1874:
1875: yyResult = pAtomicPattern(yyStart);
1876: yyError = yyResult.select(yyError);
1877: if (yyResult.hasValue()) {
1878: final Node v$g$1 = yyResult.semanticValue();
1879:
1880: yyBase = yyResult.index;
1881: yyResult = pSymbol(yyBase);
1882: yyError = yyResult.select(yyError);
1883: if (yyResult.hasValue("::")) {
1884:
1885: yyResult = pConsPattern(yyResult.index);
1886: yyError = yyResult.select(yyError);
1887: if (yyResult.hasValue()) {
1888: final Node v$g$2 = yyResult.semanticValue();
1889:
1890: yyValue = GNode.create("ConsPattern", v$g$1, v$g$2);
1891: yyValue.setLocation(location(yyStart));
1892:
1893: return yyResult.createValue(yyValue, yyError);
1894: }
1895: } else {
1896: yyError = yyError.select("\"::\" expected", yyBase);
1897: }
1898: }
1899:
1900: // Alternative <Base>.
1901:
1902: yyResult = pAtomicPattern(yyStart);
1903: yyError = yyResult.select(yyError);
1904: if (yyResult.hasValue()) {
1905: yyValue = yyResult.semanticValue();
1906:
1907: return yyResult.createValue(yyValue, yyError);
1908: }
1909:
1910: // Done.
1911: return yyError;
1912: }
1913:
1914: // =========================================================================
1915:
1916: /**
1917: * Parse nonterminal xtc.typical.Typical.AtomicPattern.
1918: *
1919: * @param yyStart The index.
1920: * @return The result.
1921: * @throws IOException Signals an I/O error.
1922: */
1923: private Result pAtomicPattern(final int yyStart) throws IOException {
1924: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
1925: if (null == yyColumn.chunk2)
1926: yyColumn.chunk2 = new Chunk2();
1927: if (null == yyColumn.chunk2.fAtomicPattern)
1928: yyColumn.chunk2.fAtomicPattern = pAtomicPattern$1(yyStart);
1929: return yyColumn.chunk2.fAtomicPattern;
1930: }
1931:
1932: /** Actually parse xtc.typical.Typical.AtomicPattern. */
1933: private Result pAtomicPattern$1(final int yyStart)
1934: throws IOException {
1935: Result yyResult;
1936: Node yyValue;
1937: ParseError yyError = ParseError.DUMMY;
1938:
1939: // Alternative <RecordPattern>.
1940:
1941: yyResult = pRecordPattern(yyStart);
1942: yyError = yyResult.select(yyError);
1943: if (yyResult.hasValue()) {
1944: yyValue = yyResult.semanticValue();
1945:
1946: return yyResult.createValue(yyValue, yyError);
1947: }
1948:
1949: // Alternative <List>.
1950:
1951: yyResult = pListPattern(yyStart);
1952: yyError = yyResult.select(yyError);
1953: if (yyResult.hasValue()) {
1954: yyValue = yyResult.semanticValue();
1955:
1956: return yyResult.createValue(yyValue, yyError);
1957: }
1958:
1959: // Alternative <TypeConstructor>.
1960:
1961: yyResult = pTypeConstructorPattern(yyStart);
1962: yyError = yyResult.select(yyError);
1963: if (yyResult.hasValue()) {
1964: yyValue = yyResult.semanticValue();
1965:
1966: return yyResult.createValue(yyValue, yyError);
1967: }
1968:
1969: // Alternative <Parenthesised>.
1970:
1971: yyResult = pParenthesisedPattern(yyStart);
1972: yyError = yyResult.select(yyError);
1973: if (yyResult.hasValue()) {
1974: yyValue = yyResult.semanticValue();
1975:
1976: return yyResult.createValue(yyValue, yyError);
1977: }
1978:
1979: // Alternative <Variable>.
1980:
1981: yyResult = pVariable(yyStart);
1982: yyError = yyResult.select(yyError);
1983: if (yyResult.hasValue()) {
1984: yyValue = yyResult.semanticValue();
1985:
1986: return yyResult.createValue(yyValue, yyError);
1987: }
1988:
1989: // Alternative <BottomPattern>.
1990:
1991: yyResult = pBottomPattern(yyStart);
1992: yyError = yyResult.select(yyError);
1993: if (yyResult.hasValue()) {
1994: yyValue = yyResult.semanticValue();
1995:
1996: return yyResult.createValue(yyValue, yyError);
1997: }
1998:
1999: // Alternative 7.
2000:
2001: yyResult = pKeyword(yyStart);
2002: yyError = yyResult.select(yyError);
2003: if (yyResult.hasValue("_")) {
2004:
2005: yyValue = GNode.create("WildCard", false);
2006: yyValue.setLocation(location(yyStart));
2007:
2008: return yyResult.createValue(yyValue, yyError);
2009: }
2010:
2011: // Alternative <Literal>.
2012:
2013: yyResult = pLiteral(yyStart);
2014: yyError = yyResult.select(yyError);
2015: if (yyResult.hasValue()) {
2016: yyValue = yyResult.semanticValue();
2017:
2018: return yyResult.createValue(yyValue, yyError);
2019: }
2020:
2021: // Done.
2022: yyError = yyError.select("atomic pattern expected", yyStart);
2023: return yyError;
2024: }
2025:
2026: // =========================================================================
2027:
2028: /**
2029: * Parse nonterminal xtc.typical.Typical.Variable.
2030: *
2031: * @param yyStart The index.
2032: * @return The result.
2033: * @throws IOException Signals an I/O error.
2034: */
2035: private Result pVariable(final int yyStart) throws IOException {
2036: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
2037: if (null == yyColumn.chunk2)
2038: yyColumn.chunk2 = new Chunk2();
2039: if (null == yyColumn.chunk2.fVariable)
2040: yyColumn.chunk2.fVariable = pVariable$1(yyStart);
2041: return yyColumn.chunk2.fVariable;
2042: }
2043:
2044: /** Actually parse xtc.typical.Typical.Variable. */
2045: private Result pVariable$1(final int yyStart) throws IOException {
2046: Result yyResult;
2047: Node yyValue;
2048: ParseError yyError = ParseError.DUMMY;
2049:
2050: // Alternative 1.
2051:
2052: yyResult = pLowerIdentifier(yyStart);
2053: yyError = yyResult.select(yyError);
2054: if (yyResult.hasValue()) {
2055: final String v$g$1 = yyResult.semanticValue();
2056:
2057: yyValue = GNode.create("Variable", v$g$1);
2058: yyValue.setLocation(location(yyStart));
2059:
2060: return yyResult.createValue(yyValue, yyError);
2061: }
2062:
2063: // Done.
2064: return yyError;
2065: }
2066:
2067: // =========================================================================
2068:
2069: /**
2070: * Parse nonterminal xtc.typical.Typical.ParenthesisedPattern.
2071: *
2072: * @param yyStart The index.
2073: * @return The result.
2074: * @throws IOException Signals an I/O error.
2075: */
2076: private Result pParenthesisedPattern(final int yyStart)
2077: throws IOException {
2078: Result yyResult;
2079: int yyBase;
2080: Node yyValue;
2081: ParseError yyError = ParseError.DUMMY;
2082:
2083: // Alternative 1.
2084:
2085: yyResult = pSymbol(yyStart);
2086: yyError = yyResult.select(yyError);
2087: if (yyResult.hasValue("(")) {
2088:
2089: yyResult = pPattern(yyResult.index);
2090: yyError = yyResult.select(yyError);
2091: if (yyResult.hasValue()) {
2092: yyValue = yyResult.semanticValue();
2093:
2094: yyBase = yyResult.index;
2095: yyResult = pSymbol(yyBase);
2096: yyError = yyResult.select(yyError);
2097: if (yyResult.hasValue(")")) {
2098:
2099: return yyResult.createValue(yyValue, yyError);
2100: } else {
2101: yyError = yyError.select("\")\" expected", yyBase);
2102: }
2103: }
2104: }
2105:
2106: // Done.
2107: yyError = yyError.select("parenthesised pattern expected",
2108: yyStart);
2109: return yyError;
2110: }
2111:
2112: // =========================================================================
2113:
2114: /**
2115: * Parse nonterminal xtc.typical.Typical.TypeConstructorPattern.
2116: *
2117: * @param yyStart The index.
2118: * @return The result.
2119: * @throws IOException Signals an I/O error.
2120: */
2121: private Result pTypeConstructorPattern(final int yyStart)
2122: throws IOException {
2123:
2124: Result yyResult;
2125: int yyBase;
2126: int yyOption1;
2127: Node yyValue;
2128: ParseError yyError = ParseError.DUMMY;
2129:
2130: // Alternative 1.
2131:
2132: yyResult = pUpperIdentifier(yyStart);
2133: yyError = yyResult.select(yyError);
2134: if (yyResult.hasValue()) {
2135: final String v$g$1 = yyResult.semanticValue();
2136:
2137: final int yyChoice1 = yyResult.index;
2138:
2139: // Nested alternative 1.
2140:
2141: yyResult = pPatternParameters(yyChoice1);
2142: yyError = yyResult.select(yyError);
2143: if (yyResult.hasValue()) {
2144: final Node v$g$2 = yyResult.semanticValue();
2145:
2146: yyValue = GNode.create("TypeConstructorPattern", v$g$1,
2147: v$g$2);
2148: yyValue.setLocation(location(yyStart));
2149:
2150: return yyResult.createValue(yyValue, yyError);
2151: }
2152:
2153: // Nested alternative 2.
2154:
2155: yyResult = pWildCard(yyChoice1);
2156: yyError = yyResult.select(yyError);
2157: if (yyResult.hasValue()) {
2158: final Node v$g$3 = yyResult.semanticValue();
2159:
2160: yyValue = GNode.create("TypeConstructorPattern", v$g$1,
2161: v$g$3);
2162: yyValue.setLocation(location(yyStart));
2163:
2164: return yyResult.createValue(yyValue, yyError);
2165: }
2166:
2167: // Nested alternative 3.
2168:
2169: yyOption1 = yyChoice1;
2170:
2171: yyBase = yyOption1;
2172: yyResult = pSymbol(yyBase);
2173: yyError = yyResult.select(yyError);
2174: if (yyResult.hasValue("(")) {
2175:
2176: yyBase = yyResult.index;
2177: yyResult = pSymbol(yyBase);
2178: yyError = yyResult.select(yyError);
2179: if (yyResult.hasValue(")")) {
2180:
2181: yyOption1 = yyResult.index;
2182: } else {
2183: yyError = yyError.select("\")\" expected", yyBase);
2184: }
2185: } else {
2186: yyError = yyError.select("\"(\" expected", yyBase);
2187: }
2188:
2189: yyValue = GNode.create("TypeConstructorPattern", v$g$1);
2190: yyValue.setLocation(location(yyStart));
2191:
2192: return new SemanticValue(yyValue, yyOption1, yyError);
2193: }
2194:
2195: // Done.
2196: return yyError;
2197: }
2198:
2199: // =========================================================================
2200:
2201: /**
2202: * Parse nonterminal xtc.typical.Typical.PatternParameters.
2203: *
2204: * @param yyStart The index.
2205: * @return The result.
2206: * @throws IOException Signals an I/O error.
2207: */
2208: private Result pPatternParameters(final int yyStart)
2209: throws IOException {
2210: Result yyResult;
2211: int yyBase;
2212: int yyRepetition1;
2213: Pair<Node> yyRepValue1;
2214: Node yyValue;
2215: ParseError yyError = ParseError.DUMMY;
2216:
2217: // Alternative 1.
2218:
2219: yyResult = pSymbol(yyStart);
2220: yyError = yyResult.select(yyError);
2221: if (yyResult.hasValue("(")) {
2222:
2223: yyResult = pWhenPattern(yyResult.index);
2224: yyError = yyResult.select(yyError);
2225: if (yyResult.hasValue()) {
2226: final Node v$g$1 = yyResult.semanticValue();
2227:
2228: yyRepetition1 = yyResult.index;
2229: yyRepValue1 = Pair.empty();
2230: while (true) {
2231:
2232: yyBase = yyRepetition1;
2233: yyResult = pSymbol(yyBase);
2234: yyError = yyResult.select(yyError);
2235: if (yyResult.hasValue(",")) {
2236:
2237: yyResult = pWhenPattern(yyResult.index);
2238: yyError = yyResult.select(yyError);
2239: if (yyResult.hasValue()) {
2240: final Node v$el$1 = yyResult
2241: .semanticValue();
2242:
2243: yyRepetition1 = yyResult.index;
2244: yyRepValue1 = new Pair<Node>(v$el$1,
2245: yyRepValue1);
2246: continue;
2247: }
2248: } else {
2249: yyError = yyError.select("\",\" expected",
2250: yyBase);
2251: }
2252: break;
2253: }
2254: { // Start scope for v$g$2.
2255: final Pair<Node> v$g$2 = yyRepValue1.reverse();
2256:
2257: yyBase = yyRepetition1;
2258: yyResult = pSymbol(yyBase);
2259: yyError = yyResult.select(yyError);
2260: if (yyResult.hasValue(")")) {
2261:
2262: yyValue = GNode.createFromPair(
2263: "PatternParameters", v$g$1, v$g$2);
2264: yyValue.setLocation(location(yyStart));
2265:
2266: return yyResult.createValue(yyValue, yyError);
2267: } else {
2268: yyError = yyError.select("\")\" expected",
2269: yyBase);
2270: }
2271: } // End scope for v$g$2.
2272: }
2273: }
2274:
2275: // Done.
2276: yyError = yyError
2277: .select("pattern parameters expected", yyStart);
2278: return yyError;
2279: }
2280:
2281: // =========================================================================
2282:
2283: /**
2284: * Parse nonterminal xtc.typical.Typical.BottomPattern.
2285: *
2286: * @param yyStart The index.
2287: * @return The result.
2288: * @throws IOException Signals an I/O error.
2289: */
2290: private Result pBottomPattern(final int yyStart) throws IOException {
2291: Result yyResult;
2292: Node yyValue;
2293: ParseError yyError = ParseError.DUMMY;
2294:
2295: // Alternative 1.
2296:
2297: yyResult = pKeyword(yyStart);
2298: yyError = yyResult.select(yyError);
2299: if (yyResult.hasValue("bottom")) {
2300:
2301: yyValue = GNode.create("BottomPattern", false);
2302: yyValue.setLocation(location(yyStart));
2303:
2304: return yyResult.createValue(yyValue, yyError);
2305: }
2306:
2307: // Done.
2308: yyError = yyError.select("bottom pattern expected", yyStart);
2309: return yyError;
2310: }
2311:
2312: // =========================================================================
2313:
2314: /**
2315: * Parse nonterminal xtc.typical.Typical.ListPattern.
2316: *
2317: * @param yyStart The index.
2318: * @return The result.
2319: * @throws IOException Signals an I/O error.
2320: */
2321: private Result pListPattern(final int yyStart) throws IOException {
2322: Result yyResult;
2323: int yyBase;
2324: int yyRepetition1;
2325: Pair<Node> yyRepValue1;
2326: Node yyValue;
2327: ParseError yyError = ParseError.DUMMY;
2328:
2329: // Alternative 1.
2330:
2331: yyResult = pSymbol(yyStart);
2332: yyError = yyResult.select(yyError);
2333: if (yyResult.hasValue("[")) {
2334:
2335: final int yyChoice1 = yyResult.index;
2336:
2337: // Nested alternative 1.
2338:
2339: yyResult = pWhenPattern(yyChoice1);
2340: yyError = yyResult.select(yyError);
2341: if (yyResult.hasValue()) {
2342: final Node v$g$1 = yyResult.semanticValue();
2343:
2344: yyRepetition1 = yyResult.index;
2345: yyRepValue1 = Pair.empty();
2346: while (true) {
2347:
2348: yyBase = yyRepetition1;
2349: yyResult = pSymbol(yyBase);
2350: yyError = yyResult.select(yyError);
2351: if (yyResult.hasValue(",")) {
2352:
2353: yyResult = pWhenPattern(yyResult.index);
2354: yyError = yyResult.select(yyError);
2355: if (yyResult.hasValue()) {
2356: final Node v$el$1 = yyResult
2357: .semanticValue();
2358:
2359: yyRepetition1 = yyResult.index;
2360: yyRepValue1 = new Pair<Node>(v$el$1,
2361: yyRepValue1);
2362: continue;
2363: }
2364: } else {
2365: yyError = yyError.select("\",\" expected",
2366: yyBase);
2367: }
2368: break;
2369: }
2370: { // Start scope for v$g$2.
2371: final Pair<Node> v$g$2 = yyRepValue1.reverse();
2372:
2373: yyBase = yyRepetition1;
2374: yyResult = pSymbol(yyBase);
2375: yyError = yyResult.select(yyError);
2376: if (yyResult.hasValue("]")) {
2377:
2378: yyValue = GNode.createFromPair("ListPattern",
2379: v$g$1, v$g$2);
2380: yyValue.setLocation(location(yyStart));
2381:
2382: return yyResult.createValue(yyValue, yyError);
2383: } else {
2384: yyError = yyError.select("\"]\" expected",
2385: yyBase);
2386: }
2387: } // End scope for v$g$2.
2388: }
2389:
2390: // Nested alternative 2.
2391:
2392: yyBase = yyChoice1;
2393: yyResult = pSymbol(yyBase);
2394: yyError = yyResult.select(yyError);
2395: if (yyResult.hasValue("]")) {
2396:
2397: yyValue = GNode.create("ListPattern", false);
2398: yyValue.setLocation(location(yyStart));
2399:
2400: return yyResult.createValue(yyValue, yyError);
2401: } else {
2402: yyError = yyError.select("\"]\" expected", yyBase);
2403: }
2404: }
2405:
2406: // Done.
2407: yyError = yyError.select("list pattern expected", yyStart);
2408: return yyError;
2409: }
2410:
2411: // =========================================================================
2412:
2413: /**
2414: * Parse nonterminal xtc.typical.Typical.RecordPattern.
2415: *
2416: * @param yyStart The index.
2417: * @return The result.
2418: * @throws IOException Signals an I/O error.
2419: */
2420: private Result pRecordPattern(final int yyStart) throws IOException {
2421: Result yyResult;
2422: int yyBase;
2423: int yyRepetition1;
2424: Pair<Node> yyRepValue1;
2425: Node yyValue;
2426: ParseError yyError = ParseError.DUMMY;
2427:
2428: // Alternative 1.
2429:
2430: yyResult = pSymbol(yyStart);
2431: yyError = yyResult.select(yyError);
2432: if (yyResult.hasValue("{")) {
2433:
2434: final int yyChoice1 = yyResult.index;
2435:
2436: // Nested alternative 1.
2437:
2438: yyResult = pFieldPattern(yyChoice1);
2439: yyError = yyResult.select(yyError);
2440: if (yyResult.hasValue()) {
2441: final Node v$g$1 = yyResult.semanticValue();
2442:
2443: yyRepetition1 = yyResult.index;
2444: yyRepValue1 = Pair.empty();
2445: while (true) {
2446:
2447: yyBase = yyRepetition1;
2448: yyResult = pSymbol(yyBase);
2449: yyError = yyResult.select(yyError);
2450: if (yyResult.hasValue(",")) {
2451:
2452: yyResult = pFieldPattern(yyResult.index);
2453: yyError = yyResult.select(yyError);
2454: if (yyResult.hasValue()) {
2455: final Node v$el$1 = yyResult
2456: .semanticValue();
2457:
2458: yyRepetition1 = yyResult.index;
2459: yyRepValue1 = new Pair<Node>(v$el$1,
2460: yyRepValue1);
2461: continue;
2462: }
2463: } else {
2464: yyError = yyError.select("\",\" expected",
2465: yyBase);
2466: }
2467: break;
2468: }
2469: { // Start scope for v$g$2.
2470: final Pair<Node> v$g$2 = yyRepValue1.reverse();
2471:
2472: yyBase = yyRepetition1;
2473: yyResult = pSymbol(yyBase);
2474: yyError = yyResult.select(yyError);
2475: if (yyResult.hasValue("}")) {
2476:
2477: yyValue = GNode.createFromPair("RecordPattern",
2478: v$g$1, v$g$2);
2479: yyValue.setLocation(location(yyStart));
2480:
2481: return yyResult.createValue(yyValue, yyError);
2482: } else {
2483: yyError = yyError.select("\"}\" expected",
2484: yyBase);
2485: }
2486: } // End scope for v$g$2.
2487: }
2488:
2489: // Nested alternative 2.
2490:
2491: yyBase = yyChoice1;
2492: yyResult = pSymbol(yyBase);
2493: yyError = yyResult.select(yyError);
2494: if (yyResult.hasValue("}")) {
2495:
2496: yyValue = GNode.create("RecordPattern", false);
2497: yyValue.setLocation(location(yyStart));
2498:
2499: return yyResult.createValue(yyValue, yyError);
2500: } else {
2501: yyError = yyError.select("\"}\" expected", yyBase);
2502: }
2503: }
2504:
2505: // Done.
2506: yyError = yyError.select("record pattern expected", yyStart);
2507: return yyError;
2508: }
2509:
2510: // =========================================================================
2511:
2512: /**
2513: * Parse nonterminal xtc.typical.Typical.FieldPattern.
2514: *
2515: * @param yyStart The index.
2516: * @return The result.
2517: * @throws IOException Signals an I/O error.
2518: */
2519: private Result pFieldPattern(final int yyStart) throws IOException {
2520: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
2521: if (null == yyColumn.chunk2)
2522: yyColumn.chunk2 = new Chunk2();
2523: if (null == yyColumn.chunk2.fFieldPattern)
2524: yyColumn.chunk2.fFieldPattern = pFieldPattern$1(yyStart);
2525: return yyColumn.chunk2.fFieldPattern;
2526: }
2527:
2528: /** Actually parse xtc.typical.Typical.FieldPattern. */
2529: private Result pFieldPattern$1(final int yyStart)
2530: throws IOException {
2531: Result yyResult;
2532: int yyBase;
2533: Node yyValue;
2534: ParseError yyError = ParseError.DUMMY;
2535:
2536: // Alternative 1.
2537:
2538: yyResult = pLowerID(yyStart);
2539: yyError = yyResult.select(yyError);
2540: if (yyResult.hasValue()) {
2541: final Node v$g$1 = yyResult.semanticValue();
2542:
2543: yyBase = yyResult.index;
2544: yyResult = pSymbol(yyBase);
2545: yyError = yyResult.select(yyError);
2546: if (yyResult.hasValue("=")) {
2547:
2548: yyResult = pWhenPattern(yyResult.index);
2549: yyError = yyResult.select(yyError);
2550: if (yyResult.hasValue()) {
2551: final Node v$g$2 = yyResult.semanticValue();
2552:
2553: yyValue = GNode
2554: .create("FieldPattern", v$g$1, v$g$2);
2555: yyValue.setLocation(location(yyStart));
2556:
2557: return yyResult.createValue(yyValue, yyError);
2558: }
2559: } else {
2560: yyError = yyError.select("\"=\" expected", yyBase);
2561: }
2562: }
2563:
2564: // Done.
2565: return yyError;
2566: }
2567:
2568: // =========================================================================
2569:
2570: /**
2571: * Parse nonterminal xtc.typical.Typical.WildCard.
2572: *
2573: * @param yyStart The index.
2574: * @return The result.
2575: * @throws IOException Signals an I/O error.
2576: */
2577: private Result pWildCard(final int yyStart) throws IOException {
2578: Result yyResult;
2579: Node yyValue;
2580: ParseError yyError = ParseError.DUMMY;
2581:
2582: // Alternative 1.
2583:
2584: yyResult = pKeyword(yyStart);
2585: yyError = yyResult.select(yyError);
2586: if (yyResult.hasValue("_")) {
2587:
2588: yyValue = GNode.create("WildCard", false);
2589: yyValue.setLocation(location(yyStart));
2590:
2591: return yyResult.createValue(yyValue, yyError);
2592: }
2593:
2594: // Done.
2595: yyError = yyError.select("wild card expected", yyStart);
2596: return yyError;
2597: }
2598:
2599: // =========================================================================
2600:
2601: /**
2602: * Parse nonterminal xtc.typical.Typical.Expression.
2603: *
2604: * @param yyStart The index.
2605: * @return The result.
2606: * @throws IOException Signals an I/O error.
2607: */
2608: private Result pExpression(final int yyStart) throws IOException {
2609: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
2610: if (null == yyColumn.chunk2)
2611: yyColumn.chunk2 = new Chunk2();
2612: if (null == yyColumn.chunk2.fExpression)
2613: yyColumn.chunk2.fExpression = pExpression$1(yyStart);
2614: return yyColumn.chunk2.fExpression;
2615: }
2616:
2617: /** Actually parse xtc.typical.Typical.Expression. */
2618: private Result pExpression$1(final int yyStart) throws IOException {
2619: Result yyResult;
2620: Node yyValue;
2621: ParseError yyError = ParseError.DUMMY;
2622:
2623: // Alternative 1.
2624:
2625: yyResult = pTupleLiteral(yyStart);
2626: yyError = yyResult.select(yyError);
2627: if (yyResult.hasValue()) {
2628: yyValue = yyResult.semanticValue();
2629:
2630: return yyResult.createValue(yyValue, yyError);
2631: }
2632:
2633: // Done.
2634: return yyError;
2635: }
2636:
2637: // =========================================================================
2638:
2639: /**
2640: * Parse nonterminal xtc.typical.Typical.TupleLiteral.
2641: *
2642: * @param yyStart The index.
2643: * @return The result.
2644: * @throws IOException Signals an I/O error.
2645: */
2646: private Result pTupleLiteral(final int yyStart) throws IOException {
2647: Result yyResult;
2648: int yyBase;
2649: int yyRepetition1;
2650: boolean yyRepeated1;
2651: Pair<Node> yyRepValue1;
2652: Node yyValue;
2653: ParseError yyError = ParseError.DUMMY;
2654:
2655: // Alternative <Recursion>.
2656:
2657: yyResult = pLogicalOrExpression(yyStart);
2658: yyError = yyResult.select(yyError);
2659: if (yyResult.hasValue()) {
2660: final Node v$g$1 = yyResult.semanticValue();
2661:
2662: yyRepetition1 = yyResult.index;
2663: yyRepeated1 = false;
2664: yyRepValue1 = Pair.empty();
2665: while (true) {
2666:
2667: yyBase = yyRepetition1;
2668: yyResult = pSymbol(yyBase);
2669: yyError = yyResult.select(yyError);
2670: if (yyResult.hasValue(",")) {
2671:
2672: yyResult = pLogicalOrExpression(yyResult.index);
2673: yyError = yyResult.select(yyError);
2674: if (yyResult.hasValue()) {
2675: final Node v$el$1 = yyResult.semanticValue();
2676:
2677: yyRepetition1 = yyResult.index;
2678: yyRepeated1 = true;
2679: yyRepValue1 = new Pair<Node>(v$el$1,
2680: yyRepValue1);
2681: continue;
2682: }
2683: } else {
2684: yyError = yyError.select("\",\" expected", yyBase);
2685: }
2686: break;
2687: }
2688:
2689: if (yyRepeated1) {
2690: final Pair<Node> v$g$2 = yyRepValue1.reverse();
2691:
2692: yyValue = GNode.createFromPair("TupleLiteral", v$g$1,
2693: v$g$2);
2694: yyValue.setLocation(location(yyStart));
2695:
2696: return new SemanticValue(yyValue, yyRepetition1,
2697: yyError);
2698: }
2699: }
2700:
2701: // Alternative <Base>.
2702:
2703: yyResult = pLogicalOrExpression(yyStart);
2704: yyError = yyResult.select(yyError);
2705: if (yyResult.hasValue()) {
2706: yyValue = yyResult.semanticValue();
2707:
2708: return yyResult.createValue(yyValue, yyError);
2709: }
2710:
2711: // Done.
2712: return yyError;
2713: }
2714:
2715: // =========================================================================
2716:
2717: /**
2718: * Parse nonterminal xtc.typical.Typical.LogicalOrExpression.
2719: *
2720: * @param yyStart The index.
2721: * @return The result.
2722: * @throws IOException Signals an I/O error.
2723: */
2724: private Result pLogicalOrExpression(final int yyStart)
2725: throws IOException {
2726: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
2727: if (null == yyColumn.chunk2)
2728: yyColumn.chunk2 = new Chunk2();
2729: if (null == yyColumn.chunk2.fLogicalOrExpression)
2730: yyColumn.chunk2.fLogicalOrExpression = pLogicalOrExpression$1(yyStart);
2731: return yyColumn.chunk2.fLogicalOrExpression;
2732: }
2733:
2734: /** Actually parse xtc.typical.Typical.LogicalOrExpression. */
2735: private Result pLogicalOrExpression$1(final int yyStart)
2736: throws IOException {
2737:
2738: Result yyResult;
2739: int yyRepetition1;
2740: Pair<Action<Node>> yyRepValue1;
2741: Node yyValue;
2742: ParseError yyError = ParseError.DUMMY;
2743:
2744: // Alternative <Base>.
2745:
2746: yyResult = pLogicalAndExpression(yyStart);
2747: yyError = yyResult.select(yyError);
2748: if (yyResult.hasValue()) {
2749: final Node v$3 = yyResult.semanticValue();
2750:
2751: yyRepetition1 = yyResult.index;
2752: yyRepValue1 = Pair.empty();
2753: while (true) {
2754:
2755: yyResult = pLogicalOrExpression$$Tail1(yyRepetition1);
2756: yyError = yyResult.select(yyError);
2757: if (yyResult.hasValue()) {
2758: final Action<Node> v$4 = yyResult.semanticValue();
2759:
2760: yyRepetition1 = yyResult.index;
2761: yyRepValue1 = new Pair<Action<Node>>(v$4,
2762: yyRepValue1);
2763: continue;
2764: }
2765: break;
2766: }
2767: { // Start scope for v$5.
2768: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
2769:
2770: yyValue = apply(v$5, v$3, yyStart);
2771:
2772: return new SemanticValue(yyValue, yyRepetition1,
2773: yyError);
2774: } // End scope for v$5.
2775: }
2776:
2777: // Done.
2778: return yyError;
2779: }
2780:
2781: // =========================================================================
2782:
2783: /**
2784: * Parse synthetic nonterminal
2785: * xtc.typical.Typical.LogicalOrExpression$$Tail1.
2786: *
2787: * @param yyStart The index.
2788: * @return The result.
2789: * @throws IOException Signals an I/O error.
2790: */
2791: private Result pLogicalOrExpression$$Tail1(final int yyStart)
2792: throws IOException {
2793:
2794: Result yyResult;
2795: Action<Node> yyValue;
2796: ParseError yyError = ParseError.DUMMY;
2797:
2798: // Alternative <Or>.
2799:
2800: yyResult = pSymbol(yyStart);
2801: yyError = yyResult.select(yyError);
2802: if (yyResult.hasValue("||")) {
2803:
2804: yyResult = pLogicalAndExpression(yyResult.index);
2805: yyError = yyResult.select(yyError);
2806: if (yyResult.hasValue()) {
2807: final Node v$g$2 = yyResult.semanticValue();
2808:
2809: yyValue = new Action<Node>() {
2810: public Node run(Node v$1) {
2811: return GNode.create("LogicalOrExpression", v$1,
2812: v$g$2);
2813: }
2814: };
2815:
2816: return yyResult.createValue(yyValue, yyError);
2817: }
2818: }
2819:
2820: // Done.
2821: yyError = yyError.select("logical or expression expected",
2822: yyStart);
2823: return yyError;
2824: }
2825:
2826: // =========================================================================
2827:
2828: /**
2829: * Parse nonterminal xtc.typical.Typical.LogicalAndExpression.
2830: *
2831: * @param yyStart The index.
2832: * @return The result.
2833: * @throws IOException Signals an I/O error.
2834: */
2835: private Result pLogicalAndExpression(final int yyStart)
2836: throws IOException {
2837: Result yyResult;
2838: int yyRepetition1;
2839: Pair<Action<Node>> yyRepValue1;
2840: Node yyValue;
2841: ParseError yyError = ParseError.DUMMY;
2842:
2843: // Alternative <Base>.
2844:
2845: yyResult = pEqualityExpression(yyStart);
2846: yyError = yyResult.select(yyError);
2847: if (yyResult.hasValue()) {
2848: final Node v$3 = yyResult.semanticValue();
2849:
2850: yyRepetition1 = yyResult.index;
2851: yyRepValue1 = Pair.empty();
2852: while (true) {
2853:
2854: yyResult = pLogicalAndExpression$$Tail1(yyRepetition1);
2855: yyError = yyResult.select(yyError);
2856: if (yyResult.hasValue()) {
2857: final Action<Node> v$4 = yyResult.semanticValue();
2858:
2859: yyRepetition1 = yyResult.index;
2860: yyRepValue1 = new Pair<Action<Node>>(v$4,
2861: yyRepValue1);
2862: continue;
2863: }
2864: break;
2865: }
2866: { // Start scope for v$5.
2867: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
2868:
2869: yyValue = apply(v$5, v$3, yyStart);
2870:
2871: return new SemanticValue(yyValue, yyRepetition1,
2872: yyError);
2873: } // End scope for v$5.
2874: }
2875:
2876: // Done.
2877: return yyError;
2878: }
2879:
2880: // =========================================================================
2881:
2882: /**
2883: * Parse synthetic nonterminal
2884: * xtc.typical.Typical.LogicalAndExpression$$Tail1.
2885: *
2886: * @param yyStart The index.
2887: * @return The result.
2888: * @throws IOException Signals an I/O error.
2889: */
2890: private Result pLogicalAndExpression$$Tail1(final int yyStart)
2891: throws IOException {
2892:
2893: Result yyResult;
2894: Action<Node> yyValue;
2895: ParseError yyError = ParseError.DUMMY;
2896:
2897: // Alternative <And>.
2898:
2899: yyResult = pSymbol(yyStart);
2900: yyError = yyResult.select(yyError);
2901: if (yyResult.hasValue("&&")) {
2902:
2903: yyResult = pEqualityExpression(yyResult.index);
2904: yyError = yyResult.select(yyError);
2905: if (yyResult.hasValue()) {
2906: final Node v$g$2 = yyResult.semanticValue();
2907:
2908: yyValue = new Action<Node>() {
2909: public Node run(Node v$1) {
2910: return GNode.create("LogicalAndExpression",
2911: v$1, v$g$2);
2912: }
2913: };
2914:
2915: return yyResult.createValue(yyValue, yyError);
2916: }
2917: }
2918:
2919: // Done.
2920: yyError = yyError.select("logical and expression expected",
2921: yyStart);
2922: return yyError;
2923: }
2924:
2925: // =========================================================================
2926:
2927: /**
2928: * Parse nonterminal xtc.typical.Typical.EqualityExpression.
2929: *
2930: * @param yyStart The index.
2931: * @return The result.
2932: * @throws IOException Signals an I/O error.
2933: */
2934: private Result pEqualityExpression(final int yyStart)
2935: throws IOException {
2936: Result yyResult;
2937: int yyRepetition1;
2938: Pair<Action<Node>> yyRepValue1;
2939: Node yyValue;
2940: ParseError yyError = ParseError.DUMMY;
2941:
2942: // Alternative <Base>.
2943:
2944: yyResult = pRelationalExpression(yyStart);
2945: yyError = yyResult.select(yyError);
2946: if (yyResult.hasValue()) {
2947: final Node v$4 = yyResult.semanticValue();
2948:
2949: yyRepetition1 = yyResult.index;
2950: yyRepValue1 = Pair.empty();
2951: while (true) {
2952:
2953: yyResult = pEqualityExpression$$Tail1(yyRepetition1);
2954: yyError = yyResult.select(yyError);
2955: if (yyResult.hasValue()) {
2956: final Action<Node> v$5 = yyResult.semanticValue();
2957:
2958: yyRepetition1 = yyResult.index;
2959: yyRepValue1 = new Pair<Action<Node>>(v$5,
2960: yyRepValue1);
2961: continue;
2962: }
2963: break;
2964: }
2965: { // Start scope for v$6.
2966: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
2967:
2968: yyValue = apply(v$6, v$4, yyStart);
2969:
2970: return new SemanticValue(yyValue, yyRepetition1,
2971: yyError);
2972: } // End scope for v$6.
2973: }
2974:
2975: // Done.
2976: return yyError;
2977: }
2978:
2979: // =========================================================================
2980:
2981: /**
2982: * Parse synthetic nonterminal
2983: * xtc.typical.Typical.EqualityExpression$$Tail1.
2984: *
2985: * @param yyStart The index.
2986: * @return The result.
2987: * @throws IOException Signals an I/O error.
2988: */
2989: private Result pEqualityExpression$$Tail1(final int yyStart)
2990: throws IOException {
2991:
2992: Result yyResult;
2993: Action<Node> yyValue;
2994: ParseError yyError = ParseError.DUMMY;
2995:
2996: // Alternative <Recursion>.
2997:
2998: yyResult = pEqualityOperator(yyStart);
2999: yyError = yyResult.select(yyError);
3000: if (yyResult.hasValue()) {
3001: final String v$g$2 = yyResult.semanticValue();
3002:
3003: yyResult = pRelationalExpression(yyResult.index);
3004: yyError = yyResult.select(yyError);
3005: if (yyResult.hasValue()) {
3006: final Node v$g$3 = yyResult.semanticValue();
3007:
3008: yyValue = new Action<Node>() {
3009: public Node run(Node v$1) {
3010: return GNode.create("EqualityExpression", v$1,
3011: v$g$2, v$g$3);
3012: }
3013: };
3014:
3015: return yyResult.createValue(yyValue, yyError);
3016: }
3017: }
3018:
3019: // Done.
3020: return yyError;
3021: }
3022:
3023: // =========================================================================
3024:
3025: /**
3026: * Parse nonterminal xtc.typical.Typical.EqualityOperator.
3027: *
3028: * @param yyStart The index.
3029: * @return The result.
3030: * @throws IOException Signals an I/O error.
3031: */
3032: private Result pEqualityOperator(final int yyStart)
3033: throws IOException {
3034: Result yyResult;
3035: String yyValue;
3036: ParseError yyError = ParseError.DUMMY;
3037:
3038: // Alternative <Equal>.
3039:
3040: yyResult = pSymbol(yyStart);
3041: yyError = yyResult.select(yyError);
3042: if (yyResult.hasValue("=")) {
3043: yyValue = "=";
3044:
3045: return yyResult.createValue(yyValue, yyError);
3046: }
3047:
3048: // Alternative <NotEqual>.
3049:
3050: yyResult = pSymbol(yyStart);
3051: yyError = yyResult.select(yyError);
3052: if (yyResult.hasValue("!=")) {
3053: yyValue = "!=";
3054:
3055: return yyResult.createValue(yyValue, yyError);
3056: }
3057:
3058: // Done.
3059: yyError = yyError.select("equality operator expected", yyStart);
3060: return yyError;
3061: }
3062:
3063: // =========================================================================
3064:
3065: /**
3066: * Parse nonterminal xtc.typical.Typical.RelationalExpression.
3067: *
3068: * @param yyStart The index.
3069: * @return The result.
3070: * @throws IOException Signals an I/O error.
3071: */
3072: private Result pRelationalExpression(final int yyStart)
3073: throws IOException {
3074: Result yyResult;
3075: int yyRepetition1;
3076: Pair<Action<Node>> yyRepValue1;
3077: Node yyValue;
3078: ParseError yyError = ParseError.DUMMY;
3079:
3080: // Alternative 1.
3081:
3082: yyResult = pAdditiveExpression(yyStart);
3083: yyError = yyResult.select(yyError);
3084: if (yyResult.hasValue()) {
3085: final Node v$g$4 = yyResult.semanticValue();
3086:
3087: yyRepetition1 = yyResult.index;
3088: yyRepValue1 = Pair.empty();
3089: while (true) {
3090:
3091: yyResult = pRelationalExpression$$Tail1(yyRepetition1);
3092: yyError = yyResult.select(yyError);
3093: if (yyResult.hasValue()) {
3094: final Action<Node> v$5 = yyResult.semanticValue();
3095:
3096: yyRepetition1 = yyResult.index;
3097: yyRepValue1 = new Pair<Action<Node>>(v$5,
3098: yyRepValue1);
3099: continue;
3100: }
3101: break;
3102: }
3103: { // Start scope for v$6.
3104: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
3105:
3106: yyValue = apply(v$6, v$g$4, yyStart);
3107:
3108: return new SemanticValue(yyValue, yyRepetition1,
3109: yyError);
3110: } // End scope for v$6.
3111: }
3112:
3113: // Done.
3114: return yyError;
3115: }
3116:
3117: // =========================================================================
3118:
3119: /**
3120: * Parse synthetic nonterminal
3121: * xtc.typical.Typical.RelationalExpression$$Tail1.
3122: *
3123: * @param yyStart The index.
3124: * @return The result.
3125: * @throws IOException Signals an I/O error.
3126: */
3127: private Result pRelationalExpression$$Tail1(final int yyStart)
3128: throws IOException {
3129:
3130: Result yyResult;
3131: Action<Node> yyValue;
3132: ParseError yyError = ParseError.DUMMY;
3133:
3134: // Alternative <Recursion>.
3135:
3136: yyResult = pRelationalOperator(yyStart);
3137: yyError = yyResult.select(yyError);
3138: if (yyResult.hasValue()) {
3139: final String v$g$2 = yyResult.semanticValue();
3140:
3141: yyResult = pAdditiveExpression(yyResult.index);
3142: yyError = yyResult.select(yyError);
3143: if (yyResult.hasValue()) {
3144: final Node v$g$3 = yyResult.semanticValue();
3145:
3146: yyValue = new Action<Node>() {
3147: public Node run(Node v$1) {
3148: return GNode.create("RelationalExpression",
3149: v$1, v$g$2, v$g$3);
3150: }
3151: };
3152:
3153: return yyResult.createValue(yyValue, yyError);
3154: }
3155: }
3156:
3157: // Done.
3158: return yyError;
3159: }
3160:
3161: // =========================================================================
3162:
3163: /**
3164: * Parse nonterminal xtc.typical.Typical.RelationalOperator.
3165: *
3166: * @param yyStart The index.
3167: * @return The result.
3168: * @throws IOException Signals an I/O error.
3169: */
3170: private Result pRelationalOperator(final int yyStart)
3171: throws IOException {
3172: Result yyResult;
3173: String yyValue;
3174: ParseError yyError = ParseError.DUMMY;
3175:
3176: // Alternative 1.
3177:
3178: yyResult = pIntegerRelationalOperator(yyStart);
3179: yyError = yyResult.select(yyError);
3180: if (yyResult.hasValue()) {
3181: yyValue = yyResult.semanticValue();
3182:
3183: return yyResult.createValue(yyValue, yyError);
3184: }
3185:
3186: // Alternative 2.
3187:
3188: yyResult = pFloatRelationalOperator(yyStart);
3189: yyError = yyResult.select(yyError);
3190: if (yyResult.hasValue()) {
3191: yyValue = yyResult.semanticValue();
3192:
3193: return yyResult.createValue(yyValue, yyError);
3194: }
3195:
3196: // Done.
3197: return yyError;
3198: }
3199:
3200: // =========================================================================
3201:
3202: /**
3203: * Parse nonterminal xtc.typical.Typical.IntegerRelationalOperator.
3204: *
3205: * @param yyStart The index.
3206: * @return The result.
3207: * @throws IOException Signals an I/O error.
3208: */
3209: private Result pIntegerRelationalOperator(final int yyStart)
3210: throws IOException {
3211:
3212: Result yyResult;
3213: String yyValue;
3214: ParseError yyError = ParseError.DUMMY;
3215:
3216: // Alternative <IntegerLessEqual>.
3217:
3218: yyResult = pSymbol(yyStart);
3219: yyError = yyResult.select(yyError);
3220: if (yyResult.hasValue("<=")) {
3221: yyValue = "<=";
3222:
3223: return yyResult.createValue(yyValue, yyError);
3224: }
3225:
3226: // Alternative <IntegerLess>.
3227:
3228: yyResult = pSymbol(yyStart);
3229: yyError = yyResult.select(yyError);
3230: if (yyResult.hasValue("<")) {
3231: yyValue = "<";
3232:
3233: return yyResult.createValue(yyValue, yyError);
3234: }
3235:
3236: // Alternative <IntegerGreaterEqual>.
3237:
3238: yyResult = pSymbol(yyStart);
3239: yyError = yyResult.select(yyError);
3240: if (yyResult.hasValue(">=")) {
3241: yyValue = ">=";
3242:
3243: return yyResult.createValue(yyValue, yyError);
3244: }
3245:
3246: // Alternative <IntegerGreater>.
3247:
3248: yyResult = pSymbol(yyStart);
3249: yyError = yyResult.select(yyError);
3250: if (yyResult.hasValue(">")) {
3251: yyValue = ">";
3252:
3253: return yyResult.createValue(yyValue, yyError);
3254: }
3255:
3256: // Done.
3257: yyError = yyError.select(
3258: "integer relational operator expected", yyStart);
3259: return yyError;
3260: }
3261:
3262: // =========================================================================
3263:
3264: /**
3265: * Parse nonterminal xtc.typical.Typical.FloatRelationalOperator.
3266: *
3267: * @param yyStart The index.
3268: * @return The result.
3269: * @throws IOException Signals an I/O error.
3270: */
3271: private Result pFloatRelationalOperator(final int yyStart)
3272: throws IOException {
3273:
3274: Result yyResult;
3275: String yyValue;
3276: ParseError yyError = ParseError.DUMMY;
3277:
3278: // Alternative <FloatLessEqual>.
3279:
3280: yyResult = pSymbol(yyStart);
3281: yyError = yyResult.select(yyError);
3282: if (yyResult.hasValue("<=.")) {
3283: yyValue = "<=.";
3284:
3285: return yyResult.createValue(yyValue, yyError);
3286: }
3287:
3288: // Alternative <FloatLess>.
3289:
3290: yyResult = pSymbol(yyStart);
3291: yyError = yyResult.select(yyError);
3292: if (yyResult.hasValue("<.")) {
3293: yyValue = "<.";
3294:
3295: return yyResult.createValue(yyValue, yyError);
3296: }
3297:
3298: // Alternative <FloatGreaterEqual>.
3299:
3300: yyResult = pSymbol(yyStart);
3301: yyError = yyResult.select(yyError);
3302: if (yyResult.hasValue(">=.")) {
3303: yyValue = ">=.";
3304:
3305: return yyResult.createValue(yyValue, yyError);
3306: }
3307:
3308: // Alternative <FloatGreater>.
3309:
3310: yyResult = pSymbol(yyStart);
3311: yyError = yyResult.select(yyError);
3312: if (yyResult.hasValue(">.")) {
3313: yyValue = ">.";
3314:
3315: return yyResult.createValue(yyValue, yyError);
3316: }
3317:
3318: // Done.
3319: yyError = yyError.select("float relational operator expected",
3320: yyStart);
3321: return yyError;
3322: }
3323:
3324: // =========================================================================
3325:
3326: /**
3327: * Parse nonterminal xtc.typical.Typical.AdditiveExpression.
3328: *
3329: * @param yyStart The index.
3330: * @return The result.
3331: * @throws IOException Signals an I/O error.
3332: */
3333: private Result pAdditiveExpression(final int yyStart)
3334: throws IOException {
3335: Result yyResult;
3336: int yyRepetition1;
3337: Pair<Action<Node>> yyRepValue1;
3338: Node yyValue;
3339: ParseError yyError = ParseError.DUMMY;
3340:
3341: // Alternative <Base>.
3342:
3343: yyResult = pConcatenationExpression(yyStart);
3344: yyError = yyResult.select(yyError);
3345: if (yyResult.hasValue()) {
3346: final Node v$g$4 = yyResult.semanticValue();
3347:
3348: yyRepetition1 = yyResult.index;
3349: yyRepValue1 = Pair.empty();
3350: while (true) {
3351:
3352: yyResult = pAdditiveExpression$$Tail1(yyRepetition1);
3353: yyError = yyResult.select(yyError);
3354: if (yyResult.hasValue()) {
3355: final Action<Node> v$5 = yyResult.semanticValue();
3356:
3357: yyRepetition1 = yyResult.index;
3358: yyRepValue1 = new Pair<Action<Node>>(v$5,
3359: yyRepValue1);
3360: continue;
3361: }
3362: break;
3363: }
3364: { // Start scope for v$6.
3365: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
3366:
3367: yyValue = apply(v$6, v$g$4, yyStart);
3368:
3369: return new SemanticValue(yyValue, yyRepetition1,
3370: yyError);
3371: } // End scope for v$6.
3372: }
3373:
3374: // Done.
3375: return yyError;
3376: }
3377:
3378: // =========================================================================
3379:
3380: /**
3381: * Parse synthetic nonterminal
3382: * xtc.typical.Typical.AdditiveExpression$$Tail1.
3383: *
3384: * @param yyStart The index.
3385: * @return The result.
3386: * @throws IOException Signals an I/O error.
3387: */
3388: private Result pAdditiveExpression$$Tail1(final int yyStart)
3389: throws IOException {
3390:
3391: Result yyResult;
3392: Action<Node> yyValue;
3393: ParseError yyError = ParseError.DUMMY;
3394:
3395: // Alternative <Recursion>.
3396:
3397: yyResult = pAdditiveOperator(yyStart);
3398: yyError = yyResult.select(yyError);
3399: if (yyResult.hasValue()) {
3400: final String v$g$2 = yyResult.semanticValue();
3401:
3402: yyResult = pMultiplicativeExpression(yyResult.index);
3403: yyError = yyResult.select(yyError);
3404: if (yyResult.hasValue()) {
3405: final Node v$g$3 = yyResult.semanticValue();
3406:
3407: yyValue = new Action<Node>() {
3408: public Node run(Node v$1) {
3409: return GNode.create("AdditiveExpression", v$1,
3410: v$g$2, v$g$3);
3411: }
3412: };
3413:
3414: return yyResult.createValue(yyValue, yyError);
3415: }
3416: }
3417:
3418: // Done.
3419: return yyError;
3420: }
3421:
3422: // =========================================================================
3423:
3424: /**
3425: * Parse nonterminal xtc.typical.Typical.ConcatenationExpression.
3426: *
3427: * @param yyStart The index.
3428: * @return The result.
3429: * @throws IOException Signals an I/O error.
3430: */
3431: private Result pConcatenationExpression(final int yyStart)
3432: throws IOException {
3433:
3434: Result yyResult;
3435: int yyRepetition1;
3436: Pair<Action<Node>> yyRepValue1;
3437: Node yyValue;
3438: ParseError yyError = ParseError.DUMMY;
3439:
3440: // Alternative <Base>.
3441:
3442: yyResult = pMultiplicativeExpression(yyStart);
3443: yyError = yyResult.select(yyError);
3444: if (yyResult.hasValue()) {
3445: final Node v$g$4 = yyResult.semanticValue();
3446:
3447: yyRepetition1 = yyResult.index;
3448: yyRepValue1 = Pair.empty();
3449: while (true) {
3450:
3451: yyResult = pConcatenationExpression$$Tail1(yyRepetition1);
3452: yyError = yyResult.select(yyError);
3453: if (yyResult.hasValue()) {
3454: final Action<Node> v$5 = yyResult.semanticValue();
3455:
3456: yyRepetition1 = yyResult.index;
3457: yyRepValue1 = new Pair<Action<Node>>(v$5,
3458: yyRepValue1);
3459: continue;
3460: }
3461: break;
3462: }
3463: { // Start scope for v$6.
3464: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
3465:
3466: yyValue = apply(v$6, v$g$4, yyStart);
3467:
3468: return new SemanticValue(yyValue, yyRepetition1,
3469: yyError);
3470: } // End scope for v$6.
3471: }
3472:
3473: // Done.
3474: return yyError;
3475: }
3476:
3477: // =========================================================================
3478:
3479: /**
3480: * Parse synthetic nonterminal
3481: * xtc.typical.Typical.ConcatenationExpression$$Tail1.
3482: *
3483: * @param yyStart The index.
3484: * @return The result.
3485: * @throws IOException Signals an I/O error.
3486: */
3487: private Result pConcatenationExpression$$Tail1(final int yyStart)
3488: throws IOException {
3489:
3490: Result yyResult;
3491: Action<Node> yyValue;
3492: ParseError yyError = ParseError.DUMMY;
3493:
3494: // Alternative <Recursion>.
3495:
3496: yyResult = pConcatenationOperator(yyStart);
3497: yyError = yyResult.select(yyError);
3498: if (yyResult.hasValue()) {
3499: final String v$g$2 = yyResult.semanticValue();
3500:
3501: yyResult = pMultiplicativeExpression(yyResult.index);
3502: yyError = yyResult.select(yyError);
3503: if (yyResult.hasValue()) {
3504: final Node v$g$3 = yyResult.semanticValue();
3505:
3506: yyValue = new Action<Node>() {
3507: public Node run(Node v$1) {
3508: return GNode.create("ConcatenationExpression",
3509: v$1, v$g$2, v$g$3);
3510: }
3511: };
3512:
3513: return yyResult.createValue(yyValue, yyError);
3514: }
3515: }
3516:
3517: // Done.
3518: return yyError;
3519: }
3520:
3521: // =========================================================================
3522:
3523: /**
3524: * Parse nonterminal xtc.typical.Typical.AdditiveOperator.
3525: *
3526: * @param yyStart The index.
3527: * @return The result.
3528: * @throws IOException Signals an I/O error.
3529: */
3530: private Result pAdditiveOperator(final int yyStart)
3531: throws IOException {
3532: Result yyResult;
3533: String yyValue;
3534: ParseError yyError = ParseError.DUMMY;
3535:
3536: // Alternative 1.
3537:
3538: yyResult = pIntegerAdditiveOperator(yyStart);
3539: yyError = yyResult.select(yyError);
3540: if (yyResult.hasValue()) {
3541: yyValue = yyResult.semanticValue();
3542:
3543: return yyResult.createValue(yyValue, yyError);
3544: }
3545:
3546: // Alternative 2.
3547:
3548: yyResult = pFloatAdditiveOperator(yyStart);
3549: yyError = yyResult.select(yyError);
3550: if (yyResult.hasValue()) {
3551: yyValue = yyResult.semanticValue();
3552:
3553: return yyResult.createValue(yyValue, yyError);
3554: }
3555:
3556: // Done.
3557: return yyError;
3558: }
3559:
3560: // =========================================================================
3561:
3562: /**
3563: * Parse nonterminal xtc.typical.Typical.ConcatenationOperator.
3564: *
3565: * @param yyStart The index.
3566: * @return The result.
3567: * @throws IOException Signals an I/O error.
3568: */
3569: private Result pConcatenationOperator(final int yyStart)
3570: throws IOException {
3571:
3572: Result yyResult;
3573: String yyValue;
3574: ParseError yyError = ParseError.DUMMY;
3575:
3576: // Alternative 1.
3577:
3578: yyResult = pSymbol(yyStart);
3579: yyError = yyResult.select(yyError);
3580: if (yyResult.hasValue("^")) {
3581: yyValue = "^";
3582:
3583: return yyResult.createValue(yyValue, yyError);
3584: }
3585:
3586: // Alternative 2.
3587:
3588: yyResult = pSymbol(yyStart);
3589: yyError = yyResult.select(yyError);
3590: if (yyResult.hasValue("@")) {
3591: yyValue = "@";
3592:
3593: return yyResult.createValue(yyValue, yyError);
3594: }
3595:
3596: // Done.
3597: yyError = yyError.select("concatenation operator expected",
3598: yyStart);
3599: return yyError;
3600: }
3601:
3602: // =========================================================================
3603:
3604: /**
3605: * Parse nonterminal xtc.typical.Typical.IntegerAdditiveOperator.
3606: *
3607: * @param yyStart The index.
3608: * @return The result.
3609: * @throws IOException Signals an I/O error.
3610: */
3611: private Result pIntegerAdditiveOperator(final int yyStart)
3612: throws IOException {
3613:
3614: Result yyResult;
3615: String yyValue;
3616: ParseError yyError = ParseError.DUMMY;
3617:
3618: // Alternative <IntegerPlus>.
3619:
3620: yyResult = pSymbol(yyStart);
3621: yyError = yyResult.select(yyError);
3622: if (yyResult.hasValue("+")) {
3623: yyValue = "+";
3624:
3625: return yyResult.createValue(yyValue, yyError);
3626: }
3627:
3628: // Alternative <IntegerMinus>.
3629:
3630: yyResult = pSymbol(yyStart);
3631: yyError = yyResult.select(yyError);
3632: if (yyResult.hasValue("-")) {
3633: yyValue = "-";
3634:
3635: return yyResult.createValue(yyValue, yyError);
3636: }
3637:
3638: // Done.
3639: yyError = yyError.select("integer additive operator expected",
3640: yyStart);
3641: return yyError;
3642: }
3643:
3644: // =========================================================================
3645:
3646: /**
3647: * Parse nonterminal xtc.typical.Typical.FloatAdditiveOperator.
3648: *
3649: * @param yyStart The index.
3650: * @return The result.
3651: * @throws IOException Signals an I/O error.
3652: */
3653: private Result pFloatAdditiveOperator(final int yyStart)
3654: throws IOException {
3655:
3656: Result yyResult;
3657: String yyValue;
3658: ParseError yyError = ParseError.DUMMY;
3659:
3660: // Alternative <FloatPlus>.
3661:
3662: yyResult = pSymbol(yyStart);
3663: yyError = yyResult.select(yyError);
3664: if (yyResult.hasValue("+.")) {
3665: yyValue = "+.";
3666:
3667: return yyResult.createValue(yyValue, yyError);
3668: }
3669:
3670: // Alternative <FloatMinus>.
3671:
3672: yyResult = pSymbol(yyStart);
3673: yyError = yyResult.select(yyError);
3674: if (yyResult.hasValue("-.")) {
3675: yyValue = "-.";
3676:
3677: return yyResult.createValue(yyValue, yyError);
3678: }
3679:
3680: // Done.
3681: yyError = yyError.select("float additive operator expected",
3682: yyStart);
3683: return yyError;
3684: }
3685:
3686: // =========================================================================
3687:
3688: /**
3689: * Parse nonterminal xtc.typical.Typical.MultiplicativeExpression.
3690: *
3691: * @param yyStart The index.
3692: * @return The result.
3693: * @throws IOException Signals an I/O error.
3694: */
3695: private Result pMultiplicativeExpression(final int yyStart)
3696: throws IOException {
3697:
3698: Result yyResult;
3699: int yyRepetition1;
3700: Pair<Action<Node>> yyRepValue1;
3701: Node yyValue;
3702: ParseError yyError = ParseError.DUMMY;
3703:
3704: // Alternative <Base>.
3705:
3706: yyResult = pConsExpression(yyStart);
3707: yyError = yyResult.select(yyError);
3708: if (yyResult.hasValue()) {
3709: final Node v$4 = yyResult.semanticValue();
3710:
3711: yyRepetition1 = yyResult.index;
3712: yyRepValue1 = Pair.empty();
3713: while (true) {
3714:
3715: yyResult = pMultiplicativeExpression$$Tail1(yyRepetition1);
3716: yyError = yyResult.select(yyError);
3717: if (yyResult.hasValue()) {
3718: final Action<Node> v$5 = yyResult.semanticValue();
3719:
3720: yyRepetition1 = yyResult.index;
3721: yyRepValue1 = new Pair<Action<Node>>(v$5,
3722: yyRepValue1);
3723: continue;
3724: }
3725: break;
3726: }
3727: { // Start scope for v$6.
3728: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
3729:
3730: yyValue = apply(v$6, v$4, yyStart);
3731:
3732: return new SemanticValue(yyValue, yyRepetition1,
3733: yyError);
3734: } // End scope for v$6.
3735: }
3736:
3737: // Done.
3738: return yyError;
3739: }
3740:
3741: // =========================================================================
3742:
3743: /**
3744: * Parse synthetic nonterminal
3745: * xtc.typical.Typical.MultiplicativeExpression$$Tail1.
3746: *
3747: * @param yyStart The index.
3748: * @return The result.
3749: * @throws IOException Signals an I/O error.
3750: */
3751: private Result pMultiplicativeExpression$$Tail1(final int yyStart)
3752: throws IOException {
3753:
3754: Result yyResult;
3755: Action<Node> yyValue;
3756: ParseError yyError = ParseError.DUMMY;
3757:
3758: // Alternative <Recursion>.
3759:
3760: yyResult = pMultiplicativeOperator(yyStart);
3761: yyError = yyResult.select(yyError);
3762: if (yyResult.hasValue()) {
3763: final String v$g$2 = yyResult.semanticValue();
3764:
3765: yyResult = pConsExpression(yyResult.index);
3766: yyError = yyResult.select(yyError);
3767: if (yyResult.hasValue()) {
3768: final Node v$g$3 = yyResult.semanticValue();
3769:
3770: yyValue = new Action<Node>() {
3771: public Node run(Node v$1) {
3772: return GNode.create("MultiplicativeExpression",
3773: v$1, v$g$2, v$g$3);
3774: }
3775: };
3776:
3777: return yyResult.createValue(yyValue, yyError);
3778: }
3779: }
3780:
3781: // Done.
3782: return yyError;
3783: }
3784:
3785: // =========================================================================
3786:
3787: /**
3788: * Parse nonterminal xtc.typical.Typical.MultiplicativeOperator.
3789: *
3790: * @param yyStart The index.
3791: * @return The result.
3792: * @throws IOException Signals an I/O error.
3793: */
3794: private Result pMultiplicativeOperator(final int yyStart)
3795: throws IOException {
3796:
3797: Result yyResult;
3798: String yyValue;
3799: ParseError yyError = ParseError.DUMMY;
3800:
3801: // Alternative 1.
3802:
3803: yyResult = pIntegerMultiplicativeOperator(yyStart);
3804: yyError = yyResult.select(yyError);
3805: if (yyResult.hasValue()) {
3806: yyValue = yyResult.semanticValue();
3807:
3808: return yyResult.createValue(yyValue, yyError);
3809: }
3810:
3811: // Alternative 2.
3812:
3813: yyResult = pFloatMultiplicativeOperator(yyStart);
3814: yyError = yyResult.select(yyError);
3815: if (yyResult.hasValue()) {
3816: yyValue = yyResult.semanticValue();
3817:
3818: return yyResult.createValue(yyValue, yyError);
3819: }
3820:
3821: // Done.
3822: return yyError;
3823: }
3824:
3825: // =========================================================================
3826:
3827: /**
3828: * Parse nonterminal xtc.typical.Typical.IntegerMultiplicativeOperator.
3829: *
3830: * @param yyStart The index.
3831: * @return The result.
3832: * @throws IOException Signals an I/O error.
3833: */
3834: private Result pIntegerMultiplicativeOperator(final int yyStart)
3835: throws IOException {
3836:
3837: Result yyResult;
3838: String yyValue;
3839: ParseError yyError = ParseError.DUMMY;
3840:
3841: // Alternative <IntegerTimes>.
3842:
3843: yyResult = pSymbol(yyStart);
3844: yyError = yyResult.select(yyError);
3845: if (yyResult.hasValue("*")) {
3846: yyValue = "*";
3847:
3848: return yyResult.createValue(yyValue, yyError);
3849: }
3850:
3851: // Alternative <IntegerOver>.
3852:
3853: yyResult = pSymbol(yyStart);
3854: yyError = yyResult.select(yyError);
3855: if (yyResult.hasValue("/")) {
3856: yyValue = "/";
3857:
3858: return yyResult.createValue(yyValue, yyError);
3859: }
3860:
3861: // Alternative <Modulo>.
3862:
3863: yyResult = pSymbol(yyStart);
3864: yyError = yyResult.select(yyError);
3865: if (yyResult.hasValue("%")) {
3866: yyValue = "%";
3867:
3868: return yyResult.createValue(yyValue, yyError);
3869: }
3870:
3871: // Done.
3872: yyError = yyError.select(
3873: "integer multiplicative operator expected", yyStart);
3874: return yyError;
3875: }
3876:
3877: // =========================================================================
3878:
3879: /**
3880: * Parse nonterminal xtc.typical.Typical.FloatMultiplicativeOperator.
3881: *
3882: * @param yyStart The index.
3883: * @return The result.
3884: * @throws IOException Signals an I/O error.
3885: */
3886: private Result pFloatMultiplicativeOperator(final int yyStart)
3887: throws IOException {
3888:
3889: Result yyResult;
3890: String yyValue;
3891: ParseError yyError = ParseError.DUMMY;
3892:
3893: // Alternative <FloatTimes>.
3894:
3895: yyResult = pSymbol(yyStart);
3896: yyError = yyResult.select(yyError);
3897: if (yyResult.hasValue("*.")) {
3898: yyValue = "*.";
3899:
3900: return yyResult.createValue(yyValue, yyError);
3901: }
3902:
3903: // Alternative <FloatOver>.
3904:
3905: yyResult = pSymbol(yyStart);
3906: yyError = yyResult.select(yyError);
3907: if (yyResult.hasValue("/.")) {
3908: yyValue = "/.";
3909:
3910: return yyResult.createValue(yyValue, yyError);
3911: }
3912:
3913: // Done.
3914: yyError = yyError.select(
3915: "float multiplicative operator expected", yyStart);
3916: return yyError;
3917: }
3918:
3919: // =========================================================================
3920:
3921: /**
3922: * Parse nonterminal xtc.typical.Typical.ConsExpression.
3923: *
3924: * @param yyStart The index.
3925: * @return The result.
3926: * @throws IOException Signals an I/O error.
3927: */
3928: private Result pConsExpression(final int yyStart)
3929: throws IOException {
3930: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
3931: if (null == yyColumn.chunk2)
3932: yyColumn.chunk2 = new Chunk2();
3933: if (null == yyColumn.chunk2.fConsExpression)
3934: yyColumn.chunk2.fConsExpression = pConsExpression$1(yyStart);
3935: return yyColumn.chunk2.fConsExpression;
3936: }
3937:
3938: /** Actually parse xtc.typical.Typical.ConsExpression. */
3939: private Result pConsExpression$1(final int yyStart)
3940: throws IOException {
3941: Result yyResult;
3942: int yyBase;
3943: Node yyValue;
3944: ParseError yyError = ParseError.DUMMY;
3945:
3946: // Alternative <Recursive>.
3947:
3948: yyResult = pFunctionApplication(yyStart);
3949: yyError = yyResult.select(yyError);
3950: if (yyResult.hasValue()) {
3951: final Node v$g$1 = yyResult.semanticValue();
3952:
3953: yyBase = yyResult.index;
3954: yyResult = pSymbol(yyBase);
3955: yyError = yyResult.select(yyError);
3956: if (yyResult.hasValue("::")) {
3957:
3958: yyResult = pConsExpression(yyResult.index);
3959: yyError = yyResult.select(yyError);
3960: if (yyResult.hasValue()) {
3961: final Node v$g$2 = yyResult.semanticValue();
3962:
3963: yyValue = GNode.create("ConsExpression", v$g$1,
3964: v$g$2);
3965: yyValue.setLocation(location(yyStart));
3966:
3967: return yyResult.createValue(yyValue, yyError);
3968: }
3969: } else {
3970: yyError = yyError.select("\"::\" expected", yyBase);
3971: }
3972: }
3973:
3974: // Alternative <Base>.
3975:
3976: yyResult = pFunctionApplication(yyStart);
3977: yyError = yyResult.select(yyError);
3978: if (yyResult.hasValue()) {
3979: yyValue = yyResult.semanticValue();
3980:
3981: return yyResult.createValue(yyValue, yyError);
3982: }
3983:
3984: // Done.
3985: return yyError;
3986: }
3987:
3988: // =========================================================================
3989:
3990: /**
3991: * Parse nonterminal xtc.typical.Typical.FunctionApplication.
3992: *
3993: * @param yyStart The index.
3994: * @return The result.
3995: * @throws IOException Signals an I/O error.
3996: */
3997: private Result pFunctionApplication(final int yyStart)
3998: throws IOException {
3999: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
4000: if (null == yyColumn.chunk2)
4001: yyColumn.chunk2 = new Chunk2();
4002: if (null == yyColumn.chunk2.fFunctionApplication)
4003: yyColumn.chunk2.fFunctionApplication = pFunctionApplication$1(yyStart);
4004: return yyColumn.chunk2.fFunctionApplication;
4005: }
4006:
4007: /** Actually parse xtc.typical.Typical.FunctionApplication. */
4008: private Result pFunctionApplication$1(final int yyStart)
4009: throws IOException {
4010:
4011: Result yyResult;
4012: int yyBase;
4013: Node yyValue;
4014: ParseError yyError = ParseError.DUMMY;
4015:
4016: // Alternative <Library>.
4017:
4018: yyResult = pUpperID(yyStart);
4019: yyError = yyResult.select(yyError);
4020: if (yyResult.hasValue()) {
4021: final Node v$g$1 = yyResult.semanticValue();
4022:
4023: yyBase = yyResult.index;
4024: yyResult = pSymbol(yyBase);
4025: yyError = yyResult.select(yyError);
4026: if (yyResult.hasValue(".")) {
4027:
4028: yyResult = pLowerID(yyResult.index);
4029: yyError = yyResult.select(yyError);
4030: if (yyResult.hasValue()) {
4031: final Node v$g$2 = yyResult.semanticValue();
4032:
4033: yyResult = pArguments(yyResult.index);
4034: yyError = yyResult.select(yyError);
4035: if (yyResult.hasValue()) {
4036: final Node v$g$3 = yyResult.semanticValue();
4037:
4038: yyValue = GNode.create("FunctionApplication",
4039: v$g$1, v$g$2, v$g$3);
4040: yyValue.setLocation(location(yyStart));
4041:
4042: return yyResult.createValue(yyValue, yyError);
4043: }
4044: }
4045: } else {
4046: yyError = yyError.select("\".\" expected", yyBase);
4047: }
4048: }
4049:
4050: // Alternative <Normal>.
4051:
4052: yyResult = pLowerID(yyStart);
4053: yyError = yyResult.select(yyError);
4054: if (yyResult.hasValue()) {
4055: final Node v$g$4 = yyResult.semanticValue();
4056:
4057: yyResult = pArguments(yyResult.index);
4058: yyError = yyResult.select(yyError);
4059: if (yyResult.hasValue()) {
4060: final Node v$g$5 = yyResult.semanticValue();
4061:
4062: yyValue = GNode.create("FunctionApplication", v$g$4,
4063: v$g$5);
4064: yyValue.setLocation(location(yyStart));
4065:
4066: return yyResult.createValue(yyValue, yyError);
4067: }
4068: }
4069:
4070: // Alternative <Base>.
4071:
4072: yyResult = pFieldExpression(yyStart);
4073: yyError = yyResult.select(yyError);
4074: if (yyResult.hasValue()) {
4075: yyValue = yyResult.semanticValue();
4076:
4077: return yyResult.createValue(yyValue, yyError);
4078: }
4079:
4080: // Done.
4081: return yyError;
4082: }
4083:
4084: // =========================================================================
4085:
4086: /**
4087: * Parse nonterminal xtc.typical.Typical.Arguments.
4088: *
4089: * @param yyStart The index.
4090: * @return The result.
4091: * @throws IOException Signals an I/O error.
4092: */
4093: private Result pArguments(final int yyStart) throws IOException {
4094: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
4095: if (null == yyColumn.chunk2)
4096: yyColumn.chunk2 = new Chunk2();
4097: if (null == yyColumn.chunk2.fArguments)
4098: yyColumn.chunk2.fArguments = pArguments$1(yyStart);
4099: return yyColumn.chunk2.fArguments;
4100: }
4101:
4102: /** Actually parse xtc.typical.Typical.Arguments. */
4103: private Result pArguments$1(final int yyStart) throws IOException {
4104: Result yyResult;
4105: Node yyValue;
4106: ParseError yyError = ParseError.DUMMY;
4107:
4108: // Alternative 1.
4109:
4110: yyResult = pArguments$$Plus1(yyStart);
4111: yyError = yyResult.select(yyError);
4112: if (yyResult.hasValue()) {
4113: final Pair<Node> v$g$1 = yyResult.semanticValue();
4114:
4115: yyValue = GNode.createFromPair("Arguments", v$g$1);
4116: yyValue.setLocation(location(yyStart));
4117:
4118: return yyResult.createValue(yyValue, yyError);
4119: }
4120:
4121: // Done.
4122: return yyError;
4123: }
4124:
4125: // =========================================================================
4126:
4127: /**
4128: * Parse synthetic nonterminal xtc.typical.Typical.Arguments$$Plus1.
4129: *
4130: * @param yyStart The index.
4131: * @return The result.
4132: * @throws IOException Signals an I/O error.
4133: */
4134: private Result pArguments$$Plus1(final int yyStart)
4135: throws IOException {
4136: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
4137: if (null == yyColumn.chunk2)
4138: yyColumn.chunk2 = new Chunk2();
4139: if (null == yyColumn.chunk2.fArguments$$Plus1)
4140: yyColumn.chunk2.fArguments$$Plus1 = pArguments$$Plus1$1(yyStart);
4141: return yyColumn.chunk2.fArguments$$Plus1;
4142: }
4143:
4144: /** Actually parse xtc.typical.Typical.Arguments$$Plus1. */
4145: private Result pArguments$$Plus1$1(final int yyStart)
4146: throws IOException {
4147: Result yyResult;
4148: Pair<Node> yyValue;
4149: ParseError yyError = ParseError.DUMMY;
4150:
4151: // Alternative 1.
4152:
4153: yyResult = pArgument(yyStart);
4154: yyError = yyResult.select(yyError);
4155: if (yyResult.hasValue()) {
4156: final Node v$el$1 = yyResult.semanticValue();
4157:
4158: final int yyChoice1 = yyResult.index;
4159:
4160: // Nested alternative 1.
4161:
4162: yyResult = pArguments$$Plus1(yyChoice1);
4163: yyError = yyResult.select(yyError);
4164: if (yyResult.hasValue()) {
4165: final Pair<Node> v$2 = yyResult.semanticValue();
4166:
4167: yyValue = new Pair<Node>(v$el$1, v$2);
4168:
4169: return yyResult.createValue(yyValue, yyError);
4170: }
4171:
4172: // Nested alternative 2.
4173:
4174: yyValue = new Pair<Node>(v$el$1);
4175:
4176: return new SemanticValue(yyValue, yyChoice1, yyError);
4177: }
4178:
4179: // Done.
4180: return yyError;
4181: }
4182:
4183: // =========================================================================
4184:
4185: /**
4186: * Parse nonterminal xtc.typical.Typical.Argument.
4187: *
4188: * @param yyStart The index.
4189: * @return The result.
4190: * @throws IOException Signals an I/O error.
4191: */
4192: private Result pArgument(final int yyStart) throws IOException {
4193: Result yyResult;
4194: Node yyValue;
4195: ParseError yyError = ParseError.DUMMY;
4196:
4197: // Alternative 1.
4198:
4199: yyResult = pFieldExpression(yyStart);
4200: yyError = yyResult.select(yyError);
4201: if (yyResult.hasValue()) {
4202: yyValue = yyResult.semanticValue();
4203:
4204: return yyResult.createValue(yyValue, yyError);
4205: }
4206:
4207: // Alternative 2.
4208:
4209: yyResult = pPattern(yyStart);
4210: yyError = yyResult.select(yyError);
4211: if (yyResult.hasValue()) {
4212: yyValue = yyResult.semanticValue();
4213:
4214: return yyResult.createValue(yyValue, yyError);
4215: }
4216:
4217: // Done.
4218: return yyError;
4219: }
4220:
4221: // =========================================================================
4222:
4223: /**
4224: * Parse nonterminal xtc.typical.Typical.PredicateArgument.
4225: *
4226: * @param yyStart The index.
4227: * @return The result.
4228: * @throws IOException Signals an I/O error.
4229: */
4230: private Result pPredicateArgument(final int yyStart)
4231: throws IOException {
4232: Result yyResult;
4233: int yyBase;
4234: Node yyValue;
4235: ParseError yyError = ParseError.DUMMY;
4236:
4237: // Alternative 1.
4238:
4239: yyResult = pSymbol(yyStart);
4240: yyError = yyResult.select(yyError);
4241: if (yyResult.hasValue("(")) {
4242:
4243: yyBase = yyResult.index;
4244: yyResult = pKeyword(yyBase);
4245: yyError = yyResult.select(yyError);
4246: if (yyResult.hasValue("predicate")) {
4247:
4248: yyResult = pPatterns(yyResult.index);
4249: yyError = yyResult.select(yyError);
4250: if (yyResult.hasValue()) {
4251: final Node v$g$1 = yyResult.semanticValue();
4252:
4253: yyBase = yyResult.index;
4254: yyResult = pSymbol(yyBase);
4255: yyError = yyResult.select(yyError);
4256: if (yyResult.hasValue(")")) {
4257:
4258: yyValue = GNode.create("PredicateArgument",
4259: v$g$1);
4260: yyValue.setLocation(location(yyStart));
4261:
4262: return yyResult.createValue(yyValue, yyError);
4263: } else {
4264: yyError = yyError.select("\")\" expected",
4265: yyBase);
4266: }
4267: }
4268: } else {
4269: yyError = yyError.select("\"predicate\" expected",
4270: yyBase);
4271: }
4272: }
4273:
4274: // Alternative 2.
4275:
4276: yyResult = pKeyword(yyStart);
4277: yyError = yyResult.select(yyError);
4278: if (yyResult.hasValue("predicate")) {
4279:
4280: yyResult = pPatterns(yyResult.index);
4281: yyError = yyResult.select(yyError);
4282: if (yyResult.hasValue()) {
4283: final Node v$g$2 = yyResult.semanticValue();
4284:
4285: yyValue = GNode.create("PredicateArgument", v$g$2);
4286: yyValue.setLocation(location(yyStart));
4287:
4288: return yyResult.createValue(yyValue, yyError);
4289: }
4290: }
4291:
4292: // Done.
4293: yyError = yyError
4294: .select("predicate argument expected", yyStart);
4295: return yyError;
4296: }
4297:
4298: // =========================================================================
4299:
4300: /**
4301: * Parse nonterminal xtc.typical.Typical.PredicateExpression.
4302: *
4303: * @param yyStart The index.
4304: * @return The result.
4305: * @throws IOException Signals an I/O error.
4306: */
4307: private Result pPredicateExpression(final int yyStart)
4308: throws IOException {
4309: Result yyResult;
4310: Node yyValue;
4311: ParseError yyError = ParseError.DUMMY;
4312:
4313: // Alternative 1.
4314:
4315: yyResult = pPredicateArgument(yyStart);
4316: yyError = yyResult.select(yyError);
4317: if (yyResult.hasValue()) {
4318: final Node v$g$1 = yyResult.semanticValue();
4319:
4320: yyResult = pExpression(yyResult.index);
4321: yyError = yyResult.select(yyError);
4322: if (yyResult.hasValue()) {
4323: final Node v$g$2 = yyResult.semanticValue();
4324:
4325: yyValue = GNode.create("PredicateExpression", v$g$1,
4326: v$g$2);
4327: yyValue.setLocation(location(yyStart));
4328:
4329: return yyResult.createValue(yyValue, yyError);
4330: }
4331: }
4332:
4333: // Done.
4334: return yyError;
4335: }
4336:
4337: // =========================================================================
4338:
4339: /**
4340: * Parse nonterminal xtc.typical.Typical.FieldExpression.
4341: *
4342: * @param yyStart The index.
4343: * @return The result.
4344: * @throws IOException Signals an I/O error.
4345: */
4346: private Result pFieldExpression(final int yyStart)
4347: throws IOException {
4348: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
4349: if (null == yyColumn.chunk3)
4350: yyColumn.chunk3 = new Chunk3();
4351: if (null == yyColumn.chunk3.fFieldExpression)
4352: yyColumn.chunk3.fFieldExpression = pFieldExpression$1(yyStart);
4353: return yyColumn.chunk3.fFieldExpression;
4354: }
4355:
4356: /** Actually parse xtc.typical.Typical.FieldExpression. */
4357: private Result pFieldExpression$1(final int yyStart)
4358: throws IOException {
4359: Result yyResult;
4360: int yyRepetition1;
4361: Pair<Action<Node>> yyRepValue1;
4362: Node yyValue;
4363: ParseError yyError = ParseError.DUMMY;
4364:
4365: // Alternative <Base>.
4366:
4367: yyResult = pPrimaryExpression(yyStart);
4368: yyError = yyResult.select(yyError);
4369: if (yyResult.hasValue()) {
4370: final Node v$3 = yyResult.semanticValue();
4371:
4372: yyRepetition1 = yyResult.index;
4373: yyRepValue1 = Pair.empty();
4374: while (true) {
4375:
4376: yyResult = pFieldExpression$$Tail1(yyRepetition1);
4377: yyError = yyResult.select(yyError);
4378: if (yyResult.hasValue()) {
4379: final Action<Node> v$4 = yyResult.semanticValue();
4380:
4381: yyRepetition1 = yyResult.index;
4382: yyRepValue1 = new Pair<Action<Node>>(v$4,
4383: yyRepValue1);
4384: continue;
4385: }
4386: break;
4387: }
4388: { // Start scope for v$5.
4389: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
4390:
4391: yyValue = apply(v$5, v$3, yyStart);
4392:
4393: return new SemanticValue(yyValue, yyRepetition1,
4394: yyError);
4395: } // End scope for v$5.
4396: }
4397:
4398: // Done.
4399: return yyError;
4400: }
4401:
4402: // =========================================================================
4403:
4404: /**
4405: * Parse synthetic nonterminal xtc.typical.Typical.FieldExpression$$Tail1.
4406: *
4407: * @param yyStart The index.
4408: * @return The result.
4409: * @throws IOException Signals an I/O error.
4410: */
4411: private Result pFieldExpression$$Tail1(final int yyStart)
4412: throws IOException {
4413:
4414: Result yyResult;
4415: Action<Node> yyValue;
4416: ParseError yyError = ParseError.DUMMY;
4417:
4418: // Alternative <Recursion>.
4419:
4420: yyResult = pSymbol(yyStart);
4421: yyError = yyResult.select(yyError);
4422: if (yyResult.hasValue(".")) {
4423:
4424: yyResult = pLowerIdentifier(yyResult.index);
4425: yyError = yyResult.select(yyError);
4426: if (yyResult.hasValue()) {
4427: final String v$g$2 = yyResult.semanticValue();
4428:
4429: yyValue = new Action<Node>() {
4430: public Node run(Node v$1) {
4431: return GNode.create("FieldExpression", v$1,
4432: v$g$2);
4433: }
4434: };
4435:
4436: return yyResult.createValue(yyValue, yyError);
4437: }
4438: }
4439:
4440: // Done.
4441: yyError = yyError.select("field expression expected", yyStart);
4442: return yyError;
4443: }
4444:
4445: // =========================================================================
4446:
4447: /**
4448: * Parse nonterminal xtc.typical.Typical.PrimaryExpression.
4449: *
4450: * @param yyStart The index.
4451: * @return The result.
4452: * @throws IOException Signals an I/O error.
4453: */
4454: private Result pPrimaryExpression(final int yyStart)
4455: throws IOException {
4456: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
4457: if (null == yyColumn.chunk3)
4458: yyColumn.chunk3 = new Chunk3();
4459: if (null == yyColumn.chunk3.fPrimaryExpression)
4460: yyColumn.chunk3.fPrimaryExpression = pPrimaryExpression$1(yyStart);
4461: return yyColumn.chunk3.fPrimaryExpression;
4462: }
4463:
4464: /** Actually parse xtc.typical.Typical.PrimaryExpression. */
4465: private Result pPrimaryExpression$1(final int yyStart)
4466: throws IOException {
4467: Result yyResult;
4468: int yyBase;
4469: Node yyValue;
4470: ParseError yyError = ParseError.DUMMY;
4471:
4472: // Alternative <Block>.
4473:
4474: yyResult = pKeyword(yyStart);
4475: yyError = yyResult.select(yyError);
4476: if (yyResult.hasValue("begin")) {
4477:
4478: yyResult = pExpression(yyResult.index);
4479: yyError = yyResult.select(yyError);
4480: if (yyResult.hasValue()) {
4481: yyValue = yyResult.semanticValue();
4482:
4483: yyBase = yyResult.index;
4484: yyResult = pKeyword(yyBase);
4485: yyError = yyResult.select(yyError);
4486: if (yyResult.hasValue("end")) {
4487:
4488: return yyResult.createValue(yyValue, yyError);
4489: } else {
4490: yyError = yyError
4491: .select("\"end\" expected", yyBase);
4492: }
4493: }
4494: }
4495:
4496: // Alternative <Parenthesised>.
4497:
4498: yyResult = pSymbol(yyStart);
4499: yyError = yyResult.select(yyError);
4500: if (yyResult.hasValue("(")) {
4501:
4502: yyResult = pExpression(yyResult.index);
4503: yyError = yyResult.select(yyError);
4504: if (yyResult.hasValue()) {
4505: yyValue = yyResult.semanticValue();
4506:
4507: yyBase = yyResult.index;
4508: yyResult = pSymbol(yyBase);
4509: yyError = yyResult.select(yyError);
4510: if (yyResult.hasValue(")")) {
4511:
4512: return yyResult.createValue(yyValue, yyError);
4513: } else {
4514: yyError = yyError.select("\")\" expected", yyBase);
4515: }
4516: }
4517: }
4518:
4519: // Alternative <PredicateExpression>.
4520:
4521: yyResult = pPredicateExpression(yyStart);
4522: yyError = yyResult.select(yyError);
4523: if (yyResult.hasValue()) {
4524: yyValue = yyResult.semanticValue();
4525:
4526: return yyResult.createValue(yyValue, yyError);
4527: }
4528:
4529: // Alternative <ReduceExpression>.
4530:
4531: yyResult = pReduceExpression(yyStart);
4532: yyError = yyResult.select(yyError);
4533: if (yyResult.hasValue()) {
4534: yyValue = yyResult.semanticValue();
4535:
4536: return yyResult.createValue(yyValue, yyError);
4537: }
4538:
4539: // Alternative <Function>.
4540:
4541: yyResult = pFunctionExpression(yyStart);
4542: yyError = yyResult.select(yyError);
4543: if (yyResult.hasValue()) {
4544: yyValue = yyResult.semanticValue();
4545:
4546: return yyResult.createValue(yyValue, yyError);
4547: }
4548:
4549: // Alternative <Record>.
4550:
4551: yyResult = pRecordExpression(yyStart);
4552: yyError = yyResult.select(yyError);
4553: if (yyResult.hasValue()) {
4554: yyValue = yyResult.semanticValue();
4555:
4556: return yyResult.createValue(yyValue, yyError);
4557: }
4558:
4559: // Alternative 7.
4560:
4561: yyResult = pSymbol(yyStart);
4562: yyError = yyResult.select(yyError);
4563: if (yyResult.hasValue("!")) {
4564:
4565: yyResult = pPrimaryExpression(yyResult.index);
4566: yyError = yyResult.select(yyError);
4567: if (yyResult.hasValue()) {
4568: final Node v$g$1 = yyResult.semanticValue();
4569:
4570: yyValue = GNode.create("LogicalNegationExpression",
4571: v$g$1);
4572: yyValue.setLocation(location(yyStart));
4573:
4574: return yyResult.createValue(yyValue, yyError);
4575: }
4576: }
4577:
4578: // Alternative <Match>.
4579:
4580: yyResult = pMatchExpression(yyStart);
4581: yyError = yyResult.select(yyError);
4582: if (yyResult.hasValue()) {
4583: yyValue = yyResult.semanticValue();
4584:
4585: return yyResult.createValue(yyValue, yyError);
4586: }
4587:
4588: // Alternative <TupleConstructor>.
4589:
4590: yyResult = pTupleConstructor(yyStart);
4591: yyError = yyResult.select(yyError);
4592: if (yyResult.hasValue()) {
4593: yyValue = yyResult.semanticValue();
4594:
4595: return yyResult.createValue(yyValue, yyError);
4596: }
4597:
4598: // Alternative <ListLiteral>.
4599:
4600: yyResult = pListLiteral(yyStart);
4601: yyError = yyResult.select(yyError);
4602: if (yyResult.hasValue()) {
4603: yyValue = yyResult.semanticValue();
4604:
4605: return yyResult.createValue(yyValue, yyError);
4606: }
4607:
4608: // Alternative <Let>.
4609:
4610: yyResult = pLetExpression(yyStart);
4611: yyError = yyResult.select(yyError);
4612: if (yyResult.hasValue()) {
4613: yyValue = yyResult.semanticValue();
4614:
4615: return yyResult.createValue(yyValue, yyError);
4616: }
4617:
4618: // Alternative <Error>.
4619:
4620: yyResult = pErrorClause(yyStart);
4621: yyError = yyResult.select(yyError);
4622: if (yyResult.hasValue()) {
4623: yyValue = yyResult.semanticValue();
4624:
4625: return yyResult.createValue(yyValue, yyError);
4626: }
4627:
4628: // Alternative <Assertion>.
4629:
4630: yyResult = pAssertClause(yyStart);
4631: yyError = yyResult.select(yyError);
4632: if (yyResult.hasValue()) {
4633: yyValue = yyResult.semanticValue();
4634:
4635: return yyResult.createValue(yyValue, yyError);
4636: }
4637:
4638: // Alternative <Guard>.
4639:
4640: yyResult = pGuardExpression(yyStart);
4641: yyError = yyResult.select(yyError);
4642: if (yyResult.hasValue()) {
4643: yyValue = yyResult.semanticValue();
4644:
4645: return yyResult.createValue(yyValue, yyError);
4646: }
4647:
4648: // Alternative <Require>.
4649:
4650: yyResult = pRequireExpression(yyStart);
4651: yyError = yyResult.select(yyError);
4652: if (yyResult.hasValue()) {
4653: yyValue = yyResult.semanticValue();
4654:
4655: return yyResult.createValue(yyValue, yyError);
4656: }
4657:
4658: // Alternative <IfElse>.
4659:
4660: yyResult = pIfElseExpression(yyStart);
4661: yyError = yyResult.select(yyError);
4662: if (yyResult.hasValue()) {
4663: yyValue = yyResult.semanticValue();
4664:
4665: return yyResult.createValue(yyValue, yyError);
4666: }
4667:
4668: // Alternative <If>.
4669:
4670: yyResult = pIfExpression(yyStart);
4671: yyError = yyResult.select(yyError);
4672: if (yyResult.hasValue()) {
4673: yyValue = yyResult.semanticValue();
4674:
4675: return yyResult.createValue(yyValue, yyError);
4676: }
4677:
4678: // Alternative <LowerIdentifier>.
4679:
4680: yyResult = pLowerID(yyStart);
4681: yyError = yyResult.select(yyError);
4682: if (yyResult.hasValue()) {
4683: yyValue = yyResult.semanticValue();
4684:
4685: return yyResult.createValue(yyValue, yyError);
4686: }
4687:
4688: // Alternative <Literal>.
4689:
4690: yyResult = pLiteral(yyStart);
4691: yyError = yyResult.select(yyError);
4692: if (yyResult.hasValue()) {
4693: yyValue = yyResult.semanticValue();
4694:
4695: return yyResult.createValue(yyValue, yyError);
4696: }
4697:
4698: // Done.
4699: yyError = yyError
4700: .select("primary expression expected", yyStart);
4701: return yyError;
4702: }
4703:
4704: // =========================================================================
4705:
4706: /**
4707: * Parse nonterminal xtc.typical.Typical.LetExpression.
4708: *
4709: * @param yyStart The index.
4710: * @return The result.
4711: * @throws IOException Signals an I/O error.
4712: */
4713: private Result pLetExpression(final int yyStart) throws IOException {
4714: Result yyResult;
4715: int yyBase;
4716: Node yyValue;
4717: ParseError yyError = ParseError.DUMMY;
4718:
4719: // Alternative 1.
4720:
4721: yyResult = pKeyword(yyStart);
4722: yyError = yyResult.select(yyError);
4723: if (yyResult.hasValue("let")) {
4724:
4725: yyResult = pLetBindings(yyResult.index);
4726: yyError = yyResult.select(yyError);
4727: if (yyResult.hasValue()) {
4728: final Node v$g$1 = yyResult.semanticValue();
4729:
4730: yyBase = yyResult.index;
4731: yyResult = pKeyword(yyBase);
4732: yyError = yyResult.select(yyError);
4733: if (yyResult.hasValue("in")) {
4734:
4735: yyResult = pExpression(yyResult.index);
4736: yyError = yyResult.select(yyError);
4737: if (yyResult.hasValue()) {
4738: final Node v$g$2 = yyResult.semanticValue();
4739:
4740: yyValue = GNode.create("LetExpression", v$g$1,
4741: v$g$2);
4742: yyValue.setLocation(location(yyStart));
4743:
4744: return yyResult.createValue(yyValue, yyError);
4745: }
4746: } else {
4747: yyError = yyError.select("\"in\" expected", yyBase);
4748: }
4749: }
4750: }
4751:
4752: // Done.
4753: yyError = yyError.select("let expression expected", yyStart);
4754: return yyError;
4755: }
4756:
4757: // =========================================================================
4758:
4759: /**
4760: * Parse nonterminal xtc.typical.Typical.LetBindings.
4761: *
4762: * @param yyStart The index.
4763: * @return The result.
4764: * @throws IOException Signals an I/O error.
4765: */
4766: private Result pLetBindings(final int yyStart) throws IOException {
4767: Result yyResult;
4768: int yyBase;
4769: int yyRepetition1;
4770: Pair<Node> yyRepValue1;
4771: Node yyValue;
4772: ParseError yyError = ParseError.DUMMY;
4773:
4774: // Alternative 1.
4775:
4776: yyResult = pLetBinding(yyStart);
4777: yyError = yyResult.select(yyError);
4778: if (yyResult.hasValue()) {
4779: final Node v$g$1 = yyResult.semanticValue();
4780:
4781: yyRepetition1 = yyResult.index;
4782: yyRepValue1 = Pair.empty();
4783: while (true) {
4784:
4785: yyBase = yyRepetition1;
4786: yyResult = pKeyword(yyBase);
4787: yyError = yyResult.select(yyError);
4788: if (yyResult.hasValue("and")) {
4789:
4790: yyResult = pLetBinding(yyResult.index);
4791: yyError = yyResult.select(yyError);
4792: if (yyResult.hasValue()) {
4793: final Node v$el$1 = yyResult.semanticValue();
4794:
4795: yyRepetition1 = yyResult.index;
4796: yyRepValue1 = new Pair<Node>(v$el$1,
4797: yyRepValue1);
4798: continue;
4799: }
4800: } else {
4801: yyError = yyError
4802: .select("\"and\" expected", yyBase);
4803: }
4804: break;
4805: }
4806: { // Start scope for v$g$2.
4807: final Pair<Node> v$g$2 = yyRepValue1.reverse();
4808:
4809: yyValue = GNode.createFromPair("LetBindings", v$g$1,
4810: v$g$2);
4811: yyValue.setLocation(location(yyStart));
4812:
4813: return new SemanticValue(yyValue, yyRepetition1,
4814: yyError);
4815: } // End scope for v$g$2.
4816: }
4817:
4818: // Done.
4819: return yyError;
4820: }
4821:
4822: // =========================================================================
4823:
4824: /**
4825: * Parse nonterminal xtc.typical.Typical.LetBinding.
4826: *
4827: * @param yyStart The index.
4828: * @return The result.
4829: * @throws IOException Signals an I/O error.
4830: */
4831: private Result pLetBinding(final int yyStart) throws IOException {
4832: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
4833: if (null == yyColumn.chunk3)
4834: yyColumn.chunk3 = new Chunk3();
4835: if (null == yyColumn.chunk3.fLetBinding)
4836: yyColumn.chunk3.fLetBinding = pLetBinding$1(yyStart);
4837: return yyColumn.chunk3.fLetBinding;
4838: }
4839:
4840: /** Actually parse xtc.typical.Typical.LetBinding. */
4841: private Result pLetBinding$1(final int yyStart) throws IOException {
4842: Result yyResult;
4843: int yyBase;
4844: Node yyValue;
4845: ParseError yyError = ParseError.DUMMY;
4846:
4847: // Alternative 1.
4848:
4849: yyResult = pPattern(yyStart);
4850: yyError = yyResult.select(yyError);
4851: if (yyResult.hasValue()) {
4852: final Node v$g$1 = yyResult.semanticValue();
4853:
4854: yyBase = yyResult.index;
4855: yyResult = pSymbol(yyBase);
4856: yyError = yyResult.select(yyError);
4857: if (yyResult.hasValue("=")) {
4858:
4859: yyResult = pExpression(yyResult.index);
4860: yyError = yyResult.select(yyError);
4861: if (yyResult.hasValue()) {
4862: final Node v$g$2 = yyResult.semanticValue();
4863:
4864: yyValue = GNode.create("LetBinding", v$g$1, v$g$2);
4865: yyValue.setLocation(location(yyStart));
4866:
4867: return yyResult.createValue(yyValue, yyError);
4868: }
4869: } else {
4870: yyError = yyError.select("\"=\" expected", yyBase);
4871: }
4872: }
4873:
4874: // Done.
4875: return yyError;
4876: }
4877:
4878: // =========================================================================
4879:
4880: /**
4881: * Parse nonterminal xtc.typical.Typical.FunctionExpression.
4882: *
4883: * @param yyStart The index.
4884: * @return The result.
4885: * @throws IOException Signals an I/O error.
4886: */
4887: private Result pFunctionExpression(final int yyStart)
4888: throws IOException {
4889: Result yyResult;
4890: Node yyValue;
4891: ParseError yyError = ParseError.DUMMY;
4892:
4893: // Alternative 1.
4894:
4895: yyResult = pKeyword(yyStart);
4896: yyError = yyResult.select(yyError);
4897: if (yyResult.hasValue("function")) {
4898:
4899: yyResult = pPatternMatching(yyResult.index);
4900: yyError = yyResult.select(yyError);
4901: if (yyResult.hasValue()) {
4902: final Node v$g$1 = yyResult.semanticValue();
4903:
4904: yyValue = GNode.create("FunctionExpression", v$g$1);
4905: yyValue.setLocation(location(yyStart));
4906:
4907: return yyResult.createValue(yyValue, yyError);
4908: }
4909: }
4910:
4911: // Done.
4912: yyError = yyError.select("function expression expected",
4913: yyStart);
4914: return yyError;
4915: }
4916:
4917: // =========================================================================
4918:
4919: /**
4920: * Parse nonterminal xtc.typical.Typical.MatchExpression.
4921: *
4922: * @param yyStart The index.
4923: * @return The result.
4924: * @throws IOException Signals an I/O error.
4925: */
4926: private Result pMatchExpression(final int yyStart)
4927: throws IOException {
4928: Result yyResult;
4929: int yyBase;
4930: Node yyValue;
4931: ParseError yyError = ParseError.DUMMY;
4932:
4933: // Alternative 1.
4934:
4935: yyResult = pKeyword(yyStart);
4936: yyError = yyResult.select(yyError);
4937: if (yyResult.hasValue("match")) {
4938:
4939: yyResult = pExpression(yyResult.index);
4940: yyError = yyResult.select(yyError);
4941: if (yyResult.hasValue()) {
4942: final Node v$g$1 = yyResult.semanticValue();
4943:
4944: yyBase = yyResult.index;
4945: yyResult = pKeyword(yyBase);
4946: yyError = yyResult.select(yyError);
4947: if (yyResult.hasValue("with")) {
4948:
4949: yyResult = pPatternMatching(yyResult.index);
4950: yyError = yyResult.select(yyError);
4951: if (yyResult.hasValue()) {
4952: final Node v$g$2 = yyResult.semanticValue();
4953:
4954: yyValue = GNode.create("MatchExpression",
4955: v$g$1, v$g$2);
4956: yyValue.setLocation(location(yyStart));
4957:
4958: return yyResult.createValue(yyValue, yyError);
4959: }
4960: } else {
4961: yyError = yyError.select("\"with\" expected",
4962: yyBase);
4963: }
4964: }
4965: }
4966:
4967: // Done.
4968: yyError = yyError.select("match expression expected", yyStart);
4969: return yyError;
4970: }
4971:
4972: // =========================================================================
4973:
4974: /**
4975: * Parse nonterminal xtc.typical.Typical.RequireExpression.
4976: *
4977: * @param yyStart The index.
4978: * @return The result.
4979: * @throws IOException Signals an I/O error.
4980: */
4981: private Result pRequireExpression(final int yyStart)
4982: throws IOException {
4983: Result yyResult;
4984: int yyBase;
4985: int yyRepetition1;
4986: Pair<Node> yyRepValue1;
4987: Node yyValue;
4988: ParseError yyError = ParseError.DUMMY;
4989:
4990: // Alternative 1.
4991:
4992: yyResult = pKeyword(yyStart);
4993: yyError = yyResult.select(yyError);
4994: if (yyResult.hasValue("require")) {
4995:
4996: yyResult = pRequireArgs(yyResult.index);
4997: yyError = yyResult.select(yyError);
4998: if (yyResult.hasValue()) {
4999: final Node v$g$1 = yyResult.semanticValue();
5000:
5001: yyRepetition1 = yyResult.index;
5002: yyRepValue1 = Pair.empty();
5003: while (true) {
5004:
5005: yyBase = yyRepetition1;
5006: yyResult = pKeyword(yyBase);
5007: yyError = yyResult.select(yyError);
5008: if (yyResult.hasValue("and")) {
5009:
5010: yyResult = pRequireArgs(yyResult.index);
5011: yyError = yyResult.select(yyError);
5012: if (yyResult.hasValue()) {
5013: final Node v$el$1 = yyResult
5014: .semanticValue();
5015:
5016: yyRepetition1 = yyResult.index;
5017: yyRepValue1 = new Pair<Node>(v$el$1,
5018: yyRepValue1);
5019: continue;
5020: }
5021: } else {
5022: yyError = yyError.select("\"and\" expected",
5023: yyBase);
5024: }
5025: break;
5026: }
5027: { // Start scope for v$g$2.
5028: final Pair<Node> v$g$2 = yyRepValue1.reverse();
5029:
5030: yyBase = yyRepetition1;
5031: yyResult = pKeyword(yyBase);
5032: yyError = yyResult.select(yyError);
5033: if (yyResult.hasValue("in")) {
5034:
5035: yyResult = pExpression(yyResult.index);
5036: yyError = yyResult.select(yyError);
5037: if (yyResult.hasValue()) {
5038: final Node v$g$3 = yyResult.semanticValue();
5039:
5040: yyValue = GNode.create("RequireExpression",
5041: v$g$2.size() + 2).add(v$g$1)
5042: .addAll(v$g$2).add(v$g$3);
5043: yyValue.setLocation(location(yyStart));
5044:
5045: return yyResult.createValue(yyValue,
5046: yyError);
5047: }
5048: } else {
5049: yyError = yyError.select("\"in\" expected",
5050: yyBase);
5051: }
5052: } // End scope for v$g$2.
5053: }
5054: }
5055:
5056: // Done.
5057: yyError = yyError
5058: .select("require expression expected", yyStart);
5059: return yyError;
5060: }
5061:
5062: // =========================================================================
5063:
5064: /**
5065: * Parse nonterminal xtc.typical.Typical.RequireArgs.
5066: *
5067: * @param yyStart The index.
5068: * @return The result.
5069: * @throws IOException Signals an I/O error.
5070: */
5071: private Result pRequireArgs(final int yyStart) throws IOException {
5072: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
5073: if (null == yyColumn.chunk3)
5074: yyColumn.chunk3 = new Chunk3();
5075: if (null == yyColumn.chunk3.fRequireArgs)
5076: yyColumn.chunk3.fRequireArgs = pRequireArgs$1(yyStart);
5077: return yyColumn.chunk3.fRequireArgs;
5078: }
5079:
5080: /** Actually parse xtc.typical.Typical.RequireArgs. */
5081: private Result pRequireArgs$1(final int yyStart) throws IOException {
5082: Result yyResult;
5083: int yyBase;
5084: int yyOption1;
5085: Node yyOpValue1;
5086: Node yyValue;
5087: ParseError yyError = ParseError.DUMMY;
5088:
5089: // Alternative 1.
5090:
5091: yyResult = pExpression(yyStart);
5092: yyError = yyResult.select(yyError);
5093: if (yyResult.hasValue()) {
5094: final Node v$g$1 = yyResult.semanticValue();
5095:
5096: yyResult = pMessageTag(yyResult.index);
5097: yyError = yyResult.select(yyError);
5098: if (yyResult.hasValue()) {
5099: final Node v$g$2 = yyResult.semanticValue();
5100:
5101: yyResult = pExpression(yyResult.index);
5102: yyError = yyResult.select(yyError);
5103: if (yyResult.hasValue()) {
5104: final Node v$g$3 = yyResult.semanticValue();
5105:
5106: yyOption1 = yyResult.index;
5107: yyOpValue1 = null;
5108:
5109: yyBase = yyOption1;
5110: yyResult = pKeyword(yyBase);
5111: yyError = yyResult.select(yyError);
5112: if (yyResult.hasValue("at")) {
5113:
5114: yyResult = pLowerID(yyResult.index);
5115: yyError = yyResult.select(yyError);
5116: if (yyResult.hasValue()) {
5117: final Node v$el$1 = yyResult
5118: .semanticValue();
5119:
5120: yyOption1 = yyResult.index;
5121: yyOpValue1 = v$el$1;
5122: }
5123: } else {
5124: yyError = yyError.select("\"at\" expected",
5125: yyBase);
5126: }
5127: { // Start scope for v$g$4.
5128: final Node v$g$4 = yyOpValue1;
5129:
5130: yyValue = GNode.create("RequireArgs", v$g$1,
5131: v$g$2, v$g$3, v$g$4);
5132: yyValue.setLocation(location(yyStart));
5133:
5134: return new SemanticValue(yyValue, yyOption1,
5135: yyError);
5136: } // End scope for v$g$4.
5137: }
5138: }
5139: }
5140:
5141: // Done.
5142: return yyError;
5143: }
5144:
5145: // =========================================================================
5146:
5147: /**
5148: * Parse nonterminal xtc.typical.Typical.MessageTag.
5149: *
5150: * @param yyStart The index.
5151: * @return The result.
5152: * @throws IOException Signals an I/O error.
5153: */
5154: private Result pMessageTag(final int yyStart) throws IOException {
5155: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
5156: if (null == yyColumn.chunk3)
5157: yyColumn.chunk3 = new Chunk3();
5158: if (null == yyColumn.chunk3.fMessageTag)
5159: yyColumn.chunk3.fMessageTag = pMessageTag$1(yyStart);
5160: return yyColumn.chunk3.fMessageTag;
5161: }
5162:
5163: /** Actually parse xtc.typical.Typical.MessageTag. */
5164: private Result pMessageTag$1(final int yyStart) throws IOException {
5165: Result yyResult;
5166: Node yyValue;
5167: ParseError yyError = ParseError.DUMMY;
5168:
5169: // Alternative 1.
5170:
5171: yyResult = pKeyword(yyStart);
5172: yyError = yyResult.select(yyError);
5173: if (yyResult.hasValue("warning")) {
5174: final String v$g$1 = "warning";
5175:
5176: yyValue = GNode.create("MessageTag", v$g$1);
5177: yyValue.setLocation(location(yyStart));
5178:
5179: return yyResult.createValue(yyValue, yyError);
5180: }
5181:
5182: // Alternative 2.
5183:
5184: yyResult = pKeyword(yyStart);
5185: yyError = yyResult.select(yyError);
5186: if (yyResult.hasValue("error")) {
5187: final String v$g$2 = "error";
5188:
5189: yyValue = GNode.create("MessageTag", v$g$2);
5190: yyValue.setLocation(location(yyStart));
5191:
5192: return yyResult.createValue(yyValue, yyError);
5193: }
5194:
5195: // Done.
5196: yyError = yyError.select("message tag expected", yyStart);
5197: return yyError;
5198: }
5199:
5200: // =========================================================================
5201:
5202: /**
5203: * Parse nonterminal xtc.typical.Typical.GuardExpression.
5204: *
5205: * @param yyStart The index.
5206: * @return The result.
5207: * @throws IOException Signals an I/O error.
5208: */
5209: private Result pGuardExpression(final int yyStart)
5210: throws IOException {
5211: Result yyResult;
5212: Node yyValue;
5213: ParseError yyError = ParseError.DUMMY;
5214:
5215: // Alternative 1.
5216:
5217: yyResult = pKeyword(yyStart);
5218: yyError = yyResult.select(yyError);
5219: if (yyResult.hasValue("guard")) {
5220:
5221: yyResult = pExpression(yyResult.index);
5222: yyError = yyResult.select(yyError);
5223: if (yyResult.hasValue()) {
5224: final Node v$g$1 = yyResult.semanticValue();
5225:
5226: yyResult = pErrorClause(yyResult.index);
5227: yyError = yyResult.select(yyError);
5228: if (yyResult.hasValue()) {
5229: final Node v$g$2 = yyResult.semanticValue();
5230:
5231: yyValue = GNode.create("GuardExpression", v$g$1,
5232: v$g$2);
5233: yyValue.setLocation(location(yyStart));
5234:
5235: return yyResult.createValue(yyValue, yyError);
5236: }
5237: }
5238: }
5239:
5240: // Done.
5241: yyError = yyError.select("guard expression expected", yyStart);
5242: return yyError;
5243: }
5244:
5245: // =========================================================================
5246:
5247: /**
5248: * Parse nonterminal xtc.typical.Typical.ErrorClause.
5249: *
5250: * @param yyStart The index.
5251: * @return The result.
5252: * @throws IOException Signals an I/O error.
5253: */
5254: private Result pErrorClause(final int yyStart) throws IOException {
5255: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
5256: if (null == yyColumn.chunk3)
5257: yyColumn.chunk3 = new Chunk3();
5258: if (null == yyColumn.chunk3.fErrorClause)
5259: yyColumn.chunk3.fErrorClause = pErrorClause$1(yyStart);
5260: return yyColumn.chunk3.fErrorClause;
5261: }
5262:
5263: /** Actually parse xtc.typical.Typical.ErrorClause. */
5264: private Result pErrorClause$1(final int yyStart) throws IOException {
5265: Result yyResult;
5266: int yyBase;
5267: int yyOption1;
5268: Node yyOpValue1;
5269: Node yyValue;
5270: ParseError yyError = ParseError.DUMMY;
5271:
5272: // Alternative 1.
5273:
5274: yyResult = pMessageTag(yyStart);
5275: yyError = yyResult.select(yyError);
5276: if (yyResult.hasValue()) {
5277: final Node v$g$1 = yyResult.semanticValue();
5278:
5279: yyResult = pExpression(yyResult.index);
5280: yyError = yyResult.select(yyError);
5281: if (yyResult.hasValue()) {
5282: final Node v$g$2 = yyResult.semanticValue();
5283:
5284: yyOption1 = yyResult.index;
5285: yyOpValue1 = null;
5286:
5287: yyBase = yyOption1;
5288: yyResult = pKeyword(yyBase);
5289: yyError = yyResult.select(yyError);
5290: if (yyResult.hasValue("at")) {
5291:
5292: yyResult = pLowerID(yyResult.index);
5293: yyError = yyResult.select(yyError);
5294: if (yyResult.hasValue()) {
5295: final Node v$el$1 = yyResult.semanticValue();
5296:
5297: yyOption1 = yyResult.index;
5298: yyOpValue1 = v$el$1;
5299: }
5300: } else {
5301: yyError = yyError.select("\"at\" expected", yyBase);
5302: }
5303: { // Start scope for v$g$3.
5304: final Node v$g$3 = yyOpValue1;
5305:
5306: yyValue = GNode.create("ErrorClause", v$g$1, v$g$2,
5307: v$g$3);
5308: yyValue.setLocation(location(yyStart));
5309:
5310: return new SemanticValue(yyValue, yyOption1,
5311: yyError);
5312: } // End scope for v$g$3.
5313: }
5314: }
5315:
5316: // Done.
5317: return yyError;
5318: }
5319:
5320: // =========================================================================
5321:
5322: /**
5323: * Parse nonterminal xtc.typical.Typical.AssertClause.
5324: *
5325: * @param yyStart The index.
5326: * @return The result.
5327: * @throws IOException Signals an I/O error.
5328: */
5329: private Result pAssertClause(final int yyStart) throws IOException {
5330: Result yyResult;
5331: int yyOption1;
5332: Node yyOpValue1;
5333: Node yyValue;
5334: ParseError yyError = ParseError.DUMMY;
5335:
5336: // Alternative 1.
5337:
5338: yyResult = pKeyword(yyStart);
5339: yyError = yyResult.select(yyError);
5340: if (yyResult.hasValue("assert")) {
5341:
5342: yyResult = pExpression(yyResult.index);
5343: yyError = yyResult.select(yyError);
5344: if (yyResult.hasValue()) {
5345: final Node v$g$1 = yyResult.semanticValue();
5346:
5347: yyOption1 = yyResult.index;
5348: yyOpValue1 = null;
5349:
5350: yyResult = pExpression(yyOption1);
5351: yyError = yyResult.select(yyError);
5352: if (yyResult.hasValue()) {
5353: final Node v$el$1 = yyResult.semanticValue();
5354:
5355: yyOption1 = yyResult.index;
5356: yyOpValue1 = v$el$1;
5357: }
5358: { // Start scope for v$g$2.
5359: final Node v$g$2 = yyOpValue1;
5360:
5361: yyValue = GNode
5362: .create("AssertClause", v$g$1, v$g$2);
5363: yyValue.setLocation(location(yyStart));
5364:
5365: return new SemanticValue(yyValue, yyOption1,
5366: yyError);
5367: } // End scope for v$g$2.
5368: }
5369: }
5370:
5371: // Done.
5372: yyError = yyError.select("assert clause expected", yyStart);
5373: return yyError;
5374: }
5375:
5376: // =========================================================================
5377:
5378: /**
5379: * Parse nonterminal xtc.typical.Typical.TupleConstructor.
5380: *
5381: * @param yyStart The index.
5382: * @return The result.
5383: * @throws IOException Signals an I/O error.
5384: */
5385: private Result pTupleConstructor(final int yyStart)
5386: throws IOException {
5387: Result yyResult;
5388: int yyBase;
5389: int yyRepetition1;
5390: Pair<Node> yyRepValue1;
5391: Node yyValue;
5392: ParseError yyError = ParseError.DUMMY;
5393:
5394: // Alternative 1.
5395:
5396: yyResult = pUpperIdentifier(yyStart);
5397: yyError = yyResult.select(yyError);
5398: if (yyResult.hasValue()) {
5399: final String v$g$1 = yyResult.semanticValue();
5400:
5401: final int yyChoice1 = yyResult.index;
5402:
5403: // Nested alternative 1.
5404:
5405: yyBase = yyChoice1;
5406: yyResult = pSymbol(yyBase);
5407: yyError = yyResult.select(yyError);
5408: if (yyResult.hasValue("(")) {
5409:
5410: yyResult = pLogicalOrExpression(yyResult.index);
5411: yyError = yyResult.select(yyError);
5412: if (yyResult.hasValue()) {
5413: final Node v$g$2 = yyResult.semanticValue();
5414:
5415: yyRepetition1 = yyResult.index;
5416: yyRepValue1 = Pair.empty();
5417: while (true) {
5418:
5419: yyBase = yyRepetition1;
5420: yyResult = pSymbol(yyBase);
5421: yyError = yyResult.select(yyError);
5422: if (yyResult.hasValue(",")) {
5423:
5424: yyResult = pLogicalOrExpression(yyResult.index);
5425: yyError = yyResult.select(yyError);
5426: if (yyResult.hasValue()) {
5427: final Node v$el$1 = yyResult
5428: .semanticValue();
5429:
5430: yyRepetition1 = yyResult.index;
5431: yyRepValue1 = new Pair<Node>(v$el$1,
5432: yyRepValue1);
5433: continue;
5434: }
5435: } else {
5436: yyError = yyError.select("\",\" expected",
5437: yyBase);
5438: }
5439: break;
5440: }
5441: { // Start scope for v$g$3.
5442: final Pair<Node> v$g$3 = yyRepValue1.reverse();
5443:
5444: yyBase = yyRepetition1;
5445: yyResult = pSymbol(yyBase);
5446: yyError = yyResult.select(yyError);
5447: if (yyResult.hasValue(")")) {
5448:
5449: yyValue = GNode.create("TupleConstructor",
5450: v$g$3.size() + 2).add(v$g$1).add(
5451: v$g$2).addAll(v$g$3);
5452: yyValue.setLocation(location(yyStart));
5453:
5454: return yyResult.createValue(yyValue,
5455: yyError);
5456: } else {
5457: yyError = yyError.select("\")\" expected",
5458: yyBase);
5459: }
5460: } // End scope for v$g$3.
5461: }
5462: } else {
5463: yyError = yyError.select("\"(\" expected", yyBase);
5464: }
5465:
5466: // Nested alternative 2.
5467:
5468: yyValue = GNode.create("TupleConstructor", v$g$1);
5469: yyValue.setLocation(location(yyStart));
5470:
5471: return new SemanticValue(yyValue, yyChoice1, yyError);
5472: }
5473:
5474: // Done.
5475: return yyError;
5476: }
5477:
5478: // =========================================================================
5479:
5480: /**
5481: * Parse nonterminal xtc.typical.Typical.RecordExpression.
5482: *
5483: * @param yyStart The index.
5484: * @return The result.
5485: * @throws IOException Signals an I/O error.
5486: */
5487: private Result pRecordExpression(final int yyStart)
5488: throws IOException {
5489: Result yyResult;
5490: int yyBase;
5491: int yyRepetition1;
5492: Pair<Node> yyRepValue1;
5493: int yyOption1;
5494: Node yyOpValue1;
5495: Node yyValue;
5496: ParseError yyError = ParseError.DUMMY;
5497:
5498: // Alternative 1.
5499:
5500: yyResult = pSymbol(yyStart);
5501: yyError = yyResult.select(yyError);
5502: if (yyResult.hasValue("{")) {
5503:
5504: final int yyChoice1 = yyResult.index;
5505:
5506: // Nested alternative 1.
5507:
5508: yyOption1 = yyChoice1;
5509: yyOpValue1 = null;
5510:
5511: yyResult = pWithExpression(yyOption1);
5512: yyError = yyResult.select(yyError);
5513: if (yyResult.hasValue()) {
5514: final Node v$el$1 = yyResult.semanticValue();
5515:
5516: yyOption1 = yyResult.index;
5517: yyOpValue1 = v$el$1;
5518: }
5519: { // Start scope for v$g$1.
5520: final Node v$g$1 = yyOpValue1;
5521:
5522: yyResult = pFieldAssignment(yyOption1);
5523: yyError = yyResult.select(yyError);
5524: if (yyResult.hasValue()) {
5525: final Node v$g$2 = yyResult.semanticValue();
5526:
5527: yyRepetition1 = yyResult.index;
5528: yyRepValue1 = Pair.empty();
5529: while (true) {
5530:
5531: yyBase = yyRepetition1;
5532: yyResult = pSymbol(yyBase);
5533: yyError = yyResult.select(yyError);
5534: if (yyResult.hasValue(",")) {
5535:
5536: yyResult = pFieldAssignment(yyResult.index);
5537: yyError = yyResult.select(yyError);
5538: if (yyResult.hasValue()) {
5539: final Node v$el$2 = yyResult
5540: .semanticValue();
5541:
5542: yyRepetition1 = yyResult.index;
5543: yyRepValue1 = new Pair<Node>(v$el$2,
5544: yyRepValue1);
5545: continue;
5546: }
5547: } else {
5548: yyError = yyError.select("\",\" expected",
5549: yyBase);
5550: }
5551: break;
5552: }
5553: { // Start scope for v$g$3.
5554: final Pair<Node> v$g$3 = yyRepValue1.reverse();
5555:
5556: yyBase = yyRepetition1;
5557: yyResult = pSymbol(yyBase);
5558: yyError = yyResult.select(yyError);
5559: if (yyResult.hasValue("}")) {
5560:
5561: yyValue = GNode.create("RecordExpression",
5562: v$g$3.size() + 2).add(v$g$1).add(
5563: v$g$2).addAll(v$g$3);
5564: yyValue.setLocation(location(yyStart));
5565:
5566: return yyResult.createValue(yyValue,
5567: yyError);
5568: } else {
5569: yyError = yyError.select("\"}\" expected",
5570: yyBase);
5571: }
5572: } // End scope for v$g$3.
5573: }
5574: } // End scope for v$g$1.
5575:
5576: // Nested alternative 2.
5577:
5578: yyBase = yyChoice1;
5579: yyResult = pSymbol(yyBase);
5580: yyError = yyResult.select(yyError);
5581: if (yyResult.hasValue("}")) {
5582:
5583: yyValue = GNode.create("RecordExpression", false);
5584: yyValue.setLocation(location(yyStart));
5585:
5586: return yyResult.createValue(yyValue, yyError);
5587: } else {
5588: yyError = yyError.select("\"}\" expected", yyBase);
5589: }
5590: }
5591:
5592: // Done.
5593: yyError = yyError.select("record expression expected", yyStart);
5594: return yyError;
5595: }
5596:
5597: // =========================================================================
5598:
5599: /**
5600: * Parse nonterminal xtc.typical.Typical.WithExpression.
5601: *
5602: * @param yyStart The index.
5603: * @return The result.
5604: * @throws IOException Signals an I/O error.
5605: */
5606: private Result pWithExpression(final int yyStart)
5607: throws IOException {
5608: Result yyResult;
5609: int yyBase;
5610: Node yyValue;
5611: ParseError yyError = ParseError.DUMMY;
5612:
5613: // Alternative 1.
5614:
5615: yyResult = pExpression(yyStart);
5616: yyError = yyResult.select(yyError);
5617: if (yyResult.hasValue()) {
5618: final Node v$g$1 = yyResult.semanticValue();
5619:
5620: yyBase = yyResult.index;
5621: yyResult = pKeyword(yyBase);
5622: yyError = yyResult.select(yyError);
5623: if (yyResult.hasValue("with")) {
5624:
5625: yyValue = GNode.create("WithExpression", v$g$1);
5626: yyValue.setLocation(location(yyStart));
5627:
5628: return yyResult.createValue(yyValue, yyError);
5629: } else {
5630: yyError = yyError.select("\"with\" expected", yyBase);
5631: }
5632: }
5633:
5634: // Done.
5635: return yyError;
5636: }
5637:
5638: // =========================================================================
5639:
5640: /**
5641: * Parse nonterminal xtc.typical.Typical.FieldAssignment.
5642: *
5643: * @param yyStart The index.
5644: * @return The result.
5645: * @throws IOException Signals an I/O error.
5646: */
5647: private Result pFieldAssignment(final int yyStart)
5648: throws IOException {
5649: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
5650: if (null == yyColumn.chunk3)
5651: yyColumn.chunk3 = new Chunk3();
5652: if (null == yyColumn.chunk3.fFieldAssignment)
5653: yyColumn.chunk3.fFieldAssignment = pFieldAssignment$1(yyStart);
5654: return yyColumn.chunk3.fFieldAssignment;
5655: }
5656:
5657: /** Actually parse xtc.typical.Typical.FieldAssignment. */
5658: private Result pFieldAssignment$1(final int yyStart)
5659: throws IOException {
5660: Result yyResult;
5661: int yyBase;
5662: Node yyValue;
5663: ParseError yyError = ParseError.DUMMY;
5664:
5665: // Alternative 1.
5666:
5667: yyResult = pLowerIdentifier(yyStart);
5668: yyError = yyResult.select(yyError);
5669: if (yyResult.hasValue()) {
5670: final String v$g$1 = yyResult.semanticValue();
5671:
5672: yyBase = yyResult.index;
5673: yyResult = pSymbol(yyBase);
5674: yyError = yyResult.select(yyError);
5675: if (yyResult.hasValue("=")) {
5676:
5677: yyResult = pLogicalOrExpression(yyResult.index);
5678: yyError = yyResult.select(yyError);
5679: if (yyResult.hasValue()) {
5680: final Node v$g$2 = yyResult.semanticValue();
5681:
5682: yyValue = GNode.create("FieldAssignment", v$g$1,
5683: v$g$2);
5684: yyValue.setLocation(location(yyStart));
5685:
5686: return yyResult.createValue(yyValue, yyError);
5687: }
5688: } else {
5689: yyError = yyError.select("\"=\" expected", yyBase);
5690: }
5691: }
5692:
5693: // Done.
5694: return yyError;
5695: }
5696:
5697: // =========================================================================
5698:
5699: /**
5700: * Parse nonterminal xtc.typical.Typical.IfExpression.
5701: *
5702: * @param yyStart The index.
5703: * @return The result.
5704: * @throws IOException Signals an I/O error.
5705: */
5706: private Result pIfExpression(final int yyStart) throws IOException {
5707: Result yyResult;
5708: int yyBase;
5709: Node yyValue;
5710: ParseError yyError = ParseError.DUMMY;
5711:
5712: // Alternative 1.
5713:
5714: yyResult = pKeyword(yyStart);
5715: yyError = yyResult.select(yyError);
5716: if (yyResult.hasValue("if")) {
5717:
5718: yyResult = pExpression(yyResult.index);
5719: yyError = yyResult.select(yyError);
5720: if (yyResult.hasValue()) {
5721: final Node v$g$1 = yyResult.semanticValue();
5722:
5723: yyBase = yyResult.index;
5724: yyResult = pKeyword(yyBase);
5725: yyError = yyResult.select(yyError);
5726: if (yyResult.hasValue("then")) {
5727:
5728: yyResult = pExpression(yyResult.index);
5729: yyError = yyResult.select(yyError);
5730: if (yyResult.hasValue()) {
5731: final Node v$g$2 = yyResult.semanticValue();
5732:
5733: yyValue = GNode.create("IfExpression", v$g$1,
5734: v$g$2);
5735: yyValue.setLocation(location(yyStart));
5736:
5737: return yyResult.createValue(yyValue, yyError);
5738: }
5739: } else {
5740: yyError = yyError.select("\"then\" expected",
5741: yyBase);
5742: }
5743: }
5744: }
5745:
5746: // Done.
5747: yyError = yyError.select("if expression expected", yyStart);
5748: return yyError;
5749: }
5750:
5751: // =========================================================================
5752:
5753: /**
5754: * Parse nonterminal xtc.typical.Typical.IfElseExpression.
5755: *
5756: * @param yyStart The index.
5757: * @return The result.
5758: * @throws IOException Signals an I/O error.
5759: */
5760: private Result pIfElseExpression(final int yyStart)
5761: throws IOException {
5762: Result yyResult;
5763: int yyBase;
5764: Node yyValue;
5765: ParseError yyError = ParseError.DUMMY;
5766:
5767: // Alternative 1.
5768:
5769: yyResult = pKeyword(yyStart);
5770: yyError = yyResult.select(yyError);
5771: if (yyResult.hasValue("if")) {
5772:
5773: yyResult = pExpression(yyResult.index);
5774: yyError = yyResult.select(yyError);
5775: if (yyResult.hasValue()) {
5776: final Node v$g$1 = yyResult.semanticValue();
5777:
5778: yyBase = yyResult.index;
5779: yyResult = pKeyword(yyBase);
5780: yyError = yyResult.select(yyError);
5781: if (yyResult.hasValue("then")) {
5782:
5783: yyResult = pExpression(yyResult.index);
5784: yyError = yyResult.select(yyError);
5785: if (yyResult.hasValue()) {
5786: final Node v$g$2 = yyResult.semanticValue();
5787:
5788: yyBase = yyResult.index;
5789: yyResult = pKeyword(yyBase);
5790: yyError = yyResult.select(yyError);
5791: if (yyResult.hasValue("else")) {
5792:
5793: yyResult = pExpression(yyResult.index);
5794: yyError = yyResult.select(yyError);
5795: if (yyResult.hasValue()) {
5796: final Node v$g$3 = yyResult
5797: .semanticValue();
5798:
5799: yyValue = GNode.create(
5800: "IfElseExpression", v$g$1,
5801: v$g$2, v$g$3);
5802: yyValue.setLocation(location(yyStart));
5803:
5804: return yyResult.createValue(yyValue,
5805: yyError);
5806: }
5807: } else {
5808: yyError = yyError.select(
5809: "\"else\" expected", yyBase);
5810: }
5811: }
5812: } else {
5813: yyError = yyError.select("\"then\" expected",
5814: yyBase);
5815: }
5816: }
5817: }
5818:
5819: // Done.
5820: yyError = yyError
5821: .select("if else expression expected", yyStart);
5822: return yyError;
5823: }
5824:
5825: // =========================================================================
5826:
5827: /**
5828: * Parse nonterminal xtc.typical.Typical.ListLiteral.
5829: *
5830: * @param yyStart The index.
5831: * @return The result.
5832: * @throws IOException Signals an I/O error.
5833: */
5834: private Result pListLiteral(final int yyStart) throws IOException {
5835: Result yyResult;
5836: int yyBase;
5837: int yyRepetition1;
5838: Pair<Node> yyRepValue1;
5839: Node yyValue;
5840: ParseError yyError = ParseError.DUMMY;
5841:
5842: // Alternative 1.
5843:
5844: yyResult = pSymbol(yyStart);
5845: yyError = yyResult.select(yyError);
5846: if (yyResult.hasValue("[")) {
5847:
5848: final int yyChoice1 = yyResult.index;
5849:
5850: // Nested alternative 1.
5851:
5852: yyResult = pLogicalOrExpression(yyChoice1);
5853: yyError = yyResult.select(yyError);
5854: if (yyResult.hasValue()) {
5855: final Node v$g$1 = yyResult.semanticValue();
5856:
5857: yyRepetition1 = yyResult.index;
5858: yyRepValue1 = Pair.empty();
5859: while (true) {
5860:
5861: yyBase = yyRepetition1;
5862: yyResult = pSymbol(yyBase);
5863: yyError = yyResult.select(yyError);
5864: if (yyResult.hasValue(",")) {
5865:
5866: yyResult = pLogicalOrExpression(yyResult.index);
5867: yyError = yyResult.select(yyError);
5868: if (yyResult.hasValue()) {
5869: final Node v$el$1 = yyResult
5870: .semanticValue();
5871:
5872: yyRepetition1 = yyResult.index;
5873: yyRepValue1 = new Pair<Node>(v$el$1,
5874: yyRepValue1);
5875: continue;
5876: }
5877: } else {
5878: yyError = yyError.select("\",\" expected",
5879: yyBase);
5880: }
5881: break;
5882: }
5883: { // Start scope for v$g$2.
5884: final Pair<Node> v$g$2 = yyRepValue1.reverse();
5885:
5886: yyBase = yyRepetition1;
5887: yyResult = pSymbol(yyBase);
5888: yyError = yyResult.select(yyError);
5889: if (yyResult.hasValue("]")) {
5890:
5891: yyValue = GNode.createFromPair("ListLiteral",
5892: v$g$1, v$g$2);
5893: yyValue.setLocation(location(yyStart));
5894:
5895: return yyResult.createValue(yyValue, yyError);
5896: } else {
5897: yyError = yyError.select("\"]\" expected",
5898: yyBase);
5899: }
5900: } // End scope for v$g$2.
5901: }
5902:
5903: // Nested alternative 2.
5904:
5905: yyBase = yyChoice1;
5906: yyResult = pSymbol(yyBase);
5907: yyError = yyResult.select(yyError);
5908: if (yyResult.hasValue("]")) {
5909:
5910: yyValue = GNode.create("ListLiteral", false);
5911: yyValue.setLocation(location(yyStart));
5912:
5913: return yyResult.createValue(yyValue, yyError);
5914: } else {
5915: yyError = yyError.select("\"]\" expected", yyBase);
5916: }
5917: }
5918:
5919: // Done.
5920: yyError = yyError.select("list literal expected", yyStart);
5921: return yyError;
5922: }
5923:
5924: // =========================================================================
5925:
5926: /**
5927: * Parse nonterminal xtc.typical.Typical.Literal.
5928: *
5929: * @param yyStart The index.
5930: * @return The result.
5931: * @throws IOException Signals an I/O error.
5932: */
5933: private Result pLiteral(final int yyStart) throws IOException {
5934: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
5935: if (null == yyColumn.chunk3)
5936: yyColumn.chunk3 = new Chunk3();
5937: if (null == yyColumn.chunk3.fLiteral)
5938: yyColumn.chunk3.fLiteral = pLiteral$1(yyStart);
5939: return yyColumn.chunk3.fLiteral;
5940: }
5941:
5942: /** Actually parse xtc.typical.Typical.Literal. */
5943: private Result pLiteral$1(final int yyStart) throws IOException {
5944: Result yyResult;
5945: Node yyValue;
5946: ParseError yyError = ParseError.DUMMY;
5947:
5948: // Alternative 1.
5949:
5950: yyResult = pFloatingLiteral(yyStart);
5951: yyError = yyResult.select(yyError);
5952: if (yyResult.hasValue()) {
5953: yyValue = yyResult.semanticValue();
5954:
5955: yyResult = pSpacing(yyResult.index);
5956: yyError = yyResult.select(yyError);
5957: if (yyResult.hasValue()) {
5958:
5959: return yyResult.createValue(yyValue, yyError);
5960: }
5961: }
5962:
5963: // Alternative 2.
5964:
5965: yyResult = pIntegerLiteral(yyStart);
5966: yyError = yyResult.select(yyError);
5967: if (yyResult.hasValue()) {
5968: yyValue = yyResult.semanticValue();
5969:
5970: yyResult = pSpacing(yyResult.index);
5971: yyError = yyResult.select(yyError);
5972: if (yyResult.hasValue()) {
5973:
5974: return yyResult.createValue(yyValue, yyError);
5975: }
5976: }
5977:
5978: // Alternative 3.
5979:
5980: yyResult = pStringLiteral(yyStart);
5981: yyError = yyResult.select(yyError);
5982: if (yyResult.hasValue()) {
5983: yyValue = yyResult.semanticValue();
5984:
5985: yyResult = pSpacing(yyResult.index);
5986: yyError = yyResult.select(yyError);
5987: if (yyResult.hasValue()) {
5988:
5989: return yyResult.createValue(yyValue, yyError);
5990: }
5991: }
5992:
5993: // Alternative 4.
5994:
5995: yyResult = pBooleanLiteral(yyStart);
5996: yyError = yyResult.select(yyError);
5997: if (yyResult.hasValue()) {
5998: yyValue = yyResult.semanticValue();
5999:
6000: yyResult = pSpacing(yyResult.index);
6001: yyError = yyResult.select(yyError);
6002: if (yyResult.hasValue()) {
6003:
6004: return yyResult.createValue(yyValue, yyError);
6005: }
6006: }
6007:
6008: // Alternative 5.
6009:
6010: yyResult = pKeyword(yyStart);
6011: yyError = yyResult.select(yyError);
6012: if (yyResult.hasValue("bottom")) {
6013:
6014: yyValue = GNode.create("Bottom", false);
6015: yyValue.setLocation(location(yyStart));
6016:
6017: return yyResult.createValue(yyValue, yyError);
6018: }
6019:
6020: // Done.
6021: yyError = yyError.select("literal expected", yyStart);
6022: return yyError;
6023: }
6024:
6025: // =========================================================================
6026:
6027: /**
6028: * Parse nonterminal xtc.typical.Typical.ReduceExpression.
6029: *
6030: * @param yyStart The index.
6031: * @return The result.
6032: * @throws IOException Signals an I/O error.
6033: */
6034: private Result pReduceExpression(final int yyStart)
6035: throws IOException {
6036: Result yyResult;
6037: int yyBase;
6038: Node yyValue;
6039: ParseError yyError = ParseError.DUMMY;
6040:
6041: // Alternative <Reduce>.
6042:
6043: yyResult = pKeyword(yyStart);
6044: yyError = yyResult.select(yyError);
6045: if (yyResult.hasValue("reduce")) {
6046:
6047: yyBase = yyResult.index;
6048: yyResult = pKeyword(yyBase);
6049: yyError = yyResult.select(yyError);
6050: if (yyResult.hasValue("to")) {
6051:
6052: yyResult = pReduceOptions(yyResult.index);
6053: yyError = yyResult.select(yyError);
6054: if (yyResult.hasValue()) {
6055: final Node v$g$1 = yyResult.semanticValue();
6056:
6057: yyResult = pLiteral(yyResult.index);
6058: yyError = yyResult.select(yyError);
6059: if (yyResult.hasValue()) {
6060: final Node v$g$2 = yyResult.semanticValue();
6061:
6062: yyBase = yyResult.index;
6063: yyResult = pKeyword(yyBase);
6064: yyError = yyResult.select(yyError);
6065: if (yyResult.hasValue("with")) {
6066:
6067: yyResult = pPatternMatching(yyResult.index);
6068: yyError = yyResult.select(yyError);
6069: if (yyResult.hasValue()) {
6070: final Node v$g$3 = yyResult
6071: .semanticValue();
6072:
6073: yyValue = GNode.create(
6074: "ReduceExpression", v$g$1,
6075: v$g$2, v$g$3);
6076: yyValue.setLocation(location(yyStart));
6077:
6078: return yyResult.createValue(yyValue,
6079: yyError);
6080: }
6081: } else {
6082: yyError = yyError.select(
6083: "\"with\" expected", yyBase);
6084: }
6085: }
6086: }
6087: } else {
6088: yyError = yyError.select("\"to\" expected", yyBase);
6089: }
6090: }
6091:
6092: // Done.
6093: yyError = yyError.select("reduce expression expected", yyStart);
6094: return yyError;
6095: }
6096:
6097: // =========================================================================
6098:
6099: /**
6100: * Parse nonterminal xtc.typical.Typical.ReduceOptions.
6101: *
6102: * @param yyStart The index.
6103: * @return The result.
6104: * @throws IOException Signals an I/O error.
6105: */
6106: private Result pReduceOptions(final int yyStart) throws IOException {
6107: Result yyResult;
6108: int yyRepetition1;
6109: Pair<String> yyRepValue1;
6110: Node yyValue;
6111: ParseError yyError = ParseError.DUMMY;
6112:
6113: // Alternative 1.
6114:
6115: yyRepetition1 = yyStart;
6116: yyRepValue1 = Pair.empty();
6117: while (true) {
6118:
6119: yyResult = pLowerIdentifier(yyRepetition1);
6120: yyError = yyResult.select(yyError);
6121: if (yyResult.hasValue()) {
6122: final String v$el$1 = yyResult.semanticValue();
6123:
6124: yyRepetition1 = yyResult.index;
6125: yyRepValue1 = new Pair<String>(v$el$1, yyRepValue1);
6126: continue;
6127: }
6128: break;
6129: }
6130: { // Start scope for v$g$1.
6131: final Pair<String> v$g$1 = yyRepValue1.reverse();
6132:
6133: yyValue = GNode.createFromPair("ReduceOptions", v$g$1);
6134: yyValue.setLocation(location(yyStart));
6135:
6136: return new SemanticValue(yyValue, yyRepetition1, yyError);
6137: } // End scope for v$g$1.
6138: }
6139:
6140: // =========================================================================
6141:
6142: /**
6143: * Parse nonterminal xtc.typical.Typical.LowerID.
6144: *
6145: * @param yyStart The index.
6146: * @return The result.
6147: * @throws IOException Signals an I/O error.
6148: */
6149: private Result pLowerID(final int yyStart) throws IOException {
6150: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
6151: if (null == yyColumn.chunk3)
6152: yyColumn.chunk3 = new Chunk3();
6153: if (null == yyColumn.chunk3.fLowerID)
6154: yyColumn.chunk3.fLowerID = pLowerID$1(yyStart);
6155: return yyColumn.chunk3.fLowerID;
6156: }
6157:
6158: /** Actually parse xtc.typical.Typical.LowerID. */
6159: private Result pLowerID$1(final int yyStart) throws IOException {
6160: Result yyResult;
6161: Node yyValue;
6162: ParseError yyError = ParseError.DUMMY;
6163:
6164: // Alternative 1.
6165:
6166: yyResult = pLowerIdentifier(yyStart);
6167: yyError = yyResult.select(yyError);
6168: if (yyResult.hasValue()) {
6169: final String v$g$1 = yyResult.semanticValue();
6170:
6171: yyValue = GNode.create("LowerID", v$g$1);
6172: yyValue.setLocation(location(yyStart));
6173:
6174: return yyResult.createValue(yyValue, yyError);
6175: }
6176:
6177: // Done.
6178: return yyError;
6179: }
6180:
6181: // =========================================================================
6182:
6183: /**
6184: * Parse nonterminal xtc.typical.Typical.UpperID.
6185: *
6186: * @param yyStart The index.
6187: * @return The result.
6188: * @throws IOException Signals an I/O error.
6189: */
6190: private Result pUpperID(final int yyStart) throws IOException {
6191: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
6192: if (null == yyColumn.chunk3)
6193: yyColumn.chunk3 = new Chunk3();
6194: if (null == yyColumn.chunk3.fUpperID)
6195: yyColumn.chunk3.fUpperID = pUpperID$1(yyStart);
6196: return yyColumn.chunk3.fUpperID;
6197: }
6198:
6199: /** Actually parse xtc.typical.Typical.UpperID. */
6200: private Result pUpperID$1(final int yyStart) throws IOException {
6201: Result yyResult;
6202: Node yyValue;
6203: ParseError yyError = ParseError.DUMMY;
6204:
6205: // Alternative 1.
6206:
6207: yyResult = pUpperIdentifier(yyStart);
6208: yyError = yyResult.select(yyError);
6209: if (yyResult.hasValue()) {
6210: final String v$g$1 = yyResult.semanticValue();
6211:
6212: yyValue = GNode.create("UpperID", v$g$1);
6213: yyValue.setLocation(location(yyStart));
6214:
6215: return yyResult.createValue(yyValue, yyError);
6216: }
6217:
6218: // Done.
6219: return yyError;
6220: }
6221:
6222: // =========================================================================
6223:
6224: /**
6225: * Parse nonterminal xtc.typical.Type.AliasedType.
6226: *
6227: * @param yyStart The index.
6228: * @return The result.
6229: * @throws IOException Signals an I/O error.
6230: */
6231: private Result pAliasedType(final int yyStart) throws IOException {
6232: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
6233: if (null == yyColumn.chunk4)
6234: yyColumn.chunk4 = new Chunk4();
6235: if (null == yyColumn.chunk4.fAliasedType)
6236: yyColumn.chunk4.fAliasedType = pAliasedType$1(yyStart);
6237: return yyColumn.chunk4.fAliasedType;
6238: }
6239:
6240: /** Actually parse xtc.typical.Type.AliasedType. */
6241: private Result pAliasedType$1(final int yyStart) throws IOException {
6242: Result yyResult;
6243: int yyRepetition1;
6244: Pair<Action<Node>> yyRepValue1;
6245: Node yyValue;
6246: ParseError yyError = ParseError.DUMMY;
6247:
6248: // Alternative <Base>.
6249:
6250: yyResult = pFunctionType(yyStart);
6251: yyError = yyResult.select(yyError);
6252: if (yyResult.hasValue()) {
6253: final Node v$3 = yyResult.semanticValue();
6254:
6255: yyRepetition1 = yyResult.index;
6256: yyRepValue1 = Pair.empty();
6257: while (true) {
6258:
6259: yyResult = pAliasedType$$Tail1(yyRepetition1);
6260: yyError = yyResult.select(yyError);
6261: if (yyResult.hasValue()) {
6262: final Action<Node> v$4 = yyResult.semanticValue();
6263:
6264: yyRepetition1 = yyResult.index;
6265: yyRepValue1 = new Pair<Action<Node>>(v$4,
6266: yyRepValue1);
6267: continue;
6268: }
6269: break;
6270: }
6271: { // Start scope for v$5.
6272: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
6273:
6274: yyValue = apply(v$5, v$3, yyStart);
6275:
6276: return new SemanticValue(yyValue, yyRepetition1,
6277: yyError);
6278: } // End scope for v$5.
6279: }
6280:
6281: // Done.
6282: return yyError;
6283: }
6284:
6285: // =========================================================================
6286:
6287: /**
6288: * Parse synthetic nonterminal xtc.typical.Typical.AliasedType$$Tail1.
6289: *
6290: * @param yyStart The index.
6291: * @return The result.
6292: * @throws IOException Signals an I/O error.
6293: */
6294: private Result pAliasedType$$Tail1(final int yyStart)
6295: throws IOException {
6296: Result yyResult;
6297: Action<Node> yyValue;
6298: ParseError yyError = ParseError.DUMMY;
6299:
6300: // Alternative <Recursion>.
6301:
6302: yyResult = pKeyword(yyStart);
6303: yyError = yyResult.select(yyError);
6304: if (yyResult.hasValue("as")) {
6305:
6306: yyResult = pTypeVariable(yyResult.index);
6307: yyError = yyResult.select(yyError);
6308: if (yyResult.hasValue()) {
6309: final Node v$g$2 = yyResult.semanticValue();
6310:
6311: yyValue = new Action<Node>() {
6312: public Node run(Node v$1) {
6313: return GNode.create("AliasedType", v$1, v$g$2);
6314: }
6315: };
6316:
6317: return yyResult.createValue(yyValue, yyError);
6318: }
6319: }
6320:
6321: // Done.
6322: yyError = yyError.select("aliased type expected", yyStart);
6323: return yyError;
6324: }
6325:
6326: // =========================================================================
6327:
6328: /**
6329: * Parse nonterminal xtc.typical.Type.FunctionType.
6330: *
6331: * @param yyStart The index.
6332: * @return The result.
6333: * @throws IOException Signals an I/O error.
6334: */
6335: private Result pFunctionType(final int yyStart) throws IOException {
6336: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
6337: if (null == yyColumn.chunk4)
6338: yyColumn.chunk4 = new Chunk4();
6339: if (null == yyColumn.chunk4.fFunctionType)
6340: yyColumn.chunk4.fFunctionType = pFunctionType$1(yyStart);
6341: return yyColumn.chunk4.fFunctionType;
6342: }
6343:
6344: /** Actually parse xtc.typical.Type.FunctionType. */
6345: private Result pFunctionType$1(final int yyStart)
6346: throws IOException {
6347: Result yyResult;
6348: int yyBase;
6349: Node yyValue;
6350: ParseError yyError = ParseError.DUMMY;
6351:
6352: // Alternative <Recursion>.
6353:
6354: yyResult = pTupleType(yyStart);
6355: yyError = yyResult.select(yyError);
6356: if (yyResult.hasValue()) {
6357: final Node v$g$1 = yyResult.semanticValue();
6358:
6359: yyBase = yyResult.index;
6360: yyResult = pSymbol(yyBase);
6361: yyError = yyResult.select(yyError);
6362: if (yyResult.hasValue("->")) {
6363:
6364: yyResult = pFunctionType(yyResult.index);
6365: yyError = yyResult.select(yyError);
6366: if (yyResult.hasValue()) {
6367: final Node v$g$2 = yyResult.semanticValue();
6368:
6369: yyValue = GNode
6370: .create("FunctionType", v$g$1, v$g$2);
6371: yyValue.setLocation(location(yyStart));
6372:
6373: return yyResult.createValue(yyValue, yyError);
6374: }
6375: } else {
6376: yyError = yyError.select("\"->\" expected", yyBase);
6377: }
6378: }
6379:
6380: // Alternative <Base>.
6381:
6382: yyResult = pTupleType(yyStart);
6383: yyError = yyResult.select(yyError);
6384: if (yyResult.hasValue()) {
6385: yyValue = yyResult.semanticValue();
6386:
6387: return yyResult.createValue(yyValue, yyError);
6388: }
6389:
6390: // Done.
6391: return yyError;
6392: }
6393:
6394: // =========================================================================
6395:
6396: /**
6397: * Parse nonterminal xtc.typical.Type.TupleType.
6398: *
6399: * @param yyStart The index.
6400: * @return The result.
6401: * @throws IOException Signals an I/O error.
6402: */
6403: private Result pTupleType(final int yyStart) throws IOException {
6404: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
6405: if (null == yyColumn.chunk4)
6406: yyColumn.chunk4 = new Chunk4();
6407: if (null == yyColumn.chunk4.fTupleType)
6408: yyColumn.chunk4.fTupleType = pTupleType$1(yyStart);
6409: return yyColumn.chunk4.fTupleType;
6410: }
6411:
6412: /** Actually parse xtc.typical.Type.TupleType. */
6413: private Result pTupleType$1(final int yyStart) throws IOException {
6414: Result yyResult;
6415: Node yyValue;
6416: ParseError yyError = ParseError.DUMMY;
6417:
6418: // Alternative <Tuple>.
6419:
6420: yyResult = pConstructedType(yyStart);
6421: yyError = yyResult.select(yyError);
6422: if (yyResult.hasValue()) {
6423: final Node v$g$1 = yyResult.semanticValue();
6424:
6425: yyResult = pTupleType$$Plus1(yyResult.index);
6426: yyError = yyResult.select(yyError);
6427: if (yyResult.hasValue()) {
6428: final Pair<Node> v$g$2 = yyResult.semanticValue();
6429:
6430: yyValue = GNode.createFromPair("TupleType", v$g$1,
6431: v$g$2);
6432: yyValue.setLocation(location(yyStart));
6433:
6434: return yyResult.createValue(yyValue, yyError);
6435: }
6436: }
6437:
6438: // Alternative <Base>.
6439:
6440: yyResult = pConstructedType(yyStart);
6441: yyError = yyResult.select(yyError);
6442: if (yyResult.hasValue()) {
6443: yyValue = yyResult.semanticValue();
6444:
6445: return yyResult.createValue(yyValue, yyError);
6446: }
6447:
6448: // Done.
6449: return yyError;
6450: }
6451:
6452: // =========================================================================
6453:
6454: /**
6455: * Parse synthetic nonterminal xtc.typical.Typical.TupleType$$Plus1.
6456: *
6457: * @param yyStart The index.
6458: * @return The result.
6459: * @throws IOException Signals an I/O error.
6460: */
6461: private Result pTupleType$$Plus1(final int yyStart)
6462: throws IOException {
6463: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
6464: if (null == yyColumn.chunk4)
6465: yyColumn.chunk4 = new Chunk4();
6466: if (null == yyColumn.chunk4.fTupleType$$Plus1)
6467: yyColumn.chunk4.fTupleType$$Plus1 = pTupleType$$Plus1$1(yyStart);
6468: return yyColumn.chunk4.fTupleType$$Plus1;
6469: }
6470:
6471: /** Actually parse xtc.typical.Typical.TupleType$$Plus1. */
6472: private Result pTupleType$$Plus1$1(final int yyStart)
6473: throws IOException {
6474: Result yyResult;
6475: Pair<Node> yyValue;
6476: ParseError yyError = ParseError.DUMMY;
6477:
6478: // Alternative 1.
6479:
6480: yyResult = pSymbol(yyStart);
6481: yyError = yyResult.select(yyError);
6482: if (yyResult.hasValue("*")) {
6483:
6484: yyResult = pConstructedType(yyResult.index);
6485: yyError = yyResult.select(yyError);
6486: if (yyResult.hasValue()) {
6487: final Node v$el$1 = yyResult.semanticValue();
6488:
6489: final int yyChoice1 = yyResult.index;
6490:
6491: // Nested alternative 1.
6492:
6493: yyResult = pTupleType$$Plus1(yyChoice1);
6494: yyError = yyResult.select(yyError);
6495: if (yyResult.hasValue()) {
6496: final Pair<Node> v$2 = yyResult.semanticValue();
6497:
6498: yyValue = new Pair<Node>(v$el$1, v$2);
6499:
6500: return yyResult.createValue(yyValue, yyError);
6501: }
6502:
6503: // Nested alternative 2.
6504:
6505: yyValue = new Pair<Node>(v$el$1);
6506:
6507: return new SemanticValue(yyValue, yyChoice1, yyError);
6508: }
6509: }
6510:
6511: // Done.
6512: yyError = yyError.select("tuple type expected", yyStart);
6513: return yyError;
6514: }
6515:
6516: // =========================================================================
6517:
6518: /**
6519: * Parse nonterminal xtc.typical.Type.ConstructedType.
6520: *
6521: * @param yyStart The index.
6522: * @return The result.
6523: * @throws IOException Signals an I/O error.
6524: */
6525: private Result pConstructedType(final int yyStart)
6526: throws IOException {
6527: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
6528: if (null == yyColumn.chunk4)
6529: yyColumn.chunk4 = new Chunk4();
6530: if (null == yyColumn.chunk4.fConstructedType)
6531: yyColumn.chunk4.fConstructedType = pConstructedType$1(yyStart);
6532: return yyColumn.chunk4.fConstructedType;
6533: }
6534:
6535: /** Actually parse xtc.typical.Type.ConstructedType. */
6536: private Result pConstructedType$1(final int yyStart)
6537: throws IOException {
6538: Result yyResult;
6539: int yyRepetition1;
6540: Pair<Action<Node>> yyRepValue1;
6541: Node yyValue;
6542: ParseError yyError = ParseError.DUMMY;
6543:
6544: // Alternative <Nary>.
6545:
6546: yyResult = pNaryConstructedType(yyStart);
6547: yyError = yyResult.select(yyError);
6548: if (yyResult.hasValue()) {
6549: final Node v$3 = yyResult.semanticValue();
6550:
6551: yyRepetition1 = yyResult.index;
6552: yyRepValue1 = Pair.empty();
6553: while (true) {
6554:
6555: yyResult = pConstructedType$$Tail1(yyRepetition1);
6556: yyError = yyResult.select(yyError);
6557: if (yyResult.hasValue()) {
6558: final Action<Node> v$4 = yyResult.semanticValue();
6559:
6560: yyRepetition1 = yyResult.index;
6561: yyRepValue1 = new Pair<Action<Node>>(v$4,
6562: yyRepValue1);
6563: continue;
6564: }
6565: break;
6566: }
6567: { // Start scope for v$5.
6568: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
6569:
6570: yyValue = apply(v$5, v$3, yyStart);
6571:
6572: return new SemanticValue(yyValue, yyRepetition1,
6573: yyError);
6574: } // End scope for v$5.
6575: }
6576:
6577: // Alternative <Base>.
6578:
6579: yyResult = pPrimaryType(yyStart);
6580: yyError = yyResult.select(yyError);
6581: if (yyResult.hasValue()) {
6582: final Node v$6 = yyResult.semanticValue();
6583:
6584: yyRepetition1 = yyResult.index;
6585: yyRepValue1 = Pair.empty();
6586: while (true) {
6587:
6588: yyResult = pConstructedType$$Tail1(yyRepetition1);
6589: yyError = yyResult.select(yyError);
6590: if (yyResult.hasValue()) {
6591: final Action<Node> v$7 = yyResult.semanticValue();
6592:
6593: yyRepetition1 = yyResult.index;
6594: yyRepValue1 = new Pair<Action<Node>>(v$7,
6595: yyRepValue1);
6596: continue;
6597: }
6598: break;
6599: }
6600: { // Start scope for v$8.
6601: final Pair<Action<Node>> v$8 = yyRepValue1.reverse();
6602:
6603: yyValue = apply(v$8, v$6, yyStart);
6604:
6605: return new SemanticValue(yyValue, yyRepetition1,
6606: yyError);
6607: } // End scope for v$8.
6608: }
6609:
6610: // Done.
6611: return yyError;
6612: }
6613:
6614: // =========================================================================
6615:
6616: /**
6617: * Parse synthetic nonterminal xtc.typical.Typical.ConstructedType$$Tail1.
6618: *
6619: * @param yyStart The index.
6620: * @return The result.
6621: * @throws IOException Signals an I/O error.
6622: */
6623: private Result pConstructedType$$Tail1(final int yyStart)
6624: throws IOException {
6625:
6626: Result yyResult;
6627: Action<Node> yyValue;
6628: ParseError yyError = ParseError.DUMMY;
6629:
6630: // Alternative <Unary>.
6631:
6632: yyResult = pLowerIdentifier(yyStart);
6633: yyError = yyResult.select(yyError);
6634: if (yyResult.hasValue()) {
6635: final String v$g$2 = yyResult.semanticValue();
6636:
6637: yyValue = new Action<Node>() {
6638: public Node run(Node v$1) {
6639: return GNode.create("ConstructedType", v$1, v$g$2);
6640: }
6641: };
6642:
6643: return yyResult.createValue(yyValue, yyError);
6644: }
6645:
6646: // Done.
6647: return yyError;
6648: }
6649:
6650: // =========================================================================
6651:
6652: /**
6653: * Parse nonterminal xtc.typical.Type.NaryConstructedType.
6654: *
6655: * @param yyStart The index.
6656: * @return The result.
6657: * @throws IOException Signals an I/O error.
6658: */
6659: private Result pNaryConstructedType(final int yyStart)
6660: throws IOException {
6661: Result yyResult;
6662: Node yyValue;
6663: ParseError yyError = ParseError.DUMMY;
6664:
6665: // Alternative 1.
6666:
6667: yyResult = pNaryType(yyStart);
6668: yyError = yyResult.select(yyError);
6669: if (yyResult.hasValue()) {
6670: final Node v$g$1 = yyResult.semanticValue();
6671:
6672: yyResult = pLowerIdentifier(yyResult.index);
6673: yyError = yyResult.select(yyError);
6674: if (yyResult.hasValue()) {
6675: final String v$g$2 = yyResult.semanticValue();
6676:
6677: yyValue = GNode.create("NaryConstructedType", v$g$1,
6678: v$g$2);
6679: yyValue.setLocation(location(yyStart));
6680:
6681: return yyResult.createValue(yyValue, yyError);
6682: }
6683: }
6684:
6685: // Done.
6686: return yyError;
6687: }
6688:
6689: // =========================================================================
6690:
6691: /**
6692: * Parse nonterminal xtc.typical.Type.NaryType.
6693: *
6694: * @param yyStart The index.
6695: * @return The result.
6696: * @throws IOException Signals an I/O error.
6697: */
6698: private Result pNaryType(final int yyStart) throws IOException {
6699: Result yyResult;
6700: int yyBase;
6701: int yyRepetition1;
6702: boolean yyRepeated1;
6703: Pair<Node> yyRepValue1;
6704: Node yyValue;
6705: ParseError yyError = ParseError.DUMMY;
6706:
6707: // Alternative 1.
6708:
6709: yyResult = pSymbol(yyStart);
6710: yyError = yyResult.select(yyError);
6711: if (yyResult.hasValue("(")) {
6712:
6713: yyResult = pConstructedType(yyResult.index);
6714: yyError = yyResult.select(yyError);
6715: if (yyResult.hasValue()) {
6716: final Node v$g$1 = yyResult.semanticValue();
6717:
6718: yyRepetition1 = yyResult.index;
6719: yyRepeated1 = false;
6720: yyRepValue1 = Pair.empty();
6721: while (true) {
6722:
6723: yyBase = yyRepetition1;
6724: yyResult = pSymbol(yyBase);
6725: yyError = yyResult.select(yyError);
6726: if (yyResult.hasValue(",")) {
6727:
6728: yyResult = pConstructedType(yyResult.index);
6729: yyError = yyResult.select(yyError);
6730: if (yyResult.hasValue()) {
6731: final Node v$el$1 = yyResult
6732: .semanticValue();
6733:
6734: yyRepetition1 = yyResult.index;
6735: yyRepeated1 = true;
6736: yyRepValue1 = new Pair<Node>(v$el$1,
6737: yyRepValue1);
6738: continue;
6739: }
6740: } else {
6741: yyError = yyError.select("\",\" expected",
6742: yyBase);
6743: }
6744: break;
6745: }
6746:
6747: if (yyRepeated1) {
6748: final Pair<Node> v$g$2 = yyRepValue1.reverse();
6749:
6750: yyBase = yyRepetition1;
6751: yyResult = pSymbol(yyBase);
6752: yyError = yyResult.select(yyError);
6753: if (yyResult.hasValue(")")) {
6754:
6755: yyValue = GNode.createFromPair("NaryType",
6756: v$g$1, v$g$2);
6757: yyValue.setLocation(location(yyStart));
6758:
6759: return yyResult.createValue(yyValue, yyError);
6760: } else {
6761: yyError = yyError.select("\")\" expected",
6762: yyBase);
6763: }
6764: }
6765: }
6766: }
6767:
6768: // Done.
6769: yyError = yyError.select("nary type expected", yyStart);
6770: return yyError;
6771: }
6772:
6773: // =========================================================================
6774:
6775: /**
6776: * Parse nonterminal xtc.typical.Type.PrimaryType.
6777: *
6778: * @param yyStart The index.
6779: * @return The result.
6780: * @throws IOException Signals an I/O error.
6781: */
6782: private Result pPrimaryType(final int yyStart) throws IOException {
6783: Result yyResult;
6784: int yyBase;
6785: int yyRepetition1;
6786: Pair<Node> yyRepValue1;
6787: int yyOption1;
6788: Node yyValue;
6789: ParseError yyError = ParseError.DUMMY;
6790:
6791: // Alternative 1.
6792:
6793: yyResult = pKeyword(yyStart);
6794: yyError = yyResult.select(yyError);
6795: if (yyResult.hasValue("bool")) {
6796:
6797: yyValue = GNode.create("BooleanType", false);
6798: yyValue.setLocation(location(yyStart));
6799:
6800: return yyResult.createValue(yyValue, yyError);
6801: }
6802:
6803: // Alternative 2.
6804:
6805: yyResult = pKeyword(yyStart);
6806: yyError = yyResult.select(yyError);
6807: if (yyResult.hasValue("int")) {
6808:
6809: yyValue = GNode.create("IntType", false);
6810: yyValue.setLocation(location(yyStart));
6811:
6812: return yyResult.createValue(yyValue, yyError);
6813: }
6814:
6815: // Alternative 3.
6816:
6817: yyResult = pKeyword(yyStart);
6818: yyError = yyResult.select(yyError);
6819: if (yyResult.hasValue("float32")) {
6820:
6821: yyValue = GNode.create("Float32", false);
6822: yyValue.setLocation(location(yyStart));
6823:
6824: return yyResult.createValue(yyValue, yyError);
6825: }
6826:
6827: // Alternative 4.
6828:
6829: yyResult = pKeyword(yyStart);
6830: yyError = yyResult.select(yyError);
6831: if (yyResult.hasValue("float64")) {
6832:
6833: yyValue = GNode.create("Float64", false);
6834: yyValue.setLocation(location(yyStart));
6835:
6836: return yyResult.createValue(yyValue, yyError);
6837: }
6838:
6839: // Alternative 5.
6840:
6841: yyResult = pKeyword(yyStart);
6842: yyError = yyResult.select(yyError);
6843: if (yyResult.hasValue("string")) {
6844:
6845: yyValue = GNode.create("StringType", false);
6846: yyValue.setLocation(location(yyStart));
6847:
6848: return yyResult.createValue(yyValue, yyError);
6849: }
6850:
6851: // Alternative 6.
6852:
6853: yyResult = pKeyword(yyStart);
6854: yyError = yyResult.select(yyError);
6855: if (yyResult.hasValue("any")) {
6856:
6857: yyValue = GNode.create("AnyType", false);
6858: yyValue.setLocation(location(yyStart));
6859:
6860: return yyResult.createValue(yyValue, yyError);
6861: }
6862:
6863: // Alternative 7.
6864:
6865: yyResult = pLowerIdentifier(yyStart);
6866: yyError = yyResult.select(yyError);
6867: if (yyResult.hasValue()) {
6868: final String v$g$1 = yyResult.semanticValue();
6869:
6870: yyValue = GNode.create("UserDefinedType", v$g$1);
6871: yyValue.setLocation(location(yyStart));
6872:
6873: return yyResult.createValue(yyValue, yyError);
6874: }
6875:
6876: // Alternative 8.
6877:
6878: yyResult = pSymbol(yyStart);
6879: yyError = yyResult.select(yyError);
6880: if (yyResult.hasValue("\'")) {
6881:
6882: yyResult = pLowerIdentifier(yyResult.index);
6883: yyError = yyResult.select(yyError);
6884: if (yyResult.hasValue()) {
6885: final String v$g$1 = yyResult.semanticValue();
6886:
6887: yyValue = GNode.create("TypeVariable", v$g$1);
6888: yyValue.setLocation(location(yyStart));
6889:
6890: return yyResult.createValue(yyValue, yyError);
6891: }
6892: }
6893:
6894: // Alternative 9.
6895:
6896: yyResult = pKeyword(yyStart);
6897: yyError = yyResult.select(yyError);
6898: if (yyResult.hasValue("Node")) {
6899:
6900: yyResult = pTypeVariable(yyResult.index);
6901: yyError = yyResult.select(yyError);
6902: if (yyResult.hasValue()) {
6903: final Node v$g$1 = yyResult.semanticValue();
6904:
6905: yyValue = GNode.create("ConstraintType", v$g$1);
6906: yyValue.setLocation(location(yyStart));
6907:
6908: return yyResult.createValue(yyValue, yyError);
6909: }
6910: }
6911:
6912: // Alternative 10.
6913:
6914: yyResult = pSymbol(yyStart);
6915: yyError = yyResult.select(yyError);
6916: if (yyResult.hasValue("[")) {
6917:
6918: yyOption1 = yyResult.index;
6919:
6920: yyBase = yyOption1;
6921: yyResult = pSymbol(yyBase);
6922: yyError = yyResult.select(yyError);
6923: if (yyResult.hasValue("|")) {
6924:
6925: yyOption1 = yyResult.index;
6926: } else {
6927: yyError = yyError.select("\"|\" expected", yyBase);
6928: }
6929:
6930: yyResult = pPolyTypeConstructor(yyOption1);
6931: yyError = yyResult.select(yyError);
6932: if (yyResult.hasValue()) {
6933: final Node v$g$1 = yyResult.semanticValue();
6934:
6935: yyRepetition1 = yyResult.index;
6936: yyRepValue1 = Pair.empty();
6937: while (true) {
6938:
6939: yyBase = yyRepetition1;
6940: yyResult = pSymbol(yyBase);
6941: yyError = yyResult.select(yyError);
6942: if (yyResult.hasValue("|")) {
6943:
6944: yyResult = pPolyTypeConstructor(yyResult.index);
6945: yyError = yyResult.select(yyError);
6946: if (yyResult.hasValue()) {
6947: final Node v$el$1 = yyResult
6948: .semanticValue();
6949:
6950: yyRepetition1 = yyResult.index;
6951: yyRepValue1 = new Pair<Node>(v$el$1,
6952: yyRepValue1);
6953: continue;
6954: }
6955: } else {
6956: yyError = yyError.select("\"|\" expected",
6957: yyBase);
6958: }
6959: break;
6960: }
6961: { // Start scope for v$g$2.
6962: final Pair<Node> v$g$2 = yyRepValue1.reverse();
6963:
6964: yyBase = yyRepetition1;
6965: yyResult = pSymbol(yyBase);
6966: yyError = yyResult.select(yyError);
6967: if (yyResult.hasValue("]")) {
6968:
6969: yyValue = GNode.createFromPair(
6970: "PolyVariantType", v$g$1, v$g$2);
6971: yyValue.setLocation(location(yyStart));
6972:
6973: return yyResult.createValue(yyValue, yyError);
6974: } else {
6975: yyError = yyError.select("\"]\" expected",
6976: yyBase);
6977: }
6978: } // End scope for v$g$2.
6979: }
6980: }
6981:
6982: // Alternative <Parenthesized>.
6983:
6984: yyResult = pSymbol(yyStart);
6985: yyError = yyResult.select(yyError);
6986: if (yyResult.hasValue("(")) {
6987:
6988: yyResult = pAliasedType(yyResult.index);
6989: yyError = yyResult.select(yyError);
6990: if (yyResult.hasValue()) {
6991: yyValue = yyResult.semanticValue();
6992:
6993: yyBase = yyResult.index;
6994: yyResult = pSymbol(yyBase);
6995: yyError = yyResult.select(yyError);
6996: if (yyResult.hasValue(")")) {
6997:
6998: return yyResult.createValue(yyValue, yyError);
6999: } else {
7000: yyError = yyError.select("\")\" expected", yyBase);
7001: }
7002: }
7003: }
7004:
7005: // Done.
7006: yyError = yyError.select("primary type expected", yyStart);
7007: return yyError;
7008: }
7009:
7010: // =========================================================================
7011:
7012: /**
7013: * Parse nonterminal xtc.typical.Type.TypeVariable.
7014: *
7015: * @param yyStart The index.
7016: * @return The result.
7017: * @throws IOException Signals an I/O error.
7018: */
7019: private Result pTypeVariable(final int yyStart) throws IOException {
7020: Result yyResult;
7021: Node yyValue;
7022: ParseError yyError = ParseError.DUMMY;
7023:
7024: // Alternative 1.
7025:
7026: yyResult = pSymbol(yyStart);
7027: yyError = yyResult.select(yyError);
7028: if (yyResult.hasValue("\'")) {
7029:
7030: yyResult = pLowerIdentifier(yyResult.index);
7031: yyError = yyResult.select(yyError);
7032: if (yyResult.hasValue()) {
7033: final String v$g$1 = yyResult.semanticValue();
7034:
7035: yyValue = GNode.create("TypeVariable", v$g$1);
7036: yyValue.setLocation(location(yyStart));
7037:
7038: return yyResult.createValue(yyValue, yyError);
7039: }
7040: }
7041:
7042: // Done.
7043: yyError = yyError.select("type variable expected", yyStart);
7044: return yyError;
7045: }
7046:
7047: // =========================================================================
7048:
7049: /**
7050: * Parse nonterminal xtc.typical.Type.TypeParameters.
7051: *
7052: * @param yyStart The index.
7053: * @return The result.
7054: * @throws IOException Signals an I/O error.
7055: */
7056: private Result pTypeParameters(final int yyStart)
7057: throws IOException {
7058: Result yyResult;
7059: int yyBase;
7060: int yyRepetition1;
7061: boolean yyRepeated1;
7062: Pair<Node> yyRepValue1;
7063: Node yyValue;
7064: ParseError yyError = ParseError.DUMMY;
7065:
7066: // Alternative <Nary>.
7067:
7068: yyResult = pSymbol(yyStart);
7069: yyError = yyResult.select(yyError);
7070: if (yyResult.hasValue("(")) {
7071:
7072: yyResult = pTypeVariable(yyResult.index);
7073: yyError = yyResult.select(yyError);
7074: if (yyResult.hasValue()) {
7075: final Node v$g$1 = yyResult.semanticValue();
7076:
7077: yyRepetition1 = yyResult.index;
7078: yyRepeated1 = false;
7079: yyRepValue1 = Pair.empty();
7080: while (true) {
7081:
7082: yyBase = yyRepetition1;
7083: yyResult = pSymbol(yyBase);
7084: yyError = yyResult.select(yyError);
7085: if (yyResult.hasValue(",")) {
7086:
7087: yyResult = pTypeVariable(yyResult.index);
7088: yyError = yyResult.select(yyError);
7089: if (yyResult.hasValue()) {
7090: final Node v$el$1 = yyResult
7091: .semanticValue();
7092:
7093: yyRepetition1 = yyResult.index;
7094: yyRepeated1 = true;
7095: yyRepValue1 = new Pair<Node>(v$el$1,
7096: yyRepValue1);
7097: continue;
7098: }
7099: } else {
7100: yyError = yyError.select("\",\" expected",
7101: yyBase);
7102: }
7103: break;
7104: }
7105:
7106: if (yyRepeated1) {
7107: final Pair<Node> v$g$2 = yyRepValue1.reverse();
7108:
7109: yyBase = yyRepetition1;
7110: yyResult = pSymbol(yyBase);
7111: yyError = yyResult.select(yyError);
7112: if (yyResult.hasValue(")")) {
7113:
7114: yyValue = GNode.createFromPair(
7115: "TypeParameters", v$g$1, v$g$2);
7116: yyValue.setLocation(location(yyStart));
7117:
7118: return yyResult.createValue(yyValue, yyError);
7119: } else {
7120: yyError = yyError.select("\")\" expected",
7121: yyBase);
7122: }
7123: }
7124: }
7125: }
7126:
7127: // Alternative <Unary>.
7128:
7129: yyResult = pTypeVariable(yyStart);
7130: yyError = yyResult.select(yyError);
7131: if (yyResult.hasValue()) {
7132: final Node v$g$3 = yyResult.semanticValue();
7133:
7134: yyValue = GNode.create("TypeParameters", v$g$3);
7135: yyValue.setLocation(location(yyStart));
7136:
7137: return yyResult.createValue(yyValue, yyError);
7138: }
7139:
7140: // Done.
7141: yyError = yyError.select("type parameters expected", yyStart);
7142: return yyError;
7143: }
7144:
7145: // =========================================================================
7146:
7147: /**
7148: * Parse nonterminal xtc.typical.Type.TypeInformation.
7149: *
7150: * @param yyStart The index.
7151: * @return The result.
7152: * @throws IOException Signals an I/O error.
7153: */
7154: private Result pTypeInformation(final int yyStart)
7155: throws IOException {
7156: Result yyResult;
7157: int yyBase;
7158: int yyRepetition1;
7159: Pair<Node> yyRepValue1;
7160: int yyOption1;
7161: Node yyValue;
7162: ParseError yyError = ParseError.DUMMY;
7163:
7164: // Alternative 1.
7165:
7166: yyOption1 = yyStart;
7167:
7168: yyBase = yyOption1;
7169: yyResult = pSymbol(yyBase);
7170: yyError = yyResult.select(yyError);
7171: if (yyResult.hasValue("|")) {
7172:
7173: yyOption1 = yyResult.index;
7174: } else {
7175: yyError = yyError.select("\"|\" expected", yyBase);
7176: }
7177:
7178: yyResult = pTypeConstructor(yyOption1);
7179: yyError = yyResult.select(yyError);
7180: if (yyResult.hasValue()) {
7181: final Node v$g$1 = yyResult.semanticValue();
7182:
7183: yyRepetition1 = yyResult.index;
7184: yyRepValue1 = Pair.empty();
7185: while (true) {
7186:
7187: yyBase = yyRepetition1;
7188: yyResult = pSymbol(yyBase);
7189: yyError = yyResult.select(yyError);
7190: if (yyResult.hasValue("|")) {
7191:
7192: yyResult = pTypeConstructor(yyResult.index);
7193: yyError = yyResult.select(yyError);
7194: if (yyResult.hasValue()) {
7195: final Node v$el$1 = yyResult.semanticValue();
7196:
7197: yyRepetition1 = yyResult.index;
7198: yyRepValue1 = new Pair<Node>(v$el$1,
7199: yyRepValue1);
7200: continue;
7201: }
7202: } else {
7203: yyError = yyError.select("\"|\" expected", yyBase);
7204: }
7205: break;
7206: }
7207: { // Start scope for v$g$2.
7208: final Pair<Node> v$g$2 = yyRepValue1.reverse();
7209:
7210: yyValue = GNode.createFromPair("VariantDeclaration",
7211: v$g$1, v$g$2);
7212: yyValue.setLocation(location(yyStart));
7213:
7214: return new SemanticValue(yyValue, yyRepetition1,
7215: yyError);
7216: } // End scope for v$g$2.
7217: }
7218:
7219: // Alternative 2.
7220:
7221: yyResult = pSymbol(yyStart);
7222: yyError = yyResult.select(yyError);
7223: if (yyResult.hasValue("{")) {
7224:
7225: yyResult = pFieldType(yyResult.index);
7226: yyError = yyResult.select(yyError);
7227: if (yyResult.hasValue()) {
7228: final Node v$g$1 = yyResult.semanticValue();
7229:
7230: yyRepetition1 = yyResult.index;
7231: yyRepValue1 = Pair.empty();
7232: while (true) {
7233:
7234: yyBase = yyRepetition1;
7235: yyResult = pSymbol(yyBase);
7236: yyError = yyResult.select(yyError);
7237: if (yyResult.hasValue(",")) {
7238:
7239: yyResult = pFieldType(yyResult.index);
7240: yyError = yyResult.select(yyError);
7241: if (yyResult.hasValue()) {
7242: final Node v$el$1 = yyResult
7243: .semanticValue();
7244:
7245: yyRepetition1 = yyResult.index;
7246: yyRepValue1 = new Pair<Node>(v$el$1,
7247: yyRepValue1);
7248: continue;
7249: }
7250: } else {
7251: yyError = yyError.select("\",\" expected",
7252: yyBase);
7253: }
7254: break;
7255: }
7256: { // Start scope for v$g$2.
7257: final Pair<Node> v$g$2 = yyRepValue1.reverse();
7258:
7259: yyBase = yyRepetition1;
7260: yyResult = pSymbol(yyBase);
7261: yyError = yyResult.select(yyError);
7262: if (yyResult.hasValue("}")) {
7263:
7264: yyValue = GNode.createFromPair(
7265: "RecordDeclaration", v$g$1, v$g$2);
7266: yyValue.setLocation(location(yyStart));
7267:
7268: return yyResult.createValue(yyValue, yyError);
7269: } else {
7270: yyError = yyError.select("\"}\" expected",
7271: yyBase);
7272: }
7273: } // End scope for v$g$2.
7274: }
7275: }
7276:
7277: // Alternative 3.
7278:
7279: yyResult = pSymbol(yyStart);
7280: yyError = yyResult.select(yyError);
7281: if (yyResult.hasValue("[")) {
7282:
7283: yyOption1 = yyResult.index;
7284:
7285: yyBase = yyOption1;
7286: yyResult = pSymbol(yyBase);
7287: yyError = yyResult.select(yyError);
7288: if (yyResult.hasValue("|")) {
7289:
7290: yyOption1 = yyResult.index;
7291: } else {
7292: yyError = yyError.select("\"|\" expected", yyBase);
7293: }
7294:
7295: yyResult = pPolyTypeConstructor(yyOption1);
7296: yyError = yyResult.select(yyError);
7297: if (yyResult.hasValue()) {
7298: final Node v$g$1 = yyResult.semanticValue();
7299:
7300: yyRepetition1 = yyResult.index;
7301: yyRepValue1 = Pair.empty();
7302: while (true) {
7303:
7304: yyBase = yyRepetition1;
7305: yyResult = pSymbol(yyBase);
7306: yyError = yyResult.select(yyError);
7307: if (yyResult.hasValue("|")) {
7308:
7309: yyResult = pPolyTypeConstructor(yyResult.index);
7310: yyError = yyResult.select(yyError);
7311: if (yyResult.hasValue()) {
7312: final Node v$el$1 = yyResult
7313: .semanticValue();
7314:
7315: yyRepetition1 = yyResult.index;
7316: yyRepValue1 = new Pair<Node>(v$el$1,
7317: yyRepValue1);
7318: continue;
7319: }
7320: } else {
7321: yyError = yyError.select("\"|\" expected",
7322: yyBase);
7323: }
7324: break;
7325: }
7326: { // Start scope for v$g$2.
7327: final Pair<Node> v$g$2 = yyRepValue1.reverse();
7328:
7329: yyBase = yyRepetition1;
7330: yyResult = pSymbol(yyBase);
7331: yyError = yyResult.select(yyError);
7332: if (yyResult.hasValue("]")) {
7333:
7334: yyValue = GNode.createFromPair(
7335: "PolyVariantDeclaration", v$g$1, v$g$2);
7336: yyValue.setLocation(location(yyStart));
7337:
7338: return yyResult.createValue(yyValue, yyError);
7339: } else {
7340: yyError = yyError.select("\"]\" expected",
7341: yyBase);
7342: }
7343: } // End scope for v$g$2.
7344: }
7345: }
7346:
7347: // Done.
7348: yyError = yyError.select("type information expected", yyStart);
7349: return yyError;
7350: }
7351:
7352: // =========================================================================
7353:
7354: /**
7355: * Parse nonterminal xtc.typical.Type.TypeConstructor.
7356: *
7357: * @param yyStart The index.
7358: * @return The result.
7359: * @throws IOException Signals an I/O error.
7360: */
7361: private Result pTypeConstructor(final int yyStart)
7362: throws IOException {
7363: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
7364: if (null == yyColumn.chunk4)
7365: yyColumn.chunk4 = new Chunk4();
7366: if (null == yyColumn.chunk4.fTypeConstructor)
7367: yyColumn.chunk4.fTypeConstructor = pTypeConstructor$1(yyStart);
7368: return yyColumn.chunk4.fTypeConstructor;
7369: }
7370:
7371: /** Actually parse xtc.typical.Type.TypeConstructor. */
7372: private Result pTypeConstructor$1(final int yyStart)
7373: throws IOException {
7374: Result yyResult;
7375: int yyBase;
7376: int yyOption1;
7377: Node yyOpValue1;
7378: Node yyValue;
7379: ParseError yyError = ParseError.DUMMY;
7380:
7381: // Alternative 1.
7382:
7383: yyResult = pUpperIdentifier(yyStart);
7384: yyError = yyResult.select(yyError);
7385: if (yyResult.hasValue()) {
7386: final String v$g$1 = yyResult.semanticValue();
7387:
7388: yyOption1 = yyResult.index;
7389: yyOpValue1 = null;
7390:
7391: yyBase = yyOption1;
7392: yyResult = pKeyword(yyBase);
7393: yyError = yyResult.select(yyError);
7394: if (yyResult.hasValue("of")) {
7395:
7396: yyResult = pAliasedType(yyResult.index);
7397: yyError = yyResult.select(yyError);
7398: if (yyResult.hasValue()) {
7399: final Node v$el$1 = yyResult.semanticValue();
7400:
7401: yyOption1 = yyResult.index;
7402: yyOpValue1 = v$el$1;
7403: }
7404: } else {
7405: yyError = yyError.select("\"of\" expected", yyBase);
7406: }
7407: { // Start scope for v$g$2.
7408: final Node v$g$2 = yyOpValue1;
7409:
7410: yyValue = GNode.create("TypeConstructor", v$g$1, v$g$2);
7411: yyValue.setLocation(location(yyStart));
7412:
7413: return new SemanticValue(yyValue, yyOption1, yyError);
7414: } // End scope for v$g$2.
7415: }
7416:
7417: // Done.
7418: return yyError;
7419: }
7420:
7421: // =========================================================================
7422:
7423: /**
7424: * Parse nonterminal xtc.typical.Type.FieldType.
7425: *
7426: * @param yyStart The index.
7427: * @return The result.
7428: * @throws IOException Signals an I/O error.
7429: */
7430: private Result pFieldType(final int yyStart) throws IOException {
7431: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
7432: if (null == yyColumn.chunk4)
7433: yyColumn.chunk4 = new Chunk4();
7434: if (null == yyColumn.chunk4.fFieldType)
7435: yyColumn.chunk4.fFieldType = pFieldType$1(yyStart);
7436: return yyColumn.chunk4.fFieldType;
7437: }
7438:
7439: /** Actually parse xtc.typical.Type.FieldType. */
7440: private Result pFieldType$1(final int yyStart) throws IOException {
7441: Result yyResult;
7442: int yyBase;
7443: Node yyValue;
7444: ParseError yyError = ParseError.DUMMY;
7445:
7446: // Alternative 1.
7447:
7448: yyResult = pLowerIdentifier(yyStart);
7449: yyError = yyResult.select(yyError);
7450: if (yyResult.hasValue()) {
7451: final String v$g$1 = yyResult.semanticValue();
7452:
7453: yyBase = yyResult.index;
7454: yyResult = pSymbol(yyBase);
7455: yyError = yyResult.select(yyError);
7456: if (yyResult.hasValue(":")) {
7457:
7458: yyResult = pAliasedType(yyResult.index);
7459: yyError = yyResult.select(yyError);
7460: if (yyResult.hasValue()) {
7461: final Node v$g$2 = yyResult.semanticValue();
7462:
7463: yyValue = GNode.create("FieldType", v$g$1, v$g$2);
7464: yyValue.setLocation(location(yyStart));
7465:
7466: return yyResult.createValue(yyValue, yyError);
7467: }
7468: } else {
7469: yyError = yyError.select("\":\" expected", yyBase);
7470: }
7471: }
7472:
7473: // Done.
7474: return yyError;
7475: }
7476:
7477: // =========================================================================
7478:
7479: /**
7480: * Parse nonterminal xtc.typical.Type.PolyTypeConstructor.
7481: *
7482: * @param yyStart The index.
7483: * @return The result.
7484: * @throws IOException Signals an I/O error.
7485: */
7486: private Result pPolyTypeConstructor(final int yyStart)
7487: throws IOException {
7488: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
7489: if (null == yyColumn.chunk4)
7490: yyColumn.chunk4 = new Chunk4();
7491: if (null == yyColumn.chunk4.fPolyTypeConstructor)
7492: yyColumn.chunk4.fPolyTypeConstructor = pPolyTypeConstructor$1(yyStart);
7493: return yyColumn.chunk4.fPolyTypeConstructor;
7494: }
7495:
7496: /** Actually parse xtc.typical.Type.PolyTypeConstructor. */
7497: private Result pPolyTypeConstructor$1(final int yyStart)
7498: throws IOException {
7499:
7500: Result yyResult;
7501: int yyBase;
7502: Node yyValue;
7503: ParseError yyError = ParseError.DUMMY;
7504:
7505: // Alternative 1.
7506:
7507: yyResult = pSymbol(yyStart);
7508: yyError = yyResult.select(yyError);
7509: if (yyResult.hasValue("`")) {
7510:
7511: yyResult = pUpperIdentifier(yyResult.index);
7512: yyError = yyResult.select(yyError);
7513: if (yyResult.hasValue()) {
7514: final String v$g$1 = yyResult.semanticValue();
7515:
7516: yyBase = yyResult.index;
7517: yyResult = pKeyword(yyBase);
7518: yyError = yyResult.select(yyError);
7519: if (yyResult.hasValue("of")) {
7520:
7521: yyResult = pLowerIdentifier(yyResult.index);
7522: yyError = yyResult.select(yyError);
7523: if (yyResult.hasValue()) {
7524: final String v$g$2 = yyResult.semanticValue();
7525:
7526: yyValue = GNode.create("PolyTypeConstructor",
7527: v$g$1, v$g$2);
7528: yyValue.setLocation(location(yyStart));
7529:
7530: return yyResult.createValue(yyValue, yyError);
7531: }
7532: } else {
7533: yyError = yyError.select("\"of\" expected", yyBase);
7534: }
7535: }
7536: }
7537:
7538: // Done.
7539: yyError = yyError.select("poly type constructor expected",
7540: yyStart);
7541: return yyError;
7542: }
7543:
7544: // =========================================================================
7545:
7546: /**
7547: * Parse nonterminal xtc.typical.Constant.IntegerLiteral.
7548: *
7549: * @param yyStart The index.
7550: * @return The result.
7551: * @throws IOException Signals an I/O error.
7552: */
7553: private Result pIntegerLiteral(final int yyStart)
7554: throws IOException {
7555: Result yyResult;
7556: Node yyValue;
7557: ParseError yyError = ParseError.DUMMY;
7558:
7559: // Alternative <Decimal>.
7560:
7561: yyResult = pDecimalLiteral(yyStart);
7562: yyError = yyResult.select(yyError);
7563: if (yyResult.hasValue()) {
7564: final String v$g$1 = yyResult.semanticValue();
7565:
7566: yyValue = GNode.create("IntegerLiteral", v$g$1);
7567: yyValue.setLocation(location(yyStart));
7568:
7569: return yyResult.createValue(yyValue, yyError);
7570: }
7571:
7572: // Done.
7573: return yyError;
7574: }
7575:
7576: // =========================================================================
7577:
7578: /**
7579: * Parse nonterminal xtc.typical.Constant.FloatingLiteral.
7580: *
7581: * @param yyStart The index.
7582: * @return The result.
7583: * @throws IOException Signals an I/O error.
7584: */
7585: private Result pFloatingLiteral(final int yyStart)
7586: throws IOException {
7587: Result yyResult;
7588: Node yyValue;
7589: ParseError yyError = ParseError.DUMMY;
7590:
7591: // Alternative <FloatingDecimal>.
7592:
7593: yyResult = pDecimalFloatingLiteral(yyStart);
7594: yyError = yyResult.select(yyError);
7595: if (yyResult.hasValue()) {
7596: final String v$g$1 = yyResult.semanticValue();
7597:
7598: yyValue = GNode.create("FloatingLiteral", v$g$1);
7599: yyValue.setLocation(location(yyStart));
7600:
7601: return yyResult.createValue(yyValue, yyError);
7602: }
7603:
7604: // Done.
7605: return yyError;
7606: }
7607:
7608: // =========================================================================
7609:
7610: /**
7611: * Parse nonterminal xtc.typical.Constant.DecimalLiteral.
7612: *
7613: * @param yyStart The index.
7614: * @return The result.
7615: * @throws IOException Signals an I/O error.
7616: */
7617: private Result pDecimalLiteral(final int yyStart)
7618: throws IOException {
7619: int yyC;
7620: int yyIndex;
7621: int yyRepetition1;
7622: String yyValue;
7623: ParseError yyError = ParseError.DUMMY;
7624:
7625: // Alternative 1.
7626:
7627: yyC = character(yyStart);
7628: if (-1 != yyC) {
7629: yyIndex = yyStart + 1;
7630:
7631: switch (yyC) {
7632: case '0':
7633: case '1':
7634: case '2':
7635: case '3':
7636: case '4':
7637: case '5':
7638: case '6':
7639: case '7':
7640: case '8':
7641: case '9': {
7642: yyRepetition1 = yyIndex;
7643: while (true) {
7644:
7645: yyC = character(yyRepetition1);
7646: if (-1 != yyC) {
7647: yyIndex = yyRepetition1 + 1;
7648:
7649: switch (yyC) {
7650: case '0':
7651: case '1':
7652: case '2':
7653: case '3':
7654: case '4':
7655: case '5':
7656: case '6':
7657: case '7':
7658: case '8':
7659: case '9': {
7660: yyRepetition1 = yyIndex;
7661: continue;
7662: }
7663:
7664: default:
7665: /* No match. */
7666: }
7667: }
7668: break;
7669: }
7670:
7671: yyValue = difference(yyStart, yyRepetition1);
7672:
7673: return new SemanticValue(yyValue, yyRepetition1,
7674: yyError);
7675: }
7676:
7677: default:
7678: /* No match. */
7679: }
7680: }
7681:
7682: // Done.
7683: yyError = yyError.select("decimal literal expected", yyStart);
7684: return yyError;
7685: }
7686:
7687: // =========================================================================
7688:
7689: /**
7690: * Parse nonterminal xtc.typical.Constant.DecimalFloatingLiteral.
7691: *
7692: * @param yyStart The index.
7693: * @return The result.
7694: * @throws IOException Signals an I/O error.
7695: */
7696: private Result pDecimalFloatingLiteral(final int yyStart)
7697: throws IOException {
7698:
7699: int yyC;
7700: int yyIndex;
7701: Result yyResult;
7702: int yyRepetition1;
7703: boolean yyRepeated1;
7704: int yyOption1;
7705: String yyValue;
7706: ParseError yyError = ParseError.DUMMY;
7707:
7708: // Alternative 1.
7709:
7710: yyRepetition1 = yyStart;
7711: yyRepeated1 = false;
7712: while (true) {
7713:
7714: yyC = character(yyRepetition1);
7715: if (-1 != yyC) {
7716: yyIndex = yyRepetition1 + 1;
7717:
7718: switch (yyC) {
7719: case '0':
7720: case '1':
7721: case '2':
7722: case '3':
7723: case '4':
7724: case '5':
7725: case '6':
7726: case '7':
7727: case '8':
7728: case '9': {
7729: yyRepetition1 = yyIndex;
7730: yyRepeated1 = true;
7731: continue;
7732: }
7733:
7734: default:
7735: /* No match. */
7736: }
7737: }
7738: break;
7739: }
7740:
7741: if (yyRepeated1) {
7742:
7743: yyC = character(yyRepetition1);
7744: if ('.' == yyC) {
7745: yyIndex = yyRepetition1 + 1;
7746:
7747: yyRepetition1 = yyIndex;
7748: while (true) {
7749:
7750: yyC = character(yyRepetition1);
7751: if (-1 != yyC) {
7752: yyIndex = yyRepetition1 + 1;
7753:
7754: switch (yyC) {
7755: case '0':
7756: case '1':
7757: case '2':
7758: case '3':
7759: case '4':
7760: case '5':
7761: case '6':
7762: case '7':
7763: case '8':
7764: case '9': {
7765: yyRepetition1 = yyIndex;
7766: continue;
7767: }
7768:
7769: default:
7770: /* No match. */
7771: }
7772: }
7773: break;
7774: }
7775:
7776: yyOption1 = yyRepetition1;
7777:
7778: yyResult = pExponent(yyOption1);
7779: yyError = yyResult.select(yyError);
7780: if (yyResult.hasValue()) {
7781:
7782: yyOption1 = yyResult.index;
7783: }
7784:
7785: yyValue = difference(yyStart, yyOption1);
7786:
7787: return new SemanticValue(yyValue, yyOption1, yyError);
7788: }
7789: }
7790:
7791: // Alternative 2.
7792:
7793: yyC = character(yyStart);
7794: if ('.' == yyC) {
7795: yyIndex = yyStart + 1;
7796:
7797: yyRepetition1 = yyIndex;
7798: yyRepeated1 = false;
7799: while (true) {
7800:
7801: yyC = character(yyRepetition1);
7802: if (-1 != yyC) {
7803: yyIndex = yyRepetition1 + 1;
7804:
7805: switch (yyC) {
7806: case '0':
7807: case '1':
7808: case '2':
7809: case '3':
7810: case '4':
7811: case '5':
7812: case '6':
7813: case '7':
7814: case '8':
7815: case '9': {
7816: yyRepetition1 = yyIndex;
7817: yyRepeated1 = true;
7818: continue;
7819: }
7820:
7821: default:
7822: /* No match. */
7823: }
7824: }
7825: break;
7826: }
7827:
7828: if (yyRepeated1) {
7829:
7830: yyOption1 = yyRepetition1;
7831:
7832: yyResult = pExponent(yyOption1);
7833: yyError = yyResult.select(yyError);
7834: if (yyResult.hasValue()) {
7835:
7836: yyOption1 = yyResult.index;
7837: }
7838:
7839: yyValue = difference(yyStart, yyOption1);
7840:
7841: return new SemanticValue(yyValue, yyOption1, yyError);
7842: }
7843: }
7844:
7845: // Done.
7846: yyError = yyError.select("decimal floating literal expected",
7847: yyStart);
7848: return yyError;
7849: }
7850:
7851: // =========================================================================
7852:
7853: /**
7854: * Parse nonterminal xtc.typical.Constant.Exponent.
7855: *
7856: * @param yyStart The index.
7857: * @return The result.
7858: * @throws IOException Signals an I/O error.
7859: */
7860: private Result pExponent(final int yyStart) throws IOException {
7861: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
7862: if (null == yyColumn.chunk4)
7863: yyColumn.chunk4 = new Chunk4();
7864: if (null == yyColumn.chunk4.fExponent)
7865: yyColumn.chunk4.fExponent = pExponent$1(yyStart);
7866: return yyColumn.chunk4.fExponent;
7867: }
7868:
7869: /** Actually parse xtc.typical.Constant.Exponent. */
7870: private Result pExponent$1(final int yyStart) throws IOException {
7871: int yyC;
7872: int yyIndex;
7873: Result yyResult;
7874: int yyOption1;
7875: Void yyValue;
7876: ParseError yyError = ParseError.DUMMY;
7877:
7878: // Alternative 1.
7879:
7880: yyC = character(yyStart);
7881: if (-1 != yyC) {
7882: yyIndex = yyStart + 1;
7883:
7884: switch (yyC) {
7885: case 'E':
7886: case 'e': {
7887: yyOption1 = yyIndex;
7888:
7889: yyC = character(yyOption1);
7890: if (-1 != yyC) {
7891: yyIndex = yyOption1 + 1;
7892:
7893: switch (yyC) {
7894: case '+':
7895: case '-': {
7896: yyOption1 = yyIndex;
7897: }
7898:
7899: default:
7900: /* No match. */
7901: }
7902: }
7903:
7904: yyResult = pExponent$$Plus1(yyOption1);
7905: yyError = yyResult.select(yyError);
7906: if (yyResult.hasValue()) {
7907:
7908: yyValue = null;
7909:
7910: return yyResult.createValue(yyValue, yyError);
7911: }
7912: }
7913: break;
7914:
7915: default:
7916: /* No match. */
7917: }
7918: }
7919:
7920: // Done.
7921: yyError = yyError.select("exponent expected", yyStart);
7922: return yyError;
7923: }
7924:
7925: // =========================================================================
7926:
7927: /**
7928: * Parse synthetic nonterminal xtc.typical.Typical.Exponent$$Plus1.
7929: *
7930: * @param yyStart The index.
7931: * @return The result.
7932: * @throws IOException Signals an I/O error.
7933: */
7934: private Result pExponent$$Plus1(final int yyStart)
7935: throws IOException {
7936: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
7937: if (null == yyColumn.chunk4)
7938: yyColumn.chunk4 = new Chunk4();
7939: if (null == yyColumn.chunk4.fExponent$$Plus1)
7940: yyColumn.chunk4.fExponent$$Plus1 = pExponent$$Plus1$1(yyStart);
7941: return yyColumn.chunk4.fExponent$$Plus1;
7942: }
7943:
7944: /** Actually parse xtc.typical.Typical.Exponent$$Plus1. */
7945: private Result pExponent$$Plus1$1(final int yyStart)
7946: throws IOException {
7947: int yyC;
7948: int yyIndex;
7949: Result yyResult;
7950: Void yyValue;
7951: ParseError yyError = ParseError.DUMMY;
7952:
7953: // Alternative 1.
7954:
7955: yyC = character(yyStart);
7956: if (-1 != yyC) {
7957: yyIndex = yyStart + 1;
7958:
7959: switch (yyC) {
7960: case '0':
7961: case '1':
7962: case '2':
7963: case '3':
7964: case '4':
7965: case '5':
7966: case '6':
7967: case '7':
7968: case '8':
7969: case '9': {
7970: final int yyChoice1 = yyIndex;
7971:
7972: // Nested alternative 1.
7973:
7974: yyResult = pExponent$$Plus1(yyChoice1);
7975: yyError = yyResult.select(yyError);
7976: if (yyResult.hasValue()) {
7977:
7978: yyValue = null;
7979:
7980: return yyResult.createValue(yyValue, yyError);
7981: }
7982:
7983: // Nested alternative 2.
7984:
7985: yyValue = null;
7986:
7987: return new SemanticValue(yyValue, yyChoice1, yyError);
7988: }
7989:
7990: default:
7991: /* No match. */
7992: }
7993: }
7994:
7995: // Done.
7996: yyError = yyError.select("exponent expected", yyStart);
7997: return yyError;
7998: }
7999:
8000: // =========================================================================
8001:
8002: /**
8003: * Parse nonterminal xtc.typical.Constant.StringLiteral.
8004: *
8005: * @param yyStart The index.
8006: * @return The result.
8007: * @throws IOException Signals an I/O error.
8008: */
8009: private Result pStringLiteral(final int yyStart) throws IOException {
8010: Result yyResult;
8011: Node yyValue;
8012: ParseError yyError = ParseError.DUMMY;
8013:
8014: // Alternative 1.
8015:
8016: yyResult = pStringConstant(yyStart);
8017: yyError = yyResult.select(yyError);
8018: if (yyResult.hasValue()) {
8019: final String v$g$1 = yyResult.semanticValue();
8020:
8021: yyValue = GNode.create("StringLiteral", v$g$1);
8022: yyValue.setLocation(location(yyStart));
8023:
8024: return yyResult.createValue(yyValue, yyError);
8025: }
8026:
8027: // Done.
8028: return yyError;
8029: }
8030:
8031: // =========================================================================
8032:
8033: /**
8034: * Parse nonterminal xtc.typical.Constant.StringConstant.
8035: *
8036: * @param yyStart The index.
8037: * @return The result.
8038: * @throws IOException Signals an I/O error.
8039: */
8040: private Result pStringConstant(final int yyStart)
8041: throws IOException {
8042: int yyC;
8043: int yyIndex;
8044: int yyRepetition1;
8045: String yyValue;
8046: ParseError yyError = ParseError.DUMMY;
8047:
8048: // Alternative 1.
8049:
8050: yyC = character(yyStart);
8051: if ('\"' == yyC) {
8052: yyIndex = yyStart + 1;
8053:
8054: yyRepetition1 = yyIndex;
8055: while (true) {
8056:
8057: final int yyChoice1 = yyRepetition1;
8058:
8059: // Nested alternative 1.
8060:
8061: yyC = character(yyChoice1);
8062: if (-1 != yyC) {
8063: yyIndex = yyChoice1 + 1;
8064:
8065: switch (yyC) {
8066: case '\\': {
8067: yyC = character(yyIndex);
8068: if (-1 != yyC) {
8069: yyIndex = yyIndex + 1;
8070:
8071: switch (yyC) {
8072: case '\"':
8073: case '\'':
8074: case '\\':
8075: case 'b':
8076: case 'f':
8077: case 'n':
8078: case 'r':
8079: case 't': {
8080: yyRepetition1 = yyIndex;
8081: continue;
8082: }
8083:
8084: default:
8085: /* No match. */
8086: }
8087: }
8088: }
8089: break;
8090:
8091: default:
8092: /* No match. */
8093: }
8094: }
8095:
8096: // Nested alternative 2.
8097:
8098: yyC = character(yyChoice1);
8099: if (-1 != yyC) {
8100: yyIndex = yyChoice1 + 1;
8101:
8102: switch (yyC) {
8103: case '\"':
8104: case '\\':
8105: /* No match. */
8106: break;
8107:
8108: default: {
8109: yyRepetition1 = yyIndex;
8110: continue;
8111: }
8112: }
8113: }
8114: break;
8115: }
8116:
8117: yyC = character(yyRepetition1);
8118: if ('\"' == yyC) {
8119: yyIndex = yyRepetition1 + 1;
8120:
8121: yyValue = difference(yyStart, yyIndex);
8122:
8123: return new SemanticValue(yyValue, yyIndex, yyError);
8124: }
8125: }
8126:
8127: // Done.
8128: yyError = yyError.select("string constant expected", yyStart);
8129: return yyError;
8130: }
8131:
8132: // =========================================================================
8133:
8134: /**
8135: * Parse nonterminal xtc.typical.Constant.BooleanLiteral.
8136: *
8137: * @param yyStart The index.
8138: * @return The result.
8139: * @throws IOException Signals an I/O error.
8140: */
8141: private Result pBooleanLiteral(final int yyStart)
8142: throws IOException {
8143: Result yyResult;
8144: Node yyValue;
8145: ParseError yyError = ParseError.DUMMY;
8146:
8147: // Alternative 1.
8148:
8149: yyResult = pKeyword(yyStart);
8150: yyError = yyResult.select(yyError);
8151: if (yyResult.hasValue("true")) {
8152: final String v$g$1 = "true";
8153:
8154: yyResult = pSpacing(yyResult.index);
8155: yyError = yyResult.select(yyError);
8156: if (yyResult.hasValue()) {
8157:
8158: yyValue = GNode.create("BooleanLiteral", v$g$1);
8159: yyValue.setLocation(location(yyStart));
8160:
8161: return yyResult.createValue(yyValue, yyError);
8162: }
8163: }
8164:
8165: // Alternative 2.
8166:
8167: yyResult = pKeyword(yyStart);
8168: yyError = yyResult.select(yyError);
8169: if (yyResult.hasValue("false")) {
8170: final String v$g$2 = "false";
8171:
8172: yyResult = pSpacing(yyResult.index);
8173: yyError = yyResult.select(yyError);
8174: if (yyResult.hasValue()) {
8175:
8176: yyValue = GNode.create("BooleanLiteral", v$g$2);
8177: yyValue.setLocation(location(yyStart));
8178:
8179: return yyResult.createValue(yyValue, yyError);
8180: }
8181: }
8182:
8183: // Done.
8184: yyError = yyError.select("boolean literal expected", yyStart);
8185: return yyError;
8186: }
8187:
8188: // =========================================================================
8189:
8190: /**
8191: * Parse nonterminal xtc.typical.Identifier.LowerIdentifier.
8192: *
8193: * @param yyStart The index.
8194: * @return The result.
8195: * @throws IOException Signals an I/O error.
8196: */
8197: private Result pLowerIdentifier(final int yyStart)
8198: throws IOException {
8199: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
8200: if (null == yyColumn.chunk5)
8201: yyColumn.chunk5 = new Chunk5();
8202: if (null == yyColumn.chunk5.fLowerIdentifier)
8203: yyColumn.chunk5.fLowerIdentifier = pLowerIdentifier$1(yyStart);
8204: return yyColumn.chunk5.fLowerIdentifier;
8205: }
8206:
8207: /** Actually parse xtc.typical.Identifier.LowerIdentifier. */
8208: private Result pLowerIdentifier$1(final int yyStart)
8209: throws IOException {
8210: Result yyResult;
8211: String yyValue;
8212: ParseError yyError = ParseError.DUMMY;
8213:
8214: // Alternative 1.
8215:
8216: yyResult = pLowerWord(yyStart);
8217: yyError = yyResult.select(yyError);
8218: if (yyResult.hasValue()) {
8219: yyValue = yyResult.semanticValue();
8220:
8221: if (!TYPICAL_KEYWORDS.contains(yyValue)) {
8222:
8223: yyResult = pSpacing(yyResult.index);
8224: yyError = yyResult.select(yyError);
8225: if (yyResult.hasValue()) {
8226:
8227: return yyResult.createValue(yyValue, yyError);
8228: }
8229: }
8230: }
8231:
8232: // Done.
8233: yyError = yyError.select("lower identifier expected", yyStart);
8234: return yyError;
8235: }
8236:
8237: // =========================================================================
8238:
8239: /**
8240: * Parse nonterminal xtc.typical.Identifier.UpperIdentifier.
8241: *
8242: * @param yyStart The index.
8243: * @return The result.
8244: * @throws IOException Signals an I/O error.
8245: */
8246: private Result pUpperIdentifier(final int yyStart)
8247: throws IOException {
8248: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
8249: if (null == yyColumn.chunk5)
8250: yyColumn.chunk5 = new Chunk5();
8251: if (null == yyColumn.chunk5.fUpperIdentifier)
8252: yyColumn.chunk5.fUpperIdentifier = pUpperIdentifier$1(yyStart);
8253: return yyColumn.chunk5.fUpperIdentifier;
8254: }
8255:
8256: /** Actually parse xtc.typical.Identifier.UpperIdentifier. */
8257: private Result pUpperIdentifier$1(final int yyStart)
8258: throws IOException {
8259: Result yyResult;
8260: String yyValue;
8261: ParseError yyError = ParseError.DUMMY;
8262:
8263: // Alternative 1.
8264:
8265: yyResult = pUpperWord(yyStart);
8266: yyError = yyResult.select(yyError);
8267: if (yyResult.hasValue()) {
8268: yyValue = yyResult.semanticValue();
8269:
8270: if (!TYPICAL_KEYWORDS.contains(yyValue)) {
8271:
8272: yyResult = pSpacing(yyResult.index);
8273: yyError = yyResult.select(yyError);
8274: if (yyResult.hasValue()) {
8275:
8276: return yyResult.createValue(yyValue, yyError);
8277: }
8278: }
8279: }
8280:
8281: // Done.
8282: yyError = yyError.select("upper identifier expected", yyStart);
8283: return yyError;
8284: }
8285:
8286: // =========================================================================
8287:
8288: /**
8289: * Parse nonterminal xtc.typical.Identifier.Identifier.
8290: *
8291: * @param yyStart The index.
8292: * @return The result.
8293: * @throws IOException Signals an I/O error.
8294: */
8295: private Result pIdentifier(final int yyStart) throws IOException {
8296: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
8297: if (null == yyColumn.chunk5)
8298: yyColumn.chunk5 = new Chunk5();
8299: if (null == yyColumn.chunk5.fIdentifier)
8300: yyColumn.chunk5.fIdentifier = pIdentifier$1(yyStart);
8301: return yyColumn.chunk5.fIdentifier;
8302: }
8303:
8304: /** Actually parse xtc.typical.Identifier.Identifier. */
8305: private Result pIdentifier$1(final int yyStart) throws IOException {
8306: Result yyResult;
8307: String yyValue;
8308: ParseError yyError = ParseError.DUMMY;
8309:
8310: // Alternative 1.
8311:
8312: yyResult = pWord(yyStart);
8313: yyError = yyResult.select(yyError);
8314: if (yyResult.hasValue()) {
8315: yyValue = yyResult.semanticValue();
8316:
8317: if (!TYPICAL_KEYWORDS.contains(yyValue)) {
8318:
8319: yyResult = pSpacing(yyResult.index);
8320: yyError = yyResult.select(yyError);
8321: if (yyResult.hasValue()) {
8322:
8323: return yyResult.createValue(yyValue, yyError);
8324: }
8325: }
8326: }
8327:
8328: // Done.
8329: yyError = yyError.select("identifier expected", yyStart);
8330: return yyError;
8331: }
8332:
8333: // =========================================================================
8334:
8335: /**
8336: * Parse nonterminal xtc.typical.Identifier.LowerWord.
8337: *
8338: * @param yyStart The index.
8339: * @return The result.
8340: * @throws IOException Signals an I/O error.
8341: */
8342: private Result pLowerWord(final int yyStart) throws IOException {
8343: int yyC;
8344: int yyIndex;
8345: int yyRepetition1;
8346: String yyValue;
8347: ParseError yyError = ParseError.DUMMY;
8348:
8349: // Alternative 1.
8350:
8351: yyC = character(yyStart);
8352: if (-1 != yyC) {
8353: yyIndex = yyStart + 1;
8354: if (('_' == yyC) || (('a' <= yyC) && (yyC <= 'z'))) {
8355:
8356: yyRepetition1 = yyIndex;
8357: while (true) {
8358:
8359: yyC = character(yyRepetition1);
8360: if (-1 != yyC) {
8361: yyIndex = yyRepetition1 + 1;
8362: if ((('0' <= yyC) && (yyC <= '9'))
8363: || (('A' <= yyC) && (yyC <= 'Z'))
8364: || ('_' == yyC)
8365: || (('a' <= yyC) && (yyC <= 'z'))) {
8366:
8367: yyRepetition1 = yyIndex;
8368: continue;
8369: }
8370: }
8371: break;
8372: }
8373:
8374: yyValue = difference(yyStart, yyRepetition1);
8375:
8376: return new SemanticValue(yyValue, yyRepetition1,
8377: yyError);
8378: }
8379: }
8380:
8381: // Done.
8382: yyError = yyError.select("lower word expected", yyStart);
8383: return yyError;
8384: }
8385:
8386: // =========================================================================
8387:
8388: /**
8389: * Parse nonterminal xtc.typical.Identifier.UpperWord.
8390: *
8391: * @param yyStart The index.
8392: * @return The result.
8393: * @throws IOException Signals an I/O error.
8394: */
8395: private Result pUpperWord(final int yyStart) throws IOException {
8396: int yyC;
8397: int yyIndex;
8398: int yyRepetition1;
8399: String yyValue;
8400: ParseError yyError = ParseError.DUMMY;
8401:
8402: // Alternative 1.
8403:
8404: yyC = character(yyStart);
8405: if (-1 != yyC) {
8406: yyIndex = yyStart + 1;
8407: if ((('A' <= yyC) && (yyC <= 'Z')) || ('_' == yyC)) {
8408:
8409: yyRepetition1 = yyIndex;
8410: while (true) {
8411:
8412: yyC = character(yyRepetition1);
8413: if (-1 != yyC) {
8414: yyIndex = yyRepetition1 + 1;
8415: if ((('0' <= yyC) && (yyC <= '9'))
8416: || (('A' <= yyC) && (yyC <= 'Z'))
8417: || ('_' == yyC)
8418: || (('a' <= yyC) && (yyC <= 'z'))) {
8419:
8420: yyRepetition1 = yyIndex;
8421: continue;
8422: }
8423: }
8424: break;
8425: }
8426:
8427: yyValue = difference(yyStart, yyRepetition1);
8428:
8429: return new SemanticValue(yyValue, yyRepetition1,
8430: yyError);
8431: }
8432: }
8433:
8434: // Done.
8435: yyError = yyError.select("upper word expected", yyStart);
8436: return yyError;
8437: }
8438:
8439: // =========================================================================
8440:
8441: /**
8442: * Parse nonterminal xtc.typical.Identifier.Word.
8443: *
8444: * @param yyStart The index.
8445: * @return The result.
8446: * @throws IOException Signals an I/O error.
8447: */
8448: private Result pWord(final int yyStart) throws IOException {
8449: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
8450: if (null == yyColumn.chunk5)
8451: yyColumn.chunk5 = new Chunk5();
8452: if (null == yyColumn.chunk5.fWord)
8453: yyColumn.chunk5.fWord = pWord$1(yyStart);
8454: return yyColumn.chunk5.fWord;
8455: }
8456:
8457: /** Actually parse xtc.typical.Identifier.Word. */
8458: private Result pWord$1(final int yyStart) throws IOException {
8459: int yyC;
8460: int yyIndex;
8461: Result yyResult;
8462: String yyValue;
8463: ParseError yyError = ParseError.DUMMY;
8464:
8465: // Alternative 1.
8466:
8467: yyC = character(yyStart);
8468: if (-1 != yyC) {
8469: yyIndex = yyStart + 1;
8470: if ((('A' <= yyC) && (yyC <= 'Z')) || ('_' == yyC)
8471: || (('a' <= yyC) && (yyC <= 'z'))) {
8472:
8473: yyResult = pWord$$Star1(yyIndex);
8474: yyError = yyResult.select(yyError);
8475: if (yyResult.hasValue()) {
8476:
8477: yyValue = difference(yyStart, yyResult.index);
8478:
8479: return yyResult.createValue(yyValue, yyError);
8480: }
8481: }
8482: }
8483:
8484: // Done.
8485: yyError = yyError.select("word expected", yyStart);
8486: return yyError;
8487: }
8488:
8489: // =========================================================================
8490:
8491: /**
8492: * Parse synthetic nonterminal xtc.typical.Typical.Word$$Star1.
8493: *
8494: * @param yyStart The index.
8495: * @return The result.
8496: * @throws IOException Signals an I/O error.
8497: */
8498: private Result pWord$$Star1(final int yyStart) throws IOException {
8499: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
8500: if (null == yyColumn.chunk5)
8501: yyColumn.chunk5 = new Chunk5();
8502: if (null == yyColumn.chunk5.fWord$$Star1)
8503: yyColumn.chunk5.fWord$$Star1 = pWord$$Star1$1(yyStart);
8504: return yyColumn.chunk5.fWord$$Star1;
8505: }
8506:
8507: /** Actually parse xtc.typical.Typical.Word$$Star1. */
8508: private Result pWord$$Star1$1(final int yyStart) throws IOException {
8509: int yyC;
8510: int yyIndex;
8511: Result yyResult;
8512: Void yyValue;
8513: ParseError yyError = ParseError.DUMMY;
8514:
8515: // Alternative 1.
8516:
8517: yyC = character(yyStart);
8518: if (-1 != yyC) {
8519: yyIndex = yyStart + 1;
8520: if ((('0' <= yyC) && (yyC <= '9'))
8521: || (('A' <= yyC) && (yyC <= 'Z')) || ('_' == yyC)
8522: || (('a' <= yyC) && (yyC <= 'z'))) {
8523:
8524: yyResult = pWord$$Star1(yyIndex);
8525: yyError = yyResult.select(yyError);
8526: if (yyResult.hasValue()) {
8527:
8528: yyValue = null;
8529:
8530: return yyResult.createValue(yyValue, yyError);
8531: }
8532: }
8533: }
8534:
8535: // Alternative 2.
8536:
8537: yyValue = null;
8538:
8539: return new SemanticValue(yyValue, yyStart, yyError);
8540: }
8541:
8542: // =========================================================================
8543:
8544: /**
8545: * Parse nonterminal xtc.typical.Identifier.Keyword.
8546: *
8547: * @param yyStart The index.
8548: * @return The result.
8549: * @throws IOException Signals an I/O error.
8550: */
8551: private Result pKeyword(final int yyStart) throws IOException {
8552: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
8553: if (null == yyColumn.chunk5)
8554: yyColumn.chunk5 = new Chunk5();
8555: if (null == yyColumn.chunk5.fKeyword)
8556: yyColumn.chunk5.fKeyword = pKeyword$1(yyStart);
8557: return yyColumn.chunk5.fKeyword;
8558: }
8559:
8560: /** Actually parse xtc.typical.Identifier.Keyword. */
8561: private Result pKeyword$1(final int yyStart) throws IOException {
8562: Result yyResult;
8563: String yyValue;
8564: ParseError yyError = ParseError.DUMMY;
8565:
8566: // Alternative 1.
8567:
8568: yyResult = pWord(yyStart);
8569: yyError = yyResult.select(yyError);
8570: if (yyResult.hasValue()) {
8571: yyValue = yyResult.semanticValue();
8572:
8573: if (TYPICAL_KEYWORDS.contains(yyValue)) {
8574:
8575: yyResult = pSpacing(yyResult.index);
8576: yyError = yyResult.select(yyError);
8577: if (yyResult.hasValue()) {
8578:
8579: return yyResult.createValue(yyValue, yyError);
8580: }
8581: }
8582: }
8583:
8584: // Done.
8585: yyError = yyError.select("keyword expected", yyStart);
8586: return yyError;
8587: }
8588:
8589: // =========================================================================
8590:
8591: /**
8592: * Parse nonterminal xtc.typical.Symbol.Symbol.
8593: *
8594: * @param yyStart The index.
8595: * @return The result.
8596: * @throws IOException Signals an I/O error.
8597: */
8598: private Result pSymbol(final int yyStart) throws IOException {
8599: TypicalParserColumn yyColumn = (TypicalParserColumn) column(yyStart);
8600: if (null == yyColumn.chunk5)
8601: yyColumn.chunk5 = new Chunk5();
8602: if (null == yyColumn.chunk5.fSymbol)
8603: yyColumn.chunk5.fSymbol = pSymbol$1(yyStart);
8604: return yyColumn.chunk5.fSymbol;
8605: }
8606:
8607: /** Actually parse xtc.typical.Symbol.Symbol. */
8608: private Result pSymbol$1(final int yyStart) throws IOException {
8609: Result yyResult;
8610: String yyValue;
8611: ParseError yyError = ParseError.DUMMY;
8612:
8613: // Alternative 1.
8614:
8615: yyResult = pSymbolCharacters(yyStart);
8616: yyError = yyResult.select(yyError);
8617: if (yyResult.hasValue()) {
8618: yyValue = yyResult.semanticValue();
8619:
8620: yyResult = pSpacing(yyResult.index);
8621: yyError = yyResult.select(yyError);
8622: if (yyResult.hasValue()) {
8623:
8624: return yyResult.createValue(yyValue, yyError);
8625: }
8626: }
8627:
8628: // Done.
8629: return yyError;
8630: }
8631:
8632: // =========================================================================
8633:
8634: /**
8635: * Parse nonterminal xtc.typical.Symbol.SymbolCharacters.
8636: *
8637: * @param yyStart The index.
8638: * @return The result.
8639: * @throws IOException Signals an I/O error.
8640: */
8641: private Result pSymbolCharacters(final int yyStart)
8642: throws IOException {
8643: int yyC;
8644: int yyIndex;
8645: String yyValue;
8646: ParseError yyError = ParseError.DUMMY;
8647:
8648: // Alternative 1.
8649:
8650: yyC = character(yyStart);
8651: if (-1 != yyC) {
8652: yyIndex = yyStart + 1;
8653:
8654: switch (yyC) {
8655: case '<': {
8656: final int yyChoice1 = yyIndex;
8657:
8658: // Nested alternative 1.
8659:
8660: yyC = character(yyChoice1);
8661: if (-1 != yyC) {
8662: yyIndex = yyChoice1 + 1;
8663:
8664: switch (yyC) {
8665: case '=': {
8666: final int yyChoice2 = yyIndex;
8667:
8668: // Nested alternative 1.
8669:
8670: yyC = character(yyChoice2);
8671: if (-1 != yyC) {
8672: yyIndex = yyChoice2 + 1;
8673: if ('.' == yyC) {
8674:
8675: yyValue = "<=.";
8676:
8677: return new SemanticValue(yyValue,
8678: yyIndex, yyError);
8679: }
8680: }
8681:
8682: // Nested alternative 2.
8683:
8684: yyValue = "<=";
8685:
8686: return new SemanticValue(yyValue, yyChoice2,
8687: yyError);
8688: }
8689:
8690: case '.': {
8691: yyValue = "<.";
8692:
8693: return new SemanticValue(yyValue, yyIndex,
8694: yyError);
8695: }
8696:
8697: default:
8698: /* No match. */
8699: }
8700: }
8701:
8702: // Nested alternative 2.
8703:
8704: yyValue = "<";
8705:
8706: return new SemanticValue(yyValue, yyChoice1, yyError);
8707: }
8708:
8709: case '>': {
8710: final int yyChoice1 = yyIndex;
8711:
8712: // Nested alternative 1.
8713:
8714: yyC = character(yyChoice1);
8715: if (-1 != yyC) {
8716: yyIndex = yyChoice1 + 1;
8717:
8718: switch (yyC) {
8719: case '=': {
8720: final int yyChoice2 = yyIndex;
8721:
8722: // Nested alternative 1.
8723:
8724: yyC = character(yyChoice2);
8725: if (-1 != yyC) {
8726: yyIndex = yyChoice2 + 1;
8727: if ('.' == yyC) {
8728:
8729: yyValue = ">=.";
8730:
8731: return new SemanticValue(yyValue,
8732: yyIndex, yyError);
8733: }
8734: }
8735:
8736: // Nested alternative 2.
8737:
8738: yyValue = ">=";
8739:
8740: return new SemanticValue(yyValue, yyChoice2,
8741: yyError);
8742: }
8743:
8744: case '.': {
8745: yyValue = ">.";
8746:
8747: return new SemanticValue(yyValue, yyIndex,
8748: yyError);
8749: }
8750:
8751: default:
8752: /* No match. */
8753: }
8754: }
8755:
8756: // Nested alternative 2.
8757:
8758: yyValue = ">";
8759:
8760: return new SemanticValue(yyValue, yyChoice1, yyError);
8761: }
8762:
8763: case '&': {
8764: yyC = character(yyIndex);
8765: if (-1 != yyC) {
8766: yyIndex = yyIndex + 1;
8767: if ('&' == yyC) {
8768:
8769: yyValue = "&&";
8770:
8771: return new SemanticValue(yyValue, yyIndex,
8772: yyError);
8773: }
8774: }
8775: }
8776: break;
8777:
8778: case '|': {
8779: final int yyChoice1 = yyIndex;
8780:
8781: // Nested alternative 1.
8782:
8783: yyC = character(yyChoice1);
8784: if (-1 != yyC) {
8785: yyIndex = yyChoice1 + 1;
8786: if ('|' == yyC) {
8787:
8788: yyValue = "||";
8789:
8790: return new SemanticValue(yyValue, yyIndex,
8791: yyError);
8792: }
8793: }
8794:
8795: // Nested alternative 2.
8796:
8797: yyValue = "|";
8798:
8799: return new SemanticValue(yyValue, yyChoice1, yyError);
8800: }
8801:
8802: case '=': {
8803: final int yyChoice1 = yyIndex;
8804:
8805: // Nested alternative 1.
8806:
8807: yyC = character(yyChoice1);
8808: if (-1 != yyC) {
8809: yyIndex = yyChoice1 + 1;
8810: if ('=' == yyC) {
8811:
8812: yyValue = "==";
8813:
8814: return new SemanticValue(yyValue, yyIndex,
8815: yyError);
8816: }
8817: }
8818:
8819: // Nested alternative 2.
8820:
8821: yyValue = "=";
8822:
8823: return new SemanticValue(yyValue, yyChoice1, yyError);
8824: }
8825:
8826: case '!': {
8827: final int yyChoice1 = yyIndex;
8828:
8829: // Nested alternative 1.
8830:
8831: yyC = character(yyChoice1);
8832: if (-1 != yyC) {
8833: yyIndex = yyChoice1 + 1;
8834: if ('=' == yyC) {
8835:
8836: yyValue = "!=";
8837:
8838: return new SemanticValue(yyValue, yyIndex,
8839: yyError);
8840: }
8841: }
8842:
8843: // Nested alternative 2.
8844:
8845: yyValue = "!";
8846:
8847: return new SemanticValue(yyValue, yyChoice1, yyError);
8848: }
8849:
8850: case '/': {
8851: final int yyChoice1 = yyIndex;
8852:
8853: // Nested alternative 1.
8854:
8855: yyC = character(yyChoice1);
8856: if (-1 != yyC) {
8857: yyIndex = yyChoice1 + 1;
8858: if ('.' == yyC) {
8859:
8860: yyValue = "/.";
8861:
8862: return new SemanticValue(yyValue, yyIndex,
8863: yyError);
8864: }
8865: }
8866:
8867: // Nested alternative 2.
8868:
8869: yyValue = "/";
8870:
8871: return new SemanticValue(yyValue, yyChoice1, yyError);
8872: }
8873:
8874: case '%': {
8875: final int yyChoice1 = yyIndex;
8876:
8877: // Nested alternative 1.
8878:
8879: yyC = character(yyChoice1);
8880: if (-1 != yyC) {
8881: yyIndex = yyChoice1 + 1;
8882: if ('.' == yyC) {
8883:
8884: yyValue = "%.";
8885:
8886: return new SemanticValue(yyValue, yyIndex,
8887: yyError);
8888: }
8889: }
8890:
8891: // Nested alternative 2.
8892:
8893: yyValue = "%";
8894:
8895: return new SemanticValue(yyValue, yyChoice1, yyError);
8896: }
8897:
8898: case '*': {
8899: final int yyChoice1 = yyIndex;
8900:
8901: // Nested alternative 1.
8902:
8903: yyC = character(yyChoice1);
8904: if (-1 != yyC) {
8905: yyIndex = yyChoice1 + 1;
8906: if ('.' == yyC) {
8907:
8908: yyValue = "*.";
8909:
8910: return new SemanticValue(yyValue, yyIndex,
8911: yyError);
8912: }
8913: }
8914:
8915: // Nested alternative 2.
8916:
8917: yyValue = "*";
8918:
8919: return new SemanticValue(yyValue, yyChoice1, yyError);
8920: }
8921:
8922: case '-': {
8923: final int yyChoice1 = yyIndex;
8924:
8925: // Nested alternative 1.
8926:
8927: yyC = character(yyChoice1);
8928: if (-1 != yyC) {
8929: yyIndex = yyChoice1 + 1;
8930:
8931: switch (yyC) {
8932: case '.': {
8933: yyValue = "-.";
8934:
8935: return new SemanticValue(yyValue, yyIndex,
8936: yyError);
8937: }
8938:
8939: case '>': {
8940: yyValue = "->";
8941:
8942: return new SemanticValue(yyValue, yyIndex,
8943: yyError);
8944: }
8945:
8946: default:
8947: /* No match. */
8948: }
8949: }
8950:
8951: // Nested alternative 2.
8952:
8953: yyValue = "-";
8954:
8955: return new SemanticValue(yyValue, yyChoice1, yyError);
8956: }
8957:
8958: case '+': {
8959: final int yyChoice1 = yyIndex;
8960:
8961: // Nested alternative 1.
8962:
8963: yyC = character(yyChoice1);
8964: if (-1 != yyC) {
8965: yyIndex = yyChoice1 + 1;
8966: if ('.' == yyC) {
8967:
8968: yyValue = "+.";
8969:
8970: return new SemanticValue(yyValue, yyIndex,
8971: yyError);
8972: }
8973: }
8974:
8975: // Nested alternative 2.
8976:
8977: yyValue = "+";
8978:
8979: return new SemanticValue(yyValue, yyChoice1, yyError);
8980: }
8981:
8982: case ':': {
8983: final int yyChoice1 = yyIndex;
8984:
8985: // Nested alternative 1.
8986:
8987: yyC = character(yyChoice1);
8988: if (-1 != yyC) {
8989: yyIndex = yyChoice1 + 1;
8990: if (':' == yyC) {
8991:
8992: yyValue = "::";
8993:
8994: return new SemanticValue(yyValue, yyIndex,
8995: yyError);
8996: }
8997: }
8998:
8999: // Nested alternative 2.
9000:
9001: yyValue = ":";
9002:
9003: return new SemanticValue(yyValue, yyChoice1, yyError);
9004: }
9005:
9006: case ';': {
9007: yyValue = ";";
9008:
9009: return new SemanticValue(yyValue, yyIndex, yyError);
9010: }
9011:
9012: case ',': {
9013: yyValue = ",";
9014:
9015: return new SemanticValue(yyValue, yyIndex, yyError);
9016: }
9017:
9018: case '.': {
9019: yyValue = ".";
9020:
9021: return new SemanticValue(yyValue, yyIndex, yyError);
9022: }
9023:
9024: case '{': {
9025: yyValue = "{";
9026:
9027: return new SemanticValue(yyValue, yyIndex, yyError);
9028: }
9029:
9030: case '}': {
9031: yyValue = "}";
9032:
9033: return new SemanticValue(yyValue, yyIndex, yyError);
9034: }
9035:
9036: case '(': {
9037: yyValue = "(";
9038:
9039: return new SemanticValue(yyValue, yyIndex, yyError);
9040: }
9041:
9042: case ')': {
9043: yyValue = ")";
9044:
9045: return new SemanticValue(yyValue, yyIndex, yyError);
9046: }
9047:
9048: case '[': {
9049: yyValue = "[";
9050:
9051: return new SemanticValue(yyValue, yyIndex, yyError);
9052: }
9053:
9054: case ']': {
9055: yyValue = "]";
9056:
9057: return new SemanticValue(yyValue, yyIndex, yyError);
9058: }
9059:
9060: case '^': {
9061: yyValue = "^";
9062:
9063: return new SemanticValue(yyValue, yyIndex, yyError);
9064: }
9065:
9066: case '@': {
9067: yyValue = "@";
9068:
9069: return new SemanticValue(yyValue, yyIndex, yyError);
9070: }
9071:
9072: case '\'': {
9073: yyValue = "\'";
9074:
9075: return new SemanticValue(yyValue, yyIndex, yyError);
9076: }
9077:
9078: case '`': {
9079: yyValue = "`";
9080:
9081: return new SemanticValue(yyValue, yyIndex, yyError);
9082: }
9083:
9084: default:
9085: /* No match. */
9086: }
9087: }
9088:
9089: // Done.
9090: yyError = yyError.select("symbol characters expected", yyStart);
9091: return yyError;
9092: }
9093:
9094: // =========================================================================
9095:
9096: /**
9097: * Parse nonterminal xtc.typical.Spacing.Spacing.
9098: *
9099: * @param yyStart The index.
9100: * @return The result.
9101: * @throws IOException Signals an I/O error.
9102: */
9103: private Result pSpacing(final int yyStart) throws IOException {
9104: int yyC;
9105: int yyIndex;
9106: boolean yyPredMatched;
9107: int yyBase;
9108: int yyRepetition1;
9109: int yyRepetition2;
9110: Void yyValue;
9111: ParseError yyError = ParseError.DUMMY;
9112:
9113: // Alternative 1.
9114:
9115: yyRepetition1 = yyStart;
9116: while (true) {
9117:
9118: final int yyChoice1 = yyRepetition1;
9119:
9120: // Nested alternative 1.
9121:
9122: yyC = character(yyChoice1);
9123: if (-1 != yyC) {
9124: yyIndex = yyChoice1 + 1;
9125:
9126: switch (yyC) {
9127: case ' ': {
9128: yyRepetition1 = yyIndex;
9129: continue;
9130: }
9131:
9132: case '\t': {
9133: yyRepetition1 = yyIndex;
9134: continue;
9135: }
9136:
9137: case '\f': {
9138: yyRepetition1 = yyIndex;
9139: continue;
9140: }
9141:
9142: case '\r': {
9143: final int yyChoice2 = yyIndex;
9144:
9145: // Nested alternative 1.
9146:
9147: yyC = character(yyChoice2);
9148: if ('\n' == yyC) {
9149: yyIndex = yyChoice2 + 1;
9150:
9151: yyRepetition1 = yyIndex;
9152: continue;
9153: }
9154:
9155: // Nested alternative 2.
9156:
9157: yyRepetition1 = yyChoice2;
9158: continue;
9159: }
9160:
9161: case '\n': {
9162: yyRepetition1 = yyIndex;
9163: continue;
9164: }
9165:
9166: case '(': {
9167: yyC = character(yyIndex);
9168: if (-1 != yyC) {
9169: yyIndex = yyIndex + 1;
9170: if ('*' == yyC) {
9171:
9172: yyRepetition2 = yyIndex;
9173: while (true) {
9174:
9175: final int yyChoice2 = yyRepetition2;
9176:
9177: // Nested alternative 1.
9178:
9179: yyC = character(yyChoice2);
9180: if (-1 != yyC) {
9181: yyIndex = yyChoice2 + 1;
9182:
9183: switch (yyC) {
9184: case '*': {
9185: yyPredMatched = false;
9186:
9187: yyC = character(yyIndex);
9188: if (')' == yyC) {
9189:
9190: yyPredMatched = true;
9191: }
9192:
9193: if (!yyPredMatched) {
9194:
9195: yyRepetition2 = yyIndex;
9196: continue;
9197: } else {
9198: yyError = yyError.select(
9199: "spacing expected",
9200: yyStart);
9201: }
9202: }
9203: break;
9204:
9205: default: {
9206: yyRepetition2 = yyIndex;
9207: continue;
9208: }
9209: }
9210: }
9211: break;
9212: }
9213:
9214: yyBase = yyRepetition2;
9215: yyC = character(yyBase);
9216: if ('*' == yyC) {
9217: yyIndex = yyRepetition2 + 1;
9218:
9219: yyC = character(yyIndex);
9220: if (')' == yyC) {
9221: yyIndex = yyIndex + 1;
9222:
9223: yyRepetition1 = yyIndex;
9224: continue;
9225: } else {
9226: yyError = yyError.select(
9227: "\"*)\" expected", yyBase);
9228: }
9229: } else {
9230: yyError = yyError.select(
9231: "\"*)\" expected", yyBase);
9232: }
9233: }
9234: }
9235: }
9236: break;
9237:
9238: default:
9239: /* No match. */
9240: }
9241: }
9242: break;
9243: }
9244:
9245: yyValue = null;
9246:
9247: return new SemanticValue(yyValue, yyRepetition1, yyError);
9248: }
9249:
9250: // =========================================================================
9251:
9252: /**
9253: * Parse nonterminal xtc.typical.Spacing.EndOfFile.
9254: *
9255: * @param yyStart The index.
9256: * @return The result.
9257: * @throws IOException Signals an I/O error.
9258: */
9259: private Result pEndOfFile(final int yyStart) throws IOException {
9260: int yyC;
9261: boolean yyPredMatched;
9262: Void yyValue;
9263: ParseError yyError = ParseError.DUMMY;
9264:
9265: // Alternative 1.
9266:
9267: yyPredMatched = false;
9268:
9269: yyC = character(yyStart);
9270: if (-1 != yyC) {
9271:
9272: yyPredMatched = true;
9273: }
9274:
9275: if (!yyPredMatched) {
9276:
9277: yyValue = null;
9278:
9279: return new SemanticValue(yyValue, yyStart, yyError);
9280: } else {
9281: yyError = yyError.select("end of file expected", yyStart);
9282: }
9283:
9284: // Done.
9285: return yyError;
9286: }
9287:
9288: // =========================================================================
9289:
9290: static {
9291: add(TYPICAL_KEYWORDS, new String[] { "and", "any", "assert",
9292: "require", "attribute", "bool", "bottom", "else",
9293: "error", "equality", "float", "float32", "float64",
9294: "as", "if", "in", "int", "guard", "mlvalue", "match",
9295: "namespace", "of", "scope", "string", "symbol",
9296: "mltype", "warning", "when", "with", "reduce", "then",
9297: "to", "true", "false", "sig", "modify", "module", "_",
9298: "predicate", "instantiate", "import", "eqattribute",
9299: "function", "let", "at", "begin", "end", "default",
9300: "Node" });
9301: }
9302:
9303: // =========================================================================
9304:
9305: /**
9306: * Get the specified text.
9307: *
9308: * @param s The text.
9309: * @return The text.
9310: */
9311: protected static final String toText(String s) {
9312: return s;
9313: }
9314:
9315: // =========================================================================
9316:
9317: /**
9318: * Add the specified values to the specified set.
9319: *
9320: * @param set The set.
9321: * @param values The new values.
9322: */
9323: protected static final <T> void add(Set<T> set, T[] values) {
9324: for (T v : values)
9325: set.add(v);
9326: }
9327:
9328: /**
9329: * Check whether the specified set contains the specified value.
9330: *
9331: * @param set The set.
9332: * @param value The value.
9333: * @return <code>true</code> if the set contains the value.
9334: */
9335: protected static final <T> boolean contains(Set<T> set, T value) {
9336: return set.contains(value);
9337: }
9338:
9339: }
|