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 8, 2007 at 5:40:36 PM.
0006: // Edit at your own risk.
0007: // ===========================================================================
0008:
0009: package xtc.xform;
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.xform.XForm</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 XFormParser extends ParserBase {
0036:
0037: /** The XFORM_KEYWORDS set. */
0038: public static final Set<String> XFORM_KEYWORDS = new HashSet<String>();
0039:
0040: // =========================================================================
0041:
0042: /** Chunk 1 of memoized results. */
0043: static final class Chunk1 {
0044: Result fCompoundExpression;
0045: Result fCompoundExpression$$Plus1;
0046: Result fLetBinding;
0047: Result fIterativeBindingList;
0048: Result fIterativeBindingList$$Star1;
0049: Result fIterativeBinding;
0050: Result fReplacementExpression;
0051: Result fNewNodeExpression;
0052: Result fChild;
0053: Result fIntersectionExpression;
0054: }
0055:
0056: /** Chunk 2 of memoized results. */
0057: static final class Chunk2 {
0058: Result fLogicalExpression;
0059: Result fPathExpression;
0060: Result fRelativePathExpression;
0061: Result fStepExpression;
0062: Result fVariableReference;
0063: Result fIdentifier;
0064: Result fWord;
0065: Result fWord$$Star1;
0066: Result fKeyword;
0067: Result fStringLiteral;
0068: }
0069:
0070: /** Chunk 3 of memoized results. */
0071: static final class Chunk3 {
0072: Result fIntegerLiteral;
0073: Result fNull;
0074: Result fSymbol;
0075: }
0076:
0077: // =========================================================================
0078:
0079: /** Memoization table column. */
0080: static final class XFormParserColumn 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 XFormParser(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 XFormParser(final Reader reader, final String file,
0106: final int size) {
0107: super (reader, file, size);
0108: }
0109:
0110: // =========================================================================
0111:
0112: protected Column newColumn() {
0113: return new XFormParserColumn();
0114: }
0115:
0116: // =========================================================================
0117:
0118: /**
0119: * Parse nonterminal xtc.xform.XForm.XForm.
0120: *
0121: * @param yyStart The index.
0122: * @return The result.
0123: * @throws IOException Signals an I/O error.
0124: */
0125: public Result pXForm(final int yyStart) throws IOException {
0126: Result yyResult;
0127: int yyOption1;
0128: Node yyOpValue1;
0129: Node yyValue;
0130: ParseError yyError = ParseError.DUMMY;
0131:
0132: // Alternative 1.
0133:
0134: yyResult = pSpacing(yyStart);
0135: yyError = yyResult.select(yyError);
0136: if (yyResult.hasValue()) {
0137:
0138: yyOption1 = yyResult.index;
0139: yyOpValue1 = null;
0140:
0141: yyResult = pImportStatement(yyOption1);
0142: yyError = yyResult.select(yyError);
0143: if (yyResult.hasValue()) {
0144: final Node v$el$1 = yyResult.semanticValue();
0145:
0146: yyOption1 = yyResult.index;
0147: yyOpValue1 = v$el$1;
0148: }
0149: { // Start scope for v$g$1.
0150: final Node v$g$1 = yyOpValue1;
0151:
0152: yyResult = pCompoundExpression(yyOption1);
0153: yyError = yyResult.select(yyError);
0154: if (yyResult.hasValue()) {
0155: final Node v$g$2 = yyResult.semanticValue();
0156:
0157: yyResult = pEndOfFile(yyResult.index);
0158: yyError = yyResult.select(yyError);
0159: if (yyResult.hasValue()) {
0160:
0161: yyValue = GNode.create("XForm", v$g$1, v$g$2);
0162: yyValue.setLocation(location(yyStart));
0163:
0164: return yyResult.createValue(yyValue, yyError);
0165: }
0166: }
0167: } // End scope for v$g$1.
0168: }
0169:
0170: // Done.
0171: return yyError;
0172: }
0173:
0174: // =========================================================================
0175:
0176: /**
0177: * Parse nonterminal xtc.xform.XForm.ImportStatement.
0178: *
0179: * @param yyStart The index.
0180: * @return The result.
0181: * @throws IOException Signals an I/O error.
0182: */
0183: private Result pImportStatement(final int yyStart)
0184: throws IOException {
0185: Result yyResult;
0186: int yyBase;
0187: int yyRepetition1;
0188: Pair<Node> yyRepValue1;
0189: Node yyValue;
0190: ParseError yyError = ParseError.DUMMY;
0191:
0192: // Alternative 1.
0193:
0194: yyResult = pKeyword(yyStart);
0195: yyError = yyResult.select(yyError);
0196: if (yyResult.hasValue("import")) {
0197:
0198: yyResult = pStringLiteral(yyResult.index);
0199: yyError = yyResult.select(yyError);
0200: if (yyResult.hasValue()) {
0201: final Node v$g$1 = yyResult.semanticValue();
0202:
0203: yyRepetition1 = yyResult.index;
0204: yyRepValue1 = Pair.empty();
0205: while (true) {
0206:
0207: yyBase = yyRepetition1;
0208: yyResult = pSymbol(yyBase);
0209: yyError = yyResult.select(yyError);
0210: if (yyResult.hasValue(",")) {
0211:
0212: yyResult = pStringLiteral(yyResult.index);
0213: yyError = yyResult.select(yyError);
0214: if (yyResult.hasValue()) {
0215: final Node v$el$1 = yyResult
0216: .semanticValue();
0217:
0218: yyRepetition1 = yyResult.index;
0219: yyRepValue1 = new Pair<Node>(v$el$1,
0220: yyRepValue1);
0221: continue;
0222: }
0223: } else {
0224: yyError = yyError.select("\",\" expected",
0225: yyBase);
0226: }
0227: break;
0228: }
0229: { // Start scope for v$g$2.
0230: final Pair<Node> v$g$2 = yyRepValue1.reverse();
0231:
0232: yyValue = GNode.createFromPair("ImportStatement",
0233: v$g$1, v$g$2);
0234: yyValue.setLocation(location(yyStart));
0235:
0236: return new SemanticValue(yyValue, yyRepetition1,
0237: yyError);
0238: } // End scope for v$g$2.
0239: }
0240: }
0241:
0242: // Done.
0243: yyError = yyError.select("import statement expected", yyStart);
0244: return yyError;
0245: }
0246:
0247: // =========================================================================
0248:
0249: /**
0250: * Parse nonterminal xtc.xform.XForm.CompoundExpression.
0251: *
0252: * @param yyStart The index.
0253: * @return The result.
0254: * @throws IOException Signals an I/O error.
0255: */
0256: private Result pCompoundExpression(final int yyStart)
0257: throws IOException {
0258: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
0259: if (null == yyColumn.chunk1)
0260: yyColumn.chunk1 = new Chunk1();
0261: if (null == yyColumn.chunk1.fCompoundExpression)
0262: yyColumn.chunk1.fCompoundExpression = pCompoundExpression$1(yyStart);
0263: return yyColumn.chunk1.fCompoundExpression;
0264: }
0265:
0266: /** Actually parse xtc.xform.XForm.CompoundExpression. */
0267: private Result pCompoundExpression$1(final int yyStart)
0268: throws IOException {
0269: Result yyResult;
0270: Node yyValue;
0271: ParseError yyError = ParseError.DUMMY;
0272:
0273: // Alternative <Comma>.
0274:
0275: yyResult = pSingleExpression(yyStart);
0276: yyError = yyResult.select(yyError);
0277: if (yyResult.hasValue()) {
0278: final Node v$g$1 = yyResult.semanticValue();
0279:
0280: yyResult = pCompoundExpression$$Plus1(yyResult.index);
0281: yyError = yyResult.select(yyError);
0282: if (yyResult.hasValue()) {
0283: final Pair<Node> v$g$2 = yyResult.semanticValue();
0284:
0285: yyValue = GNode.createFromPair("CompoundExpression",
0286: v$g$1, v$g$2);
0287: yyValue.setLocation(location(yyStart));
0288:
0289: return yyResult.createValue(yyValue, yyError);
0290: }
0291: }
0292:
0293: // Alternative <Base>.
0294:
0295: yyResult = pSingleExpression(yyStart);
0296: yyError = yyResult.select(yyError);
0297: if (yyResult.hasValue()) {
0298: yyValue = yyResult.semanticValue();
0299:
0300: return yyResult.createValue(yyValue, yyError);
0301: }
0302:
0303: // Done.
0304: return yyError;
0305: }
0306:
0307: // =========================================================================
0308:
0309: /**
0310: * Parse synthetic nonterminal xtc.xform.XForm.CompoundExpression$$Plus1.
0311: *
0312: * @param yyStart The index.
0313: * @return The result.
0314: * @throws IOException Signals an I/O error.
0315: */
0316: private Result pCompoundExpression$$Plus1(final int yyStart)
0317: throws IOException {
0318:
0319: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
0320: if (null == yyColumn.chunk1)
0321: yyColumn.chunk1 = new Chunk1();
0322: if (null == yyColumn.chunk1.fCompoundExpression$$Plus1)
0323: yyColumn.chunk1.fCompoundExpression$$Plus1 = pCompoundExpression$$Plus1$1(yyStart);
0324: return yyColumn.chunk1.fCompoundExpression$$Plus1;
0325: }
0326:
0327: /** Actually parse xtc.xform.XForm.CompoundExpression$$Plus1. */
0328: private Result pCompoundExpression$$Plus1$1(final int yyStart)
0329: throws IOException {
0330:
0331: Result yyResult;
0332: Pair<Node> yyValue;
0333: ParseError yyError = ParseError.DUMMY;
0334:
0335: // Alternative 1.
0336:
0337: yyResult = pSymbol(yyStart);
0338: yyError = yyResult.select(yyError);
0339: if (yyResult.hasValue(",")) {
0340:
0341: yyResult = pSingleExpression(yyResult.index);
0342: yyError = yyResult.select(yyError);
0343: if (yyResult.hasValue()) {
0344: final Node v$el$1 = yyResult.semanticValue();
0345:
0346: final int yyChoice1 = yyResult.index;
0347:
0348: // Nested alternative 1.
0349:
0350: yyResult = pCompoundExpression$$Plus1(yyChoice1);
0351: yyError = yyResult.select(yyError);
0352: if (yyResult.hasValue()) {
0353: final Pair<Node> v$2 = yyResult.semanticValue();
0354:
0355: yyValue = new Pair<Node>(v$el$1, v$2);
0356:
0357: return yyResult.createValue(yyValue, yyError);
0358: }
0359:
0360: // Nested alternative 2.
0361:
0362: yyValue = new Pair<Node>(v$el$1);
0363:
0364: return new SemanticValue(yyValue, yyChoice1, yyError);
0365: }
0366: }
0367:
0368: // Done.
0369: yyError = yyError.select("compound expression expected",
0370: yyStart);
0371: return yyError;
0372: }
0373:
0374: // =========================================================================
0375:
0376: /**
0377: * Parse nonterminal xtc.xform.XForm.SingleExpression.
0378: *
0379: * @param yyStart The index.
0380: * @return The result.
0381: * @throws IOException Signals an I/O error.
0382: */
0383: private Result pSingleExpression(final int yyStart)
0384: throws IOException {
0385: Result yyResult;
0386: Node yyValue;
0387: ParseError yyError = ParseError.DUMMY;
0388:
0389: // Alternative <Replacement>.
0390:
0391: yyResult = pReplacementExpression(yyStart);
0392: yyError = yyResult.select(yyError);
0393: if (yyResult.hasValue()) {
0394: yyValue = yyResult.semanticValue();
0395:
0396: return yyResult.createValue(yyValue, yyError);
0397: }
0398:
0399: // Alternative <InsertBefore>.
0400:
0401: yyResult = pInsertBeforeExpression(yyStart);
0402: yyError = yyResult.select(yyError);
0403: if (yyResult.hasValue()) {
0404: yyValue = yyResult.semanticValue();
0405:
0406: return yyResult.createValue(yyValue, yyError);
0407: }
0408:
0409: // Alternative <InsertAfter>.
0410:
0411: yyResult = pInsertAfterExpression(yyStart);
0412: yyError = yyResult.select(yyError);
0413: if (yyResult.hasValue()) {
0414: yyValue = yyResult.semanticValue();
0415:
0416: return yyResult.createValue(yyValue, yyError);
0417: }
0418:
0419: // Alternative <Remove>.
0420:
0421: yyResult = pRemoveExpression(yyStart);
0422: yyError = yyResult.select(yyError);
0423: if (yyResult.hasValue()) {
0424: yyValue = yyResult.semanticValue();
0425:
0426: return yyResult.createValue(yyValue, yyError);
0427: }
0428:
0429: // Alternative <Add>.
0430:
0431: yyResult = pAddExpression(yyStart);
0432: yyError = yyResult.select(yyError);
0433: if (yyResult.hasValue()) {
0434: yyValue = yyResult.semanticValue();
0435:
0436: return yyResult.createValue(yyValue, yyError);
0437: }
0438:
0439: // Alternative <Let>.
0440:
0441: yyResult = pLetExpression(yyStart);
0442: yyError = yyResult.select(yyError);
0443: if (yyResult.hasValue()) {
0444: yyValue = yyResult.semanticValue();
0445:
0446: return yyResult.createValue(yyValue, yyError);
0447: }
0448:
0449: // Alternative <For>.
0450:
0451: yyResult = pForExpression(yyStart);
0452: yyError = yyResult.select(yyError);
0453: if (yyResult.hasValue()) {
0454: yyValue = yyResult.semanticValue();
0455:
0456: return yyResult.createValue(yyValue, yyError);
0457: }
0458:
0459: // Alternative <CFor>.
0460:
0461: yyResult = pCForExpression(yyStart);
0462: yyError = yyResult.select(yyError);
0463: if (yyResult.hasValue()) {
0464: yyValue = yyResult.semanticValue();
0465:
0466: return yyResult.createValue(yyValue, yyError);
0467: }
0468:
0469: // Alternative <If>.
0470:
0471: yyResult = pIfExpression(yyStart);
0472: yyError = yyResult.select(yyError);
0473: if (yyResult.hasValue()) {
0474: yyValue = yyResult.semanticValue();
0475:
0476: return yyResult.createValue(yyValue, yyError);
0477: }
0478:
0479: // Alternative <NewItem>.
0480:
0481: yyResult = pNewItemExpression(yyStart);
0482: yyError = yyResult.select(yyError);
0483: if (yyResult.hasValue()) {
0484: yyValue = yyResult.semanticValue();
0485:
0486: return yyResult.createValue(yyValue, yyError);
0487: }
0488:
0489: // Alternative <Union>.
0490:
0491: yyResult = pUnionExpression(yyStart);
0492: yyError = yyResult.select(yyError);
0493: if (yyResult.hasValue()) {
0494: yyValue = yyResult.semanticValue();
0495:
0496: return yyResult.createValue(yyValue, yyError);
0497: }
0498:
0499: // Done.
0500: return yyError;
0501: }
0502:
0503: // =========================================================================
0504:
0505: /**
0506: * Parse nonterminal xtc.xform.XForm.LetExpression.
0507: *
0508: * @param yyStart The index.
0509: * @return The result.
0510: * @throws IOException Signals an I/O error.
0511: */
0512: private Result pLetExpression(final int yyStart) throws IOException {
0513: Result yyResult;
0514: int yyBase;
0515: Node yyValue;
0516: ParseError yyError = ParseError.DUMMY;
0517:
0518: // Alternative 1.
0519:
0520: yyResult = pKeyword(yyStart);
0521: yyError = yyResult.select(yyError);
0522: if (yyResult.hasValue("let")) {
0523:
0524: yyResult = pLetBindingList(yyResult.index);
0525: yyError = yyResult.select(yyError);
0526: if (yyResult.hasValue()) {
0527: final Node v$g$1 = yyResult.semanticValue();
0528:
0529: yyBase = yyResult.index;
0530: yyResult = pKeyword(yyBase);
0531: yyError = yyResult.select(yyError);
0532: if (yyResult.hasValue("return")) {
0533:
0534: yyResult = pSingleExpression(yyResult.index);
0535: yyError = yyResult.select(yyError);
0536: if (yyResult.hasValue()) {
0537: final Node v$g$2 = yyResult.semanticValue();
0538:
0539: yyValue = GNode.create("LetExpression", v$g$1,
0540: v$g$2);
0541: yyValue.setLocation(location(yyStart));
0542:
0543: return yyResult.createValue(yyValue, yyError);
0544: }
0545: } else {
0546: yyError = yyError.select("\"return\" expected",
0547: yyBase);
0548: }
0549: }
0550: }
0551:
0552: // Done.
0553: yyError = yyError.select("let expression expected", yyStart);
0554: return yyError;
0555: }
0556:
0557: // =========================================================================
0558:
0559: /**
0560: * Parse nonterminal xtc.xform.XForm.LetBindingList.
0561: *
0562: * @param yyStart The index.
0563: * @return The result.
0564: * @throws IOException Signals an I/O error.
0565: */
0566: private Result pLetBindingList(final int yyStart)
0567: throws IOException {
0568: Result yyResult;
0569: int yyBase;
0570: int yyRepetition1;
0571: Pair<Node> yyRepValue1;
0572: Node yyValue;
0573: ParseError yyError = ParseError.DUMMY;
0574:
0575: // Alternative 1.
0576:
0577: yyResult = pLetBinding(yyStart);
0578: yyError = yyResult.select(yyError);
0579: if (yyResult.hasValue()) {
0580: final Node v$g$1 = yyResult.semanticValue();
0581:
0582: yyRepetition1 = yyResult.index;
0583: yyRepValue1 = Pair.empty();
0584: while (true) {
0585:
0586: yyBase = yyRepetition1;
0587: yyResult = pSymbol(yyBase);
0588: yyError = yyResult.select(yyError);
0589: if (yyResult.hasValue(",")) {
0590:
0591: yyResult = pLetBinding(yyResult.index);
0592: yyError = yyResult.select(yyError);
0593: if (yyResult.hasValue()) {
0594: final Node v$el$1 = yyResult.semanticValue();
0595:
0596: yyRepetition1 = yyResult.index;
0597: yyRepValue1 = new Pair<Node>(v$el$1,
0598: yyRepValue1);
0599: continue;
0600: }
0601: } else {
0602: yyError = yyError.select("\",\" expected", yyBase);
0603: }
0604: break;
0605: }
0606: { // Start scope for v$g$2.
0607: final Pair<Node> v$g$2 = yyRepValue1.reverse();
0608:
0609: yyValue = GNode.createFromPair("LetBindingList", v$g$1,
0610: v$g$2);
0611: yyValue.setLocation(location(yyStart));
0612:
0613: return new SemanticValue(yyValue, yyRepetition1,
0614: yyError);
0615: } // End scope for v$g$2.
0616: }
0617:
0618: // Done.
0619: return yyError;
0620: }
0621:
0622: // =========================================================================
0623:
0624: /**
0625: * Parse nonterminal xtc.xform.XForm.LetBinding.
0626: *
0627: * @param yyStart The index.
0628: * @return The result.
0629: * @throws IOException Signals an I/O error.
0630: */
0631: private Result pLetBinding(final int yyStart) throws IOException {
0632: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
0633: if (null == yyColumn.chunk1)
0634: yyColumn.chunk1 = new Chunk1();
0635: if (null == yyColumn.chunk1.fLetBinding)
0636: yyColumn.chunk1.fLetBinding = pLetBinding$1(yyStart);
0637: return yyColumn.chunk1.fLetBinding;
0638: }
0639:
0640: /** Actually parse xtc.xform.XForm.LetBinding. */
0641: private Result pLetBinding$1(final int yyStart) throws IOException {
0642: Result yyResult;
0643: int yyBase;
0644: Node yyValue;
0645: ParseError yyError = ParseError.DUMMY;
0646:
0647: // Alternative 1.
0648:
0649: yyResult = pVariableReference(yyStart);
0650: yyError = yyResult.select(yyError);
0651: if (yyResult.hasValue()) {
0652: final Node v$g$1 = yyResult.semanticValue();
0653:
0654: yyBase = yyResult.index;
0655: yyResult = pKeyword(yyBase);
0656: yyError = yyResult.select(yyError);
0657: if (yyResult.hasValue("be")) {
0658:
0659: yyResult = pSingleExpression(yyResult.index);
0660: yyError = yyResult.select(yyError);
0661: if (yyResult.hasValue()) {
0662: final Node v$g$2 = yyResult.semanticValue();
0663:
0664: yyValue = GNode.create("LetBinding", v$g$1, v$g$2);
0665: yyValue.setLocation(location(yyStart));
0666:
0667: return yyResult.createValue(yyValue, yyError);
0668: }
0669: } else {
0670: yyError = yyError.select("\"be\" expected", yyBase);
0671: }
0672: }
0673:
0674: // Done.
0675: return yyError;
0676: }
0677:
0678: // =========================================================================
0679:
0680: /**
0681: * Parse nonterminal xtc.xform.XForm.ForExpression.
0682: *
0683: * @param yyStart The index.
0684: * @return The result.
0685: * @throws IOException Signals an I/O error.
0686: */
0687: private Result pForExpression(final int yyStart) throws IOException {
0688: Result yyResult;
0689: int yyBase;
0690: Node yyValue;
0691: ParseError yyError = ParseError.DUMMY;
0692:
0693: // Alternative 1.
0694:
0695: yyResult = pKeyword(yyStart);
0696: yyError = yyResult.select(yyError);
0697: if (yyResult.hasValue("for")) {
0698:
0699: yyResult = pIterativeBindingList(yyResult.index);
0700: yyError = yyResult.select(yyError);
0701: if (yyResult.hasValue()) {
0702: final Node v$g$1 = yyResult.semanticValue();
0703:
0704: final int yyChoice1 = yyResult.index;
0705:
0706: // Nested alternative 1.
0707:
0708: yyBase = yyChoice1;
0709: yyResult = pKeyword(yyBase);
0710: yyError = yyResult.select(yyError);
0711: if (yyResult.hasValue("return")) {
0712:
0713: yyResult = pSingleExpression(yyResult.index);
0714: yyError = yyResult.select(yyError);
0715: if (yyResult.hasValue()) {
0716: final Node v$g$2 = yyResult.semanticValue();
0717:
0718: yyValue = GNode.create("ForExpression", v$g$1,
0719: v$g$2);
0720: yyValue.setLocation(location(yyStart));
0721:
0722: return yyResult.createValue(yyValue, yyError);
0723: }
0724: } else {
0725: yyError = yyError.select("\"return\" expected",
0726: yyBase);
0727: }
0728:
0729: // Nested alternative 2.
0730:
0731: yyResult = pReplacementExpression(yyChoice1);
0732: yyError = yyResult.select(yyError);
0733: if (yyResult.hasValue()) {
0734: final Node v$g$3 = yyResult.semanticValue();
0735:
0736: yyValue = GNode.create("ForExpression", v$g$1,
0737: v$g$3);
0738: yyValue.setLocation(location(yyStart));
0739:
0740: return yyResult.createValue(yyValue, yyError);
0741: }
0742: }
0743: }
0744:
0745: // Done.
0746: yyError = yyError.select("for expression expected", yyStart);
0747: return yyError;
0748: }
0749:
0750: // =========================================================================
0751:
0752: /**
0753: * Parse nonterminal xtc.xform.XForm.CForExpression.
0754: *
0755: * @param yyStart The index.
0756: * @return The result.
0757: * @throws IOException Signals an I/O error.
0758: */
0759: private Result pCForExpression(final int yyStart)
0760: throws IOException {
0761: Result yyResult;
0762: int yyBase;
0763: Node yyValue;
0764: ParseError yyError = ParseError.DUMMY;
0765:
0766: // Alternative 1.
0767:
0768: yyResult = pKeyword(yyStart);
0769: yyError = yyResult.select(yyError);
0770: if (yyResult.hasValue("cfor")) {
0771:
0772: yyResult = pIterativeBindingList(yyResult.index);
0773: yyError = yyResult.select(yyError);
0774: if (yyResult.hasValue()) {
0775: final Node v$g$1 = yyResult.semanticValue();
0776:
0777: final int yyChoice1 = yyResult.index;
0778:
0779: // Nested alternative 1.
0780:
0781: yyBase = yyChoice1;
0782: yyResult = pKeyword(yyBase);
0783: yyError = yyResult.select(yyError);
0784: if (yyResult.hasValue("return")) {
0785:
0786: yyResult = pSingleExpression(yyResult.index);
0787: yyError = yyResult.select(yyError);
0788: if (yyResult.hasValue()) {
0789: final Node v$g$2 = yyResult.semanticValue();
0790:
0791: yyValue = GNode.create("CForExpression", v$g$1,
0792: v$g$2);
0793: yyValue.setLocation(location(yyStart));
0794:
0795: return yyResult.createValue(yyValue, yyError);
0796: }
0797: } else {
0798: yyError = yyError.select("\"return\" expected",
0799: yyBase);
0800: }
0801:
0802: // Nested alternative 2.
0803:
0804: yyResult = pReplacementExpression(yyChoice1);
0805: yyError = yyResult.select(yyError);
0806: if (yyResult.hasValue()) {
0807: final Node v$g$3 = yyResult.semanticValue();
0808:
0809: yyValue = GNode.create("CForExpression", v$g$1,
0810: v$g$3);
0811: yyValue.setLocation(location(yyStart));
0812:
0813: return yyResult.createValue(yyValue, yyError);
0814: }
0815: }
0816: }
0817:
0818: // Done.
0819: yyError = yyError.select("c for expression expected", yyStart);
0820: return yyError;
0821: }
0822:
0823: // =========================================================================
0824:
0825: /**
0826: * Parse nonterminal xtc.xform.XForm.IterativeBindingList.
0827: *
0828: * @param yyStart The index.
0829: * @return The result.
0830: * @throws IOException Signals an I/O error.
0831: */
0832: private Result pIterativeBindingList(final int yyStart)
0833: throws IOException {
0834: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
0835: if (null == yyColumn.chunk1)
0836: yyColumn.chunk1 = new Chunk1();
0837: if (null == yyColumn.chunk1.fIterativeBindingList)
0838: yyColumn.chunk1.fIterativeBindingList = pIterativeBindingList$1(yyStart);
0839: return yyColumn.chunk1.fIterativeBindingList;
0840: }
0841:
0842: /** Actually parse xtc.xform.XForm.IterativeBindingList. */
0843: private Result pIterativeBindingList$1(final int yyStart)
0844: throws IOException {
0845:
0846: Result yyResult;
0847: Node yyValue;
0848: ParseError yyError = ParseError.DUMMY;
0849:
0850: // Alternative 1.
0851:
0852: yyResult = pIterativeBinding(yyStart);
0853: yyError = yyResult.select(yyError);
0854: if (yyResult.hasValue()) {
0855: final Node v$g$1 = yyResult.semanticValue();
0856:
0857: yyResult = pIterativeBindingList$$Star1(yyResult.index);
0858: yyError = yyResult.select(yyError);
0859: if (yyResult.hasValue()) {
0860: final Pair<Node> v$g$2 = yyResult.semanticValue();
0861:
0862: yyValue = GNode.createFromPair("IterativeBindingList",
0863: v$g$1, v$g$2);
0864: yyValue.setLocation(location(yyStart));
0865:
0866: return yyResult.createValue(yyValue, yyError);
0867: }
0868: }
0869:
0870: // Done.
0871: return yyError;
0872: }
0873:
0874: // =========================================================================
0875:
0876: /**
0877: * Parse synthetic nonterminal xtc.xform.XForm.IterativeBindingList$$Star1.
0878: *
0879: * @param yyStart The index.
0880: * @return The result.
0881: * @throws IOException Signals an I/O error.
0882: */
0883: private Result pIterativeBindingList$$Star1(final int yyStart)
0884: throws IOException {
0885:
0886: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
0887: if (null == yyColumn.chunk1)
0888: yyColumn.chunk1 = new Chunk1();
0889: if (null == yyColumn.chunk1.fIterativeBindingList$$Star1)
0890: yyColumn.chunk1.fIterativeBindingList$$Star1 = pIterativeBindingList$$Star1$1(yyStart);
0891: return yyColumn.chunk1.fIterativeBindingList$$Star1;
0892: }
0893:
0894: /** Actually parse xtc.xform.XForm.IterativeBindingList$$Star1. */
0895: private Result pIterativeBindingList$$Star1$1(final int yyStart)
0896: throws IOException {
0897:
0898: Result yyResult;
0899: Pair<Node> yyValue;
0900: ParseError yyError = ParseError.DUMMY;
0901:
0902: // Alternative 1.
0903:
0904: yyResult = pSymbol(yyStart);
0905: yyError = yyResult.select(yyError);
0906: if (yyResult.hasValue(",")) {
0907:
0908: yyResult = pIterativeBinding(yyResult.index);
0909: yyError = yyResult.select(yyError);
0910: if (yyResult.hasValue()) {
0911: final Node v$el$1 = yyResult.semanticValue();
0912:
0913: yyResult = pIterativeBindingList$$Star1(yyResult.index);
0914: yyError = yyResult.select(yyError);
0915: if (yyResult.hasValue()) {
0916: final Pair<Node> v$2 = yyResult.semanticValue();
0917:
0918: yyValue = new Pair<Node>(v$el$1, v$2);
0919:
0920: return yyResult.createValue(yyValue, yyError);
0921: }
0922: }
0923: }
0924:
0925: // Alternative 2.
0926:
0927: yyValue = Pair.empty();
0928:
0929: return new SemanticValue(yyValue, yyStart, yyError);
0930: }
0931:
0932: // =========================================================================
0933:
0934: /**
0935: * Parse nonterminal xtc.xform.XForm.IterativeBinding.
0936: *
0937: * @param yyStart The index.
0938: * @return The result.
0939: * @throws IOException Signals an I/O error.
0940: */
0941: private Result pIterativeBinding(final int yyStart)
0942: throws IOException {
0943: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
0944: if (null == yyColumn.chunk1)
0945: yyColumn.chunk1 = new Chunk1();
0946: if (null == yyColumn.chunk1.fIterativeBinding)
0947: yyColumn.chunk1.fIterativeBinding = pIterativeBinding$1(yyStart);
0948: return yyColumn.chunk1.fIterativeBinding;
0949: }
0950:
0951: /** Actually parse xtc.xform.XForm.IterativeBinding. */
0952: private Result pIterativeBinding$1(final int yyStart)
0953: throws IOException {
0954: Result yyResult;
0955: int yyBase;
0956: Node yyValue;
0957: ParseError yyError = ParseError.DUMMY;
0958:
0959: // Alternative 1.
0960:
0961: yyResult = pVariableReference(yyStart);
0962: yyError = yyResult.select(yyError);
0963: if (yyResult.hasValue()) {
0964: final Node v$g$1 = yyResult.semanticValue();
0965:
0966: yyBase = yyResult.index;
0967: yyResult = pKeyword(yyBase);
0968: yyError = yyResult.select(yyError);
0969: if (yyResult.hasValue("in")) {
0970:
0971: yyResult = pSingleExpression(yyResult.index);
0972: yyError = yyResult.select(yyError);
0973: if (yyResult.hasValue()) {
0974: final Node v$g$2 = yyResult.semanticValue();
0975:
0976: yyValue = GNode.create("IterativeBinding", v$g$1,
0977: v$g$2);
0978: yyValue.setLocation(location(yyStart));
0979:
0980: return yyResult.createValue(yyValue, yyError);
0981: }
0982: } else {
0983: yyError = yyError.select("\"in\" expected", yyBase);
0984: }
0985: }
0986:
0987: // Done.
0988: return yyError;
0989: }
0990:
0991: // =========================================================================
0992:
0993: /**
0994: * Parse nonterminal xtc.xform.XForm.IfExpression.
0995: *
0996: * @param yyStart The index.
0997: * @return The result.
0998: * @throws IOException Signals an I/O error.
0999: */
1000: private Result pIfExpression(final int yyStart) throws IOException {
1001: Result yyResult;
1002: int yyBase;
1003: Node yyValue;
1004: ParseError yyError = ParseError.DUMMY;
1005:
1006: // Alternative 1.
1007:
1008: yyResult = pKeyword(yyStart);
1009: yyError = yyResult.select(yyError);
1010: if (yyResult.hasValue("if")) {
1011:
1012: yyResult = pSingleExpression(yyResult.index);
1013: yyError = yyResult.select(yyError);
1014: if (yyResult.hasValue()) {
1015: final Node v$g$1 = yyResult.semanticValue();
1016:
1017: yyBase = yyResult.index;
1018: yyResult = pKeyword(yyBase);
1019: yyError = yyResult.select(yyError);
1020: if (yyResult.hasValue("then")) {
1021:
1022: yyResult = pSingleExpression(yyResult.index);
1023: yyError = yyResult.select(yyError);
1024: if (yyResult.hasValue()) {
1025: final Node v$g$2 = yyResult.semanticValue();
1026:
1027: yyBase = yyResult.index;
1028: yyResult = pKeyword(yyBase);
1029: yyError = yyResult.select(yyError);
1030: if (yyResult.hasValue("else")) {
1031:
1032: yyResult = pSingleExpression(yyResult.index);
1033: yyError = yyResult.select(yyError);
1034: if (yyResult.hasValue()) {
1035: final Node v$g$3 = yyResult
1036: .semanticValue();
1037:
1038: yyValue = GNode.create("IfExpression",
1039: v$g$1, v$g$2, v$g$3);
1040: yyValue.setLocation(location(yyStart));
1041:
1042: return yyResult.createValue(yyValue,
1043: yyError);
1044: }
1045: } else {
1046: yyError = yyError.select(
1047: "\"else\" expected", yyBase);
1048: }
1049: }
1050: } else {
1051: yyError = yyError.select("\"then\" expected",
1052: yyBase);
1053: }
1054: }
1055: }
1056:
1057: // Done.
1058: yyError = yyError.select("if expression expected", yyStart);
1059: return yyError;
1060: }
1061:
1062: // =========================================================================
1063:
1064: /**
1065: * Parse nonterminal xtc.xform.XForm.ReplacementExpression.
1066: *
1067: * @param yyStart The index.
1068: * @return The result.
1069: * @throws IOException Signals an I/O error.
1070: */
1071: private Result pReplacementExpression(final int yyStart)
1072: throws IOException {
1073:
1074: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
1075: if (null == yyColumn.chunk1)
1076: yyColumn.chunk1 = new Chunk1();
1077: if (null == yyColumn.chunk1.fReplacementExpression)
1078: yyColumn.chunk1.fReplacementExpression = pReplacementExpression$1(yyStart);
1079: return yyColumn.chunk1.fReplacementExpression;
1080: }
1081:
1082: /** Actually parse xtc.xform.XForm.ReplacementExpression. */
1083: private Result pReplacementExpression$1(final int yyStart)
1084: throws IOException {
1085:
1086: Result yyResult;
1087: int yyBase;
1088: Node yyValue;
1089: ParseError yyError = ParseError.DUMMY;
1090:
1091: // Alternative 1.
1092:
1093: yyResult = pKeyword(yyStart);
1094: yyError = yyResult.select(yyError);
1095: if (yyResult.hasValue("replace")) {
1096:
1097: yyResult = pSingleExpression(yyResult.index);
1098: yyError = yyResult.select(yyError);
1099: if (yyResult.hasValue()) {
1100: final Node v$g$1 = yyResult.semanticValue();
1101:
1102: yyBase = yyResult.index;
1103: yyResult = pKeyword(yyBase);
1104: yyError = yyResult.select(yyError);
1105: if (yyResult.hasValue("with")) {
1106:
1107: yyResult = pSingleExpression(yyResult.index);
1108: yyError = yyResult.select(yyError);
1109: if (yyResult.hasValue()) {
1110: final Node v$g$2 = yyResult.semanticValue();
1111:
1112: yyValue = GNode.create("ReplacementExpression",
1113: v$g$1, v$g$2);
1114: yyValue.setLocation(location(yyStart));
1115:
1116: return yyResult.createValue(yyValue, yyError);
1117: }
1118: } else {
1119: yyError = yyError.select("\"with\" expected",
1120: yyBase);
1121: }
1122: }
1123: }
1124:
1125: // Done.
1126: yyError = yyError.select("replacement expression expected",
1127: yyStart);
1128: return yyError;
1129: }
1130:
1131: // =========================================================================
1132:
1133: /**
1134: * Parse nonterminal xtc.xform.XForm.InsertAfterExpression.
1135: *
1136: * @param yyStart The index.
1137: * @return The result.
1138: * @throws IOException Signals an I/O error.
1139: */
1140: private Result pInsertAfterExpression(final int yyStart)
1141: throws IOException {
1142:
1143: Result yyResult;
1144: int yyBase;
1145: Node yyValue;
1146: ParseError yyError = ParseError.DUMMY;
1147:
1148: // Alternative 1.
1149:
1150: yyResult = pKeyword(yyStart);
1151: yyError = yyResult.select(yyError);
1152: if (yyResult.hasValue("insert")) {
1153:
1154: yyResult = pSingleExpression(yyResult.index);
1155: yyError = yyResult.select(yyError);
1156: if (yyResult.hasValue()) {
1157: final Node v$g$1 = yyResult.semanticValue();
1158:
1159: yyBase = yyResult.index;
1160: yyResult = pKeyword(yyBase);
1161: yyError = yyResult.select(yyError);
1162: if (yyResult.hasValue("after")) {
1163:
1164: yyResult = pSingleExpression(yyResult.index);
1165: yyError = yyResult.select(yyError);
1166: if (yyResult.hasValue()) {
1167: final Node v$g$2 = yyResult.semanticValue();
1168:
1169: yyValue = GNode.create("InsertAfterExpression",
1170: v$g$1, v$g$2);
1171: yyValue.setLocation(location(yyStart));
1172:
1173: return yyResult.createValue(yyValue, yyError);
1174: }
1175: } else {
1176: yyError = yyError.select("\"after\" expected",
1177: yyBase);
1178: }
1179: }
1180: }
1181:
1182: // Done.
1183: yyError = yyError.select("insert after expression expected",
1184: yyStart);
1185: return yyError;
1186: }
1187:
1188: // =========================================================================
1189:
1190: /**
1191: * Parse nonterminal xtc.xform.XForm.InsertBeforeExpression.
1192: *
1193: * @param yyStart The index.
1194: * @return The result.
1195: * @throws IOException Signals an I/O error.
1196: */
1197: private Result pInsertBeforeExpression(final int yyStart)
1198: throws IOException {
1199:
1200: Result yyResult;
1201: int yyBase;
1202: Node yyValue;
1203: ParseError yyError = ParseError.DUMMY;
1204:
1205: // Alternative 1.
1206:
1207: yyResult = pKeyword(yyStart);
1208: yyError = yyResult.select(yyError);
1209: if (yyResult.hasValue("insert")) {
1210:
1211: yyResult = pSingleExpression(yyResult.index);
1212: yyError = yyResult.select(yyError);
1213: if (yyResult.hasValue()) {
1214: final Node v$g$1 = yyResult.semanticValue();
1215:
1216: yyBase = yyResult.index;
1217: yyResult = pKeyword(yyBase);
1218: yyError = yyResult.select(yyError);
1219: if (yyResult.hasValue("before")) {
1220:
1221: yyResult = pSingleExpression(yyResult.index);
1222: yyError = yyResult.select(yyError);
1223: if (yyResult.hasValue()) {
1224: final Node v$g$2 = yyResult.semanticValue();
1225:
1226: yyValue = GNode.create(
1227: "InsertBeforeExpression", v$g$1, v$g$2);
1228: yyValue.setLocation(location(yyStart));
1229:
1230: return yyResult.createValue(yyValue, yyError);
1231: }
1232: } else {
1233: yyError = yyError.select("\"before\" expected",
1234: yyBase);
1235: }
1236: }
1237: }
1238:
1239: // Done.
1240: yyError = yyError.select("insert before expression expected",
1241: yyStart);
1242: return yyError;
1243: }
1244:
1245: // =========================================================================
1246:
1247: /**
1248: * Parse nonterminal xtc.xform.XForm.RemoveExpression.
1249: *
1250: * @param yyStart The index.
1251: * @return The result.
1252: * @throws IOException Signals an I/O error.
1253: */
1254: private Result pRemoveExpression(final int yyStart)
1255: throws IOException {
1256: Result yyResult;
1257: Node yyValue;
1258: ParseError yyError = ParseError.DUMMY;
1259:
1260: // Alternative 1.
1261:
1262: yyResult = pKeyword(yyStart);
1263: yyError = yyResult.select(yyError);
1264: if (yyResult.hasValue("remove")) {
1265:
1266: yyResult = pSingleExpression(yyResult.index);
1267: yyError = yyResult.select(yyError);
1268: if (yyResult.hasValue()) {
1269: final Node v$g$1 = yyResult.semanticValue();
1270:
1271: yyValue = GNode.create("RemoveExpression", v$g$1);
1272: yyValue.setLocation(location(yyStart));
1273:
1274: return yyResult.createValue(yyValue, yyError);
1275: }
1276: }
1277:
1278: // Done.
1279: yyError = yyError.select("remove expression expected", yyStart);
1280: return yyError;
1281: }
1282:
1283: // =========================================================================
1284:
1285: /**
1286: * Parse nonterminal xtc.xform.XForm.AddExpression.
1287: *
1288: * @param yyStart The index.
1289: * @return The result.
1290: * @throws IOException Signals an I/O error.
1291: */
1292: private Result pAddExpression(final int yyStart) throws IOException {
1293: Result yyResult;
1294: int yyBase;
1295: Node yyValue;
1296: ParseError yyError = ParseError.DUMMY;
1297:
1298: // Alternative 1.
1299:
1300: yyResult = pKeyword(yyStart);
1301: yyError = yyResult.select(yyError);
1302: if (yyResult.hasValue("add")) {
1303:
1304: yyResult = pSingleExpression(yyResult.index);
1305: yyError = yyResult.select(yyError);
1306: if (yyResult.hasValue()) {
1307: final Node v$g$1 = yyResult.semanticValue();
1308:
1309: yyBase = yyResult.index;
1310: yyResult = pKeyword(yyBase);
1311: yyError = yyResult.select(yyError);
1312: if (yyResult.hasValue("to")) {
1313:
1314: yyResult = pSingleExpression(yyResult.index);
1315: yyError = yyResult.select(yyError);
1316: if (yyResult.hasValue()) {
1317: final Node v$g$2 = yyResult.semanticValue();
1318:
1319: yyValue = GNode.create("AddExpression", v$g$1,
1320: v$g$2);
1321: yyValue.setLocation(location(yyStart));
1322:
1323: return yyResult.createValue(yyValue, yyError);
1324: }
1325: } else {
1326: yyError = yyError.select("\"to\" expected", yyBase);
1327: }
1328: }
1329: }
1330:
1331: // Done.
1332: yyError = yyError.select("add expression expected", yyStart);
1333: return yyError;
1334: }
1335:
1336: // =========================================================================
1337:
1338: /**
1339: * Parse nonterminal xtc.xform.XForm.NewItemExpression.
1340: *
1341: * @param yyStart The index.
1342: * @return The result.
1343: * @throws IOException Signals an I/O error.
1344: */
1345: private Result pNewItemExpression(final int yyStart)
1346: throws IOException {
1347: Result yyResult;
1348: Node yyValue;
1349: ParseError yyError = ParseError.DUMMY;
1350:
1351: // Alternative <Null>.
1352:
1353: yyResult = pNull(yyStart);
1354: yyError = yyResult.select(yyError);
1355: if (yyResult.hasValue()) {
1356: final Node v$g$1 = yyResult.semanticValue();
1357:
1358: yyValue = GNode.create("NewItemExpression", v$g$1);
1359: yyValue.setLocation(location(yyStart));
1360:
1361: return yyResult.createValue(yyValue, yyError);
1362: }
1363:
1364: // Alternative <StringLiteral>.
1365:
1366: yyResult = pStringLiteral(yyStart);
1367: yyError = yyResult.select(yyError);
1368: if (yyResult.hasValue()) {
1369: final Node v$g$2 = yyResult.semanticValue();
1370:
1371: yyValue = GNode.create("NewItemExpression", v$g$2);
1372: yyValue.setLocation(location(yyStart));
1373:
1374: return yyResult.createValue(yyValue, yyError);
1375: }
1376:
1377: // Alternative <NewNode>.
1378:
1379: yyResult = pNewNodeExpression(yyStart);
1380: yyError = yyResult.select(yyError);
1381: if (yyResult.hasValue()) {
1382: final Node v$g$3 = yyResult.semanticValue();
1383:
1384: yyValue = GNode.create("NewItemExpression", v$g$3);
1385: yyValue.setLocation(location(yyStart));
1386:
1387: return yyResult.createValue(yyValue, yyError);
1388: }
1389:
1390: // Done.
1391: return yyError;
1392: }
1393:
1394: // =========================================================================
1395:
1396: /**
1397: * Parse nonterminal xtc.xform.XForm.NewNodeExpression.
1398: *
1399: * @param yyStart The index.
1400: * @return The result.
1401: * @throws IOException Signals an I/O error.
1402: */
1403: private Result pNewNodeExpression(final int yyStart)
1404: throws IOException {
1405: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
1406: if (null == yyColumn.chunk1)
1407: yyColumn.chunk1 = new Chunk1();
1408: if (null == yyColumn.chunk1.fNewNodeExpression)
1409: yyColumn.chunk1.fNewNodeExpression = pNewNodeExpression$1(yyStart);
1410: return yyColumn.chunk1.fNewNodeExpression;
1411: }
1412:
1413: /** Actually parse xtc.xform.XForm.NewNodeExpression. */
1414: private Result pNewNodeExpression$1(final int yyStart)
1415: throws IOException {
1416: Result yyResult;
1417: int yyBase;
1418: Node yyValue;
1419: ParseError yyError = ParseError.DUMMY;
1420:
1421: // Alternative 1.
1422:
1423: yyResult = pIdentifier(yyStart);
1424: yyError = yyResult.select(yyError);
1425: if (yyResult.hasValue()) {
1426: final Node v$g$1 = yyResult.semanticValue();
1427:
1428: yyBase = yyResult.index;
1429: yyResult = pSymbol(yyBase);
1430: yyError = yyResult.select(yyError);
1431: if (yyResult.hasValue("<")) {
1432:
1433: yyResult = pChildren(yyResult.index);
1434: yyError = yyResult.select(yyError);
1435: if (yyResult.hasValue()) {
1436: final Node v$g$2 = yyResult.semanticValue();
1437:
1438: yyBase = yyResult.index;
1439: yyResult = pSymbol(yyBase);
1440: yyError = yyResult.select(yyError);
1441: if (yyResult.hasValue(">")) {
1442:
1443: yyValue = GNode.create("NewNodeExpression",
1444: v$g$1, v$g$2);
1445: yyValue.setLocation(location(yyStart));
1446:
1447: return yyResult.createValue(yyValue, yyError);
1448: } else {
1449: yyError = yyError.select("\">\" expected",
1450: yyBase);
1451: }
1452: }
1453: } else {
1454: yyError = yyError.select("\"<\" expected", yyBase);
1455: }
1456: }
1457:
1458: // Done.
1459: return yyError;
1460: }
1461:
1462: // =========================================================================
1463:
1464: /**
1465: * Parse nonterminal xtc.xform.XForm.Children.
1466: *
1467: * @param yyStart The index.
1468: * @return The result.
1469: * @throws IOException Signals an I/O error.
1470: */
1471: private Result pChildren(final int yyStart) throws IOException {
1472: Result yyResult;
1473: int yyBase;
1474: int yyRepetition1;
1475: Pair<Node> yyRepValue1;
1476: Node yyValue;
1477: ParseError yyError = ParseError.DUMMY;
1478:
1479: // Alternative 1.
1480:
1481: yyResult = pChild(yyStart);
1482: yyError = yyResult.select(yyError);
1483: if (yyResult.hasValue()) {
1484: final Node v$g$1 = yyResult.semanticValue();
1485:
1486: yyRepetition1 = yyResult.index;
1487: yyRepValue1 = Pair.empty();
1488: while (true) {
1489:
1490: yyBase = yyRepetition1;
1491: yyResult = pSymbol(yyBase);
1492: yyError = yyResult.select(yyError);
1493: if (yyResult.hasValue(",")) {
1494:
1495: yyResult = pChild(yyResult.index);
1496: yyError = yyResult.select(yyError);
1497: if (yyResult.hasValue()) {
1498: final Node v$el$1 = yyResult.semanticValue();
1499:
1500: yyRepetition1 = yyResult.index;
1501: yyRepValue1 = new Pair<Node>(v$el$1,
1502: yyRepValue1);
1503: continue;
1504: }
1505: } else {
1506: yyError = yyError.select("\",\" expected", yyBase);
1507: }
1508: break;
1509: }
1510: { // Start scope for v$g$2.
1511: final Pair<Node> v$g$2 = yyRepValue1.reverse();
1512:
1513: yyValue = GNode
1514: .createFromPair("Children", v$g$1, v$g$2);
1515: yyValue.setLocation(location(yyStart));
1516:
1517: return new SemanticValue(yyValue, yyRepetition1,
1518: yyError);
1519: } // End scope for v$g$2.
1520: }
1521:
1522: // Done.
1523: return yyError;
1524: }
1525:
1526: // =========================================================================
1527:
1528: /**
1529: * Parse nonterminal xtc.xform.XForm.Child.
1530: *
1531: * @param yyStart The index.
1532: * @return The result.
1533: * @throws IOException Signals an I/O error.
1534: */
1535: private Result pChild(final int yyStart) throws IOException {
1536: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
1537: if (null == yyColumn.chunk1)
1538: yyColumn.chunk1 = new Chunk1();
1539: if (null == yyColumn.chunk1.fChild)
1540: yyColumn.chunk1.fChild = pChild$1(yyStart);
1541: return yyColumn.chunk1.fChild;
1542: }
1543:
1544: /** Actually parse xtc.xform.XForm.Child. */
1545: private Result pChild$1(final int yyStart) throws IOException {
1546: Result yyResult;
1547: Node yyValue;
1548: ParseError yyError = ParseError.DUMMY;
1549:
1550: // Alternative <Null>.
1551:
1552: yyResult = pNull(yyStart);
1553: yyError = yyResult.select(yyError);
1554: if (yyResult.hasValue()) {
1555: final Node v$g$1 = yyResult.semanticValue();
1556:
1557: yyValue = GNode.create("Child", v$g$1);
1558: yyValue.setLocation(location(yyStart));
1559:
1560: return yyResult.createValue(yyValue, yyError);
1561: }
1562:
1563: // Alternative <NewNode>.
1564:
1565: yyResult = pNewNodeExpression(yyStart);
1566: yyError = yyResult.select(yyError);
1567: if (yyResult.hasValue()) {
1568: final Node v$g$2 = yyResult.semanticValue();
1569:
1570: yyValue = GNode.create("Child", v$g$2);
1571: yyValue.setLocation(location(yyStart));
1572:
1573: return yyResult.createValue(yyValue, yyError);
1574: }
1575:
1576: // Alternative <Sequence>.
1577:
1578: yyResult = pSingleExpression(yyStart);
1579: yyError = yyResult.select(yyError);
1580: if (yyResult.hasValue()) {
1581: final Node v$g$3 = yyResult.semanticValue();
1582:
1583: yyValue = GNode.create("Child", v$g$3);
1584: yyValue.setLocation(location(yyStart));
1585:
1586: return yyResult.createValue(yyValue, yyError);
1587: }
1588:
1589: // Alternative <NoChild>.
1590:
1591: yyValue = GNode.create("Child", false);
1592: yyValue.setLocation(location(yyStart));
1593:
1594: return new SemanticValue(yyValue, yyStart, yyError);
1595: }
1596:
1597: // =========================================================================
1598:
1599: /**
1600: * Parse nonterminal xtc.xform.XForm.UnionExpression.
1601: *
1602: * @param yyStart The index.
1603: * @return The result.
1604: * @throws IOException Signals an I/O error.
1605: */
1606: private Result pUnionExpression(final int yyStart)
1607: throws IOException {
1608: Result yyResult;
1609: int yyRepetition1;
1610: Pair<Action<Node>> yyRepValue1;
1611: Node yyValue;
1612: ParseError yyError = ParseError.DUMMY;
1613:
1614: // Alternative 1.
1615:
1616: yyResult = pDifferExpression(yyStart);
1617: yyError = yyResult.select(yyError);
1618: if (yyResult.hasValue()) {
1619: final Node v$g$3 = yyResult.semanticValue();
1620:
1621: yyRepetition1 = yyResult.index;
1622: yyRepValue1 = Pair.empty();
1623: while (true) {
1624:
1625: yyResult = pUnionExpression$$Tail1(yyRepetition1);
1626: yyError = yyResult.select(yyError);
1627: if (yyResult.hasValue()) {
1628: final Action<Node> v$4 = yyResult.semanticValue();
1629:
1630: yyRepetition1 = yyResult.index;
1631: yyRepValue1 = new Pair<Action<Node>>(v$4,
1632: yyRepValue1);
1633: continue;
1634: }
1635: break;
1636: }
1637: { // Start scope for v$5.
1638: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
1639:
1640: yyValue = apply(v$5, v$g$3, yyStart);
1641:
1642: return new SemanticValue(yyValue, yyRepetition1,
1643: yyError);
1644: } // End scope for v$5.
1645: }
1646:
1647: // Alternative <Base>.
1648:
1649: yyResult = pIntersectionExpression(yyStart);
1650: yyError = yyResult.select(yyError);
1651: if (yyResult.hasValue()) {
1652: final Node v$6 = yyResult.semanticValue();
1653:
1654: yyRepetition1 = yyResult.index;
1655: yyRepValue1 = Pair.empty();
1656: while (true) {
1657:
1658: yyResult = pUnionExpression$$Tail1(yyRepetition1);
1659: yyError = yyResult.select(yyError);
1660: if (yyResult.hasValue()) {
1661: final Action<Node> v$7 = yyResult.semanticValue();
1662:
1663: yyRepetition1 = yyResult.index;
1664: yyRepValue1 = new Pair<Action<Node>>(v$7,
1665: yyRepValue1);
1666: continue;
1667: }
1668: break;
1669: }
1670: { // Start scope for v$8.
1671: final Pair<Action<Node>> v$8 = yyRepValue1.reverse();
1672:
1673: yyValue = apply(v$8, v$6, yyStart);
1674:
1675: return new SemanticValue(yyValue, yyRepetition1,
1676: yyError);
1677: } // End scope for v$8.
1678: }
1679:
1680: // Done.
1681: return yyError;
1682: }
1683:
1684: // =========================================================================
1685:
1686: /**
1687: * Parse synthetic nonterminal xtc.xform.XForm.UnionExpression$$Tail1.
1688: *
1689: * @param yyStart The index.
1690: * @return The result.
1691: * @throws IOException Signals an I/O error.
1692: */
1693: private Result pUnionExpression$$Tail1(final int yyStart)
1694: throws IOException {
1695:
1696: Result yyResult;
1697: Action<Node> yyValue;
1698: ParseError yyError = ParseError.DUMMY;
1699:
1700: // Alternative 1.
1701:
1702: yyResult = pKeyword(yyStart);
1703: yyError = yyResult.select(yyError);
1704: if (yyResult.hasValue("union")) {
1705:
1706: yyResult = pIntersectionExpression(yyResult.index);
1707: yyError = yyResult.select(yyError);
1708: if (yyResult.hasValue()) {
1709: final Node v$g$2 = yyResult.semanticValue();
1710:
1711: yyValue = new Action<Node>() {
1712: public Node run(Node v$1) {
1713: return GNode.create("UnionExpression", v$1,
1714: v$g$2);
1715: }
1716: };
1717:
1718: return yyResult.createValue(yyValue, yyError);
1719: }
1720: }
1721:
1722: // Done.
1723: yyError = yyError.select("union expression expected", yyStart);
1724: return yyError;
1725: }
1726:
1727: // =========================================================================
1728:
1729: /**
1730: * Parse nonterminal xtc.xform.XForm.DifferExpression.
1731: *
1732: * @param yyStart The index.
1733: * @return The result.
1734: * @throws IOException Signals an I/O error.
1735: */
1736: private Result pDifferExpression(final int yyStart)
1737: throws IOException {
1738: Result yyResult;
1739: int yyBase;
1740: Node yyValue;
1741: ParseError yyError = ParseError.DUMMY;
1742:
1743: // Alternative <Differ>.
1744:
1745: yyResult = pLogicalExpression(yyStart);
1746: yyError = yyResult.select(yyError);
1747: if (yyResult.hasValue()) {
1748: final Node v$g$1 = yyResult.semanticValue();
1749:
1750: yyBase = yyResult.index;
1751: yyResult = pKeyword(yyBase);
1752: yyError = yyResult.select(yyError);
1753: if (yyResult.hasValue("differ")) {
1754:
1755: yyResult = pLogicalExpression(yyResult.index);
1756: yyError = yyResult.select(yyError);
1757: if (yyResult.hasValue()) {
1758: final Node v$g$2 = yyResult.semanticValue();
1759:
1760: yyValue = GNode.create("DifferExpression", v$g$1,
1761: v$g$2);
1762: yyValue.setLocation(location(yyStart));
1763:
1764: return yyResult.createValue(yyValue, yyError);
1765: }
1766: } else {
1767: yyError = yyError.select("\"differ\" expected", yyBase);
1768: }
1769: }
1770:
1771: // Done.
1772: return yyError;
1773: }
1774:
1775: // =========================================================================
1776:
1777: /**
1778: * Parse nonterminal xtc.xform.XForm.IntersectionExpression.
1779: *
1780: * @param yyStart The index.
1781: * @return The result.
1782: * @throws IOException Signals an I/O error.
1783: */
1784: private Result pIntersectionExpression(final int yyStart)
1785: throws IOException {
1786:
1787: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
1788: if (null == yyColumn.chunk1)
1789: yyColumn.chunk1 = new Chunk1();
1790: if (null == yyColumn.chunk1.fIntersectionExpression)
1791: yyColumn.chunk1.fIntersectionExpression = pIntersectionExpression$1(yyStart);
1792: return yyColumn.chunk1.fIntersectionExpression;
1793: }
1794:
1795: /** Actually parse xtc.xform.XForm.IntersectionExpression. */
1796: private Result pIntersectionExpression$1(final int yyStart)
1797: throws IOException {
1798:
1799: Result yyResult;
1800: int yyRepetition1;
1801: Pair<Action<Node>> yyRepValue1;
1802: Node yyValue;
1803: ParseError yyError = ParseError.DUMMY;
1804:
1805: // Alternative <Base>.
1806:
1807: yyResult = pLogicalExpression(yyStart);
1808: yyError = yyResult.select(yyError);
1809: if (yyResult.hasValue()) {
1810: final Node v$g$3 = yyResult.semanticValue();
1811:
1812: yyRepetition1 = yyResult.index;
1813: yyRepValue1 = Pair.empty();
1814: while (true) {
1815:
1816: yyResult = pIntersectionExpression$$Tail1(yyRepetition1);
1817: yyError = yyResult.select(yyError);
1818: if (yyResult.hasValue()) {
1819: final Action<Node> v$4 = yyResult.semanticValue();
1820:
1821: yyRepetition1 = yyResult.index;
1822: yyRepValue1 = new Pair<Action<Node>>(v$4,
1823: yyRepValue1);
1824: continue;
1825: }
1826: break;
1827: }
1828: { // Start scope for v$5.
1829: final Pair<Action<Node>> v$5 = yyRepValue1.reverse();
1830:
1831: yyValue = apply(v$5, v$g$3, yyStart);
1832:
1833: return new SemanticValue(yyValue, yyRepetition1,
1834: yyError);
1835: } // End scope for v$5.
1836: }
1837:
1838: // Done.
1839: return yyError;
1840: }
1841:
1842: // =========================================================================
1843:
1844: /**
1845: * Parse synthetic nonterminal
1846: * xtc.xform.XForm.IntersectionExpression$$Tail1.
1847: *
1848: * @param yyStart The index.
1849: * @return The result.
1850: * @throws IOException Signals an I/O error.
1851: */
1852: private Result pIntersectionExpression$$Tail1(final int yyStart)
1853: throws IOException {
1854:
1855: Result yyResult;
1856: Action<Node> yyValue;
1857: ParseError yyError = ParseError.DUMMY;
1858:
1859: // Alternative <Intersect>.
1860:
1861: yyResult = pKeyword(yyStart);
1862: yyError = yyResult.select(yyError);
1863: if (yyResult.hasValue("intersect")) {
1864:
1865: yyResult = pLogicalExpression(yyResult.index);
1866: yyError = yyResult.select(yyError);
1867: if (yyResult.hasValue()) {
1868: final Node v$g$2 = yyResult.semanticValue();
1869:
1870: yyValue = new Action<Node>() {
1871: public Node run(Node v$1) {
1872: return GNode.create("IntersectionExpression",
1873: v$1, v$g$2);
1874: }
1875: };
1876:
1877: return yyResult.createValue(yyValue, yyError);
1878: }
1879: }
1880:
1881: // Done.
1882: yyError = yyError.select("intersection expression expected",
1883: yyStart);
1884: return yyError;
1885: }
1886:
1887: // =========================================================================
1888:
1889: /**
1890: * Parse nonterminal xtc.xform.XForm.LogicalExpression.
1891: *
1892: * @param yyStart The index.
1893: * @return The result.
1894: * @throws IOException Signals an I/O error.
1895: */
1896: private Result pLogicalExpression(final int yyStart)
1897: throws IOException {
1898: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
1899: if (null == yyColumn.chunk2)
1900: yyColumn.chunk2 = new Chunk2();
1901: if (null == yyColumn.chunk2.fLogicalExpression)
1902: yyColumn.chunk2.fLogicalExpression = pLogicalExpression$1(yyStart);
1903: return yyColumn.chunk2.fLogicalExpression;
1904: }
1905:
1906: /** Actually parse xtc.xform.XForm.LogicalExpression. */
1907: private Result pLogicalExpression$1(final int yyStart)
1908: throws IOException {
1909: Result yyResult;
1910: Node yyValue;
1911: ParseError yyError = ParseError.DUMMY;
1912:
1913: // Alternative <OrExpr>.
1914:
1915: yyResult = pOrExpression(yyStart);
1916: yyError = yyResult.select(yyError);
1917: if (yyResult.hasValue()) {
1918: yyValue = yyResult.semanticValue();
1919:
1920: return yyResult.createValue(yyValue, yyError);
1921: }
1922:
1923: // Alternative <AndExpr>.
1924:
1925: yyResult = pAndExpression(yyStart);
1926: yyError = yyResult.select(yyError);
1927: if (yyResult.hasValue()) {
1928: yyValue = yyResult.semanticValue();
1929:
1930: return yyResult.createValue(yyValue, yyError);
1931: }
1932:
1933: // Alternative <Base>.
1934:
1935: yyResult = pPathExpression(yyStart);
1936: yyError = yyResult.select(yyError);
1937: if (yyResult.hasValue()) {
1938: yyValue = yyResult.semanticValue();
1939:
1940: return yyResult.createValue(yyValue, yyError);
1941: }
1942:
1943: // Done.
1944: return yyError;
1945: }
1946:
1947: // =========================================================================
1948:
1949: /**
1950: * Parse nonterminal xtc.xform.XForm.OrExpression.
1951: *
1952: * @param yyStart The index.
1953: * @return The result.
1954: * @throws IOException Signals an I/O error.
1955: */
1956: private Result pOrExpression(final int yyStart) throws IOException {
1957: Result yyResult;
1958: int yyBase;
1959: int yyRepetition1;
1960: boolean yyRepeated1;
1961: Pair<Node> yyRepValue1;
1962: Node yyValue;
1963: ParseError yyError = ParseError.DUMMY;
1964:
1965: // Alternative 1.
1966:
1967: yyResult = pPathExpression(yyStart);
1968: yyError = yyResult.select(yyError);
1969: if (yyResult.hasValue()) {
1970: final Node v$g$1 = yyResult.semanticValue();
1971:
1972: yyRepetition1 = yyResult.index;
1973: yyRepeated1 = false;
1974: yyRepValue1 = Pair.empty();
1975: while (true) {
1976:
1977: yyBase = yyRepetition1;
1978: yyResult = pKeyword(yyBase);
1979: yyError = yyResult.select(yyError);
1980: if (yyResult.hasValue("or")) {
1981:
1982: yyResult = pPathExpression(yyResult.index);
1983: yyError = yyResult.select(yyError);
1984: if (yyResult.hasValue()) {
1985: final Node v$el$1 = yyResult.semanticValue();
1986:
1987: yyRepetition1 = yyResult.index;
1988: yyRepeated1 = true;
1989: yyRepValue1 = new Pair<Node>(v$el$1,
1990: yyRepValue1);
1991: continue;
1992: }
1993: } else {
1994: yyError = yyError.select("\"or\" expected", yyBase);
1995: }
1996: break;
1997: }
1998:
1999: if (yyRepeated1) {
2000: final Pair<Node> v$g$2 = yyRepValue1.reverse();
2001:
2002: yyValue = GNode.createFromPair("OrExpression", v$g$1,
2003: v$g$2);
2004: yyValue.setLocation(location(yyStart));
2005:
2006: return new SemanticValue(yyValue, yyRepetition1,
2007: yyError);
2008: }
2009: }
2010:
2011: // Done.
2012: return yyError;
2013: }
2014:
2015: // =========================================================================
2016:
2017: /**
2018: * Parse nonterminal xtc.xform.XForm.AndExpression.
2019: *
2020: * @param yyStart The index.
2021: * @return The result.
2022: * @throws IOException Signals an I/O error.
2023: */
2024: private Result pAndExpression(final int yyStart) throws IOException {
2025: Result yyResult;
2026: int yyBase;
2027: int yyRepetition1;
2028: boolean yyRepeated1;
2029: Pair<Node> yyRepValue1;
2030: Node yyValue;
2031: ParseError yyError = ParseError.DUMMY;
2032:
2033: // Alternative 1.
2034:
2035: yyResult = pPathExpression(yyStart);
2036: yyError = yyResult.select(yyError);
2037: if (yyResult.hasValue()) {
2038: final Node v$g$1 = yyResult.semanticValue();
2039:
2040: yyRepetition1 = yyResult.index;
2041: yyRepeated1 = false;
2042: yyRepValue1 = Pair.empty();
2043: while (true) {
2044:
2045: yyBase = yyRepetition1;
2046: yyResult = pKeyword(yyBase);
2047: yyError = yyResult.select(yyError);
2048: if (yyResult.hasValue("and")) {
2049:
2050: yyResult = pPathExpression(yyResult.index);
2051: yyError = yyResult.select(yyError);
2052: if (yyResult.hasValue()) {
2053: final Node v$el$1 = yyResult.semanticValue();
2054:
2055: yyRepetition1 = yyResult.index;
2056: yyRepeated1 = true;
2057: yyRepValue1 = new Pair<Node>(v$el$1,
2058: yyRepValue1);
2059: continue;
2060: }
2061: } else {
2062: yyError = yyError
2063: .select("\"and\" expected", yyBase);
2064: }
2065: break;
2066: }
2067:
2068: if (yyRepeated1) {
2069: final Pair<Node> v$g$2 = yyRepValue1.reverse();
2070:
2071: yyValue = GNode.createFromPair("AndExpression", v$g$1,
2072: v$g$2);
2073: yyValue.setLocation(location(yyStart));
2074:
2075: return new SemanticValue(yyValue, yyRepetition1,
2076: yyError);
2077: }
2078: }
2079:
2080: // Done.
2081: return yyError;
2082: }
2083:
2084: // =========================================================================
2085:
2086: /**
2087: * Parse nonterminal xtc.xform.XForm.PathExpression.
2088: *
2089: * @param yyStart The index.
2090: * @return The result.
2091: * @throws IOException Signals an I/O error.
2092: */
2093: private Result pPathExpression(final int yyStart)
2094: throws IOException {
2095: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
2096: if (null == yyColumn.chunk2)
2097: yyColumn.chunk2 = new Chunk2();
2098: if (null == yyColumn.chunk2.fPathExpression)
2099: yyColumn.chunk2.fPathExpression = pPathExpression$1(yyStart);
2100: return yyColumn.chunk2.fPathExpression;
2101: }
2102:
2103: /** Actually parse xtc.xform.XForm.PathExpression. */
2104: private Result pPathExpression$1(final int yyStart)
2105: throws IOException {
2106: Result yyResult;
2107: int yyBase;
2108: int yyOption1;
2109: Object yyOpValue1;
2110: Node yyValue;
2111: ParseError yyError = ParseError.DUMMY;
2112:
2113: // Alternative <AbsolutePath>.
2114:
2115: yyResult = pSymbol(yyStart);
2116: yyError = yyResult.select(yyError);
2117: if (yyResult.hasValue("/")) {
2118: final String v$g$1 = "/";
2119:
2120: yyOption1 = yyResult.index;
2121: yyOpValue1 = null;
2122:
2123: yyResult = pRelativePathExpression(yyOption1);
2124: yyError = yyResult.select(yyError);
2125: if (yyResult.hasValue()) {
2126: final Node v$el$1 = yyResult.semanticValue();
2127:
2128: yyOption1 = yyResult.index;
2129: yyOpValue1 = v$el$1;
2130: }
2131: { // Start scope for v$g$2.
2132: final Node v$g$2 = cast(yyOpValue1);
2133:
2134: yyValue = GNode.create("PathExpression", v$g$1, v$g$2);
2135: yyValue.setLocation(location(yyStart));
2136:
2137: return new SemanticValue(yyValue, yyOption1, yyError);
2138: } // End scope for v$g$2.
2139: }
2140:
2141: // Alternative <AllPaths>.
2142:
2143: yyOption1 = yyStart;
2144: yyOpValue1 = null;
2145:
2146: yyBase = yyOption1;
2147: yyResult = pKeyword(yyBase);
2148: yyError = yyResult.select(yyError);
2149: if (yyResult.hasValue("inside_out")) {
2150: final String v$el$2 = "inside_out";
2151:
2152: yyOption1 = yyResult.index;
2153: yyOpValue1 = v$el$2;
2154: } else {
2155: yyError = yyError.select("\"inside_out\" expected", yyBase);
2156: }
2157: { // Start scope for v$g$3.
2158: final String v$g$3 = cast(yyOpValue1);
2159:
2160: yyBase = yyOption1;
2161: yyResult = pSymbol(yyBase);
2162: yyError = yyResult.select(yyError);
2163: if (yyResult.hasValue("//")) {
2164: final String v$g$4 = "//";
2165:
2166: yyResult = pRelativePathExpression(yyResult.index);
2167: yyError = yyResult.select(yyError);
2168: if (yyResult.hasValue()) {
2169: final Node v$g$5 = yyResult.semanticValue();
2170:
2171: yyValue = GNode.create("PathExpression", v$g$3,
2172: v$g$4, v$g$5);
2173: yyValue.setLocation(location(yyStart));
2174:
2175: return yyResult.createValue(yyValue, yyError);
2176: }
2177: } else {
2178: yyError = yyError.select("\"//\" expected", yyBase);
2179: }
2180: } // End scope for v$g$3.
2181:
2182: // Alternative <Base>.
2183:
2184: yyResult = pRelativePathExpression(yyStart);
2185: yyError = yyResult.select(yyError);
2186: if (yyResult.hasValue()) {
2187: final Node v$g$6 = yyResult.semanticValue();
2188:
2189: yyValue = GNode.create("PathExpression", v$g$6);
2190: yyValue.setLocation(location(yyStart));
2191:
2192: return yyResult.createValue(yyValue, yyError);
2193: }
2194:
2195: // Done.
2196: yyError = yyError.select("path expression expected", yyStart);
2197: return yyError;
2198: }
2199:
2200: // =========================================================================
2201:
2202: /**
2203: * Parse nonterminal xtc.xform.XForm.RelativePathExpression.
2204: *
2205: * @param yyStart The index.
2206: * @return The result.
2207: * @throws IOException Signals an I/O error.
2208: */
2209: private Result pRelativePathExpression(final int yyStart)
2210: throws IOException {
2211:
2212: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
2213: if (null == yyColumn.chunk2)
2214: yyColumn.chunk2 = new Chunk2();
2215: if (null == yyColumn.chunk2.fRelativePathExpression)
2216: yyColumn.chunk2.fRelativePathExpression = pRelativePathExpression$1(yyStart);
2217: return yyColumn.chunk2.fRelativePathExpression;
2218: }
2219:
2220: /** Actually parse xtc.xform.XForm.RelativePathExpression. */
2221: private Result pRelativePathExpression$1(final int yyStart)
2222: throws IOException {
2223:
2224: Result yyResult;
2225: int yyRepetition1;
2226: Pair<Action<Node>> yyRepValue1;
2227: Node yyValue;
2228: ParseError yyError = ParseError.DUMMY;
2229:
2230: // Alternative 1.
2231:
2232: yyResult = pStepExpression(yyStart);
2233: yyError = yyResult.select(yyError);
2234: if (yyResult.hasValue()) {
2235: final Node v$g$4 = yyResult.semanticValue();
2236:
2237: yyRepetition1 = yyResult.index;
2238: yyRepValue1 = Pair.empty();
2239: while (true) {
2240:
2241: yyResult = pRelativePathExpression$$Tail1(yyRepetition1);
2242: yyError = yyResult.select(yyError);
2243: if (yyResult.hasValue()) {
2244: final Action<Node> v$5 = yyResult.semanticValue();
2245:
2246: yyRepetition1 = yyResult.index;
2247: yyRepValue1 = new Pair<Action<Node>>(v$5,
2248: yyRepValue1);
2249: continue;
2250: }
2251: break;
2252: }
2253: { // Start scope for v$6.
2254: final Pair<Action<Node>> v$6 = yyRepValue1.reverse();
2255:
2256: yyValue = apply(v$6, v$g$4, yyStart);
2257:
2258: return new SemanticValue(yyValue, yyRepetition1,
2259: yyError);
2260: } // End scope for v$6.
2261: }
2262:
2263: // Done.
2264: return yyError;
2265: }
2266:
2267: // =========================================================================
2268:
2269: /**
2270: * Parse synthetic nonterminal
2271: * xtc.xform.XForm.RelativePathExpression$$Tail1.
2272: *
2273: * @param yyStart The index.
2274: * @return The result.
2275: * @throws IOException Signals an I/O error.
2276: */
2277: private Result pRelativePathExpression$$Tail1(final int yyStart)
2278: throws IOException {
2279:
2280: Result yyResult;
2281: Action<Node> yyValue;
2282: ParseError yyError = ParseError.DUMMY;
2283:
2284: // Alternative 1.
2285:
2286: yyResult = pRelativePathExpression$$Choice1(yyStart);
2287: yyError = yyResult.select(yyError);
2288: if (yyResult.hasValue()) {
2289: final String v$g$2 = yyResult.semanticValue();
2290:
2291: yyResult = pStepExpression(yyResult.index);
2292: yyError = yyResult.select(yyError);
2293: if (yyResult.hasValue()) {
2294: final Node v$g$3 = yyResult.semanticValue();
2295:
2296: yyValue = new Action<Node>() {
2297: public Node run(Node v$1) {
2298: return GNode.create("RelativePathExpression",
2299: v$1, v$g$2, v$g$3);
2300: }
2301: };
2302:
2303: return yyResult.createValue(yyValue, yyError);
2304: }
2305: }
2306:
2307: // Done.
2308: return yyError;
2309: }
2310:
2311: // =========================================================================
2312:
2313: /**
2314: * Parse synthetic nonterminal
2315: * xtc.xform.XForm.RelativePathExpression$$Choice1.
2316: *
2317: * @param yyStart The index.
2318: * @return The result.
2319: * @throws IOException Signals an I/O error.
2320: */
2321: private Result pRelativePathExpression$$Choice1(final int yyStart)
2322: throws IOException {
2323:
2324: Result yyResult;
2325: String yyValue;
2326: ParseError yyError = ParseError.DUMMY;
2327:
2328: // Alternative 1.
2329:
2330: yyResult = pSymbol(yyStart);
2331: yyError = yyResult.select(yyError);
2332: if (yyResult.hasValue("/")) {
2333: yyValue = "/";
2334:
2335: return yyResult.createValue(yyValue, yyError);
2336: }
2337:
2338: // Alternative 2.
2339:
2340: yyResult = pSymbol(yyStart);
2341: yyError = yyResult.select(yyError);
2342: if (yyResult.hasValue("//")) {
2343: yyValue = "//";
2344:
2345: return yyResult.createValue(yyValue, yyError);
2346: }
2347:
2348: // Done.
2349: yyError = yyError.select("relative path expression expected",
2350: yyStart);
2351: return yyError;
2352: }
2353:
2354: // =========================================================================
2355:
2356: /**
2357: * Parse nonterminal xtc.xform.XForm.StepExpression.
2358: *
2359: * @param yyStart The index.
2360: * @return The result.
2361: * @throws IOException Signals an I/O error.
2362: */
2363: private Result pStepExpression(final int yyStart)
2364: throws IOException {
2365: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
2366: if (null == yyColumn.chunk2)
2367: yyColumn.chunk2 = new Chunk2();
2368: if (null == yyColumn.chunk2.fStepExpression)
2369: yyColumn.chunk2.fStepExpression = pStepExpression$1(yyStart);
2370: return yyColumn.chunk2.fStepExpression;
2371: }
2372:
2373: /** Actually parse xtc.xform.XForm.StepExpression. */
2374: private Result pStepExpression$1(final int yyStart)
2375: throws IOException {
2376: Result yyResult;
2377: Node yyValue;
2378: ParseError yyError = ParseError.DUMMY;
2379:
2380: // Alternative <Selection>.
2381:
2382: yyResult = pItemTest(yyStart);
2383: yyError = yyResult.select(yyError);
2384: if (yyResult.hasValue()) {
2385: final Node v$g$1 = yyResult.semanticValue();
2386:
2387: yyResult = pPredicateList(yyResult.index);
2388: yyError = yyResult.select(yyError);
2389: if (yyResult.hasValue()) {
2390: final Node v$g$2 = yyResult.semanticValue();
2391:
2392: yyValue = GNode.create("StepExpression", v$g$1, v$g$2);
2393: yyValue.setLocation(location(yyStart));
2394:
2395: return yyResult.createValue(yyValue, yyError);
2396: }
2397: }
2398:
2399: // Alternative <Reverse>.
2400:
2401: yyResult = pReverseStep(yyStart);
2402: yyError = yyResult.select(yyError);
2403: if (yyResult.hasValue()) {
2404: final Node v$g$3 = yyResult.semanticValue();
2405:
2406: yyValue = GNode.create("StepExpression", v$g$3);
2407: yyValue.setLocation(location(yyStart));
2408:
2409: return yyResult.createValue(yyValue, yyError);
2410: }
2411:
2412: // Done.
2413: return yyError;
2414: }
2415:
2416: // =========================================================================
2417:
2418: /**
2419: * Parse nonterminal xtc.xform.XForm.ItemTest.
2420: *
2421: * @param yyStart The index.
2422: * @return The result.
2423: * @throws IOException Signals an I/O error.
2424: */
2425: private Result pItemTest(final int yyStart) throws IOException {
2426: Result yyResult;
2427: Node yyValue;
2428: ParseError yyError = ParseError.DUMMY;
2429:
2430: // Alternative <PrimaryExpression>.
2431:
2432: yyResult = pPrimaryExpression(yyStart);
2433: yyError = yyResult.select(yyError);
2434: if (yyResult.hasValue()) {
2435: yyValue = yyResult.semanticValue();
2436:
2437: return yyResult.createValue(yyValue, yyError);
2438: }
2439:
2440: // Alternative <Identifier>.
2441:
2442: yyResult = pIdentifier(yyStart);
2443: yyError = yyResult.select(yyError);
2444: if (yyResult.hasValue()) {
2445: yyValue = yyResult.semanticValue();
2446:
2447: return yyResult.createValue(yyValue, yyError);
2448: }
2449:
2450: // Alternative <Wildcard>.
2451:
2452: yyResult = pWildcard(yyStart);
2453: yyError = yyResult.select(yyError);
2454: if (yyResult.hasValue()) {
2455: yyValue = yyResult.semanticValue();
2456:
2457: return yyResult.createValue(yyValue, yyError);
2458: }
2459:
2460: // Done.
2461: return yyError;
2462: }
2463:
2464: // =========================================================================
2465:
2466: /**
2467: * Parse nonterminal xtc.xform.XForm.PredicateList.
2468: *
2469: * @param yyStart The index.
2470: * @return The result.
2471: * @throws IOException Signals an I/O error.
2472: */
2473: private Result pPredicateList(final int yyStart) throws IOException {
2474: Result yyResult;
2475: int yyRepetition1;
2476: Pair<Node> yyRepValue1;
2477: Node yyValue;
2478: ParseError yyError = ParseError.DUMMY;
2479:
2480: // Alternative 1.
2481:
2482: yyRepetition1 = yyStart;
2483: yyRepValue1 = Pair.empty();
2484: while (true) {
2485:
2486: yyResult = pPredicate(yyRepetition1);
2487: yyError = yyResult.select(yyError);
2488: if (yyResult.hasValue()) {
2489: final Node v$el$1 = yyResult.semanticValue();
2490:
2491: yyRepetition1 = yyResult.index;
2492: yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1);
2493: continue;
2494: }
2495: break;
2496: }
2497: { // Start scope for v$g$1.
2498: final Pair<Node> v$g$1 = yyRepValue1.reverse();
2499:
2500: yyValue = GNode.createFromPair("PredicateList", v$g$1);
2501: yyValue.setLocation(location(yyStart));
2502:
2503: return new SemanticValue(yyValue, yyRepetition1, yyError);
2504: } // End scope for v$g$1.
2505: }
2506:
2507: // =========================================================================
2508:
2509: /**
2510: * Parse nonterminal xtc.xform.XForm.Predicate.
2511: *
2512: * @param yyStart The index.
2513: * @return The result.
2514: * @throws IOException Signals an I/O error.
2515: */
2516: private Result pPredicate(final int yyStart) throws IOException {
2517: Result yyResult;
2518: int yyBase;
2519: Node yyValue;
2520: ParseError yyError = ParseError.DUMMY;
2521:
2522: // Alternative 1.
2523:
2524: yyResult = pSymbol(yyStart);
2525: yyError = yyResult.select(yyError);
2526: if (yyResult.hasValue("[")) {
2527:
2528: yyResult = pPredicate$$Choice1(yyResult.index);
2529: yyError = yyResult.select(yyError);
2530: if (yyResult.hasValue()) {
2531: final Node v$g$1 = yyResult.semanticValue();
2532:
2533: yyBase = yyResult.index;
2534: yyResult = pSymbol(yyBase);
2535: yyError = yyResult.select(yyError);
2536: if (yyResult.hasValue("]")) {
2537:
2538: yyValue = GNode.create("Predicate", v$g$1);
2539: yyValue.setLocation(location(yyStart));
2540:
2541: return yyResult.createValue(yyValue, yyError);
2542: } else {
2543: yyError = yyError.select("\"]\" expected", yyBase);
2544: }
2545: }
2546: }
2547:
2548: // Done.
2549: yyError = yyError.select("predicate expected", yyStart);
2550: return yyError;
2551: }
2552:
2553: // =========================================================================
2554:
2555: /**
2556: * Parse synthetic nonterminal xtc.xform.XForm.Predicate$$Choice1.
2557: *
2558: * @param yyStart The index.
2559: * @return The result.
2560: * @throws IOException Signals an I/O error.
2561: */
2562: private Result pPredicate$$Choice1(final int yyStart)
2563: throws IOException {
2564: Result yyResult;
2565: Node yyValue;
2566: ParseError yyError = ParseError.DUMMY;
2567:
2568: // Alternative 1.
2569:
2570: yyResult = pIntegerLiteral(yyStart);
2571: yyError = yyResult.select(yyError);
2572: if (yyResult.hasValue()) {
2573: yyValue = yyResult.semanticValue();
2574:
2575: return yyResult.createValue(yyValue, yyError);
2576: }
2577:
2578: // Alternative 2.
2579:
2580: yyResult = pCompoundExpression(yyStart);
2581: yyError = yyResult.select(yyError);
2582: if (yyResult.hasValue()) {
2583: yyValue = yyResult.semanticValue();
2584:
2585: return yyResult.createValue(yyValue, yyError);
2586: }
2587:
2588: // Done.
2589: return yyError;
2590: }
2591:
2592: // =========================================================================
2593:
2594: /**
2595: * Parse nonterminal xtc.xform.XForm.PrimaryExpression.
2596: *
2597: * @param yyStart The index.
2598: * @return The result.
2599: * @throws IOException Signals an I/O error.
2600: */
2601: private Result pPrimaryExpression(final int yyStart)
2602: throws IOException {
2603: Result yyResult;
2604: Node yyValue;
2605: ParseError yyError = ParseError.DUMMY;
2606:
2607: // Alternative <ContextItem>.
2608:
2609: yyResult = pContextItem(yyStart);
2610: yyError = yyResult.select(yyError);
2611: if (yyResult.hasValue()) {
2612: yyValue = yyResult.semanticValue();
2613:
2614: return yyResult.createValue(yyValue, yyError);
2615: }
2616:
2617: // Alternative <StringLiteral>.
2618:
2619: yyResult = pStringLiteral(yyStart);
2620: yyError = yyResult.select(yyError);
2621: if (yyResult.hasValue()) {
2622: yyValue = yyResult.semanticValue();
2623:
2624: return yyResult.createValue(yyValue, yyError);
2625: }
2626:
2627: // Alternative <VarRef>.
2628:
2629: yyResult = pVariableReference(yyStart);
2630: yyError = yyResult.select(yyError);
2631: if (yyResult.hasValue()) {
2632: yyValue = yyResult.semanticValue();
2633:
2634: return yyResult.createValue(yyValue, yyError);
2635: }
2636:
2637: // Alternative <FunctionCall>.
2638:
2639: yyResult = pFunctionCall(yyStart);
2640: yyError = yyResult.select(yyError);
2641: if (yyResult.hasValue()) {
2642: yyValue = yyResult.semanticValue();
2643:
2644: return yyResult.createValue(yyValue, yyError);
2645: }
2646:
2647: // Alternative <ParenthesizedExpr>.
2648:
2649: yyResult = pParenthesizedExpression(yyStart);
2650: yyError = yyResult.select(yyError);
2651: if (yyResult.hasValue()) {
2652: yyValue = yyResult.semanticValue();
2653:
2654: return yyResult.createValue(yyValue, yyError);
2655: }
2656:
2657: // Done.
2658: return yyError;
2659: }
2660:
2661: // =========================================================================
2662:
2663: /**
2664: * Parse nonterminal xtc.xform.XForm.FunctionCall.
2665: *
2666: * @param yyStart The index.
2667: * @return The result.
2668: * @throws IOException Signals an I/O error.
2669: */
2670: private Result pFunctionCall(final int yyStart) throws IOException {
2671: Result yyResult;
2672: int yyBase;
2673: int yyOption1;
2674: Node yyOpValue1;
2675: Node yyValue;
2676: ParseError yyError = ParseError.DUMMY;
2677:
2678: // Alternative 1.
2679:
2680: yyResult = pIdentifier(yyStart);
2681: yyError = yyResult.select(yyError);
2682: if (yyResult.hasValue()) {
2683: final Node v$g$1 = yyResult.semanticValue();
2684:
2685: yyBase = yyResult.index;
2686: yyResult = pSymbol(yyBase);
2687: yyError = yyResult.select(yyError);
2688: if (yyResult.hasValue("(")) {
2689:
2690: yyOption1 = yyResult.index;
2691: yyOpValue1 = null;
2692:
2693: yyResult = pArgumentList(yyOption1);
2694: yyError = yyResult.select(yyError);
2695: if (yyResult.hasValue()) {
2696: final Node v$el$1 = yyResult.semanticValue();
2697:
2698: yyOption1 = yyResult.index;
2699: yyOpValue1 = v$el$1;
2700: }
2701: { // Start scope for v$g$2.
2702: final Node v$g$2 = yyOpValue1;
2703:
2704: yyBase = yyOption1;
2705: yyResult = pSymbol(yyBase);
2706: yyError = yyResult.select(yyError);
2707: if (yyResult.hasValue(")")) {
2708:
2709: yyValue = GNode.create("FunctionCall", v$g$1,
2710: v$g$2);
2711: yyValue.setLocation(location(yyStart));
2712:
2713: return yyResult.createValue(yyValue, yyError);
2714: } else {
2715: yyError = yyError.select("\")\" expected",
2716: yyBase);
2717: }
2718: } // End scope for v$g$2.
2719: } else {
2720: yyError = yyError.select("\"(\" expected", yyBase);
2721: }
2722: }
2723:
2724: // Done.
2725: return yyError;
2726: }
2727:
2728: // =========================================================================
2729:
2730: /**
2731: * Parse nonterminal xtc.xform.XForm.ArgumentList.
2732: *
2733: * @param yyStart The index.
2734: * @return The result.
2735: * @throws IOException Signals an I/O error.
2736: */
2737: private Result pArgumentList(final int yyStart) throws IOException {
2738: Result yyResult;
2739: int yyRepetition1;
2740: Pair<Node> yyRepValue1;
2741: Node yyValue;
2742: ParseError yyError = ParseError.DUMMY;
2743:
2744: // Alternative 1.
2745:
2746: yyResult = pArgumentList$$Choice1(yyStart);
2747: yyError = yyResult.select(yyError);
2748: if (yyResult.hasValue()) {
2749: final Node v$g$1 = yyResult.semanticValue();
2750:
2751: yyRepetition1 = yyResult.index;
2752: yyRepValue1 = Pair.empty();
2753: while (true) {
2754:
2755: yyResult = pArgumentList$$Choice2(yyRepetition1);
2756: yyError = yyResult.select(yyError);
2757: if (yyResult.hasValue()) {
2758: final Node v$el$4 = yyResult.semanticValue();
2759:
2760: yyRepetition1 = yyResult.index;
2761: yyRepValue1 = new Pair<Node>(v$el$4, yyRepValue1);
2762: continue;
2763: }
2764: break;
2765: }
2766: { // Start scope for v$g$2.
2767: final Pair<Node> v$g$2 = yyRepValue1.reverse();
2768:
2769: yyValue = GNode.createFromPair("ArgumentList", v$g$1,
2770: v$g$2);
2771: yyValue.setLocation(location(yyStart));
2772:
2773: return new SemanticValue(yyValue, yyRepetition1,
2774: yyError);
2775: } // End scope for v$g$2.
2776: }
2777:
2778: // Done.
2779: return yyError;
2780: }
2781:
2782: // =========================================================================
2783:
2784: /**
2785: * Parse synthetic nonterminal xtc.xform.XForm.ArgumentList$$Choice1.
2786: *
2787: * @param yyStart The index.
2788: * @return The result.
2789: * @throws IOException Signals an I/O error.
2790: */
2791: private Result pArgumentList$$Choice1(final int yyStart)
2792: throws IOException {
2793:
2794: Result yyResult;
2795: Node yyValue;
2796: ParseError yyError = ParseError.DUMMY;
2797:
2798: // Alternative 1.
2799:
2800: yyResult = pSingleExpression(yyStart);
2801: yyError = yyResult.select(yyError);
2802: if (yyResult.hasValue()) {
2803: yyValue = yyResult.semanticValue();
2804:
2805: return yyResult.createValue(yyValue, yyError);
2806: }
2807:
2808: // Alternative 2.
2809:
2810: yyResult = pIntegerLiteral(yyStart);
2811: yyError = yyResult.select(yyError);
2812: if (yyResult.hasValue()) {
2813: yyValue = yyResult.semanticValue();
2814:
2815: return yyResult.createValue(yyValue, yyError);
2816: }
2817:
2818: // Alternative 3.
2819:
2820: yyResult = pStringLiteral(yyStart);
2821: yyError = yyResult.select(yyError);
2822: if (yyResult.hasValue()) {
2823: yyValue = yyResult.semanticValue();
2824:
2825: return yyResult.createValue(yyValue, yyError);
2826: }
2827:
2828: // Done.
2829: return yyError;
2830: }
2831:
2832: // =========================================================================
2833:
2834: /**
2835: * Parse synthetic nonterminal xtc.xform.XForm.ArgumentList$$Choice2.
2836: *
2837: * @param yyStart The index.
2838: * @return The result.
2839: * @throws IOException Signals an I/O error.
2840: */
2841: private Result pArgumentList$$Choice2(final int yyStart)
2842: throws IOException {
2843:
2844: Result yyResult;
2845: Node yyValue;
2846: ParseError yyError = ParseError.DUMMY;
2847:
2848: // Alternative 1.
2849:
2850: yyResult = pSymbol(yyStart);
2851: yyError = yyResult.select(yyError);
2852: if (yyResult.hasValue(",")) {
2853:
2854: final int yyChoice1 = yyResult.index;
2855:
2856: // Nested alternative 1.
2857:
2858: yyResult = pSingleExpression(yyChoice1);
2859: yyError = yyResult.select(yyError);
2860: if (yyResult.hasValue()) {
2861: yyValue = yyResult.semanticValue();
2862:
2863: return yyResult.createValue(yyValue, yyError);
2864: }
2865:
2866: // Nested alternative 2.
2867:
2868: yyResult = pIntegerLiteral(yyChoice1);
2869: yyError = yyResult.select(yyError);
2870: if (yyResult.hasValue()) {
2871: yyValue = yyResult.semanticValue();
2872:
2873: return yyResult.createValue(yyValue, yyError);
2874: }
2875:
2876: // Nested alternative 3.
2877:
2878: yyResult = pStringLiteral(yyChoice1);
2879: yyError = yyResult.select(yyError);
2880: if (yyResult.hasValue()) {
2881: yyValue = yyResult.semanticValue();
2882:
2883: return yyResult.createValue(yyValue, yyError);
2884: }
2885: }
2886:
2887: // Done.
2888: yyError = yyError.select("argument list expected", yyStart);
2889: return yyError;
2890: }
2891:
2892: // =========================================================================
2893:
2894: /**
2895: * Parse nonterminal xtc.xform.XForm.ParenthesizedExpression.
2896: *
2897: * @param yyStart The index.
2898: * @return The result.
2899: * @throws IOException Signals an I/O error.
2900: */
2901: private Result pParenthesizedExpression(final int yyStart)
2902: throws IOException {
2903:
2904: Result yyResult;
2905: int yyBase;
2906: int yyOption1;
2907: Node yyOpValue1;
2908: Node yyValue;
2909: ParseError yyError = ParseError.DUMMY;
2910:
2911: // Alternative 1.
2912:
2913: yyResult = pSymbol(yyStart);
2914: yyError = yyResult.select(yyError);
2915: if (yyResult.hasValue("(")) {
2916:
2917: yyOption1 = yyResult.index;
2918: yyOpValue1 = null;
2919:
2920: yyResult = pCompoundExpression(yyOption1);
2921: yyError = yyResult.select(yyError);
2922: if (yyResult.hasValue()) {
2923: final Node v$el$1 = yyResult.semanticValue();
2924:
2925: yyOption1 = yyResult.index;
2926: yyOpValue1 = v$el$1;
2927: }
2928: { // Start scope for v$g$1.
2929: final Node v$g$1 = yyOpValue1;
2930:
2931: yyBase = yyOption1;
2932: yyResult = pSymbol(yyBase);
2933: yyError = yyResult.select(yyError);
2934: if (yyResult.hasValue(")")) {
2935:
2936: yyValue = GNode.create("ParenthesizedExpression",
2937: v$g$1);
2938: yyValue.setLocation(location(yyStart));
2939:
2940: return yyResult.createValue(yyValue, yyError);
2941: } else {
2942: yyError = yyError.select("\")\" expected", yyBase);
2943: }
2944: } // End scope for v$g$1.
2945: }
2946:
2947: // Done.
2948: yyError = yyError.select("parenthesized expression expected",
2949: yyStart);
2950: return yyError;
2951: }
2952:
2953: // =========================================================================
2954:
2955: /**
2956: * Parse nonterminal xtc.xform.XForm.VariableReference.
2957: *
2958: * @param yyStart The index.
2959: * @return The result.
2960: * @throws IOException Signals an I/O error.
2961: */
2962: private Result pVariableReference(final int yyStart)
2963: throws IOException {
2964: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
2965: if (null == yyColumn.chunk2)
2966: yyColumn.chunk2 = new Chunk2();
2967: if (null == yyColumn.chunk2.fVariableReference)
2968: yyColumn.chunk2.fVariableReference = pVariableReference$1(yyStart);
2969: return yyColumn.chunk2.fVariableReference;
2970: }
2971:
2972: /** Actually parse xtc.xform.XForm.VariableReference. */
2973: private Result pVariableReference$1(final int yyStart)
2974: throws IOException {
2975: Result yyResult;
2976: Node yyValue;
2977: ParseError yyError = ParseError.DUMMY;
2978:
2979: // Alternative 1.
2980:
2981: yyResult = pSymbol(yyStart);
2982: yyError = yyResult.select(yyError);
2983: if (yyResult.hasValue("$")) {
2984:
2985: yyResult = pWord(yyResult.index);
2986: yyError = yyResult.select(yyError);
2987: if (yyResult.hasValue()) {
2988: final String w = yyResult.semanticValue();
2989:
2990: if (!contains(XFORM_KEYWORDS, w)) {
2991:
2992: yyResult = pSpacing(yyResult.index);
2993: yyError = yyResult.select(yyError);
2994: if (yyResult.hasValue()) {
2995:
2996: yyValue = GNode.create("VariableReference", w);
2997: yyValue.setLocation(location(yyStart));
2998:
2999: return yyResult.createValue(yyValue, yyError);
3000: }
3001: }
3002: }
3003: }
3004:
3005: // Done.
3006: yyError = yyError
3007: .select("variable reference expected", yyStart);
3008: return yyError;
3009: }
3010:
3011: // =========================================================================
3012:
3013: /**
3014: * Parse nonterminal xtc.xform.XForm.Identifier.
3015: *
3016: * @param yyStart The index.
3017: * @return The result.
3018: * @throws IOException Signals an I/O error.
3019: */
3020: private Result pIdentifier(final int yyStart) throws IOException {
3021: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
3022: if (null == yyColumn.chunk2)
3023: yyColumn.chunk2 = new Chunk2();
3024: if (null == yyColumn.chunk2.fIdentifier)
3025: yyColumn.chunk2.fIdentifier = pIdentifier$1(yyStart);
3026: return yyColumn.chunk2.fIdentifier;
3027: }
3028:
3029: /** Actually parse xtc.xform.XForm.Identifier. */
3030: private Result pIdentifier$1(final int yyStart) throws IOException {
3031: Result yyResult;
3032: Node yyValue;
3033: ParseError yyError = ParseError.DUMMY;
3034:
3035: // Alternative 1.
3036:
3037: yyResult = pWord(yyStart);
3038: yyError = yyResult.select(yyError);
3039: if (yyResult.hasValue()) {
3040: final String v$g$1 = yyResult.semanticValue();
3041:
3042: yyResult = pSpacing(yyResult.index);
3043: yyError = yyResult.select(yyError);
3044: if (yyResult.hasValue()) {
3045:
3046: yyValue = GNode.create("Identifier", v$g$1);
3047: yyValue.setLocation(location(yyStart));
3048:
3049: return yyResult.createValue(yyValue, yyError);
3050: }
3051: }
3052:
3053: // Done.
3054: return yyError;
3055: }
3056:
3057: // =========================================================================
3058:
3059: /**
3060: * Parse nonterminal xtc.xform.XForm.Word.
3061: *
3062: * @param yyStart The index.
3063: * @return The result.
3064: * @throws IOException Signals an I/O error.
3065: */
3066: private Result pWord(final int yyStart) throws IOException {
3067: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
3068: if (null == yyColumn.chunk2)
3069: yyColumn.chunk2 = new Chunk2();
3070: if (null == yyColumn.chunk2.fWord)
3071: yyColumn.chunk2.fWord = pWord$1(yyStart);
3072: return yyColumn.chunk2.fWord;
3073: }
3074:
3075: /** Actually parse xtc.xform.XForm.Word. */
3076: private Result pWord$1(final int yyStart) throws IOException {
3077: int yyC;
3078: int yyIndex;
3079: Result yyResult;
3080: String yyValue;
3081: ParseError yyError = ParseError.DUMMY;
3082:
3083: // Alternative 1.
3084:
3085: yyC = character(yyStart);
3086: if (-1 != yyC) {
3087: yyIndex = yyStart + 1;
3088: if ((('A' <= yyC) && (yyC <= 'Z')) || ('_' == yyC)
3089: || (('a' <= yyC) && (yyC <= 'z'))) {
3090:
3091: yyResult = pWord$$Star1(yyIndex);
3092: yyError = yyResult.select(yyError);
3093: if (yyResult.hasValue()) {
3094:
3095: yyValue = difference(yyStart, yyResult.index);
3096:
3097: return yyResult.createValue(yyValue, yyError);
3098: }
3099: }
3100: }
3101:
3102: // Done.
3103: yyError = yyError.select("word expected", yyStart);
3104: return yyError;
3105: }
3106:
3107: // =========================================================================
3108:
3109: /**
3110: * Parse synthetic nonterminal xtc.xform.XForm.Word$$Star1.
3111: *
3112: * @param yyStart The index.
3113: * @return The result.
3114: * @throws IOException Signals an I/O error.
3115: */
3116: private Result pWord$$Star1(final int yyStart) throws IOException {
3117: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
3118: if (null == yyColumn.chunk2)
3119: yyColumn.chunk2 = new Chunk2();
3120: if (null == yyColumn.chunk2.fWord$$Star1)
3121: yyColumn.chunk2.fWord$$Star1 = pWord$$Star1$1(yyStart);
3122: return yyColumn.chunk2.fWord$$Star1;
3123: }
3124:
3125: /** Actually parse xtc.xform.XForm.Word$$Star1. */
3126: private Result pWord$$Star1$1(final int yyStart) throws IOException {
3127: int yyC;
3128: int yyIndex;
3129: Result yyResult;
3130: Void yyValue;
3131: ParseError yyError = ParseError.DUMMY;
3132:
3133: // Alternative 1.
3134:
3135: yyC = character(yyStart);
3136: if (-1 != yyC) {
3137: yyIndex = yyStart + 1;
3138: if ((('0' <= yyC) && (yyC <= '9'))
3139: || (('A' <= yyC) && (yyC <= 'Z')) || ('_' == yyC)
3140: || (('a' <= yyC) && (yyC <= 'z'))) {
3141:
3142: yyResult = pWord$$Star1(yyIndex);
3143: yyError = yyResult.select(yyError);
3144: if (yyResult.hasValue()) {
3145:
3146: yyValue = null;
3147:
3148: return yyResult.createValue(yyValue, yyError);
3149: }
3150: }
3151: }
3152:
3153: // Alternative 2.
3154:
3155: yyValue = null;
3156:
3157: return new SemanticValue(yyValue, yyStart, yyError);
3158: }
3159:
3160: // =========================================================================
3161:
3162: /**
3163: * Parse nonterminal xtc.xform.XForm.Keyword.
3164: *
3165: * @param yyStart The index.
3166: * @return The result.
3167: * @throws IOException Signals an I/O error.
3168: */
3169: private Result pKeyword(final int yyStart) throws IOException {
3170: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
3171: if (null == yyColumn.chunk2)
3172: yyColumn.chunk2 = new Chunk2();
3173: if (null == yyColumn.chunk2.fKeyword)
3174: yyColumn.chunk2.fKeyword = pKeyword$1(yyStart);
3175: return yyColumn.chunk2.fKeyword;
3176: }
3177:
3178: /** Actually parse xtc.xform.XForm.Keyword. */
3179: private Result pKeyword$1(final int yyStart) throws IOException {
3180: Result yyResult;
3181: String yyValue;
3182: ParseError yyError = ParseError.DUMMY;
3183:
3184: // Alternative 1.
3185:
3186: yyResult = pWord(yyStart);
3187: yyError = yyResult.select(yyError);
3188: if (yyResult.hasValue()) {
3189: yyValue = yyResult.semanticValue();
3190:
3191: if (contains(XFORM_KEYWORDS, yyValue)) {
3192:
3193: yyResult = pSpacing(yyResult.index);
3194: yyError = yyResult.select(yyError);
3195: if (yyResult.hasValue()) {
3196:
3197: return yyResult.createValue(yyValue, yyError);
3198: }
3199: }
3200: }
3201:
3202: // Done.
3203: yyError = yyError.select("keyword expected", yyStart);
3204: return yyError;
3205: }
3206:
3207: // =========================================================================
3208:
3209: /**
3210: * Parse nonterminal xtc.xform.XForm.StringLiteral.
3211: *
3212: * @param yyStart The index.
3213: * @return The result.
3214: * @throws IOException Signals an I/O error.
3215: */
3216: private Result pStringLiteral(final int yyStart) throws IOException {
3217: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
3218: if (null == yyColumn.chunk2)
3219: yyColumn.chunk2 = new Chunk2();
3220: if (null == yyColumn.chunk2.fStringLiteral)
3221: yyColumn.chunk2.fStringLiteral = pStringLiteral$1(yyStart);
3222: return yyColumn.chunk2.fStringLiteral;
3223: }
3224:
3225: /** Actually parse xtc.xform.XForm.StringLiteral. */
3226: private Result pStringLiteral$1(final int yyStart)
3227: throws IOException {
3228: Result yyResult;
3229: Node yyValue;
3230: ParseError yyError = ParseError.DUMMY;
3231:
3232: // Alternative 1.
3233:
3234: yyResult = pQuotedString(yyStart);
3235: yyError = yyResult.select(yyError);
3236: if (yyResult.hasValue()) {
3237: final String v$g$1 = yyResult.semanticValue();
3238:
3239: yyResult = pSpacing(yyResult.index);
3240: yyError = yyResult.select(yyError);
3241: if (yyResult.hasValue()) {
3242:
3243: yyValue = GNode.create("StringLiteral", v$g$1);
3244: yyValue.setLocation(location(yyStart));
3245:
3246: return yyResult.createValue(yyValue, yyError);
3247: }
3248: }
3249:
3250: // Done.
3251: return yyError;
3252: }
3253:
3254: // =========================================================================
3255:
3256: /**
3257: * Parse nonterminal xtc.xform.XForm.IntegerLiteral.
3258: *
3259: * @param yyStart The index.
3260: * @return The result.
3261: * @throws IOException Signals an I/O error.
3262: */
3263: private Result pIntegerLiteral(final int yyStart)
3264: throws IOException {
3265: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
3266: if (null == yyColumn.chunk3)
3267: yyColumn.chunk3 = new Chunk3();
3268: if (null == yyColumn.chunk3.fIntegerLiteral)
3269: yyColumn.chunk3.fIntegerLiteral = pIntegerLiteral$1(yyStart);
3270: return yyColumn.chunk3.fIntegerLiteral;
3271: }
3272:
3273: /** Actually parse xtc.xform.XForm.IntegerLiteral. */
3274: private Result pIntegerLiteral$1(final int yyStart)
3275: throws IOException {
3276: Result yyResult;
3277: Node yyValue;
3278: ParseError yyError = ParseError.DUMMY;
3279:
3280: // Alternative 1.
3281:
3282: yyResult = pDecimalLiteral(yyStart);
3283: yyError = yyResult.select(yyError);
3284: if (yyResult.hasValue()) {
3285: final String v$g$1 = yyResult.semanticValue();
3286:
3287: yyResult = pSpacing(yyResult.index);
3288: yyError = yyResult.select(yyError);
3289: if (yyResult.hasValue()) {
3290:
3291: yyValue = GNode.create("IntegerLiteral", v$g$1);
3292: yyValue.setLocation(location(yyStart));
3293:
3294: return yyResult.createValue(yyValue, yyError);
3295: }
3296: }
3297:
3298: // Done.
3299: return yyError;
3300: }
3301:
3302: // =========================================================================
3303:
3304: /**
3305: * Parse nonterminal xtc.xform.XForm.QuotedString.
3306: *
3307: * @param yyStart The index.
3308: * @return The result.
3309: * @throws IOException Signals an I/O error.
3310: */
3311: private Result pQuotedString(final int yyStart) throws IOException {
3312: int yyC;
3313: int yyIndex;
3314: int yyRepetition1;
3315: String yyValue;
3316: ParseError yyError = ParseError.DUMMY;
3317:
3318: // Alternative 1.
3319:
3320: yyC = character(yyStart);
3321: if ('\"' == yyC) {
3322: yyIndex = yyStart + 1;
3323:
3324: yyRepetition1 = yyIndex;
3325: while (true) {
3326:
3327: yyC = character(yyRepetition1);
3328: if (-1 != yyC) {
3329: yyIndex = yyRepetition1 + 1;
3330:
3331: switch (yyC) {
3332: case '\n':
3333: case '\r':
3334: case '\"':
3335: case '\\':
3336: /* No match. */
3337: break;
3338:
3339: default: {
3340: yyRepetition1 = yyIndex;
3341: continue;
3342: }
3343: }
3344: }
3345: break;
3346: }
3347:
3348: yyC = character(yyRepetition1);
3349: if ('\"' == yyC) {
3350: yyIndex = yyRepetition1 + 1;
3351:
3352: yyValue = difference(yyStart, yyIndex);
3353:
3354: return new SemanticValue(yyValue, yyIndex, yyError);
3355: }
3356: }
3357:
3358: // Done.
3359: yyError = yyError.select("quoted string expected", yyStart);
3360: return yyError;
3361: }
3362:
3363: // =========================================================================
3364:
3365: /**
3366: * Parse nonterminal xtc.xform.XForm.DecimalLiteral.
3367: *
3368: * @param yyStart The index.
3369: * @return The result.
3370: * @throws IOException Signals an I/O error.
3371: */
3372: private Result pDecimalLiteral(final int yyStart)
3373: throws IOException {
3374: int yyC;
3375: int yyIndex;
3376: int yyRepetition1;
3377: String yyValue;
3378: ParseError yyError = ParseError.DUMMY;
3379:
3380: // Alternative 1.
3381:
3382: yyC = character(yyStart);
3383: if (-1 != yyC) {
3384: yyIndex = yyStart + 1;
3385:
3386: switch (yyC) {
3387: case '0':
3388: case '1':
3389: case '2':
3390: case '3':
3391: case '4':
3392: case '5':
3393: case '6':
3394: case '7':
3395: case '8':
3396: case '9': {
3397: yyRepetition1 = yyIndex;
3398: while (true) {
3399:
3400: yyC = character(yyRepetition1);
3401: if (-1 != yyC) {
3402: yyIndex = yyRepetition1 + 1;
3403:
3404: switch (yyC) {
3405: case '0':
3406: case '1':
3407: case '2':
3408: case '3':
3409: case '4':
3410: case '5':
3411: case '6':
3412: case '7':
3413: case '8':
3414: case '9': {
3415: yyRepetition1 = yyIndex;
3416: continue;
3417: }
3418:
3419: default:
3420: /* No match. */
3421: }
3422: }
3423: break;
3424: }
3425:
3426: yyValue = difference(yyStart, yyRepetition1);
3427:
3428: return new SemanticValue(yyValue, yyRepetition1,
3429: yyError);
3430: }
3431:
3432: default:
3433: /* No match. */
3434: }
3435: }
3436:
3437: // Done.
3438: yyError = yyError.select("decimal literal expected", yyStart);
3439: return yyError;
3440: }
3441:
3442: // =========================================================================
3443:
3444: /**
3445: * Parse nonterminal xtc.xform.XForm.ContextItem.
3446: *
3447: * @param yyStart The index.
3448: * @return The result.
3449: * @throws IOException Signals an I/O error.
3450: */
3451: private Result pContextItem(final int yyStart) throws IOException {
3452: Result yyResult;
3453: Node yyValue;
3454: ParseError yyError = ParseError.DUMMY;
3455:
3456: // Alternative 1.
3457:
3458: yyResult = pSymbol(yyStart);
3459: yyError = yyResult.select(yyError);
3460: if (yyResult.hasValue(".")) {
3461:
3462: yyValue = GNode.create("ContextItem", false);
3463: yyValue.setLocation(location(yyStart));
3464:
3465: return yyResult.createValue(yyValue, yyError);
3466: }
3467:
3468: // Done.
3469: yyError = yyError.select("context item expected", yyStart);
3470: return yyError;
3471: }
3472:
3473: // =========================================================================
3474:
3475: /**
3476: * Parse nonterminal xtc.xform.XForm.ReverseStep.
3477: *
3478: * @param yyStart The index.
3479: * @return The result.
3480: * @throws IOException Signals an I/O error.
3481: */
3482: private Result pReverseStep(final int yyStart) throws IOException {
3483: Result yyResult;
3484: Node yyValue;
3485: ParseError yyError = ParseError.DUMMY;
3486:
3487: // Alternative 1.
3488:
3489: yyResult = pSymbol(yyStart);
3490: yyError = yyResult.select(yyError);
3491: if (yyResult.hasValue("..")) {
3492:
3493: yyValue = GNode.create("ReverseStep", false);
3494: yyValue.setLocation(location(yyStart));
3495:
3496: return yyResult.createValue(yyValue, yyError);
3497: }
3498:
3499: // Done.
3500: yyError = yyError.select("reverse step expected", yyStart);
3501: return yyError;
3502: }
3503:
3504: // =========================================================================
3505:
3506: /**
3507: * Parse nonterminal xtc.xform.XForm.Null.
3508: *
3509: * @param yyStart The index.
3510: * @return The result.
3511: * @throws IOException Signals an I/O error.
3512: */
3513: private Result pNull(final int yyStart) throws IOException {
3514: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
3515: if (null == yyColumn.chunk3)
3516: yyColumn.chunk3 = new Chunk3();
3517: if (null == yyColumn.chunk3.fNull)
3518: yyColumn.chunk3.fNull = pNull$1(yyStart);
3519: return yyColumn.chunk3.fNull;
3520: }
3521:
3522: /** Actually parse xtc.xform.XForm.Null. */
3523: private Result pNull$1(final int yyStart) throws IOException {
3524: Result yyResult;
3525: Node yyValue;
3526: ParseError yyError = ParseError.DUMMY;
3527:
3528: // Alternative 1.
3529:
3530: yyResult = pKeyword(yyStart);
3531: yyError = yyResult.select(yyError);
3532: if (yyResult.hasValue("null")) {
3533:
3534: yyValue = GNode.create("Null", false);
3535: yyValue.setLocation(location(yyStart));
3536:
3537: return yyResult.createValue(yyValue, yyError);
3538: }
3539:
3540: // Done.
3541: yyError = yyError.select("null expected", yyStart);
3542: return yyError;
3543: }
3544:
3545: // =========================================================================
3546:
3547: /**
3548: * Parse nonterminal xtc.xform.XForm.Wildcard.
3549: *
3550: * @param yyStart The index.
3551: * @return The result.
3552: * @throws IOException Signals an I/O error.
3553: */
3554: private Result pWildcard(final int yyStart) throws IOException {
3555: Result yyResult;
3556: Node yyValue;
3557: ParseError yyError = ParseError.DUMMY;
3558:
3559: // Alternative 1.
3560:
3561: yyResult = pSymbol(yyStart);
3562: yyError = yyResult.select(yyError);
3563: if (yyResult.hasValue("*")) {
3564:
3565: yyValue = GNode.create("Wildcard", false);
3566: yyValue.setLocation(location(yyStart));
3567:
3568: return yyResult.createValue(yyValue, yyError);
3569: }
3570:
3571: // Done.
3572: yyError = yyError.select("wildcard expected", yyStart);
3573: return yyError;
3574: }
3575:
3576: // =========================================================================
3577:
3578: /**
3579: * Parse nonterminal xtc.xform.XForm.Symbol.
3580: *
3581: * @param yyStart The index.
3582: * @return The result.
3583: * @throws IOException Signals an I/O error.
3584: */
3585: private Result pSymbol(final int yyStart) throws IOException {
3586: XFormParserColumn yyColumn = (XFormParserColumn) column(yyStart);
3587: if (null == yyColumn.chunk3)
3588: yyColumn.chunk3 = new Chunk3();
3589: if (null == yyColumn.chunk3.fSymbol)
3590: yyColumn.chunk3.fSymbol = pSymbol$1(yyStart);
3591: return yyColumn.chunk3.fSymbol;
3592: }
3593:
3594: /** Actually parse xtc.xform.XForm.Symbol. */
3595: private Result pSymbol$1(final int yyStart) throws IOException {
3596: Result yyResult;
3597: String yyValue;
3598: ParseError yyError = ParseError.DUMMY;
3599:
3600: // Alternative 1.
3601:
3602: yyResult = pSymbolCharacters(yyStart);
3603: yyError = yyResult.select(yyError);
3604: if (yyResult.hasValue()) {
3605: yyValue = yyResult.semanticValue();
3606:
3607: yyResult = pSpacing(yyResult.index);
3608: yyError = yyResult.select(yyError);
3609: if (yyResult.hasValue()) {
3610:
3611: return yyResult.createValue(yyValue, yyError);
3612: }
3613: }
3614:
3615: // Done.
3616: return yyError;
3617: }
3618:
3619: // =========================================================================
3620:
3621: /**
3622: * Parse nonterminal xtc.xform.XForm.SymbolCharacters.
3623: *
3624: * @param yyStart The index.
3625: * @return The result.
3626: * @throws IOException Signals an I/O error.
3627: */
3628: private Result pSymbolCharacters(final int yyStart)
3629: throws IOException {
3630: int yyC;
3631: int yyIndex;
3632: String yyValue;
3633: ParseError yyError = ParseError.DUMMY;
3634:
3635: // Alternative 1.
3636:
3637: yyC = character(yyStart);
3638: if (-1 != yyC) {
3639: yyIndex = yyStart + 1;
3640:
3641: switch (yyC) {
3642: case '/': {
3643: final int yyChoice1 = yyIndex;
3644:
3645: // Nested alternative 1.
3646:
3647: yyC = character(yyChoice1);
3648: if (-1 != yyC) {
3649: yyIndex = yyChoice1 + 1;
3650: if ('/' == yyC) {
3651:
3652: yyValue = "//";
3653:
3654: return new SemanticValue(yyValue, yyIndex,
3655: yyError);
3656: }
3657: }
3658:
3659: // Nested alternative 2.
3660:
3661: yyValue = "/";
3662:
3663: return new SemanticValue(yyValue, yyChoice1, yyError);
3664: }
3665:
3666: case '.': {
3667: final int yyChoice1 = yyIndex;
3668:
3669: // Nested alternative 1.
3670:
3671: yyC = character(yyChoice1);
3672: if (-1 != yyC) {
3673: yyIndex = yyChoice1 + 1;
3674: if ('.' == yyC) {
3675:
3676: yyValue = "..";
3677:
3678: return new SemanticValue(yyValue, yyIndex,
3679: yyError);
3680: }
3681: }
3682:
3683: // Nested alternative 2.
3684:
3685: yyValue = ".";
3686:
3687: return new SemanticValue(yyValue, yyChoice1, yyError);
3688: }
3689:
3690: case '(': {
3691: yyValue = "(";
3692:
3693: return new SemanticValue(yyValue, yyIndex, yyError);
3694: }
3695:
3696: case ')': {
3697: yyValue = ")";
3698:
3699: return new SemanticValue(yyValue, yyIndex, yyError);
3700: }
3701:
3702: case '[': {
3703: yyValue = "[";
3704:
3705: return new SemanticValue(yyValue, yyIndex, yyError);
3706: }
3707:
3708: case ']': {
3709: yyValue = "]";
3710:
3711: return new SemanticValue(yyValue, yyIndex, yyError);
3712: }
3713:
3714: case '#': {
3715: yyValue = "#";
3716:
3717: return new SemanticValue(yyValue, yyIndex, yyError);
3718: }
3719:
3720: case '<': {
3721: yyValue = "<";
3722:
3723: return new SemanticValue(yyValue, yyIndex, yyError);
3724: }
3725:
3726: case '>': {
3727: yyValue = ">";
3728:
3729: return new SemanticValue(yyValue, yyIndex, yyError);
3730: }
3731:
3732: case '!': {
3733: yyValue = "!";
3734:
3735: return new SemanticValue(yyValue, yyIndex, yyError);
3736: }
3737:
3738: case '$': {
3739: yyValue = "$";
3740:
3741: return new SemanticValue(yyValue, yyIndex, yyError);
3742: }
3743:
3744: case ',': {
3745: yyValue = ",";
3746:
3747: return new SemanticValue(yyValue, yyIndex, yyError);
3748: }
3749:
3750: case '*': {
3751: yyValue = "*";
3752:
3753: return new SemanticValue(yyValue, yyIndex, yyError);
3754: }
3755:
3756: case '+': {
3757: yyValue = "+";
3758:
3759: return new SemanticValue(yyValue, yyIndex, yyError);
3760: }
3761:
3762: case '=': {
3763: yyValue = "=";
3764:
3765: return new SemanticValue(yyValue, yyIndex, yyError);
3766: }
3767:
3768: default:
3769: /* No match. */
3770: }
3771: }
3772:
3773: // Done.
3774: yyError = yyError.select("symbol characters expected", yyStart);
3775: return yyError;
3776: }
3777:
3778: // =========================================================================
3779:
3780: /**
3781: * Parse nonterminal xtc.xform.XForm.Spacing.
3782: *
3783: * @param yyStart The index.
3784: * @return The result.
3785: * @throws IOException Signals an I/O error.
3786: */
3787: private Result pSpacing(final int yyStart) throws IOException {
3788: int yyC;
3789: int yyIndex;
3790: Result yyPredResult;
3791: int yyRepetition1;
3792: int yyRepetition2;
3793: Void yyValue;
3794: ParseError yyError = ParseError.DUMMY;
3795:
3796: // Alternative 1.
3797:
3798: yyRepetition1 = yyStart;
3799: while (true) {
3800:
3801: final int yyChoice1 = yyRepetition1;
3802:
3803: // Nested alternative 1.
3804:
3805: yyC = character(yyChoice1);
3806: if (-1 != yyC) {
3807: yyIndex = yyChoice1 + 1;
3808:
3809: switch (yyC) {
3810: case ' ': {
3811: yyRepetition1 = yyIndex;
3812: continue;
3813: }
3814:
3815: case '\t': {
3816: yyRepetition1 = yyIndex;
3817: continue;
3818: }
3819:
3820: case '\f': {
3821: yyRepetition1 = yyIndex;
3822: continue;
3823: }
3824:
3825: case '#': {
3826: yyRepetition2 = yyIndex;
3827: while (true) {
3828:
3829: yyC = character(yyRepetition2);
3830: if (-1 != yyC) {
3831: yyIndex = yyRepetition2 + 1;
3832:
3833: switch (yyC) {
3834: case '\n':
3835: case '\r':
3836: /* No match. */
3837: break;
3838:
3839: default: {
3840: yyRepetition2 = yyIndex;
3841: continue;
3842: }
3843: }
3844: }
3845: break;
3846: }
3847:
3848: yyPredResult = pComment$$Choice1(yyRepetition2);
3849: yyError = yyPredResult.select(yyError);
3850: if (yyPredResult.hasValue()) {
3851:
3852: yyRepetition1 = yyRepetition2;
3853: continue;
3854: }
3855: }
3856: break;
3857:
3858: case '\r': {
3859: final int yyChoice2 = yyIndex;
3860:
3861: // Nested alternative 1.
3862:
3863: yyC = character(yyChoice2);
3864: if ('\n' == yyC) {
3865: yyIndex = yyChoice2 + 1;
3866:
3867: yyRepetition1 = yyIndex;
3868: continue;
3869: }
3870:
3871: // Nested alternative 2.
3872:
3873: yyRepetition1 = yyChoice2;
3874: continue;
3875: }
3876:
3877: case '\n': {
3878: yyRepetition1 = yyIndex;
3879: continue;
3880: }
3881:
3882: default:
3883: /* No match. */
3884: }
3885: }
3886: break;
3887: }
3888:
3889: yyValue = null;
3890:
3891: return new SemanticValue(yyValue, yyRepetition1, yyError);
3892: }
3893:
3894: // =========================================================================
3895:
3896: /**
3897: * Parse synthetic nonterminal xtc.xform.XForm.Comment$$Choice1.
3898: *
3899: * @param yyStart The index.
3900: * @return The result.
3901: * @throws IOException Signals an I/O error.
3902: */
3903: private Result pComment$$Choice1(final int yyStart)
3904: throws IOException {
3905: int yyC;
3906: int yyIndex;
3907: boolean yyPredMatched;
3908: Void yyValue;
3909: ParseError yyError = ParseError.DUMMY;
3910:
3911: // Alternative 1.
3912:
3913: yyC = character(yyStart);
3914: if (-1 != yyC) {
3915: yyIndex = yyStart + 1;
3916:
3917: switch (yyC) {
3918: case '\r': {
3919: final int yyChoice1 = yyIndex;
3920:
3921: // Nested alternative 1.
3922:
3923: yyC = character(yyChoice1);
3924: if ('\n' == yyC) {
3925: yyIndex = yyChoice1 + 1;
3926:
3927: yyValue = null;
3928:
3929: return new SemanticValue(yyValue, yyIndex, yyError);
3930: }
3931:
3932: // Nested alternative 2.
3933:
3934: yyValue = null;
3935:
3936: return new SemanticValue(yyValue, yyChoice1, yyError);
3937: }
3938:
3939: case '\n': {
3940: yyValue = null;
3941:
3942: return new SemanticValue(yyValue, yyIndex, yyError);
3943: }
3944:
3945: default:
3946: /* No match. */
3947: }
3948: }
3949:
3950: // Alternative 2.
3951:
3952: yyPredMatched = false;
3953:
3954: yyC = character(yyStart);
3955: if (-1 != yyC) {
3956:
3957: yyPredMatched = true;
3958: }
3959:
3960: if (!yyPredMatched) {
3961:
3962: yyValue = null;
3963:
3964: return new SemanticValue(yyValue, yyStart, yyError);
3965: } else {
3966: yyError = yyError.select("comment expected", yyStart);
3967: }
3968:
3969: // Done.
3970: yyError = yyError.select("comment expected", yyStart);
3971: return yyError;
3972: }
3973:
3974: // =========================================================================
3975:
3976: /**
3977: * Parse nonterminal xtc.xform.XForm.EndOfFile.
3978: *
3979: * @param yyStart The index.
3980: * @return The result.
3981: * @throws IOException Signals an I/O error.
3982: */
3983: private Result pEndOfFile(final int yyStart) throws IOException {
3984: int yyC;
3985: boolean yyPredMatched;
3986: Void yyValue;
3987: ParseError yyError = ParseError.DUMMY;
3988:
3989: // Alternative 1.
3990:
3991: yyPredMatched = false;
3992:
3993: yyC = character(yyStart);
3994: if (-1 != yyC) {
3995:
3996: yyPredMatched = true;
3997: }
3998:
3999: if (!yyPredMatched) {
4000:
4001: yyValue = null;
4002:
4003: return new SemanticValue(yyValue, yyStart, yyError);
4004: } else {
4005: yyError = yyError.select("end of file expected", yyStart);
4006: }
4007:
4008: // Done.
4009: return yyError;
4010: }
4011:
4012: // =========================================================================
4013:
4014: static {
4015: add(XFORM_KEYWORDS, new String[] { "add", "after", "and", "be",
4016: "before", "cfor", "differ", "else", "for", "if",
4017: "import", "in", "insert", "inside_out", "intersect",
4018: "let", "null", "or", "remove", "replace", "return",
4019: "then", "to", "union", "with" });
4020: }
4021:
4022: // =========================================================================
4023:
4024: /**
4025: * Get the specified text.
4026: *
4027: * @param s The text.
4028: * @return The text.
4029: */
4030: protected static final String toText(String s) {
4031: return s;
4032: }
4033:
4034: // =========================================================================
4035:
4036: /**
4037: * Add the specified values to the specified set.
4038: *
4039: * @param set The set.
4040: * @param values The new values.
4041: */
4042: protected static final <T> void add(Set<T> set, T[] values) {
4043: for (T v : values)
4044: set.add(v);
4045: }
4046:
4047: /**
4048: * Check whether the specified set contains the specified value.
4049: *
4050: * @param set The set.
4051: * @param value The value.
4052: * @return <code>true</code> if the set contains the value.
4053: */
4054: protected static final <T> boolean contains(Set<T> set, T value) {
4055: return set.contains(value);
4056: }
4057:
4058: }
|