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