0001: // ===========================================================================
0002: // This file has been generated by
0003: // Rats! Parser Generator, version 1.13.2,
0004: // (C) 2004-2007 Robert Grimm,
0005: // on Tuesday, November 27, 2007 at 1:37:23 PM.
0006: // Edit at your own risk.
0007: // ===========================================================================
0008:
0009: package xtc.lang.jeannie;
0010:
0011: import java.io.Reader;
0012: import java.io.IOException;
0013:
0014: import xtc.util.Pair;
0015:
0016: import xtc.tree.Node;
0017: import xtc.tree.GNode;
0018:
0019: import xtc.parser.ParserBase;
0020: import xtc.parser.Column;
0021: import xtc.parser.Result;
0022: import xtc.parser.SemanticValue;
0023: import xtc.parser.ParseError;
0024:
0025: import xtc.lang.CParserState;
0026:
0027: /**
0028: * Packrat parser for grammar <code>xtc.lang.jeannie.PreJeannie</code>.
0029: *
0030: * <p />This class has been generated by the <i>Rats!</i> parser
0031: * generator, version 1.13.2, (C) 2004-2007 Robert Grimm.
0032: */
0033: public final class PreJeannieParser extends ParserBase {
0034:
0035: /** The RELOCATE flag. */
0036: public static final boolean RELOCATE = true;
0037:
0038: // =========================================================================
0039:
0040: /** Memoization table column. */
0041: static final class PreJeannieParserColumn extends Column {
0042: Result fSymbol;
0043: }
0044:
0045: // =========================================================================
0046:
0047: /** The global state object. */
0048: protected final CParserState yyState;
0049:
0050: // =========================================================================
0051:
0052: /**
0053: * Create a new packrat parser.
0054: *
0055: * @param reader The reader.
0056: * @param file The file name.
0057: */
0058: public PreJeannieParser(final Reader reader, final String file) {
0059: super (reader, file);
0060: yyState = new CParserState();
0061: }
0062:
0063: /**
0064: * Create a new packrat parser.
0065: *
0066: * @param reader The file reader.
0067: * @param file The file name.
0068: * @param size The file size.
0069: */
0070: public PreJeannieParser(final Reader reader, final String file,
0071: final int size) {
0072: super (reader, file, size);
0073: yyState = new CParserState();
0074: }
0075:
0076: // =========================================================================
0077:
0078: protected Column newColumn() {
0079: return new PreJeannieParserColumn();
0080: }
0081:
0082: // =========================================================================
0083:
0084: /**
0085: * Parse nonterminal xtc.lang.jeannie.PreJeannie.File.
0086: *
0087: * @param yyStart The index.
0088: * @return The result.
0089: * @throws IOException Signals an I/O error.
0090: */
0091: public Result pFile(final int yyStart) throws IOException {
0092: Result yyResult;
0093: Node yyValue;
0094: ParseError yyError = ParseError.DUMMY;
0095:
0096: // Alternative 1.
0097:
0098: yyResult = pCPrelude(yyStart);
0099: yyError = yyResult.select(yyError);
0100: if (yyResult.hasValue()) {
0101: final String p = yyResult.semanticValue();
0102:
0103: yyResult = pHead(yyResult.index);
0104: yyError = yyResult.select(yyError);
0105: if (yyResult.hasValue()) {
0106: final String h = yyResult.semanticValue();
0107:
0108: yyResult = pTail(yyResult.index);
0109: yyError = yyResult.select(yyError);
0110: if (yyResult.hasValue()) {
0111: final String t = yyResult.semanticValue();
0112:
0113: yyValue = GNode.create("File", p + h + t);
0114:
0115: setLocation(yyValue, yyStart);
0116: return yyResult.createValue(yyValue, yyError);
0117: }
0118: }
0119: }
0120:
0121: // Done.
0122: return yyError;
0123: }
0124:
0125: // =========================================================================
0126:
0127: /**
0128: * Parse nonterminal xtc.lang.jeannie.PreJeannie.CPrelude.
0129: *
0130: * @param yyStart The index.
0131: * @return The result.
0132: * @throws IOException Signals an I/O error.
0133: */
0134: private Result pCPrelude(final int yyStart) throws IOException {
0135: Result yyResult;
0136: String yyValue;
0137: ParseError yyError = ParseError.DUMMY;
0138:
0139: // Alternative 1.
0140:
0141: yyResult = pDirective(yyStart);
0142: yyError = yyResult.select(yyError);
0143: if (yyResult.hasValue()) {
0144:
0145: yyResult = pSpacing(yyResult.index);
0146: yyError = yyResult.select(yyError);
0147: if (yyResult.hasValue()) {
0148:
0149: yyValue = origString(yyStart, yyResult.index);
0150:
0151: return yyResult.createValue(yyValue, yyError);
0152: }
0153: }
0154:
0155: // Done.
0156: return yyError;
0157: }
0158:
0159: // =========================================================================
0160:
0161: /**
0162: * Parse nonterminal xtc.lang.jeannie.PreJeannie.Head.
0163: *
0164: * @param yyStart The index.
0165: * @return The result.
0166: * @throws IOException Signals an I/O error.
0167: */
0168: private Result pHead(final int yyStart) throws IOException {
0169: Result yyResult;
0170: String yyValue;
0171: ParseError yyError = ParseError.DUMMY;
0172:
0173: // Alternative 1.
0174:
0175: yyResult = pHead$$Choice1(yyStart);
0176: yyError = yyResult.select(yyError);
0177: if (yyResult.hasValue()) {
0178: yyValue = yyResult.semanticValue();
0179:
0180: return yyResult.createValue(yyValue, yyError);
0181: }
0182:
0183: // Done.
0184: return yyError;
0185: }
0186:
0187: // =========================================================================
0188:
0189: /**
0190: * Parse synthetic nonterminal xtc.lang.jeannie.PreJeannie.Head$$Choice1.
0191: *
0192: * @param yyStart The index.
0193: * @return The result.
0194: * @throws IOException Signals an I/O error.
0195: */
0196: private Result pHead$$Choice1(final int yyStart) throws IOException {
0197: Result yyResult;
0198: String yyValue;
0199: ParseError yyError = ParseError.DUMMY;
0200:
0201: // Alternative 1.
0202:
0203: yyResult = pJavaHead(yyStart);
0204: yyError = yyResult.select(yyError);
0205: if (yyResult.hasValue()) {
0206: yyValue = yyResult.semanticValue();
0207:
0208: return yyResult.createValue(yyValue, yyError);
0209: }
0210:
0211: // Alternative 2.
0212:
0213: yyResult = pCHead(yyStart);
0214: yyError = yyResult.select(yyError);
0215: if (yyResult.hasValue()) {
0216: yyValue = yyResult.semanticValue();
0217:
0218: return yyResult.createValue(yyValue, yyError);
0219: }
0220:
0221: // Done.
0222: return yyError;
0223: }
0224:
0225: // =========================================================================
0226:
0227: /**
0228: * Parse nonterminal xtc.lang.jeannie.PreJeannie.JavaHead.
0229: *
0230: * @param yyStart The index.
0231: * @return The result.
0232: * @throws IOException Signals an I/O error.
0233: */
0234: private Result pJavaHead(final int yyStart) throws IOException {
0235: int yyC;
0236: int yyIndex;
0237: Result yyResult;
0238: int yyBase;
0239: String yyValue;
0240: ParseError yyError = ParseError.DUMMY;
0241:
0242: // Alternative 1.
0243:
0244: yyResult = pSymbol(yyStart);
0245: yyError = yyResult.select(yyError);
0246: if (yyResult.hasValue("`")) {
0247:
0248: yyBase = yyResult.index;
0249: yyResult = pSymbol(yyBase);
0250: yyError = yyResult.select(yyError);
0251: if (yyResult.hasValue(".")) {
0252:
0253: yyBase = yyResult.index;
0254: yyC = character(yyBase);
0255: if ('C' == yyC) {
0256: yyIndex = yyResult.index + 1;
0257:
0258: yyResult = pSpacing(yyIndex);
0259: yyError = yyResult.select(yyError);
0260: if (yyResult.hasValue()) {
0261:
0262: yyBase = yyResult.index;
0263: yyResult = pSymbol(yyBase);
0264: yyError = yyResult.select(yyError);
0265: if (yyResult.hasValue("{")) {
0266:
0267: yyValue = origString(yyStart,
0268: yyResult.index);
0269:
0270: return yyResult.createValue(yyValue,
0271: yyError);
0272: } else {
0273: yyError = yyError.select("\"{\" expected",
0274: yyBase);
0275: }
0276: }
0277: } else {
0278: yyError = yyError.select("\"C\" expected", yyBase);
0279: }
0280: } else {
0281: yyError = yyError.select("\".\" expected", yyBase);
0282: }
0283: }
0284:
0285: // Done.
0286: yyError = yyError.select("java head expected", yyStart);
0287: return yyError;
0288: }
0289:
0290: // =========================================================================
0291:
0292: /**
0293: * Parse nonterminal xtc.lang.jeannie.PreJeannie.CHead.
0294: *
0295: * @param yyStart The index.
0296: * @return The result.
0297: * @throws IOException Signals an I/O error.
0298: */
0299: private Result pCHead(final int yyStart) throws IOException {
0300: int yyC;
0301: int yyIndex;
0302: Result yyResult;
0303: int yyBase;
0304: int yyRepetition1;
0305: boolean yyRepeated1;
0306: String yyValue;
0307: ParseError yyError = ParseError.DUMMY;
0308:
0309: // Alternative 1.
0310:
0311: yyResult = pSymbol(yyStart);
0312: yyError = yyResult.select(yyError);
0313: if (yyResult.hasValue("`")) {
0314:
0315: yyBase = yyResult.index;
0316: yyResult = pSymbol(yyBase);
0317: yyError = yyResult.select(yyError);
0318: if (yyResult.hasValue(".")) {
0319:
0320: yyBase = yyResult.index;
0321: yyC = character(yyBase);
0322: if ('J' == yyC) {
0323: yyIndex = yyResult.index + 1;
0324:
0325: yyC = character(yyIndex);
0326: if ('a' == yyC) {
0327: yyIndex = yyIndex + 1;
0328:
0329: yyC = character(yyIndex);
0330: if ('v' == yyC) {
0331: yyIndex = yyIndex + 1;
0332:
0333: yyC = character(yyIndex);
0334: if ('a' == yyC) {
0335: yyIndex = yyIndex + 1;
0336:
0337: yyResult = pSpacing(yyIndex);
0338: yyError = yyResult.select(yyError);
0339: if (yyResult.hasValue()) {
0340:
0341: yyBase = yyResult.index;
0342: yyResult = pSymbol(yyBase);
0343: yyError = yyResult.select(yyError);
0344: if (yyResult.hasValue("{")) {
0345:
0346: yyRepetition1 = yyResult.index;
0347: yyRepeated1 = false;
0348: while (true) {
0349:
0350: yyC = character(yyRepetition1);
0351: if (-1 != yyC) {
0352: yyIndex = yyRepetition1 + 1;
0353:
0354: switch (yyC) {
0355: case '^':
0356: case '}': {
0357: yyRepetition1 = yyIndex;
0358: yyRepeated1 = true;
0359: continue;
0360: }
0361:
0362: default:
0363: /* No match. */
0364: }
0365: }
0366: break;
0367: }
0368:
0369: if (yyRepeated1) {
0370:
0371: yyBase = yyRepetition1;
0372: yyResult = pSymbol(yyBase);
0373: yyError = yyResult
0374: .select(yyError);
0375: if (yyResult.hasValue("}")) {
0376:
0377: yyValue = origString(
0378: yyStart,
0379: yyResult.index);
0380:
0381: return yyResult
0382: .createValue(
0383: yyValue,
0384: yyError);
0385: } else {
0386: yyError = yyError
0387: .select(
0388: "\"}\" expected",
0389: yyBase);
0390: }
0391: }
0392: } else {
0393: yyError = yyError.select(
0394: "\"{\" expected",
0395: yyBase);
0396: }
0397: }
0398: } else {
0399: yyError = yyError.select(
0400: "\"Java\" expected", yyBase);
0401: }
0402: } else {
0403: yyError = yyError.select(
0404: "\"Java\" expected", yyBase);
0405: }
0406: } else {
0407: yyError = yyError.select("\"Java\" expected",
0408: yyBase);
0409: }
0410: } else {
0411: yyError = yyError.select("\"Java\" expected",
0412: yyBase);
0413: }
0414: } else {
0415: yyError = yyError.select("\".\" expected", yyBase);
0416: }
0417: }
0418:
0419: // Done.
0420: yyError = yyError.select("c head expected", yyStart);
0421: return yyError;
0422: }
0423:
0424: // =========================================================================
0425:
0426: /**
0427: * Parse nonterminal xtc.lang.jeannie.PreJeannie.Tail.
0428: *
0429: * @param yyStart The index.
0430: * @return The result.
0431: * @throws IOException Signals an I/O error.
0432: */
0433: private Result pTail(final int yyStart) throws IOException {
0434: int yyC;
0435: int yyIndex;
0436: Result yyResult;
0437: int yyRepetition1;
0438: boolean yyRepeated1;
0439: String yyValue;
0440: ParseError yyError = ParseError.DUMMY;
0441:
0442: // Alternative 1.
0443:
0444: yyRepetition1 = yyStart;
0445: yyRepeated1 = false;
0446: while (true) {
0447:
0448: yyC = character(yyRepetition1);
0449: if (-1 != yyC) {
0450: yyIndex = yyRepetition1 + 1;
0451:
0452: yyRepetition1 = yyIndex;
0453: yyRepeated1 = true;
0454: continue;
0455: }
0456: break;
0457: }
0458:
0459: if (yyRepeated1) {
0460:
0461: yyResult = pEndOfFile(yyRepetition1);
0462: yyError = yyResult.select(yyError);
0463: if (yyResult.hasValue()) {
0464:
0465: yyValue = _tool.jeannieDefs()
0466: + origString(yyStart, yyResult.index);
0467:
0468: return yyResult.createValue(yyValue, yyError);
0469: }
0470: }
0471:
0472: // Done.
0473: yyError = yyError.select("tail expected", yyStart);
0474: return yyError;
0475: }
0476:
0477: // =========================================================================
0478:
0479: /**
0480: * Parse nonterminal xtc.lang.CSpacing.Spacing.
0481: *
0482: * @param yyStart The index.
0483: * @return The result.
0484: * @throws IOException Signals an I/O error.
0485: */
0486: private Result pSpacing(final int yyStart) throws IOException {
0487: int yyC;
0488: int yyIndex;
0489: Result yyResult;
0490: Result yyPredResult;
0491: boolean yyPredMatched;
0492: int yyBase;
0493: int yyRepetition1;
0494: int yyRepetition2;
0495: Void yyValue;
0496: ParseError yyError = ParseError.DUMMY;
0497:
0498: // Alternative 1.
0499:
0500: yyRepetition1 = yyStart;
0501: while (true) {
0502:
0503: final int yyChoice1 = yyRepetition1;
0504:
0505: // Nested alternative 1.
0506:
0507: yyC = character(yyChoice1);
0508: if (-1 != yyC) {
0509: yyIndex = yyChoice1 + 1;
0510:
0511: switch (yyC) {
0512: case ' ': {
0513: yyRepetition1 = yyIndex;
0514: continue;
0515: }
0516:
0517: case '\t': {
0518: yyRepetition1 = yyIndex;
0519: continue;
0520: }
0521:
0522: case '\f': {
0523: yyRepetition1 = yyIndex;
0524: continue;
0525: }
0526:
0527: case '/': {
0528: yyC = character(yyIndex);
0529: if (-1 != yyC) {
0530: yyIndex = yyIndex + 1;
0531:
0532: switch (yyC) {
0533: case '*': {
0534: yyRepetition2 = yyIndex;
0535: while (true) {
0536:
0537: final int yyChoice2 = yyRepetition2;
0538:
0539: // Nested alternative 1.
0540:
0541: yyC = character(yyChoice2);
0542: if (-1 != yyC) {
0543: yyIndex = yyChoice2 + 1;
0544:
0545: switch (yyC) {
0546: case '*': {
0547: yyPredMatched = false;
0548:
0549: yyC = character(yyIndex);
0550: if ('/' == yyC) {
0551:
0552: yyPredMatched = true;
0553: }
0554:
0555: if (!yyPredMatched) {
0556:
0557: yyRepetition2 = yyIndex;
0558: continue;
0559: } else {
0560: yyError = yyError.select(
0561: "spacing expected",
0562: yyStart);
0563: }
0564: }
0565: break;
0566:
0567: default: {
0568: yyRepetition2 = yyIndex;
0569: continue;
0570: }
0571: }
0572: }
0573: break;
0574: }
0575:
0576: yyBase = yyRepetition2;
0577: yyC = character(yyBase);
0578: if ('*' == yyC) {
0579: yyIndex = yyRepetition2 + 1;
0580:
0581: yyC = character(yyIndex);
0582: if ('/' == yyC) {
0583: yyIndex = yyIndex + 1;
0584:
0585: yyRepetition1 = yyIndex;
0586: continue;
0587: } else {
0588: yyError = yyError.select(
0589: "\"*/\" expected", yyBase);
0590: }
0591: } else {
0592: yyError = yyError.select(
0593: "\"*/\" expected", yyBase);
0594: }
0595: }
0596: break;
0597:
0598: case '/': {
0599: yyRepetition2 = yyIndex;
0600: while (true) {
0601:
0602: yyC = character(yyRepetition2);
0603: if (-1 != yyC) {
0604: yyIndex = yyRepetition2 + 1;
0605:
0606: switch (yyC) {
0607: case '\n':
0608: case '\r':
0609: /* No match. */
0610: break;
0611:
0612: default: {
0613: yyRepetition2 = yyIndex;
0614: continue;
0615: }
0616: }
0617: }
0618: break;
0619: }
0620:
0621: yyPredResult = pLineTerminator(yyRepetition2);
0622: yyError = yyPredResult.select(yyError);
0623: if (yyPredResult.hasValue()) {
0624:
0625: yyRepetition1 = yyRepetition2;
0626: continue;
0627: }
0628: }
0629: break;
0630:
0631: default:
0632: /* No match. */
0633: }
0634: }
0635: }
0636: break;
0637:
0638: case '\r': {
0639: final int yyChoice2 = yyIndex;
0640:
0641: // Nested alternative 1.
0642:
0643: yyC = character(yyChoice2);
0644: if ('\n' == yyC) {
0645: yyIndex = yyChoice2 + 1;
0646:
0647: yyResult = pDirective(yyIndex);
0648: yyError = yyResult.select(yyError);
0649: if (yyResult.hasValue()) {
0650:
0651: yyRepetition1 = yyResult.index;
0652: continue;
0653: }
0654: }
0655:
0656: // Nested alternative 2.
0657:
0658: yyResult = pDirective(yyChoice2);
0659: yyError = yyResult.select(yyError);
0660: if (yyResult.hasValue()) {
0661:
0662: yyRepetition1 = yyResult.index;
0663: continue;
0664: }
0665: }
0666: break;
0667:
0668: case '\n': {
0669: yyResult = pDirective(yyIndex);
0670: yyError = yyResult.select(yyError);
0671: if (yyResult.hasValue()) {
0672:
0673: yyRepetition1 = yyResult.index;
0674: continue;
0675: }
0676: }
0677: break;
0678:
0679: default:
0680: /* No match. */
0681: }
0682: }
0683: break;
0684: }
0685:
0686: yyValue = null;
0687:
0688: return new SemanticValue(yyValue, yyRepetition1, yyError);
0689: }
0690:
0691: // =========================================================================
0692:
0693: /**
0694: * Parse nonterminal xtc.lang.CSpacing.Space.
0695: *
0696: * @param yyStart The index.
0697: * @return The result.
0698: * @throws IOException Signals an I/O error.
0699: */
0700: private Result pSpace(final int yyStart) throws IOException {
0701: int yyC;
0702: int yyIndex;
0703: Void yyValue;
0704: ParseError yyError = ParseError.DUMMY;
0705:
0706: // Alternative 1.
0707:
0708: yyC = character(yyStart);
0709: if (-1 != yyC) {
0710: yyIndex = yyStart + 1;
0711:
0712: switch (yyC) {
0713: case ' ': {
0714: yyValue = null;
0715:
0716: return new SemanticValue(yyValue, yyIndex, yyError);
0717: }
0718:
0719: case '\t': {
0720: yyValue = null;
0721:
0722: return new SemanticValue(yyValue, yyIndex, yyError);
0723: }
0724:
0725: case '\f': {
0726: yyValue = null;
0727:
0728: return new SemanticValue(yyValue, yyIndex, yyError);
0729: }
0730:
0731: default:
0732: /* No match. */
0733: }
0734: }
0735:
0736: // Done.
0737: yyError = yyError.select("space expected", yyStart);
0738: return yyError;
0739: }
0740:
0741: // =========================================================================
0742:
0743: /**
0744: * Parse nonterminal xtc.lang.CSpacing.LineTerminator.
0745: *
0746: * @param yyStart The index.
0747: * @return The result.
0748: * @throws IOException Signals an I/O error.
0749: */
0750: private Result pLineTerminator(final int yyStart)
0751: throws IOException {
0752: int yyC;
0753: int yyIndex;
0754: Void yyValue;
0755: ParseError yyError = ParseError.DUMMY;
0756:
0757: // Alternative 1.
0758:
0759: yyC = character(yyStart);
0760: if (-1 != yyC) {
0761: yyIndex = yyStart + 1;
0762:
0763: switch (yyC) {
0764: case '\r': {
0765: final int yyChoice1 = yyIndex;
0766:
0767: // Nested alternative 1.
0768:
0769: yyC = character(yyChoice1);
0770: if ('\n' == yyC) {
0771: yyIndex = yyChoice1 + 1;
0772:
0773: yyValue = null;
0774:
0775: return new SemanticValue(yyValue, yyIndex, yyError);
0776: }
0777:
0778: // Nested alternative 2.
0779:
0780: yyValue = null;
0781:
0782: return new SemanticValue(yyValue, yyChoice1, yyError);
0783: }
0784:
0785: case '\n': {
0786: yyValue = null;
0787:
0788: return new SemanticValue(yyValue, yyIndex, yyError);
0789: }
0790:
0791: default:
0792: /* No match. */
0793: }
0794: }
0795:
0796: // Done.
0797: yyError = yyError.select("line terminator expected", yyStart);
0798: return yyError;
0799: }
0800:
0801: // =========================================================================
0802:
0803: /**
0804: * Parse nonterminal xtc.lang.CSpacing.EndOfFile.
0805: *
0806: * @param yyStart The index.
0807: * @return The result.
0808: * @throws IOException Signals an I/O error.
0809: */
0810: private Result pEndOfFile(final int yyStart) throws IOException {
0811: int yyC;
0812: boolean yyPredMatched;
0813: Void yyValue;
0814: ParseError yyError = ParseError.DUMMY;
0815:
0816: // Alternative 1.
0817:
0818: yyPredMatched = false;
0819:
0820: yyC = character(yyStart);
0821: if (-1 != yyC) {
0822:
0823: yyPredMatched = true;
0824: }
0825:
0826: if (!yyPredMatched) {
0827:
0828: yyValue = null;
0829:
0830: return new SemanticValue(yyValue, yyStart, yyError);
0831: } else {
0832: yyError = yyError.select("end of file expected", yyStart);
0833: }
0834:
0835: // Done.
0836: return yyError;
0837: }
0838:
0839: // =========================================================================
0840:
0841: /**
0842: * Parse nonterminal xtc.lang.CSpacing.Directive.
0843: *
0844: * @param yyStart The index.
0845: * @return The result.
0846: * @throws IOException Signals an I/O error.
0847: */
0848: private Result pDirective(final int yyStart) throws IOException {
0849: int yyC;
0850: int yyIndex;
0851: Result yyResult;
0852: Result yyPredResult;
0853: int yyBase;
0854: int yyRepetition1;
0855: boolean yyRepeated1;
0856: int yyOption1;
0857: String yyOpValue1;
0858: Void yyValue;
0859: ParseError yyError = ParseError.DUMMY;
0860:
0861: // Alternative 1.
0862:
0863: yyC = character(yyStart);
0864: if ('#' == yyC) {
0865: yyIndex = yyStart + 1;
0866:
0867: final int yyChoice1 = yyIndex;
0868:
0869: // Nested alternative 1.
0870:
0871: yyC = character(yyChoice1);
0872: if (' ' == yyC) {
0873: yyIndex = yyChoice1 + 1;
0874:
0875: yyResult = pLineNumber(yyIndex);
0876: yyError = yyResult.select(yyError);
0877: if (yyResult.hasValue()) {
0878: final String line = yyResult.semanticValue();
0879:
0880: yyC = character(yyResult.index);
0881: if (' ' == yyC) {
0882: yyIndex = yyResult.index + 1;
0883:
0884: yyC = character(yyIndex);
0885: if ('\"' == yyC) {
0886: yyIndex = yyIndex + 1;
0887:
0888: yyResult = pFileName(yyIndex);
0889: yyError = yyResult.select(yyError);
0890: if (yyResult.hasValue()) {
0891: final String file = yyResult
0892: .semanticValue();
0893:
0894: yyC = character(yyResult.index);
0895: if ('\"' == yyC) {
0896: yyIndex = yyResult.index + 1;
0897:
0898: yyOption1 = yyIndex;
0899: yyOpValue1 = null;
0900:
0901: yyBase = yyOption1;
0902: yyC = character(yyBase);
0903: if (' ' == yyC) {
0904: yyIndex = yyOption1 + 1;
0905:
0906: yyC = character(yyIndex);
0907: if ('1' == yyC) {
0908: yyIndex = yyIndex + 1;
0909: final String v$el$1 = " 1";
0910:
0911: yyOption1 = yyIndex;
0912: yyOpValue1 = v$el$1;
0913: } else {
0914: yyError = yyError.select(
0915: "\" 1\" expected",
0916: yyBase);
0917: }
0918: } else {
0919: yyError = yyError.select(
0920: "\" 1\" expected",
0921: yyBase);
0922: }
0923: { // Start scope for f1.
0924: final String f1 = yyOpValue1;
0925:
0926: yyOpValue1 = null;
0927:
0928: yyBase = yyOption1;
0929: yyC = character(yyBase);
0930: if (' ' == yyC) {
0931: yyIndex = yyOption1 + 1;
0932:
0933: yyC = character(yyIndex);
0934: if ('2' == yyC) {
0935: yyIndex = yyIndex + 1;
0936: final String v$el$2 = " 2";
0937:
0938: yyOption1 = yyIndex;
0939: yyOpValue1 = v$el$2;
0940: } else {
0941: yyError = yyError
0942: .select(
0943: "\" 2\" expected",
0944: yyBase);
0945: }
0946: } else {
0947: yyError = yyError.select(
0948: "\" 2\" expected",
0949: yyBase);
0950: }
0951: { // Start scope for f2.
0952: final String f2 = yyOpValue1;
0953:
0954: yyOpValue1 = null;
0955:
0956: yyBase = yyOption1;
0957: yyC = character(yyBase);
0958: if (' ' == yyC) {
0959: yyIndex = yyOption1 + 1;
0960:
0961: yyC = character(yyIndex);
0962: if ('3' == yyC) {
0963: yyIndex = yyIndex + 1;
0964: final String v$el$3 = " 3";
0965:
0966: yyOption1 = yyIndex;
0967: yyOpValue1 = v$el$3;
0968: } else {
0969: yyError = yyError
0970: .select(
0971: "\" 3\" expected",
0972: yyBase);
0973: }
0974: } else {
0975: yyError = yyError
0976: .select(
0977: "\" 3\" expected",
0978: yyBase);
0979: }
0980: { // Start scope for f3.
0981: final String f3 = yyOpValue1;
0982:
0983: yyOpValue1 = null;
0984:
0985: yyBase = yyOption1;
0986: yyC = character(yyBase);
0987: if (' ' == yyC) {
0988: yyIndex = yyOption1 + 1;
0989:
0990: yyC = character(yyIndex);
0991: if ('4' == yyC) {
0992: yyIndex = yyIndex + 1;
0993: final String v$el$4 = " 4";
0994:
0995: yyOption1 = yyIndex;
0996: yyOpValue1 = v$el$4;
0997: } else {
0998: yyError = yyError
0999: .select(
1000: "\" 4\" expected",
1001: yyBase);
1002: }
1003: } else {
1004: yyError = yyError
1005: .select(
1006: "\" 4\" expected",
1007: yyBase);
1008: }
1009: { // Start scope for f4.
1010: final String f4 = yyOpValue1;
1011:
1012: yyPredResult = pLineTerminator(yyOption1);
1013: yyError = yyPredResult
1014: .select(yyError);
1015: if (yyPredResult
1016: .hasValue()) {
1017:
1018: final int lineNo = Integer
1019: .parseInt(line);
1020: if (RELOCATE)
1021: setLocation(
1022: yyStart,
1023: file,
1024: lineNo - 1,
1025: FIRST_COLUMN);
1026: yyState
1027: .lineMarker(
1028: file,
1029: lineNo,
1030: f1,
1031: f2,
1032: f3,
1033: f4,
1034: location(yyStart));
1035:
1036: yyValue = null;
1037:
1038: return new SemanticValue(
1039: yyValue,
1040: yyOption1,
1041: yyError);
1042: }
1043: } // End scope for f4.
1044: } // End scope for f3.
1045: } // End scope for f2.
1046: } // End scope for f1.
1047: }
1048: }
1049: }
1050: }
1051: }
1052: }
1053:
1054: // Nested alternative 2.
1055:
1056: yyRepetition1 = yyChoice1;
1057: while (true) {
1058:
1059: yyResult = pSpace(yyRepetition1);
1060: yyError = yyResult.select(yyError);
1061: if (yyResult.hasValue()) {
1062:
1063: yyRepetition1 = yyResult.index;
1064: continue;
1065: }
1066: break;
1067: }
1068: { // Start scope for nested choice.
1069:
1070: final int yyChoice2 = yyRepetition1;
1071:
1072: // Nested alternative 1.
1073:
1074: yyC = character(yyChoice2);
1075: if (-1 != yyC) {
1076: yyIndex = yyChoice2 + 1;
1077:
1078: switch (yyC) {
1079: case 'p': {
1080: yyC = character(yyIndex);
1081: if (-1 != yyC) {
1082: yyIndex = yyIndex + 1;
1083: if ('r' == yyC) {
1084:
1085: yyC = character(yyIndex);
1086: if (-1 != yyC) {
1087: yyIndex = yyIndex + 1;
1088: if ('a' == yyC) {
1089:
1090: yyC = character(yyIndex);
1091: if (-1 != yyC) {
1092: yyIndex = yyIndex + 1;
1093: if ('g' == yyC) {
1094:
1095: yyC = character(yyIndex);
1096: if (-1 != yyC) {
1097: yyIndex = yyIndex + 1;
1098: if ('m' == yyC) {
1099:
1100: yyC = character(yyIndex);
1101: if (-1 != yyC) {
1102: yyIndex = yyIndex + 1;
1103: if ('a' == yyC) {
1104:
1105: yyC = character(yyIndex);
1106: if (-1 != yyC) {
1107: yyIndex = yyIndex + 1;
1108: if (' ' == yyC) {
1109:
1110: yyResult = pPragma(yyIndex);
1111: yyError = yyResult
1112: .select(yyError);
1113: if (yyResult
1114: .hasValue()) {
1115: final String pragma = yyResult
1116: .semanticValue();
1117:
1118: yyPredResult = pLineTerminator(yyResult.index);
1119: yyError = yyPredResult
1120: .select(yyError);
1121: if (yyPredResult
1122: .hasValue()) {
1123:
1124: yyState
1125: .pragma(
1126: pragma,
1127: location(yyStart));
1128:
1129: yyValue = null;
1130:
1131: return yyResult
1132: .createValue(
1133: yyValue,
1134: yyError);
1135: }
1136: }
1137: }
1138: }
1139: }
1140: }
1141: }
1142: }
1143: }
1144: }
1145: }
1146: }
1147: }
1148: }
1149: }
1150: break;
1151:
1152: case 'i': {
1153: yyC = character(yyIndex);
1154: if (-1 != yyC) {
1155: yyIndex = yyIndex + 1;
1156: if ('d' == yyC) {
1157:
1158: yyC = character(yyIndex);
1159: if (-1 != yyC) {
1160: yyIndex = yyIndex + 1;
1161: if ('e' == yyC) {
1162:
1163: yyC = character(yyIndex);
1164: if (-1 != yyC) {
1165: yyIndex = yyIndex + 1;
1166: if ('n' == yyC) {
1167:
1168: yyC = character(yyIndex);
1169: if (-1 != yyC) {
1170: yyIndex = yyIndex + 1;
1171: if ('t' == yyC) {
1172:
1173: yyRepetition1 = yyIndex;
1174: yyRepeated1 = false;
1175: while (true) {
1176:
1177: yyResult = pSpace(yyRepetition1);
1178: yyError = yyResult
1179: .select(yyError);
1180: if (yyResult
1181: .hasValue()) {
1182:
1183: yyRepetition1 = yyResult.index;
1184: yyRepeated1 = true;
1185: continue;
1186: }
1187: break;
1188: }
1189:
1190: if (yyRepeated1) {
1191:
1192: yyC = character(yyRepetition1);
1193: if ('\"' == yyC) {
1194: yyIndex = yyRepetition1 + 1;
1195:
1196: yyResult = pFileName(yyIndex);
1197: yyError = yyResult
1198: .select(yyError);
1199: if (yyResult
1200: .hasValue()) {
1201: final String s = yyResult
1202: .semanticValue();
1203:
1204: yyC = character(yyResult.index);
1205: if ('\"' == yyC) {
1206: yyIndex = yyResult.index + 1;
1207:
1208: yyPredResult = pLineTerminator(yyIndex);
1209: yyError = yyPredResult
1210: .select(yyError);
1211: if (yyPredResult
1212: .hasValue()) {
1213:
1214: yyState
1215: .ident(
1216: s,
1217: location(yyStart));
1218:
1219: yyValue = null;
1220:
1221: return new SemanticValue(
1222: yyValue,
1223: yyIndex,
1224: yyError);
1225: }
1226: }
1227: }
1228: }
1229: }
1230: }
1231: }
1232: }
1233: }
1234: }
1235: }
1236: }
1237: }
1238: }
1239: break;
1240:
1241: default:
1242: /* No match. */
1243: }
1244: }
1245: } // End scope for nested choice.
1246: }
1247:
1248: // Alternative 2.
1249:
1250: yyValue = null;
1251:
1252: return new SemanticValue(yyValue, yyStart, yyError);
1253: }
1254:
1255: // =========================================================================
1256:
1257: /**
1258: * Parse nonterminal xtc.lang.CSpacing.LineNumber.
1259: *
1260: * @param yyStart The index.
1261: * @return The result.
1262: * @throws IOException Signals an I/O error.
1263: */
1264: private Result pLineNumber(final int yyStart) throws IOException {
1265: int yyC;
1266: int yyIndex;
1267: int yyRepetition1;
1268: String yyValue;
1269: ParseError yyError = ParseError.DUMMY;
1270:
1271: // Alternative 1.
1272:
1273: yyC = character(yyStart);
1274: if (-1 != yyC) {
1275: yyIndex = yyStart + 1;
1276:
1277: switch (yyC) {
1278: case '1':
1279: case '2':
1280: case '3':
1281: case '4':
1282: case '5':
1283: case '6':
1284: case '7':
1285: case '8':
1286: case '9': {
1287: yyRepetition1 = yyIndex;
1288: while (true) {
1289:
1290: yyC = character(yyRepetition1);
1291: if (-1 != yyC) {
1292: yyIndex = yyRepetition1 + 1;
1293:
1294: switch (yyC) {
1295: case '0':
1296: case '1':
1297: case '2':
1298: case '3':
1299: case '4':
1300: case '5':
1301: case '6':
1302: case '7':
1303: case '8':
1304: case '9': {
1305: yyRepetition1 = yyIndex;
1306: continue;
1307: }
1308:
1309: default:
1310: /* No match. */
1311: }
1312: }
1313: break;
1314: }
1315:
1316: yyValue = difference(yyStart, yyRepetition1);
1317:
1318: return new SemanticValue(yyValue, yyRepetition1,
1319: yyError);
1320: }
1321:
1322: default:
1323: /* No match. */
1324: }
1325: }
1326:
1327: // Done.
1328: yyError = yyError.select("line number expected", yyStart);
1329: return yyError;
1330: }
1331:
1332: // =========================================================================
1333:
1334: /**
1335: * Parse nonterminal xtc.lang.CSpacing.FileName.
1336: *
1337: * @param yyStart The index.
1338: * @return The result.
1339: * @throws IOException Signals an I/O error.
1340: */
1341: private Result pFileName(final int yyStart) throws IOException {
1342: int yyC;
1343: int yyIndex;
1344: int yyRepetition1;
1345: String yyValue;
1346: ParseError yyError = ParseError.DUMMY;
1347:
1348: // Alternative 1.
1349:
1350: yyRepetition1 = yyStart;
1351: while (true) {
1352:
1353: final int yyChoice1 = yyRepetition1;
1354:
1355: // Nested alternative 1.
1356:
1357: yyC = character(yyChoice1);
1358: if (-1 != yyC) {
1359: yyIndex = yyChoice1 + 1;
1360:
1361: switch (yyC) {
1362: case '\\': {
1363: yyC = character(yyIndex);
1364: if (-1 != yyC) {
1365: yyIndex = yyIndex + 1;
1366:
1367: yyRepetition1 = yyIndex;
1368: continue;
1369: }
1370: }
1371: break;
1372:
1373: default:
1374: /* No match. */
1375: }
1376: }
1377:
1378: // Nested alternative 2.
1379:
1380: yyC = character(yyChoice1);
1381: if (-1 != yyC) {
1382: yyIndex = yyChoice1 + 1;
1383:
1384: switch (yyC) {
1385: case '\"':
1386: case '\\':
1387: /* No match. */
1388: break;
1389:
1390: default: {
1391: yyRepetition1 = yyIndex;
1392: continue;
1393: }
1394: }
1395: }
1396: break;
1397: }
1398:
1399: yyValue = difference(yyStart, yyRepetition1);
1400:
1401: return new SemanticValue(yyValue, yyRepetition1, yyError);
1402: }
1403:
1404: // =========================================================================
1405:
1406: /**
1407: * Parse nonterminal xtc.lang.CSpacing.Pragma.
1408: *
1409: * @param yyStart The index.
1410: * @return The result.
1411: * @throws IOException Signals an I/O error.
1412: */
1413: private Result pPragma(final int yyStart) throws IOException {
1414: int yyC;
1415: int yyIndex;
1416: int yyRepetition1;
1417: String yyValue;
1418: ParseError yyError = ParseError.DUMMY;
1419:
1420: // Alternative 1.
1421:
1422: yyRepetition1 = yyStart;
1423: while (true) {
1424:
1425: yyC = character(yyRepetition1);
1426: if (-1 != yyC) {
1427: yyIndex = yyRepetition1 + 1;
1428:
1429: switch (yyC) {
1430: case '\n':
1431: case '\r':
1432: /* No match. */
1433: break;
1434:
1435: default: {
1436: yyRepetition1 = yyIndex;
1437: continue;
1438: }
1439: }
1440: }
1441: break;
1442: }
1443:
1444: yyValue = difference(yyStart, yyRepetition1);
1445:
1446: return new SemanticValue(yyValue, yyRepetition1, yyError);
1447: }
1448:
1449: // =========================================================================
1450:
1451: /**
1452: * Parse nonterminal xtc.lang.jeannie.JeannieSymbol.Symbol.
1453: *
1454: * @param yyStart The index.
1455: * @return The result.
1456: * @throws IOException Signals an I/O error.
1457: */
1458: private Result pSymbol(final int yyStart) throws IOException {
1459: PreJeannieParserColumn yyColumn = (PreJeannieParserColumn) column(yyStart);
1460: if (null == yyColumn.fSymbol)
1461: yyColumn.fSymbol = pSymbol$1(yyStart);
1462: return yyColumn.fSymbol;
1463: }
1464:
1465: /** Actually parse xtc.lang.jeannie.JeannieSymbol.Symbol. */
1466: private Result pSymbol$1(final int yyStart) throws IOException {
1467: Result yyResult;
1468: String yyValue;
1469: ParseError yyError = ParseError.DUMMY;
1470:
1471: // Alternative 1.
1472:
1473: yyResult = pSymbolCharacters(yyStart);
1474: yyError = yyResult.select(yyError);
1475: if (yyResult.hasValue()) {
1476: yyValue = yyResult.semanticValue();
1477:
1478: yyResult = pSpacing(yyResult.index);
1479: yyError = yyResult.select(yyError);
1480: if (yyResult.hasValue()) {
1481:
1482: return yyResult.createValue(yyValue, yyError);
1483: }
1484: }
1485:
1486: // Done.
1487: return yyError;
1488: }
1489:
1490: // =========================================================================
1491:
1492: /**
1493: * Parse nonterminal xtc.lang.jeannie.JeannieSymbol.SymbolCharacters.
1494: *
1495: * @param yyStart The index.
1496: * @return The result.
1497: * @throws IOException Signals an I/O error.
1498: */
1499: private Result pSymbolCharacters(final int yyStart)
1500: throws IOException {
1501: int yyC;
1502: int yyIndex;
1503: String yyValue;
1504: ParseError yyError = ParseError.DUMMY;
1505:
1506: // Alternative 1.
1507:
1508: yyC = character(yyStart);
1509: if (-1 != yyC) {
1510: yyIndex = yyStart + 1;
1511:
1512: switch (yyC) {
1513: case '>': {
1514: final int yyChoice1 = yyIndex;
1515:
1516: // Nested alternative 1.
1517:
1518: yyC = character(yyChoice1);
1519: if (-1 != yyC) {
1520: yyIndex = yyChoice1 + 1;
1521:
1522: switch (yyC) {
1523: case '>': {
1524: final int yyChoice2 = yyIndex;
1525:
1526: // Nested alternative 1.
1527:
1528: yyC = character(yyChoice2);
1529: if (-1 != yyC) {
1530: yyIndex = yyChoice2 + 1;
1531:
1532: switch (yyC) {
1533: case '>': {
1534: final int yyChoice3 = yyIndex;
1535:
1536: // Nested alternative 1.
1537:
1538: yyC = character(yyChoice3);
1539: if (-1 != yyC) {
1540: yyIndex = yyChoice3 + 1;
1541: if ('=' == yyC) {
1542:
1543: yyValue = ">>>=";
1544:
1545: return new SemanticValue(
1546: yyValue, yyIndex,
1547: yyError);
1548: }
1549: }
1550:
1551: // Nested alternative 2.
1552:
1553: yyValue = ">>>";
1554:
1555: return new SemanticValue(yyValue,
1556: yyChoice3, yyError);
1557: }
1558:
1559: case '=': {
1560: yyValue = ">>=";
1561:
1562: return new SemanticValue(yyValue,
1563: yyIndex, yyError);
1564: }
1565:
1566: default:
1567: /* No match. */
1568: }
1569: }
1570:
1571: // Nested alternative 2.
1572:
1573: yyValue = ">>";
1574:
1575: return new SemanticValue(yyValue, yyChoice2,
1576: yyError);
1577: }
1578:
1579: case '=': {
1580: yyValue = ">=";
1581:
1582: return new SemanticValue(yyValue, yyIndex,
1583: yyError);
1584: }
1585:
1586: default:
1587: /* No match. */
1588: }
1589: }
1590:
1591: // Nested alternative 2.
1592:
1593: yyValue = ">";
1594:
1595: return new SemanticValue(yyValue, yyChoice1, yyError);
1596: }
1597:
1598: case '<': {
1599: final int yyChoice1 = yyIndex;
1600:
1601: // Nested alternative 1.
1602:
1603: yyC = character(yyChoice1);
1604: if (-1 != yyC) {
1605: yyIndex = yyChoice1 + 1;
1606:
1607: switch (yyC) {
1608: case '<': {
1609: final int yyChoice2 = yyIndex;
1610:
1611: // Nested alternative 1.
1612:
1613: yyC = character(yyChoice2);
1614: if (-1 != yyC) {
1615: yyIndex = yyChoice2 + 1;
1616: if ('=' == yyC) {
1617:
1618: yyValue = "<<=";
1619:
1620: return new SemanticValue(yyValue,
1621: yyIndex, yyError);
1622: }
1623: }
1624:
1625: // Nested alternative 2.
1626:
1627: yyValue = "<<";
1628:
1629: return new SemanticValue(yyValue, yyChoice2,
1630: yyError);
1631: }
1632:
1633: case '=': {
1634: yyValue = "<=";
1635:
1636: return new SemanticValue(yyValue, yyIndex,
1637: yyError);
1638: }
1639:
1640: default:
1641: /* No match. */
1642: }
1643: }
1644:
1645: // Nested alternative 2.
1646:
1647: yyValue = "<";
1648:
1649: return new SemanticValue(yyValue, yyChoice1, yyError);
1650: }
1651:
1652: case '.': {
1653: final int yyChoice1 = yyIndex;
1654:
1655: // Nested alternative 1.
1656:
1657: yyC = character(yyChoice1);
1658: if (-1 != yyC) {
1659: yyIndex = yyChoice1 + 1;
1660: if ('.' == yyC) {
1661:
1662: yyC = character(yyIndex);
1663: if (-1 != yyC) {
1664: yyIndex = yyIndex + 1;
1665: if ('.' == yyC) {
1666:
1667: yyValue = "...";
1668:
1669: return new SemanticValue(yyValue,
1670: yyIndex, yyError);
1671: }
1672: }
1673: }
1674: }
1675:
1676: // Nested alternative 2.
1677:
1678: yyValue = ".";
1679:
1680: return new SemanticValue(yyValue, yyChoice1, yyError);
1681: }
1682:
1683: case '+': {
1684: final int yyChoice1 = yyIndex;
1685:
1686: // Nested alternative 1.
1687:
1688: yyC = character(yyChoice1);
1689: if (-1 != yyC) {
1690: yyIndex = yyChoice1 + 1;
1691:
1692: switch (yyC) {
1693: case '=': {
1694: yyValue = "+=";
1695:
1696: return new SemanticValue(yyValue, yyIndex,
1697: yyError);
1698: }
1699:
1700: case '+': {
1701: yyValue = "++";
1702:
1703: return new SemanticValue(yyValue, yyIndex,
1704: yyError);
1705: }
1706:
1707: default:
1708: /* No match. */
1709: }
1710: }
1711:
1712: // Nested alternative 2.
1713:
1714: yyValue = "+";
1715:
1716: return new SemanticValue(yyValue, yyChoice1, yyError);
1717: }
1718:
1719: case '-': {
1720: final int yyChoice1 = yyIndex;
1721:
1722: // Nested alternative 1.
1723:
1724: yyC = character(yyChoice1);
1725: if (-1 != yyC) {
1726: yyIndex = yyChoice1 + 1;
1727:
1728: switch (yyC) {
1729: case '=': {
1730: yyValue = "-=";
1731:
1732: return new SemanticValue(yyValue, yyIndex,
1733: yyError);
1734: }
1735:
1736: case '-': {
1737: yyValue = "--";
1738:
1739: return new SemanticValue(yyValue, yyIndex,
1740: yyError);
1741: }
1742:
1743: case '>': {
1744: yyValue = "->";
1745:
1746: return new SemanticValue(yyValue, yyIndex,
1747: yyError);
1748: }
1749:
1750: default:
1751: /* No match. */
1752: }
1753: }
1754:
1755: // Nested alternative 2.
1756:
1757: yyValue = "-";
1758:
1759: return new SemanticValue(yyValue, yyChoice1, yyError);
1760: }
1761:
1762: case '*': {
1763: final int yyChoice1 = yyIndex;
1764:
1765: // Nested alternative 1.
1766:
1767: yyC = character(yyChoice1);
1768: if (-1 != yyC) {
1769: yyIndex = yyChoice1 + 1;
1770: if ('=' == yyC) {
1771:
1772: yyValue = "*=";
1773:
1774: return new SemanticValue(yyValue, yyIndex,
1775: yyError);
1776: }
1777: }
1778:
1779: // Nested alternative 2.
1780:
1781: yyValue = "*";
1782:
1783: return new SemanticValue(yyValue, yyChoice1, yyError);
1784: }
1785:
1786: case '/': {
1787: final int yyChoice1 = yyIndex;
1788:
1789: // Nested alternative 1.
1790:
1791: yyC = character(yyChoice1);
1792: if (-1 != yyC) {
1793: yyIndex = yyChoice1 + 1;
1794: if ('=' == yyC) {
1795:
1796: yyValue = "/=";
1797:
1798: return new SemanticValue(yyValue, yyIndex,
1799: yyError);
1800: }
1801: }
1802:
1803: // Nested alternative 2.
1804:
1805: yyValue = "/";
1806:
1807: return new SemanticValue(yyValue, yyChoice1, yyError);
1808: }
1809:
1810: case '%': {
1811: final int yyChoice1 = yyIndex;
1812:
1813: // Nested alternative 1.
1814:
1815: yyC = character(yyChoice1);
1816: if (-1 != yyC) {
1817: yyIndex = yyChoice1 + 1;
1818: if ('=' == yyC) {
1819:
1820: yyValue = "%=";
1821:
1822: return new SemanticValue(yyValue, yyIndex,
1823: yyError);
1824: }
1825: }
1826:
1827: // Nested alternative 2.
1828:
1829: yyValue = "%";
1830:
1831: return new SemanticValue(yyValue, yyChoice1, yyError);
1832: }
1833:
1834: case '&': {
1835: final int yyChoice1 = yyIndex;
1836:
1837: // Nested alternative 1.
1838:
1839: yyC = character(yyChoice1);
1840: if (-1 != yyC) {
1841: yyIndex = yyChoice1 + 1;
1842:
1843: switch (yyC) {
1844: case '=': {
1845: yyValue = "&=";
1846:
1847: return new SemanticValue(yyValue, yyIndex,
1848: yyError);
1849: }
1850:
1851: case '&': {
1852: yyValue = "&&";
1853:
1854: return new SemanticValue(yyValue, yyIndex,
1855: yyError);
1856: }
1857:
1858: default:
1859: /* No match. */
1860: }
1861: }
1862:
1863: // Nested alternative 2.
1864:
1865: yyValue = "&";
1866:
1867: return new SemanticValue(yyValue, yyChoice1, yyError);
1868: }
1869:
1870: case '^': {
1871: final int yyChoice1 = yyIndex;
1872:
1873: // Nested alternative 1.
1874:
1875: yyC = character(yyChoice1);
1876: if (-1 != yyC) {
1877: yyIndex = yyChoice1 + 1;
1878: if ('=' == yyC) {
1879:
1880: yyValue = "^=";
1881:
1882: return new SemanticValue(yyValue, yyIndex,
1883: yyError);
1884: }
1885: }
1886:
1887: // Nested alternative 2.
1888:
1889: yyValue = "^";
1890:
1891: return new SemanticValue(yyValue, yyChoice1, yyError);
1892: }
1893:
1894: case '|': {
1895: final int yyChoice1 = yyIndex;
1896:
1897: // Nested alternative 1.
1898:
1899: yyC = character(yyChoice1);
1900: if (-1 != yyC) {
1901: yyIndex = yyChoice1 + 1;
1902:
1903: switch (yyC) {
1904: case '=': {
1905: yyValue = "|=";
1906:
1907: return new SemanticValue(yyValue, yyIndex,
1908: yyError);
1909: }
1910:
1911: case '|': {
1912: yyValue = "||";
1913:
1914: return new SemanticValue(yyValue, yyIndex,
1915: yyError);
1916: }
1917:
1918: default:
1919: /* No match. */
1920: }
1921: }
1922:
1923: // Nested alternative 2.
1924:
1925: yyValue = "|";
1926:
1927: return new SemanticValue(yyValue, yyChoice1, yyError);
1928: }
1929:
1930: case '=': {
1931: final int yyChoice1 = yyIndex;
1932:
1933: // Nested alternative 1.
1934:
1935: yyC = character(yyChoice1);
1936: if (-1 != yyC) {
1937: yyIndex = yyChoice1 + 1;
1938: if ('=' == yyC) {
1939:
1940: yyValue = "==";
1941:
1942: return new SemanticValue(yyValue, yyIndex,
1943: yyError);
1944: }
1945: }
1946:
1947: // Nested alternative 2.
1948:
1949: yyValue = "=";
1950:
1951: return new SemanticValue(yyValue, yyChoice1, yyError);
1952: }
1953:
1954: case '!': {
1955: final int yyChoice1 = yyIndex;
1956:
1957: // Nested alternative 1.
1958:
1959: yyC = character(yyChoice1);
1960: if (-1 != yyC) {
1961: yyIndex = yyChoice1 + 1;
1962: if ('=' == yyC) {
1963:
1964: yyValue = "!=";
1965:
1966: return new SemanticValue(yyValue, yyIndex,
1967: yyError);
1968: }
1969: }
1970:
1971: // Nested alternative 2.
1972:
1973: yyValue = "!";
1974:
1975: return new SemanticValue(yyValue, yyChoice1, yyError);
1976: }
1977:
1978: case ';': {
1979: yyValue = ";";
1980:
1981: return new SemanticValue(yyValue, yyIndex, yyError);
1982: }
1983:
1984: case ':': {
1985: yyValue = ":";
1986:
1987: return new SemanticValue(yyValue, yyIndex, yyError);
1988: }
1989:
1990: case ',': {
1991: yyValue = ",";
1992:
1993: return new SemanticValue(yyValue, yyIndex, yyError);
1994: }
1995:
1996: case '{': {
1997: yyValue = "{";
1998:
1999: return new SemanticValue(yyValue, yyIndex, yyError);
2000: }
2001:
2002: case '}': {
2003: yyValue = "}";
2004:
2005: return new SemanticValue(yyValue, yyIndex, yyError);
2006: }
2007:
2008: case '(': {
2009: yyValue = "(";
2010:
2011: return new SemanticValue(yyValue, yyIndex, yyError);
2012: }
2013:
2014: case ')': {
2015: yyValue = ")";
2016:
2017: return new SemanticValue(yyValue, yyIndex, yyError);
2018: }
2019:
2020: case '[': {
2021: yyValue = "[";
2022:
2023: return new SemanticValue(yyValue, yyIndex, yyError);
2024: }
2025:
2026: case ']': {
2027: yyValue = "]";
2028:
2029: return new SemanticValue(yyValue, yyIndex, yyError);
2030: }
2031:
2032: case '`': {
2033: yyValue = "`";
2034:
2035: return new SemanticValue(yyValue, yyIndex, yyError);
2036: }
2037:
2038: case '~': {
2039: yyValue = "~";
2040:
2041: return new SemanticValue(yyValue, yyIndex, yyError);
2042: }
2043:
2044: case '?': {
2045: yyValue = "?";
2046:
2047: return new SemanticValue(yyValue, yyIndex, yyError);
2048: }
2049:
2050: default:
2051: /* No match. */
2052: }
2053: }
2054:
2055: // Done.
2056: yyError = yyError.select("symbol characters expected", yyStart);
2057: return yyError;
2058: }
2059:
2060: // =========================================================================
2061:
2062: Preprocessor _tool;
2063:
2064: final String origString(final int start, final int end)
2065: throws IOException {
2066: final StringBuilder b = new StringBuilder(20 + end - start);
2067: b.append(_tool.lineMarker(column(start)));
2068: for (int i = start; i < end; i++) {
2069: final int c = character(i);
2070: if (c == -1)
2071: throw new Error();
2072: b.append((char) c);
2073: }
2074: return b.toString();
2075: }
2076:
2077: // =========================================================================
2078:
2079: /**
2080: * Get the specified text.
2081: *
2082: * @param s The text.
2083: * @return The text.
2084: */
2085: protected static final String toText(String s) {
2086: return s;
2087: }
2088:
2089: }
|