0001: // $ANTLR : "action.g" -> "ActionLexer.java"$
0002:
0003: package persistence.antlr.actions.cpp;
0004:
0005: import java.io.InputStream;
0006: import persistence.antlr.TokenStreamException;
0007: import persistence.antlr.TokenStreamIOException;
0008: import persistence.antlr.TokenStreamRecognitionException;
0009: import persistence.antlr.CharStreamException;
0010: import persistence.antlr.CharStreamIOException;
0011: import persistence.antlr.ANTLRException;
0012: import java.io.Reader;
0013: import java.util.Hashtable;
0014: import persistence.antlr.CharScanner;
0015: import persistence.antlr.InputBuffer;
0016: import persistence.antlr.ByteBuffer;
0017: import persistence.antlr.CharBuffer;
0018: import persistence.antlr.Token;
0019: import persistence.antlr.CommonToken;
0020: import persistence.antlr.RecognitionException;
0021: import persistence.antlr.NoViableAltForCharException;
0022: import persistence.antlr.MismatchedCharException;
0023: import persistence.antlr.TokenStream;
0024: import persistence.antlr.ANTLRHashString;
0025: import persistence.antlr.LexerSharedInputState;
0026: import persistence.antlr.collections.impl.BitSet;
0027: import persistence.antlr.SemanticException;
0028:
0029: import java.io.StringReader;
0030: import persistence.antlr.collections.impl.Vector;
0031: import persistence.antlr.*;
0032:
0033: /** Perform the following translations:
0034:
0035: AST related translations
0036:
0037: ## -> currentRule_AST
0038: #(x,y,z) -> codeGenerator.getASTCreateString(vector-of(x,y,z))
0039: #[x] -> codeGenerator.getASTCreateString(x)
0040: #x -> codeGenerator.mapTreeId(x)
0041:
0042: Inside context of #(...), you can ref (x,y,z), [x], and x as shortcuts.
0043:
0044: Text related translations
0045:
0046: $append(x) -> text.append(x)
0047: $setText(x) -> text.setLength(_begin); text.append(x)
0048: $getText -> new String(text.getBuffer(),_begin,text.length()-_begin)
0049: $setToken(x) -> _token = x
0050: $setType(x) -> _ttype = x
0051: $FOLLOW(r) -> FOLLOW set name for rule r (optional arg)
0052: $FIRST(r) -> FIRST set name for rule r (optional arg)
0053: */
0054: public class ActionLexer extends persistence.antlr.CharScanner
0055: implements ActionLexerTokenTypes, TokenStream {
0056:
0057: protected RuleBlock currentRule;
0058: protected CodeGenerator generator;
0059: protected int lineOffset = 0;
0060: private Tool antlrTool; // The ANTLR tool
0061: ActionTransInfo transInfo;
0062:
0063: public ActionLexer(String s, RuleBlock currentRule,
0064: CodeGenerator generator, ActionTransInfo transInfo) {
0065: this (new StringReader(s));
0066: this .currentRule = currentRule;
0067: this .generator = generator;
0068: this .transInfo = transInfo;
0069: }
0070:
0071: public void setLineOffset(int lineOffset) {
0072: setLine(lineOffset);
0073: }
0074:
0075: public void setTool(Tool tool) {
0076: this .antlrTool = tool;
0077: }
0078:
0079: public void reportError(RecognitionException e) {
0080: antlrTool.error("Syntax error in action: " + e, getFilename(),
0081: getLine(), getColumn());
0082: }
0083:
0084: public void reportError(String s) {
0085: antlrTool.error(s, getFilename(), getLine(), getColumn());
0086: }
0087:
0088: public void reportWarning(String s) {
0089: if (getFilename() == null)
0090: antlrTool.warning(s);
0091: else
0092: antlrTool.warning(s, getFilename(), getLine(), getColumn());
0093: }
0094:
0095: public ActionLexer(InputStream in) {
0096: this (new ByteBuffer(in));
0097: }
0098:
0099: public ActionLexer(Reader in) {
0100: this (new CharBuffer(in));
0101: }
0102:
0103: public ActionLexer(InputBuffer ib) {
0104: this (new LexerSharedInputState(ib));
0105: }
0106:
0107: public ActionLexer(LexerSharedInputState state) {
0108: super (state);
0109: caseSensitiveLiterals = true;
0110: setCaseSensitive(true);
0111: literals = new Hashtable();
0112: }
0113:
0114: public Token nextToken() throws TokenStreamException {
0115: Token theRetToken = null;
0116: tryAgain: for (;;) {
0117: Token _token = null;
0118: int _ttype = Token.INVALID_TYPE;
0119: resetText();
0120: try { // for char stream error handling
0121: try { // for lexical error handling
0122: if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff'))) {
0123: mACTION(true);
0124: theRetToken = _returnToken;
0125: } else {
0126: if (LA(1) == EOF_CHAR) {
0127: uponEOF();
0128: _returnToken = makeToken(Token.EOF_TYPE);
0129: } else {
0130: throw new NoViableAltForCharException(
0131: (char) LA(1), getFilename(),
0132: getLine(), getColumn());
0133: }
0134: }
0135:
0136: if (_returnToken == null)
0137: continue tryAgain; // found SKIP token
0138: _ttype = _returnToken.getType();
0139: _returnToken.setType(_ttype);
0140: return _returnToken;
0141: } catch (RecognitionException e) {
0142: throw new TokenStreamRecognitionException(e);
0143: }
0144: } catch (CharStreamException cse) {
0145: if (cse instanceof CharStreamIOException) {
0146: throw new TokenStreamIOException(
0147: ((CharStreamIOException) cse).io);
0148: } else {
0149: throw new TokenStreamException(cse.getMessage());
0150: }
0151: }
0152: }
0153: }
0154:
0155: public final void mACTION(boolean _createToken)
0156: throws RecognitionException, CharStreamException,
0157: TokenStreamException {
0158: int _ttype;
0159: Token _token = null;
0160: int _begin = text.length();
0161: _ttype = ACTION;
0162: int _saveIndex;
0163:
0164: {
0165: int _cnt502 = 0;
0166: _loop502: do {
0167: switch (LA(1)) {
0168: case '#': {
0169: mAST_ITEM(false);
0170: break;
0171: }
0172: case '$': {
0173: mTEXT_ITEM(false);
0174: break;
0175: }
0176: default:
0177: if ((_tokenSet_0.member(LA(1)))) {
0178: mSTUFF(false);
0179: } else {
0180: if (_cnt502 >= 1) {
0181: break _loop502;
0182: } else {
0183: throw new NoViableAltForCharException(
0184: (char) LA(1), getFilename(),
0185: getLine(), getColumn());
0186: }
0187: }
0188: }
0189: _cnt502++;
0190: } while (true);
0191: }
0192: if (_createToken && _token == null && _ttype != Token.SKIP) {
0193: _token = makeToken(_ttype);
0194: _token.setText(new String(text.getBuffer(), _begin, text
0195: .length()
0196: - _begin));
0197: }
0198: _returnToken = _token;
0199: }
0200:
0201: /** stuff in between #(...) and #id items
0202: * Allow the escaping of the # for C preprocessor stuff.
0203: */
0204: protected final void mSTUFF(boolean _createToken)
0205: throws RecognitionException, CharStreamException,
0206: TokenStreamException {
0207: int _ttype;
0208: Token _token = null;
0209: int _begin = text.length();
0210: _ttype = STUFF;
0211: int _saveIndex;
0212:
0213: switch (LA(1)) {
0214: case '"': {
0215: mSTRING(false);
0216: break;
0217: }
0218: case '\'': {
0219: mCHAR(false);
0220: break;
0221: }
0222: case '\n': {
0223: match('\n');
0224: newline();
0225: break;
0226: }
0227: default:
0228: if ((LA(1) == '/') && (LA(2) == '*' || LA(2) == '/')) {
0229: mCOMMENT(false);
0230: } else if ((LA(1) == '\r') && (LA(2) == '\n') && (true)) {
0231: match("\r\n");
0232: newline();
0233: } else if ((LA(1) == '\\') && (LA(2) == '#') && (true)) {
0234: match('\\');
0235: match('#');
0236: text.setLength(_begin);
0237: text.append("#");
0238: } else if ((LA(1) == '/') && (_tokenSet_1.member(LA(2)))) {
0239: match('/');
0240: {
0241: match(_tokenSet_1);
0242: }
0243: } else if ((LA(1) == '\r') && (true) && (true)) {
0244: match('\r');
0245: newline();
0246: } else if ((_tokenSet_2.member(LA(1))) && (true) && (true)) {
0247: {
0248: match(_tokenSet_2);
0249: }
0250: } else {
0251: throw new NoViableAltForCharException((char) LA(1),
0252: getFilename(), getLine(), getColumn());
0253: }
0254: }
0255: if (_createToken && _token == null && _ttype != Token.SKIP) {
0256: _token = makeToken(_ttype);
0257: _token.setText(new String(text.getBuffer(), _begin, text
0258: .length()
0259: - _begin));
0260: }
0261: _returnToken = _token;
0262: }
0263:
0264: protected final void mAST_ITEM(boolean _createToken)
0265: throws RecognitionException, CharStreamException,
0266: TokenStreamException {
0267: int _ttype;
0268: Token _token = null;
0269: int _begin = text.length();
0270: _ttype = AST_ITEM;
0271: int _saveIndex;
0272: Token t = null;
0273: Token id = null;
0274: Token ctor = null;
0275:
0276: if ((LA(1) == '#') && (LA(2) == '(')) {
0277: _saveIndex = text.length();
0278: match('#');
0279: text.setLength(_saveIndex);
0280: mTREE(true);
0281: t = _returnToken;
0282: } else if ((LA(1) == '#') && (_tokenSet_3.member(LA(2)))) {
0283: _saveIndex = text.length();
0284: match('#');
0285: text.setLength(_saveIndex);
0286: {
0287: switch (LA(1)) {
0288: case '\t':
0289: case '\n':
0290: case '\r':
0291: case ' ': {
0292: mWS(false);
0293: break;
0294: }
0295: case ':':
0296: case 'A':
0297: case 'B':
0298: case 'C':
0299: case 'D':
0300: case 'E':
0301: case 'F':
0302: case 'G':
0303: case 'H':
0304: case 'I':
0305: case 'J':
0306: case 'K':
0307: case 'L':
0308: case 'M':
0309: case 'N':
0310: case 'O':
0311: case 'P':
0312: case 'Q':
0313: case 'R':
0314: case 'S':
0315: case 'T':
0316: case 'U':
0317: case 'V':
0318: case 'W':
0319: case 'X':
0320: case 'Y':
0321: case 'Z':
0322: case '_':
0323: case 'a':
0324: case 'b':
0325: case 'c':
0326: case 'd':
0327: case 'e':
0328: case 'f':
0329: case 'g':
0330: case 'h':
0331: case 'i':
0332: case 'j':
0333: case 'k':
0334: case 'l':
0335: case 'm':
0336: case 'n':
0337: case 'o':
0338: case 'p':
0339: case 'q':
0340: case 'r':
0341: case 's':
0342: case 't':
0343: case 'u':
0344: case 'v':
0345: case 'w':
0346: case 'x':
0347: case 'y':
0348: case 'z': {
0349: break;
0350: }
0351: default: {
0352: throw new NoViableAltForCharException((char) LA(1),
0353: getFilename(), getLine(), getColumn());
0354: }
0355: }
0356: }
0357: mID(true);
0358: id = _returnToken;
0359:
0360: String idt = id.getText();
0361: String mapped = generator
0362: .mapTreeId(id.getText(), transInfo);
0363:
0364: // verify that it's not a preprocessor macro...
0365: if (mapped != null && !idt.equals(mapped)) {
0366: text.setLength(_begin);
0367: text.append(mapped);
0368: } else {
0369: if (idt.equals("if") || idt.equals("define")
0370: || idt.equals("ifdef") || idt.equals("ifndef")
0371: || idt.equals("else") || idt.equals("elif")
0372: || idt.equals("endif") || idt.equals("warning")
0373: || idt.equals("error") || idt.equals("ident")
0374: || idt.equals("pragma")
0375: || idt.equals("include")) {
0376: text.setLength(_begin);
0377: text.append("#" + idt);
0378: }
0379: }
0380:
0381: {
0382: if ((_tokenSet_4.member(LA(1))) && (true) && (true)) {
0383: mWS(false);
0384: } else {
0385: }
0386:
0387: }
0388: {
0389: if ((LA(1) == '=') && (true) && (true)) {
0390: mVAR_ASSIGN(false);
0391: } else {
0392: }
0393:
0394: }
0395: } else if ((LA(1) == '#') && (LA(2) == '[')) {
0396: _saveIndex = text.length();
0397: match('#');
0398: text.setLength(_saveIndex);
0399: mAST_CONSTRUCTOR(true);
0400: ctor = _returnToken;
0401: } else if ((LA(1) == '#') && (LA(2) == '#')) {
0402: match("##");
0403:
0404: if (currentRule != null) {
0405: String r = currentRule.getRuleName() + "_AST";
0406: text.setLength(_begin);
0407: text.append(r);
0408:
0409: if (transInfo != null) {
0410: transInfo.refRuleRoot = r; // we ref root of tree
0411: }
0412: } else {
0413: reportWarning("\"##\" not valid in this context");
0414: text.setLength(_begin);
0415: text.append("##");
0416: }
0417:
0418: {
0419: if ((_tokenSet_4.member(LA(1))) && (true) && (true)) {
0420: mWS(false);
0421: } else {
0422: }
0423:
0424: }
0425: {
0426: if ((LA(1) == '=') && (true) && (true)) {
0427: mVAR_ASSIGN(false);
0428: } else {
0429: }
0430:
0431: }
0432: } else {
0433: throw new NoViableAltForCharException((char) LA(1),
0434: getFilename(), getLine(), getColumn());
0435: }
0436:
0437: if (_createToken && _token == null && _ttype != Token.SKIP) {
0438: _token = makeToken(_ttype);
0439: _token.setText(new String(text.getBuffer(), _begin, text
0440: .length()
0441: - _begin));
0442: }
0443: _returnToken = _token;
0444: }
0445:
0446: protected final void mTEXT_ITEM(boolean _createToken)
0447: throws RecognitionException, CharStreamException,
0448: TokenStreamException {
0449: int _ttype;
0450: Token _token = null;
0451: int _begin = text.length();
0452: _ttype = TEXT_ITEM;
0453: int _saveIndex;
0454: Token a1 = null;
0455: Token a2 = null;
0456: Token a3 = null;
0457: Token a4 = null;
0458: Token a5 = null;
0459: Token a6 = null;
0460:
0461: if ((LA(1) == '$') && (LA(2) == 'F') && (LA(3) == 'O')) {
0462: match("$FOLLOW");
0463: {
0464: if ((_tokenSet_5.member(LA(1)))
0465: && (_tokenSet_6.member(LA(2)))
0466: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
0467: {
0468: switch (LA(1)) {
0469: case '\t':
0470: case '\n':
0471: case '\r':
0472: case ' ': {
0473: mWS(false);
0474: break;
0475: }
0476: case '(': {
0477: break;
0478: }
0479: default: {
0480: throw new NoViableAltForCharException(
0481: (char) LA(1), getFilename(),
0482: getLine(), getColumn());
0483: }
0484: }
0485: }
0486: match('(');
0487: mTEXT_ARG(true);
0488: a5 = _returnToken;
0489: match(')');
0490: } else {
0491: }
0492:
0493: }
0494:
0495: String rule = currentRule.getRuleName();
0496: if (a5 != null) {
0497: rule = a5.getText();
0498: }
0499: String setName = generator.getFOLLOWBitSet(rule, 1);
0500: // System.out.println("FOLLOW("+rule+")="+setName);
0501: if (setName == null) {
0502: reportError("$FOLLOW(" + rule + ")"
0503: + ": unknown rule or bad lookahead computation");
0504: } else {
0505: text.setLength(_begin);
0506: text.append(setName);
0507: }
0508:
0509: } else if ((LA(1) == '$') && (LA(2) == 'F') && (LA(3) == 'I')) {
0510: match("$FIRST");
0511: {
0512: if ((_tokenSet_5.member(LA(1)))
0513: && (_tokenSet_6.member(LA(2)))
0514: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
0515: {
0516: switch (LA(1)) {
0517: case '\t':
0518: case '\n':
0519: case '\r':
0520: case ' ': {
0521: mWS(false);
0522: break;
0523: }
0524: case '(': {
0525: break;
0526: }
0527: default: {
0528: throw new NoViableAltForCharException(
0529: (char) LA(1), getFilename(),
0530: getLine(), getColumn());
0531: }
0532: }
0533: }
0534: match('(');
0535: mTEXT_ARG(true);
0536: a6 = _returnToken;
0537: match(')');
0538: } else {
0539: }
0540:
0541: }
0542:
0543: String rule = currentRule.getRuleName();
0544: if (a6 != null) {
0545: rule = a6.getText();
0546: }
0547: String setName = generator.getFIRSTBitSet(rule, 1);
0548: // System.out.println("FIRST("+rule+")="+setName);
0549: if (setName == null) {
0550: reportError("$FIRST(" + rule + ")"
0551: + ": unknown rule or bad lookahead computation");
0552: } else {
0553: text.setLength(_begin);
0554: text.append(setName);
0555: }
0556:
0557: } else if ((LA(1) == '$') && (LA(2) == 'a')) {
0558: match("$append");
0559: {
0560: switch (LA(1)) {
0561: case '\t':
0562: case '\n':
0563: case '\r':
0564: case ' ': {
0565: mWS(false);
0566: break;
0567: }
0568: case '(': {
0569: break;
0570: }
0571: default: {
0572: throw new NoViableAltForCharException((char) LA(1),
0573: getFilename(), getLine(), getColumn());
0574: }
0575: }
0576: }
0577: match('(');
0578: mTEXT_ARG(true);
0579: a1 = _returnToken;
0580: match(')');
0581:
0582: String t = "text += " + a1.getText();
0583: text.setLength(_begin);
0584: text.append(t);
0585:
0586: } else if ((LA(1) == '$') && (LA(2) == 's')) {
0587: match("$set");
0588: {
0589: if ((LA(1) == 'T') && (LA(2) == 'e')) {
0590: match("Text");
0591: {
0592: switch (LA(1)) {
0593: case '\t':
0594: case '\n':
0595: case '\r':
0596: case ' ': {
0597: mWS(false);
0598: break;
0599: }
0600: case '(': {
0601: break;
0602: }
0603: default: {
0604: throw new NoViableAltForCharException(
0605: (char) LA(1), getFilename(),
0606: getLine(), getColumn());
0607: }
0608: }
0609: }
0610: match('(');
0611: mTEXT_ARG(true);
0612: a2 = _returnToken;
0613: match(')');
0614:
0615: String t;
0616: t = "{ text.erase(_begin); text += " + a2.getText()
0617: + "; }";
0618: text.setLength(_begin);
0619: text.append(t);
0620:
0621: } else if ((LA(1) == 'T') && (LA(2) == 'o')) {
0622: match("Token");
0623: {
0624: switch (LA(1)) {
0625: case '\t':
0626: case '\n':
0627: case '\r':
0628: case ' ': {
0629: mWS(false);
0630: break;
0631: }
0632: case '(': {
0633: break;
0634: }
0635: default: {
0636: throw new NoViableAltForCharException(
0637: (char) LA(1), getFilename(),
0638: getLine(), getColumn());
0639: }
0640: }
0641: }
0642: match('(');
0643: mTEXT_ARG(true);
0644: a3 = _returnToken;
0645: match(')');
0646:
0647: String t = "_token = " + a3.getText();
0648: text.setLength(_begin);
0649: text.append(t);
0650:
0651: } else if ((LA(1) == 'T') && (LA(2) == 'y')) {
0652: match("Type");
0653: {
0654: switch (LA(1)) {
0655: case '\t':
0656: case '\n':
0657: case '\r':
0658: case ' ': {
0659: mWS(false);
0660: break;
0661: }
0662: case '(': {
0663: break;
0664: }
0665: default: {
0666: throw new NoViableAltForCharException(
0667: (char) LA(1), getFilename(),
0668: getLine(), getColumn());
0669: }
0670: }
0671: }
0672: match('(');
0673: mTEXT_ARG(true);
0674: a4 = _returnToken;
0675: match(')');
0676:
0677: String t = "_ttype = " + a4.getText();
0678: text.setLength(_begin);
0679: text.append(t);
0680:
0681: } else {
0682: throw new NoViableAltForCharException((char) LA(1),
0683: getFilename(), getLine(), getColumn());
0684: }
0685:
0686: }
0687: } else if ((LA(1) == '$') && (LA(2) == 'g')) {
0688: match("$getText");
0689:
0690: text.setLength(_begin);
0691: text.append("text.substr(_begin,text.length()-_begin)");
0692:
0693: } else {
0694: throw new NoViableAltForCharException((char) LA(1),
0695: getFilename(), getLine(), getColumn());
0696: }
0697:
0698: if (_createToken && _token == null && _ttype != Token.SKIP) {
0699: _token = makeToken(_ttype);
0700: _token.setText(new String(text.getBuffer(), _begin, text
0701: .length()
0702: - _begin));
0703: }
0704: _returnToken = _token;
0705: }
0706:
0707: protected final void mCOMMENT(boolean _createToken)
0708: throws RecognitionException, CharStreamException,
0709: TokenStreamException {
0710: int _ttype;
0711: Token _token = null;
0712: int _begin = text.length();
0713: _ttype = COMMENT;
0714: int _saveIndex;
0715:
0716: if ((LA(1) == '/') && (LA(2) == '/')) {
0717: mSL_COMMENT(false);
0718: } else if ((LA(1) == '/') && (LA(2) == '*')) {
0719: mML_COMMENT(false);
0720: } else {
0721: throw new NoViableAltForCharException((char) LA(1),
0722: getFilename(), getLine(), getColumn());
0723: }
0724:
0725: if (_createToken && _token == null && _ttype != Token.SKIP) {
0726: _token = makeToken(_ttype);
0727: _token.setText(new String(text.getBuffer(), _begin, text
0728: .length()
0729: - _begin));
0730: }
0731: _returnToken = _token;
0732: }
0733:
0734: protected final void mSTRING(boolean _createToken)
0735: throws RecognitionException, CharStreamException,
0736: TokenStreamException {
0737: int _ttype;
0738: Token _token = null;
0739: int _begin = text.length();
0740: _ttype = STRING;
0741: int _saveIndex;
0742:
0743: match('"');
0744: {
0745: _loop599: do {
0746: if ((LA(1) == '\\')) {
0747: mESC(false);
0748: } else if ((_tokenSet_7.member(LA(1)))) {
0749: matchNot('"');
0750: } else {
0751: break _loop599;
0752: }
0753:
0754: } while (true);
0755: }
0756: match('"');
0757: if (_createToken && _token == null && _ttype != Token.SKIP) {
0758: _token = makeToken(_ttype);
0759: _token.setText(new String(text.getBuffer(), _begin, text
0760: .length()
0761: - _begin));
0762: }
0763: _returnToken = _token;
0764: }
0765:
0766: protected final void mCHAR(boolean _createToken)
0767: throws RecognitionException, CharStreamException,
0768: TokenStreamException {
0769: int _ttype;
0770: Token _token = null;
0771: int _begin = text.length();
0772: _ttype = CHAR;
0773: int _saveIndex;
0774:
0775: match('\'');
0776: {
0777: if ((LA(1) == '\\')) {
0778: mESC(false);
0779: } else if ((_tokenSet_8.member(LA(1)))) {
0780: matchNot('\'');
0781: } else {
0782: throw new NoViableAltForCharException((char) LA(1),
0783: getFilename(), getLine(), getColumn());
0784: }
0785:
0786: }
0787: match('\'');
0788: if (_createToken && _token == null && _ttype != Token.SKIP) {
0789: _token = makeToken(_ttype);
0790: _token.setText(new String(text.getBuffer(), _begin, text
0791: .length()
0792: - _begin));
0793: }
0794: _returnToken = _token;
0795: }
0796:
0797: protected final void mTREE(boolean _createToken)
0798: throws RecognitionException, CharStreamException,
0799: TokenStreamException {
0800: int _ttype;
0801: Token _token = null;
0802: int _begin = text.length();
0803: _ttype = TREE;
0804: int _saveIndex;
0805: Token t = null;
0806: Token t2 = null;
0807:
0808: StringBuffer buf = new StringBuffer();
0809: int n = 0;
0810: Vector terms = new Vector(10);
0811:
0812: _saveIndex = text.length();
0813: match('(');
0814: text.setLength(_saveIndex);
0815: {
0816: switch (LA(1)) {
0817: case '\t':
0818: case '\n':
0819: case '\r':
0820: case ' ': {
0821: _saveIndex = text.length();
0822: mWS(false);
0823: text.setLength(_saveIndex);
0824: break;
0825: }
0826: case '"':
0827: case '#':
0828: case '(':
0829: case ':':
0830: case 'A':
0831: case 'B':
0832: case 'C':
0833: case 'D':
0834: case 'E':
0835: case 'F':
0836: case 'G':
0837: case 'H':
0838: case 'I':
0839: case 'J':
0840: case 'K':
0841: case 'L':
0842: case 'M':
0843: case 'N':
0844: case 'O':
0845: case 'P':
0846: case 'Q':
0847: case 'R':
0848: case 'S':
0849: case 'T':
0850: case 'U':
0851: case 'V':
0852: case 'W':
0853: case 'X':
0854: case 'Y':
0855: case 'Z':
0856: case '[':
0857: case '_':
0858: case 'a':
0859: case 'b':
0860: case 'c':
0861: case 'd':
0862: case 'e':
0863: case 'f':
0864: case 'g':
0865: case 'h':
0866: case 'i':
0867: case 'j':
0868: case 'k':
0869: case 'l':
0870: case 'm':
0871: case 'n':
0872: case 'o':
0873: case 'p':
0874: case 'q':
0875: case 'r':
0876: case 's':
0877: case 't':
0878: case 'u':
0879: case 'v':
0880: case 'w':
0881: case 'x':
0882: case 'y':
0883: case 'z': {
0884: break;
0885: }
0886: default: {
0887: throw new NoViableAltForCharException((char) LA(1),
0888: getFilename(), getLine(), getColumn());
0889: }
0890: }
0891: }
0892: _saveIndex = text.length();
0893: mTREE_ELEMENT(true);
0894: text.setLength(_saveIndex);
0895: t = _returnToken;
0896:
0897: terms.appendElement(generator.processStringForASTConstructor(t
0898: .getText()));
0899:
0900: {
0901: switch (LA(1)) {
0902: case '\t':
0903: case '\n':
0904: case '\r':
0905: case ' ': {
0906: _saveIndex = text.length();
0907: mWS(false);
0908: text.setLength(_saveIndex);
0909: break;
0910: }
0911: case ')':
0912: case ',': {
0913: break;
0914: }
0915: default: {
0916: throw new NoViableAltForCharException((char) LA(1),
0917: getFilename(), getLine(), getColumn());
0918: }
0919: }
0920: }
0921: {
0922: _loop528: do {
0923: if ((LA(1) == ',')) {
0924: _saveIndex = text.length();
0925: match(',');
0926: text.setLength(_saveIndex);
0927: {
0928: switch (LA(1)) {
0929: case '\t':
0930: case '\n':
0931: case '\r':
0932: case ' ': {
0933: _saveIndex = text.length();
0934: mWS(false);
0935: text.setLength(_saveIndex);
0936: break;
0937: }
0938: case '"':
0939: case '#':
0940: case '(':
0941: case ':':
0942: case 'A':
0943: case 'B':
0944: case 'C':
0945: case 'D':
0946: case 'E':
0947: case 'F':
0948: case 'G':
0949: case 'H':
0950: case 'I':
0951: case 'J':
0952: case 'K':
0953: case 'L':
0954: case 'M':
0955: case 'N':
0956: case 'O':
0957: case 'P':
0958: case 'Q':
0959: case 'R':
0960: case 'S':
0961: case 'T':
0962: case 'U':
0963: case 'V':
0964: case 'W':
0965: case 'X':
0966: case 'Y':
0967: case 'Z':
0968: case '[':
0969: case '_':
0970: case 'a':
0971: case 'b':
0972: case 'c':
0973: case 'd':
0974: case 'e':
0975: case 'f':
0976: case 'g':
0977: case 'h':
0978: case 'i':
0979: case 'j':
0980: case 'k':
0981: case 'l':
0982: case 'm':
0983: case 'n':
0984: case 'o':
0985: case 'p':
0986: case 'q':
0987: case 'r':
0988: case 's':
0989: case 't':
0990: case 'u':
0991: case 'v':
0992: case 'w':
0993: case 'x':
0994: case 'y':
0995: case 'z': {
0996: break;
0997: }
0998: default: {
0999: throw new NoViableAltForCharException(
1000: (char) LA(1), getFilename(),
1001: getLine(), getColumn());
1002: }
1003: }
1004: }
1005: _saveIndex = text.length();
1006: mTREE_ELEMENT(true);
1007: text.setLength(_saveIndex);
1008: t2 = _returnToken;
1009:
1010: terms.appendElement(generator
1011: .processStringForASTConstructor(t2
1012: .getText()));
1013:
1014: {
1015: switch (LA(1)) {
1016: case '\t':
1017: case '\n':
1018: case '\r':
1019: case ' ': {
1020: _saveIndex = text.length();
1021: mWS(false);
1022: text.setLength(_saveIndex);
1023: break;
1024: }
1025: case ')':
1026: case ',': {
1027: break;
1028: }
1029: default: {
1030: throw new NoViableAltForCharException(
1031: (char) LA(1), getFilename(),
1032: getLine(), getColumn());
1033: }
1034: }
1035: }
1036: } else {
1037: break _loop528;
1038: }
1039:
1040: } while (true);
1041: }
1042: text.setLength(_begin);
1043: text.append(generator.getASTCreateString(terms));
1044: _saveIndex = text.length();
1045: match(')');
1046: text.setLength(_saveIndex);
1047: if (_createToken && _token == null && _ttype != Token.SKIP) {
1048: _token = makeToken(_ttype);
1049: _token.setText(new String(text.getBuffer(), _begin, text
1050: .length()
1051: - _begin));
1052: }
1053: _returnToken = _token;
1054: }
1055:
1056: protected final void mWS(boolean _createToken)
1057: throws RecognitionException, CharStreamException,
1058: TokenStreamException {
1059: int _ttype;
1060: Token _token = null;
1061: int _begin = text.length();
1062: _ttype = WS;
1063: int _saveIndex;
1064:
1065: {
1066: int _cnt619 = 0;
1067: _loop619: do {
1068: if ((LA(1) == '\r') && (LA(2) == '\n') && (true)) {
1069: match('\r');
1070: match('\n');
1071: newline();
1072: } else if ((LA(1) == ' ') && (true) && (true)) {
1073: match(' ');
1074: } else if ((LA(1) == '\t') && (true) && (true)) {
1075: match('\t');
1076: } else if ((LA(1) == '\r') && (true) && (true)) {
1077: match('\r');
1078: newline();
1079: } else if ((LA(1) == '\n') && (true) && (true)) {
1080: match('\n');
1081: newline();
1082: } else {
1083: if (_cnt619 >= 1) {
1084: break _loop619;
1085: } else {
1086: throw new NoViableAltForCharException(
1087: (char) LA(1), getFilename(), getLine(),
1088: getColumn());
1089: }
1090: }
1091:
1092: _cnt619++;
1093: } while (true);
1094: }
1095: if (_createToken && _token == null && _ttype != Token.SKIP) {
1096: _token = makeToken(_ttype);
1097: _token.setText(new String(text.getBuffer(), _begin, text
1098: .length()
1099: - _begin));
1100: }
1101: _returnToken = _token;
1102: }
1103:
1104: protected final void mID(boolean _createToken)
1105: throws RecognitionException, CharStreamException,
1106: TokenStreamException {
1107: int _ttype;
1108: Token _token = null;
1109: int _begin = text.length();
1110: _ttype = ID;
1111: int _saveIndex;
1112:
1113: {
1114: switch (LA(1)) {
1115: case 'a':
1116: case 'b':
1117: case 'c':
1118: case 'd':
1119: case 'e':
1120: case 'f':
1121: case 'g':
1122: case 'h':
1123: case 'i':
1124: case 'j':
1125: case 'k':
1126: case 'l':
1127: case 'm':
1128: case 'n':
1129: case 'o':
1130: case 'p':
1131: case 'q':
1132: case 'r':
1133: case 's':
1134: case 't':
1135: case 'u':
1136: case 'v':
1137: case 'w':
1138: case 'x':
1139: case 'y':
1140: case 'z': {
1141: matchRange('a', 'z');
1142: break;
1143: }
1144: case 'A':
1145: case 'B':
1146: case 'C':
1147: case 'D':
1148: case 'E':
1149: case 'F':
1150: case 'G':
1151: case 'H':
1152: case 'I':
1153: case 'J':
1154: case 'K':
1155: case 'L':
1156: case 'M':
1157: case 'N':
1158: case 'O':
1159: case 'P':
1160: case 'Q':
1161: case 'R':
1162: case 'S':
1163: case 'T':
1164: case 'U':
1165: case 'V':
1166: case 'W':
1167: case 'X':
1168: case 'Y':
1169: case 'Z': {
1170: matchRange('A', 'Z');
1171: break;
1172: }
1173: case '_': {
1174: match('_');
1175: break;
1176: }
1177: case ':': {
1178: match("::");
1179: break;
1180: }
1181: default: {
1182: throw new NoViableAltForCharException((char) LA(1),
1183: getFilename(), getLine(), getColumn());
1184: }
1185: }
1186: }
1187: {
1188: _loop585: do {
1189: if ((_tokenSet_9.member(LA(1))) && (true) && (true)) {
1190: {
1191: switch (LA(1)) {
1192: case 'a':
1193: case 'b':
1194: case 'c':
1195: case 'd':
1196: case 'e':
1197: case 'f':
1198: case 'g':
1199: case 'h':
1200: case 'i':
1201: case 'j':
1202: case 'k':
1203: case 'l':
1204: case 'm':
1205: case 'n':
1206: case 'o':
1207: case 'p':
1208: case 'q':
1209: case 'r':
1210: case 's':
1211: case 't':
1212: case 'u':
1213: case 'v':
1214: case 'w':
1215: case 'x':
1216: case 'y':
1217: case 'z': {
1218: matchRange('a', 'z');
1219: break;
1220: }
1221: case 'A':
1222: case 'B':
1223: case 'C':
1224: case 'D':
1225: case 'E':
1226: case 'F':
1227: case 'G':
1228: case 'H':
1229: case 'I':
1230: case 'J':
1231: case 'K':
1232: case 'L':
1233: case 'M':
1234: case 'N':
1235: case 'O':
1236: case 'P':
1237: case 'Q':
1238: case 'R':
1239: case 'S':
1240: case 'T':
1241: case 'U':
1242: case 'V':
1243: case 'W':
1244: case 'X':
1245: case 'Y':
1246: case 'Z': {
1247: matchRange('A', 'Z');
1248: break;
1249: }
1250: case '0':
1251: case '1':
1252: case '2':
1253: case '3':
1254: case '4':
1255: case '5':
1256: case '6':
1257: case '7':
1258: case '8':
1259: case '9': {
1260: matchRange('0', '9');
1261: break;
1262: }
1263: case '_': {
1264: match('_');
1265: break;
1266: }
1267: case ':': {
1268: match("::");
1269: break;
1270: }
1271: default: {
1272: throw new NoViableAltForCharException(
1273: (char) LA(1), getFilename(),
1274: getLine(), getColumn());
1275: }
1276: }
1277: }
1278: } else {
1279: break _loop585;
1280: }
1281:
1282: } while (true);
1283: }
1284: if (_createToken && _token == null && _ttype != Token.SKIP) {
1285: _token = makeToken(_ttype);
1286: _token.setText(new String(text.getBuffer(), _begin, text
1287: .length()
1288: - _begin));
1289: }
1290: _returnToken = _token;
1291: }
1292:
1293: protected final void mVAR_ASSIGN(boolean _createToken)
1294: throws RecognitionException, CharStreamException,
1295: TokenStreamException {
1296: int _ttype;
1297: Token _token = null;
1298: int _begin = text.length();
1299: _ttype = VAR_ASSIGN;
1300: int _saveIndex;
1301:
1302: match('=');
1303:
1304: // inform the code generator that an assignment was done to
1305: // AST root for the rule if invoker set refRuleRoot.
1306: if (LA(1) != '=' && transInfo != null
1307: && transInfo.refRuleRoot != null) {
1308: transInfo.assignToRoot = true;
1309: }
1310:
1311: if (_createToken && _token == null && _ttype != Token.SKIP) {
1312: _token = makeToken(_ttype);
1313: _token.setText(new String(text.getBuffer(), _begin, text
1314: .length()
1315: - _begin));
1316: }
1317: _returnToken = _token;
1318: }
1319:
1320: protected final void mAST_CONSTRUCTOR(boolean _createToken)
1321: throws RecognitionException, CharStreamException,
1322: TokenStreamException {
1323: int _ttype;
1324: Token _token = null;
1325: int _begin = text.length();
1326: _ttype = AST_CONSTRUCTOR;
1327: int _saveIndex;
1328: Token x = null;
1329: Token y = null;
1330:
1331: _saveIndex = text.length();
1332: match('[');
1333: text.setLength(_saveIndex);
1334: {
1335: switch (LA(1)) {
1336: case '\t':
1337: case '\n':
1338: case '\r':
1339: case ' ': {
1340: _saveIndex = text.length();
1341: mWS(false);
1342: text.setLength(_saveIndex);
1343: break;
1344: }
1345: case '"':
1346: case '#':
1347: case '(':
1348: case '0':
1349: case '1':
1350: case '2':
1351: case '3':
1352: case '4':
1353: case '5':
1354: case '6':
1355: case '7':
1356: case '8':
1357: case '9':
1358: case ':':
1359: case 'A':
1360: case 'B':
1361: case 'C':
1362: case 'D':
1363: case 'E':
1364: case 'F':
1365: case 'G':
1366: case 'H':
1367: case 'I':
1368: case 'J':
1369: case 'K':
1370: case 'L':
1371: case 'M':
1372: case 'N':
1373: case 'O':
1374: case 'P':
1375: case 'Q':
1376: case 'R':
1377: case 'S':
1378: case 'T':
1379: case 'U':
1380: case 'V':
1381: case 'W':
1382: case 'X':
1383: case 'Y':
1384: case 'Z':
1385: case '[':
1386: case '_':
1387: case 'a':
1388: case 'b':
1389: case 'c':
1390: case 'd':
1391: case 'e':
1392: case 'f':
1393: case 'g':
1394: case 'h':
1395: case 'i':
1396: case 'j':
1397: case 'k':
1398: case 'l':
1399: case 'm':
1400: case 'n':
1401: case 'o':
1402: case 'p':
1403: case 'q':
1404: case 'r':
1405: case 's':
1406: case 't':
1407: case 'u':
1408: case 'v':
1409: case 'w':
1410: case 'x':
1411: case 'y':
1412: case 'z': {
1413: break;
1414: }
1415: default: {
1416: throw new NoViableAltForCharException((char) LA(1),
1417: getFilename(), getLine(), getColumn());
1418: }
1419: }
1420: }
1421: _saveIndex = text.length();
1422: mAST_CTOR_ELEMENT(true);
1423: text.setLength(_saveIndex);
1424: x = _returnToken;
1425: {
1426: switch (LA(1)) {
1427: case '\t':
1428: case '\n':
1429: case '\r':
1430: case ' ': {
1431: _saveIndex = text.length();
1432: mWS(false);
1433: text.setLength(_saveIndex);
1434: break;
1435: }
1436: case ',':
1437: case ']': {
1438: break;
1439: }
1440: default: {
1441: throw new NoViableAltForCharException((char) LA(1),
1442: getFilename(), getLine(), getColumn());
1443: }
1444: }
1445: }
1446: {
1447: switch (LA(1)) {
1448: case ',': {
1449: _saveIndex = text.length();
1450: match(',');
1451: text.setLength(_saveIndex);
1452: {
1453: switch (LA(1)) {
1454: case '\t':
1455: case '\n':
1456: case '\r':
1457: case ' ': {
1458: _saveIndex = text.length();
1459: mWS(false);
1460: text.setLength(_saveIndex);
1461: break;
1462: }
1463: case '"':
1464: case '#':
1465: case '(':
1466: case '0':
1467: case '1':
1468: case '2':
1469: case '3':
1470: case '4':
1471: case '5':
1472: case '6':
1473: case '7':
1474: case '8':
1475: case '9':
1476: case ':':
1477: case 'A':
1478: case 'B':
1479: case 'C':
1480: case 'D':
1481: case 'E':
1482: case 'F':
1483: case 'G':
1484: case 'H':
1485: case 'I':
1486: case 'J':
1487: case 'K':
1488: case 'L':
1489: case 'M':
1490: case 'N':
1491: case 'O':
1492: case 'P':
1493: case 'Q':
1494: case 'R':
1495: case 'S':
1496: case 'T':
1497: case 'U':
1498: case 'V':
1499: case 'W':
1500: case 'X':
1501: case 'Y':
1502: case 'Z':
1503: case '[':
1504: case '_':
1505: case 'a':
1506: case 'b':
1507: case 'c':
1508: case 'd':
1509: case 'e':
1510: case 'f':
1511: case 'g':
1512: case 'h':
1513: case 'i':
1514: case 'j':
1515: case 'k':
1516: case 'l':
1517: case 'm':
1518: case 'n':
1519: case 'o':
1520: case 'p':
1521: case 'q':
1522: case 'r':
1523: case 's':
1524: case 't':
1525: case 'u':
1526: case 'v':
1527: case 'w':
1528: case 'x':
1529: case 'y':
1530: case 'z': {
1531: break;
1532: }
1533: default: {
1534: throw new NoViableAltForCharException(
1535: (char) LA(1), getFilename(), getLine(),
1536: getColumn());
1537: }
1538: }
1539: }
1540: _saveIndex = text.length();
1541: mAST_CTOR_ELEMENT(true);
1542: text.setLength(_saveIndex);
1543: y = _returnToken;
1544: {
1545: switch (LA(1)) {
1546: case '\t':
1547: case '\n':
1548: case '\r':
1549: case ' ': {
1550: _saveIndex = text.length();
1551: mWS(false);
1552: text.setLength(_saveIndex);
1553: break;
1554: }
1555: case ']': {
1556: break;
1557: }
1558: default: {
1559: throw new NoViableAltForCharException(
1560: (char) LA(1), getFilename(), getLine(),
1561: getColumn());
1562: }
1563: }
1564: }
1565: break;
1566: }
1567: case ']': {
1568: break;
1569: }
1570: default: {
1571: throw new NoViableAltForCharException((char) LA(1),
1572: getFilename(), getLine(), getColumn());
1573: }
1574: }
1575: }
1576: _saveIndex = text.length();
1577: match(']');
1578: text.setLength(_saveIndex);
1579:
1580: // System.out.println("AST_CONSTRUCTOR: "+((x==null)?"null":x.getText())+
1581: // ", "+((y==null)?"null":y.getText()));
1582: String ys = generator.processStringForASTConstructor(x
1583: .getText());
1584:
1585: // the second does not need processing coz it's a string
1586: // (eg second param of astFactory.create(x,y)
1587: if (y != null)
1588: ys += "," + y.getText();
1589:
1590: text.setLength(_begin);
1591: text.append(generator.getASTCreateString(null, ys));
1592:
1593: if (_createToken && _token == null && _ttype != Token.SKIP) {
1594: _token = makeToken(_ttype);
1595: _token.setText(new String(text.getBuffer(), _begin, text
1596: .length()
1597: - _begin));
1598: }
1599: _returnToken = _token;
1600: }
1601:
1602: protected final void mTEXT_ARG(boolean _createToken)
1603: throws RecognitionException, CharStreamException,
1604: TokenStreamException {
1605: int _ttype;
1606: Token _token = null;
1607: int _begin = text.length();
1608: _ttype = TEXT_ARG;
1609: int _saveIndex;
1610:
1611: {
1612: switch (LA(1)) {
1613: case '\t':
1614: case '\n':
1615: case '\r':
1616: case ' ': {
1617: mWS(false);
1618: break;
1619: }
1620: case '"':
1621: case '$':
1622: case '\'':
1623: case '+':
1624: case '0':
1625: case '1':
1626: case '2':
1627: case '3':
1628: case '4':
1629: case '5':
1630: case '6':
1631: case '7':
1632: case '8':
1633: case '9':
1634: case ':':
1635: case 'A':
1636: case 'B':
1637: case 'C':
1638: case 'D':
1639: case 'E':
1640: case 'F':
1641: case 'G':
1642: case 'H':
1643: case 'I':
1644: case 'J':
1645: case 'K':
1646: case 'L':
1647: case 'M':
1648: case 'N':
1649: case 'O':
1650: case 'P':
1651: case 'Q':
1652: case 'R':
1653: case 'S':
1654: case 'T':
1655: case 'U':
1656: case 'V':
1657: case 'W':
1658: case 'X':
1659: case 'Y':
1660: case 'Z':
1661: case '_':
1662: case 'a':
1663: case 'b':
1664: case 'c':
1665: case 'd':
1666: case 'e':
1667: case 'f':
1668: case 'g':
1669: case 'h':
1670: case 'i':
1671: case 'j':
1672: case 'k':
1673: case 'l':
1674: case 'm':
1675: case 'n':
1676: case 'o':
1677: case 'p':
1678: case 'q':
1679: case 'r':
1680: case 's':
1681: case 't':
1682: case 'u':
1683: case 'v':
1684: case 'w':
1685: case 'x':
1686: case 'y':
1687: case 'z': {
1688: break;
1689: }
1690: default: {
1691: throw new NoViableAltForCharException((char) LA(1),
1692: getFilename(), getLine(), getColumn());
1693: }
1694: }
1695: }
1696: {
1697: int _cnt559 = 0;
1698: _loop559: do {
1699: if ((_tokenSet_10.member(LA(1)))
1700: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
1701: && (true)) {
1702: mTEXT_ARG_ELEMENT(false);
1703: {
1704: if ((_tokenSet_4.member(LA(1)))
1705: && (_tokenSet_11.member(LA(2)))
1706: && (true)) {
1707: mWS(false);
1708: } else if ((_tokenSet_11.member(LA(1))) && (true) && (true)) {
1709: } else {
1710: throw new NoViableAltForCharException(
1711: (char) LA(1), getFilename(),
1712: getLine(), getColumn());
1713: }
1714:
1715: }
1716: } else {
1717: if (_cnt559 >= 1) {
1718: break _loop559;
1719: } else {
1720: throw new NoViableAltForCharException(
1721: (char) LA(1), getFilename(), getLine(),
1722: getColumn());
1723: }
1724: }
1725:
1726: _cnt559++;
1727: } while (true);
1728: }
1729: if (_createToken && _token == null && _ttype != Token.SKIP) {
1730: _token = makeToken(_ttype);
1731: _token.setText(new String(text.getBuffer(), _begin, text
1732: .length()
1733: - _begin));
1734: }
1735: _returnToken = _token;
1736: }
1737:
1738: protected final void mTREE_ELEMENT(boolean _createToken)
1739: throws RecognitionException, CharStreamException,
1740: TokenStreamException {
1741: int _ttype;
1742: Token _token = null;
1743: int _begin = text.length();
1744: _ttype = TREE_ELEMENT;
1745: int _saveIndex;
1746: Token id = null;
1747: boolean was_mapped;
1748:
1749: switch (LA(1)) {
1750: case '(': {
1751: mTREE(false);
1752: break;
1753: }
1754: case '[': {
1755: mAST_CONSTRUCTOR(false);
1756: break;
1757: }
1758: case ':':
1759: case 'A':
1760: case 'B':
1761: case 'C':
1762: case 'D':
1763: case 'E':
1764: case 'F':
1765: case 'G':
1766: case 'H':
1767: case 'I':
1768: case 'J':
1769: case 'K':
1770: case 'L':
1771: case 'M':
1772: case 'N':
1773: case 'O':
1774: case 'P':
1775: case 'Q':
1776: case 'R':
1777: case 'S':
1778: case 'T':
1779: case 'U':
1780: case 'V':
1781: case 'W':
1782: case 'X':
1783: case 'Y':
1784: case 'Z':
1785: case '_':
1786: case 'a':
1787: case 'b':
1788: case 'c':
1789: case 'd':
1790: case 'e':
1791: case 'f':
1792: case 'g':
1793: case 'h':
1794: case 'i':
1795: case 'j':
1796: case 'k':
1797: case 'l':
1798: case 'm':
1799: case 'n':
1800: case 'o':
1801: case 'p':
1802: case 'q':
1803: case 'r':
1804: case 's':
1805: case 't':
1806: case 'u':
1807: case 'v':
1808: case 'w':
1809: case 'x':
1810: case 'y':
1811: case 'z': {
1812: mID_ELEMENT(false);
1813: break;
1814: }
1815: case '"': {
1816: mSTRING(false);
1817: break;
1818: }
1819: default:
1820: if ((LA(1) == '#') && (LA(2) == '(')) {
1821: _saveIndex = text.length();
1822: match('#');
1823: text.setLength(_saveIndex);
1824: mTREE(false);
1825: } else if ((LA(1) == '#') && (LA(2) == '[')) {
1826: _saveIndex = text.length();
1827: match('#');
1828: text.setLength(_saveIndex);
1829: mAST_CONSTRUCTOR(false);
1830: } else if ((LA(1) == '#') && (_tokenSet_12.member(LA(2)))) {
1831: _saveIndex = text.length();
1832: match('#');
1833: text.setLength(_saveIndex);
1834: was_mapped = mID_ELEMENT(true);
1835: id = _returnToken;
1836: // RK: I have a queer feeling that this maptreeid is redundant..
1837: if (!was_mapped) {
1838: String t = generator.mapTreeId(id.getText(), null);
1839: // System.out.println("mapped: "+id.getText()+" -> "+t);
1840: if (t != null) {
1841: text.setLength(_begin);
1842: text.append(t);
1843: }
1844: }
1845:
1846: } else if ((LA(1) == '#') && (LA(2) == '#')) {
1847: match("##");
1848:
1849: if (currentRule != null) {
1850: String t = currentRule.getRuleName() + "_AST";
1851: text.setLength(_begin);
1852: text.append(t);
1853: } else {
1854: reportError("\"##\" not valid in this context");
1855: text.setLength(_begin);
1856: text.append("##");
1857: }
1858:
1859: } else {
1860: throw new NoViableAltForCharException((char) LA(1),
1861: getFilename(), getLine(), getColumn());
1862: }
1863: }
1864: if (_createToken && _token == null && _ttype != Token.SKIP) {
1865: _token = makeToken(_ttype);
1866: _token.setText(new String(text.getBuffer(), _begin, text
1867: .length()
1868: - _begin));
1869: }
1870: _returnToken = _token;
1871: }
1872:
1873: /** An ID_ELEMENT can be a func call, array ref, simple var,
1874: * or AST label ref.
1875: */
1876: protected final boolean mID_ELEMENT(boolean _createToken)
1877: throws RecognitionException, CharStreamException,
1878: TokenStreamException {
1879: boolean mapped = false;
1880: int _ttype;
1881: Token _token = null;
1882: int _begin = text.length();
1883: _ttype = ID_ELEMENT;
1884: int _saveIndex;
1885: Token id = null;
1886:
1887: mID(true);
1888: id = _returnToken;
1889: {
1890: if ((_tokenSet_4.member(LA(1)))
1891: && (_tokenSet_13.member(LA(2))) && (true)) {
1892: _saveIndex = text.length();
1893: mWS(false);
1894: text.setLength(_saveIndex);
1895: } else if ((_tokenSet_13.member(LA(1))) && (true) && (true)) {
1896: } else {
1897: throw new NoViableAltForCharException((char) LA(1),
1898: getFilename(), getLine(), getColumn());
1899: }
1900:
1901: }
1902: {
1903: switch (LA(1)) {
1904: case '(':
1905: case '<': {
1906: {
1907: switch (LA(1)) {
1908: case '<': {
1909: match('<');
1910: {
1911: _loop542: do {
1912: if ((_tokenSet_14.member(LA(1)))) {
1913: matchNot('>');
1914: } else {
1915: break _loop542;
1916: }
1917:
1918: } while (true);
1919: }
1920: match('>');
1921: break;
1922: }
1923: case '(': {
1924: break;
1925: }
1926: default: {
1927: throw new NoViableAltForCharException(
1928: (char) LA(1), getFilename(), getLine(),
1929: getColumn());
1930: }
1931: }
1932: }
1933: match('(');
1934: {
1935: if ((_tokenSet_4.member(LA(1)))
1936: && (_tokenSet_15.member(LA(2)))
1937: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
1938: _saveIndex = text.length();
1939: mWS(false);
1940: text.setLength(_saveIndex);
1941: } else if ((_tokenSet_15.member(LA(1)))
1942: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
1943: && (true)) {
1944: } else {
1945: throw new NoViableAltForCharException(
1946: (char) LA(1), getFilename(), getLine(),
1947: getColumn());
1948: }
1949:
1950: }
1951: {
1952: switch (LA(1)) {
1953: case '"':
1954: case '#':
1955: case '\'':
1956: case '(':
1957: case '0':
1958: case '1':
1959: case '2':
1960: case '3':
1961: case '4':
1962: case '5':
1963: case '6':
1964: case '7':
1965: case '8':
1966: case '9':
1967: case ':':
1968: case 'A':
1969: case 'B':
1970: case 'C':
1971: case 'D':
1972: case 'E':
1973: case 'F':
1974: case 'G':
1975: case 'H':
1976: case 'I':
1977: case 'J':
1978: case 'K':
1979: case 'L':
1980: case 'M':
1981: case 'N':
1982: case 'O':
1983: case 'P':
1984: case 'Q':
1985: case 'R':
1986: case 'S':
1987: case 'T':
1988: case 'U':
1989: case 'V':
1990: case 'W':
1991: case 'X':
1992: case 'Y':
1993: case 'Z':
1994: case '[':
1995: case '_':
1996: case 'a':
1997: case 'b':
1998: case 'c':
1999: case 'd':
2000: case 'e':
2001: case 'f':
2002: case 'g':
2003: case 'h':
2004: case 'i':
2005: case 'j':
2006: case 'k':
2007: case 'l':
2008: case 'm':
2009: case 'n':
2010: case 'o':
2011: case 'p':
2012: case 'q':
2013: case 'r':
2014: case 's':
2015: case 't':
2016: case 'u':
2017: case 'v':
2018: case 'w':
2019: case 'x':
2020: case 'y':
2021: case 'z': {
2022: mARG(false);
2023: {
2024: _loop547: do {
2025: if ((LA(1) == ',')) {
2026: match(',');
2027: {
2028: switch (LA(1)) {
2029: case '\t':
2030: case '\n':
2031: case '\r':
2032: case ' ': {
2033: _saveIndex = text.length();
2034: mWS(false);
2035: text.setLength(_saveIndex);
2036: break;
2037: }
2038: case '"':
2039: case '#':
2040: case '\'':
2041: case '(':
2042: case '0':
2043: case '1':
2044: case '2':
2045: case '3':
2046: case '4':
2047: case '5':
2048: case '6':
2049: case '7':
2050: case '8':
2051: case '9':
2052: case ':':
2053: case 'A':
2054: case 'B':
2055: case 'C':
2056: case 'D':
2057: case 'E':
2058: case 'F':
2059: case 'G':
2060: case 'H':
2061: case 'I':
2062: case 'J':
2063: case 'K':
2064: case 'L':
2065: case 'M':
2066: case 'N':
2067: case 'O':
2068: case 'P':
2069: case 'Q':
2070: case 'R':
2071: case 'S':
2072: case 'T':
2073: case 'U':
2074: case 'V':
2075: case 'W':
2076: case 'X':
2077: case 'Y':
2078: case 'Z':
2079: case '[':
2080: case '_':
2081: case 'a':
2082: case 'b':
2083: case 'c':
2084: case 'd':
2085: case 'e':
2086: case 'f':
2087: case 'g':
2088: case 'h':
2089: case 'i':
2090: case 'j':
2091: case 'k':
2092: case 'l':
2093: case 'm':
2094: case 'n':
2095: case 'o':
2096: case 'p':
2097: case 'q':
2098: case 'r':
2099: case 's':
2100: case 't':
2101: case 'u':
2102: case 'v':
2103: case 'w':
2104: case 'x':
2105: case 'y':
2106: case 'z': {
2107: break;
2108: }
2109: default: {
2110: throw new NoViableAltForCharException(
2111: (char) LA(1),
2112: getFilename(),
2113: getLine(),
2114: getColumn());
2115: }
2116: }
2117: }
2118: mARG(false);
2119: } else {
2120: break _loop547;
2121: }
2122:
2123: } while (true);
2124: }
2125: break;
2126: }
2127: case '\t':
2128: case '\n':
2129: case '\r':
2130: case ' ':
2131: case ')': {
2132: break;
2133: }
2134: default: {
2135: throw new NoViableAltForCharException(
2136: (char) LA(1), getFilename(), getLine(),
2137: getColumn());
2138: }
2139: }
2140: }
2141: {
2142: switch (LA(1)) {
2143: case '\t':
2144: case '\n':
2145: case '\r':
2146: case ' ': {
2147: _saveIndex = text.length();
2148: mWS(false);
2149: text.setLength(_saveIndex);
2150: break;
2151: }
2152: case ')': {
2153: break;
2154: }
2155: default: {
2156: throw new NoViableAltForCharException(
2157: (char) LA(1), getFilename(), getLine(),
2158: getColumn());
2159: }
2160: }
2161: }
2162: match(')');
2163: break;
2164: }
2165: case '[': {
2166: {
2167: int _cnt552 = 0;
2168: _loop552: do {
2169: if ((LA(1) == '[')) {
2170: match('[');
2171: {
2172: switch (LA(1)) {
2173: case '\t':
2174: case '\n':
2175: case '\r':
2176: case ' ': {
2177: _saveIndex = text.length();
2178: mWS(false);
2179: text.setLength(_saveIndex);
2180: break;
2181: }
2182: case '"':
2183: case '#':
2184: case '\'':
2185: case '(':
2186: case '0':
2187: case '1':
2188: case '2':
2189: case '3':
2190: case '4':
2191: case '5':
2192: case '6':
2193: case '7':
2194: case '8':
2195: case '9':
2196: case ':':
2197: case 'A':
2198: case 'B':
2199: case 'C':
2200: case 'D':
2201: case 'E':
2202: case 'F':
2203: case 'G':
2204: case 'H':
2205: case 'I':
2206: case 'J':
2207: case 'K':
2208: case 'L':
2209: case 'M':
2210: case 'N':
2211: case 'O':
2212: case 'P':
2213: case 'Q':
2214: case 'R':
2215: case 'S':
2216: case 'T':
2217: case 'U':
2218: case 'V':
2219: case 'W':
2220: case 'X':
2221: case 'Y':
2222: case 'Z':
2223: case '[':
2224: case '_':
2225: case 'a':
2226: case 'b':
2227: case 'c':
2228: case 'd':
2229: case 'e':
2230: case 'f':
2231: case 'g':
2232: case 'h':
2233: case 'i':
2234: case 'j':
2235: case 'k':
2236: case 'l':
2237: case 'm':
2238: case 'n':
2239: case 'o':
2240: case 'p':
2241: case 'q':
2242: case 'r':
2243: case 's':
2244: case 't':
2245: case 'u':
2246: case 'v':
2247: case 'w':
2248: case 'x':
2249: case 'y':
2250: case 'z': {
2251: break;
2252: }
2253: default: {
2254: throw new NoViableAltForCharException(
2255: (char) LA(1),
2256: getFilename(), getLine(),
2257: getColumn());
2258: }
2259: }
2260: }
2261: mARG(false);
2262: {
2263: switch (LA(1)) {
2264: case '\t':
2265: case '\n':
2266: case '\r':
2267: case ' ': {
2268: _saveIndex = text.length();
2269: mWS(false);
2270: text.setLength(_saveIndex);
2271: break;
2272: }
2273: case ']': {
2274: break;
2275: }
2276: default: {
2277: throw new NoViableAltForCharException(
2278: (char) LA(1),
2279: getFilename(), getLine(),
2280: getColumn());
2281: }
2282: }
2283: }
2284: match(']');
2285: } else {
2286: if (_cnt552 >= 1) {
2287: break _loop552;
2288: } else {
2289: throw new NoViableAltForCharException(
2290: (char) LA(1), getFilename(),
2291: getLine(), getColumn());
2292: }
2293: }
2294:
2295: _cnt552++;
2296: } while (true);
2297: }
2298: break;
2299: }
2300: case '.': {
2301: match('.');
2302: mID_ELEMENT(false);
2303: break;
2304: }
2305: case ':': {
2306: match("::");
2307: mID_ELEMENT(false);
2308: break;
2309: }
2310: default:
2311: if ((LA(1) == '-') && (LA(2) == '>')
2312: && (_tokenSet_12.member(LA(3)))) {
2313: match("->");
2314: mID_ELEMENT(false);
2315: } else if ((_tokenSet_16.member(LA(1))) && (true) && (true)) {
2316:
2317: mapped = true;
2318: String t = generator.mapTreeId(id.getText(),
2319: transInfo);
2320: // System.out.println("mapped: "+id.getText()+" -> "+t);
2321: if (t != null) {
2322: text.setLength(_begin);
2323: text.append(t);
2324: }
2325:
2326: {
2327: if (((_tokenSet_17.member(LA(1)))
2328: && (_tokenSet_16.member(LA(2))) && (true))
2329: && (transInfo != null && transInfo.refRuleRoot != null)) {
2330: {
2331: switch (LA(1)) {
2332: case '\t':
2333: case '\n':
2334: case '\r':
2335: case ' ': {
2336: mWS(false);
2337: break;
2338: }
2339: case '=': {
2340: break;
2341: }
2342: default: {
2343: throw new NoViableAltForCharException(
2344: (char) LA(1),
2345: getFilename(), getLine(),
2346: getColumn());
2347: }
2348: }
2349: }
2350: mVAR_ASSIGN(false);
2351: } else if ((_tokenSet_18.member(LA(1))) && (true) && (true)) {
2352: } else {
2353: throw new NoViableAltForCharException(
2354: (char) LA(1), getFilename(),
2355: getLine(), getColumn());
2356: }
2357:
2358: }
2359: } else {
2360: throw new NoViableAltForCharException((char) LA(1),
2361: getFilename(), getLine(), getColumn());
2362: }
2363: }
2364: }
2365: if (_createToken && _token == null && _ttype != Token.SKIP) {
2366: _token = makeToken(_ttype);
2367: _token.setText(new String(text.getBuffer(), _begin, text
2368: .length()
2369: - _begin));
2370: }
2371: _returnToken = _token;
2372: return mapped;
2373: }
2374:
2375: /** The arguments of a #[...] constructor are text, token type,
2376: * or a tree.
2377: */
2378: protected final void mAST_CTOR_ELEMENT(boolean _createToken)
2379: throws RecognitionException, CharStreamException,
2380: TokenStreamException {
2381: int _ttype;
2382: Token _token = null;
2383: int _begin = text.length();
2384: _ttype = AST_CTOR_ELEMENT;
2385: int _saveIndex;
2386:
2387: if ((LA(1) == '"')
2388: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
2389: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
2390: mSTRING(false);
2391: } else if ((_tokenSet_19.member(LA(1)))
2392: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')) && (true)) {
2393: mTREE_ELEMENT(false);
2394: } else if (((LA(1) >= '0' && LA(1) <= '9'))) {
2395: mINT(false);
2396: } else {
2397: throw new NoViableAltForCharException((char) LA(1),
2398: getFilename(), getLine(), getColumn());
2399: }
2400:
2401: if (_createToken && _token == null && _ttype != Token.SKIP) {
2402: _token = makeToken(_ttype);
2403: _token.setText(new String(text.getBuffer(), _begin, text
2404: .length()
2405: - _begin));
2406: }
2407: _returnToken = _token;
2408: }
2409:
2410: protected final void mINT(boolean _createToken)
2411: throws RecognitionException, CharStreamException,
2412: TokenStreamException {
2413: int _ttype;
2414: Token _token = null;
2415: int _begin = text.length();
2416: _ttype = INT;
2417: int _saveIndex;
2418:
2419: {
2420: int _cnt610 = 0;
2421: _loop610: do {
2422: if (((LA(1) >= '0' && LA(1) <= '9'))) {
2423: mDIGIT(false);
2424: } else {
2425: if (_cnt610 >= 1) {
2426: break _loop610;
2427: } else {
2428: throw new NoViableAltForCharException(
2429: (char) LA(1), getFilename(), getLine(),
2430: getColumn());
2431: }
2432: }
2433:
2434: _cnt610++;
2435: } while (true);
2436: }
2437: if (_createToken && _token == null && _ttype != Token.SKIP) {
2438: _token = makeToken(_ttype);
2439: _token.setText(new String(text.getBuffer(), _begin, text
2440: .length()
2441: - _begin));
2442: }
2443: _returnToken = _token;
2444: }
2445:
2446: protected final void mARG(boolean _createToken)
2447: throws RecognitionException, CharStreamException,
2448: TokenStreamException {
2449: int _ttype;
2450: Token _token = null;
2451: int _begin = text.length();
2452: _ttype = ARG;
2453: int _saveIndex;
2454:
2455: {
2456: switch (LA(1)) {
2457: case '\'': {
2458: mCHAR(false);
2459: break;
2460: }
2461: case '0':
2462: case '1':
2463: case '2':
2464: case '3':
2465: case '4':
2466: case '5':
2467: case '6':
2468: case '7':
2469: case '8':
2470: case '9': {
2471: mINT_OR_FLOAT(false);
2472: break;
2473: }
2474: default:
2475: if ((_tokenSet_19.member(LA(1)))
2476: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
2477: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
2478: mTREE_ELEMENT(false);
2479: } else if ((LA(1) == '"')
2480: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
2481: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
2482: mSTRING(false);
2483: } else {
2484: throw new NoViableAltForCharException((char) LA(1),
2485: getFilename(), getLine(), getColumn());
2486: }
2487: }
2488: }
2489: {
2490: _loop580: do {
2491: if ((_tokenSet_20.member(LA(1)))
2492: && (_tokenSet_21.member(LA(2)))
2493: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
2494: {
2495: switch (LA(1)) {
2496: case '\t':
2497: case '\n':
2498: case '\r':
2499: case ' ': {
2500: mWS(false);
2501: break;
2502: }
2503: case '*':
2504: case '+':
2505: case '-':
2506: case '/': {
2507: break;
2508: }
2509: default: {
2510: throw new NoViableAltForCharException(
2511: (char) LA(1), getFilename(),
2512: getLine(), getColumn());
2513: }
2514: }
2515: }
2516: {
2517: switch (LA(1)) {
2518: case '+': {
2519: match('+');
2520: break;
2521: }
2522: case '-': {
2523: match('-');
2524: break;
2525: }
2526: case '*': {
2527: match('*');
2528: break;
2529: }
2530: case '/': {
2531: match('/');
2532: break;
2533: }
2534: default: {
2535: throw new NoViableAltForCharException(
2536: (char) LA(1), getFilename(),
2537: getLine(), getColumn());
2538: }
2539: }
2540: }
2541: {
2542: switch (LA(1)) {
2543: case '\t':
2544: case '\n':
2545: case '\r':
2546: case ' ': {
2547: mWS(false);
2548: break;
2549: }
2550: case '"':
2551: case '#':
2552: case '\'':
2553: case '(':
2554: case '0':
2555: case '1':
2556: case '2':
2557: case '3':
2558: case '4':
2559: case '5':
2560: case '6':
2561: case '7':
2562: case '8':
2563: case '9':
2564: case ':':
2565: case 'A':
2566: case 'B':
2567: case 'C':
2568: case 'D':
2569: case 'E':
2570: case 'F':
2571: case 'G':
2572: case 'H':
2573: case 'I':
2574: case 'J':
2575: case 'K':
2576: case 'L':
2577: case 'M':
2578: case 'N':
2579: case 'O':
2580: case 'P':
2581: case 'Q':
2582: case 'R':
2583: case 'S':
2584: case 'T':
2585: case 'U':
2586: case 'V':
2587: case 'W':
2588: case 'X':
2589: case 'Y':
2590: case 'Z':
2591: case '[':
2592: case '_':
2593: case 'a':
2594: case 'b':
2595: case 'c':
2596: case 'd':
2597: case 'e':
2598: case 'f':
2599: case 'g':
2600: case 'h':
2601: case 'i':
2602: case 'j':
2603: case 'k':
2604: case 'l':
2605: case 'm':
2606: case 'n':
2607: case 'o':
2608: case 'p':
2609: case 'q':
2610: case 'r':
2611: case 's':
2612: case 't':
2613: case 'u':
2614: case 'v':
2615: case 'w':
2616: case 'x':
2617: case 'y':
2618: case 'z': {
2619: break;
2620: }
2621: default: {
2622: throw new NoViableAltForCharException(
2623: (char) LA(1), getFilename(),
2624: getLine(), getColumn());
2625: }
2626: }
2627: }
2628: mARG(false);
2629: } else {
2630: break _loop580;
2631: }
2632:
2633: } while (true);
2634: }
2635: if (_createToken && _token == null && _ttype != Token.SKIP) {
2636: _token = makeToken(_ttype);
2637: _token.setText(new String(text.getBuffer(), _begin, text
2638: .length()
2639: - _begin));
2640: }
2641: _returnToken = _token;
2642: }
2643:
2644: protected final void mTEXT_ARG_ELEMENT(boolean _createToken)
2645: throws RecognitionException, CharStreamException,
2646: TokenStreamException {
2647: int _ttype;
2648: Token _token = null;
2649: int _begin = text.length();
2650: _ttype = TEXT_ARG_ELEMENT;
2651: int _saveIndex;
2652:
2653: switch (LA(1)) {
2654: case ':':
2655: case 'A':
2656: case 'B':
2657: case 'C':
2658: case 'D':
2659: case 'E':
2660: case 'F':
2661: case 'G':
2662: case 'H':
2663: case 'I':
2664: case 'J':
2665: case 'K':
2666: case 'L':
2667: case 'M':
2668: case 'N':
2669: case 'O':
2670: case 'P':
2671: case 'Q':
2672: case 'R':
2673: case 'S':
2674: case 'T':
2675: case 'U':
2676: case 'V':
2677: case 'W':
2678: case 'X':
2679: case 'Y':
2680: case 'Z':
2681: case '_':
2682: case 'a':
2683: case 'b':
2684: case 'c':
2685: case 'd':
2686: case 'e':
2687: case 'f':
2688: case 'g':
2689: case 'h':
2690: case 'i':
2691: case 'j':
2692: case 'k':
2693: case 'l':
2694: case 'm':
2695: case 'n':
2696: case 'o':
2697: case 'p':
2698: case 'q':
2699: case 'r':
2700: case 's':
2701: case 't':
2702: case 'u':
2703: case 'v':
2704: case 'w':
2705: case 'x':
2706: case 'y':
2707: case 'z': {
2708: mTEXT_ARG_ID_ELEMENT(false);
2709: break;
2710: }
2711: case '"': {
2712: mSTRING(false);
2713: break;
2714: }
2715: case '\'': {
2716: mCHAR(false);
2717: break;
2718: }
2719: case '0':
2720: case '1':
2721: case '2':
2722: case '3':
2723: case '4':
2724: case '5':
2725: case '6':
2726: case '7':
2727: case '8':
2728: case '9': {
2729: mINT_OR_FLOAT(false);
2730: break;
2731: }
2732: case '$': {
2733: mTEXT_ITEM(false);
2734: break;
2735: }
2736: case '+': {
2737: match('+');
2738: break;
2739: }
2740: default: {
2741: throw new NoViableAltForCharException((char) LA(1),
2742: getFilename(), getLine(), getColumn());
2743: }
2744: }
2745: if (_createToken && _token == null && _ttype != Token.SKIP) {
2746: _token = makeToken(_ttype);
2747: _token.setText(new String(text.getBuffer(), _begin, text
2748: .length()
2749: - _begin));
2750: }
2751: _returnToken = _token;
2752: }
2753:
2754: protected final void mTEXT_ARG_ID_ELEMENT(boolean _createToken)
2755: throws RecognitionException, CharStreamException,
2756: TokenStreamException {
2757: int _ttype;
2758: Token _token = null;
2759: int _begin = text.length();
2760: _ttype = TEXT_ARG_ID_ELEMENT;
2761: int _saveIndex;
2762: Token id = null;
2763:
2764: mID(true);
2765: id = _returnToken;
2766: {
2767: if ((_tokenSet_4.member(LA(1)))
2768: && (_tokenSet_22.member(LA(2))) && (true)) {
2769: _saveIndex = text.length();
2770: mWS(false);
2771: text.setLength(_saveIndex);
2772: } else if ((_tokenSet_22.member(LA(1))) && (true) && (true)) {
2773: } else {
2774: throw new NoViableAltForCharException((char) LA(1),
2775: getFilename(), getLine(), getColumn());
2776: }
2777:
2778: }
2779: {
2780: switch (LA(1)) {
2781: case '(': {
2782: match('(');
2783: {
2784: if ((_tokenSet_4.member(LA(1)))
2785: && (_tokenSet_23.member(LA(2)))
2786: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
2787: _saveIndex = text.length();
2788: mWS(false);
2789: text.setLength(_saveIndex);
2790: } else if ((_tokenSet_23.member(LA(1)))
2791: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
2792: && (true)) {
2793: } else {
2794: throw new NoViableAltForCharException(
2795: (char) LA(1), getFilename(), getLine(),
2796: getColumn());
2797: }
2798:
2799: }
2800: {
2801: _loop568: do {
2802: if ((_tokenSet_24.member(LA(1)))
2803: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
2804: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
2805: mTEXT_ARG(false);
2806: {
2807: _loop567: do {
2808: if ((LA(1) == ',')) {
2809: match(',');
2810: mTEXT_ARG(false);
2811: } else {
2812: break _loop567;
2813: }
2814:
2815: } while (true);
2816: }
2817: } else {
2818: break _loop568;
2819: }
2820:
2821: } while (true);
2822: }
2823: {
2824: switch (LA(1)) {
2825: case '\t':
2826: case '\n':
2827: case '\r':
2828: case ' ': {
2829: _saveIndex = text.length();
2830: mWS(false);
2831: text.setLength(_saveIndex);
2832: break;
2833: }
2834: case ')': {
2835: break;
2836: }
2837: default: {
2838: throw new NoViableAltForCharException(
2839: (char) LA(1), getFilename(), getLine(),
2840: getColumn());
2841: }
2842: }
2843: }
2844: match(')');
2845: break;
2846: }
2847: case '[': {
2848: {
2849: int _cnt573 = 0;
2850: _loop573: do {
2851: if ((LA(1) == '[')) {
2852: match('[');
2853: {
2854: if ((_tokenSet_4.member(LA(1)))
2855: && (_tokenSet_24.member(LA(2)))
2856: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
2857: _saveIndex = text.length();
2858: mWS(false);
2859: text.setLength(_saveIndex);
2860: } else if ((_tokenSet_24.member(LA(1)))
2861: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
2862: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
2863: } else {
2864: throw new NoViableAltForCharException(
2865: (char) LA(1),
2866: getFilename(), getLine(),
2867: getColumn());
2868: }
2869:
2870: }
2871: mTEXT_ARG(false);
2872: {
2873: switch (LA(1)) {
2874: case '\t':
2875: case '\n':
2876: case '\r':
2877: case ' ': {
2878: _saveIndex = text.length();
2879: mWS(false);
2880: text.setLength(_saveIndex);
2881: break;
2882: }
2883: case ']': {
2884: break;
2885: }
2886: default: {
2887: throw new NoViableAltForCharException(
2888: (char) LA(1),
2889: getFilename(), getLine(),
2890: getColumn());
2891: }
2892: }
2893: }
2894: match(']');
2895: } else {
2896: if (_cnt573 >= 1) {
2897: break _loop573;
2898: } else {
2899: throw new NoViableAltForCharException(
2900: (char) LA(1), getFilename(),
2901: getLine(), getColumn());
2902: }
2903: }
2904:
2905: _cnt573++;
2906: } while (true);
2907: }
2908: break;
2909: }
2910: case '.': {
2911: match('.');
2912: mTEXT_ARG_ID_ELEMENT(false);
2913: break;
2914: }
2915: case '-': {
2916: match("->");
2917: mTEXT_ARG_ID_ELEMENT(false);
2918: break;
2919: }
2920: default:
2921: if ((LA(1) == ':') && (LA(2) == ':')
2922: && (_tokenSet_12.member(LA(3)))) {
2923: match("::");
2924: mTEXT_ARG_ID_ELEMENT(false);
2925: } else if ((_tokenSet_11.member(LA(1))) && (true) && (true)) {
2926: } else {
2927: throw new NoViableAltForCharException((char) LA(1),
2928: getFilename(), getLine(), getColumn());
2929: }
2930: }
2931: }
2932: if (_createToken && _token == null && _ttype != Token.SKIP) {
2933: _token = makeToken(_ttype);
2934: _token.setText(new String(text.getBuffer(), _begin, text
2935: .length()
2936: - _begin));
2937: }
2938: _returnToken = _token;
2939: }
2940:
2941: protected final void mINT_OR_FLOAT(boolean _createToken)
2942: throws RecognitionException, CharStreamException,
2943: TokenStreamException {
2944: int _ttype;
2945: Token _token = null;
2946: int _begin = text.length();
2947: _ttype = INT_OR_FLOAT;
2948: int _saveIndex;
2949:
2950: {
2951: int _cnt613 = 0;
2952: _loop613: do {
2953: if (((LA(1) >= '0' && LA(1) <= '9'))
2954: && (_tokenSet_25.member(LA(2))) && (true)) {
2955: mDIGIT(false);
2956: } else {
2957: if (_cnt613 >= 1) {
2958: break _loop613;
2959: } else {
2960: throw new NoViableAltForCharException(
2961: (char) LA(1), getFilename(), getLine(),
2962: getColumn());
2963: }
2964: }
2965:
2966: _cnt613++;
2967: } while (true);
2968: }
2969: {
2970: if ((LA(1) == 'L') && (_tokenSet_26.member(LA(2)))
2971: && (true)) {
2972: match('L');
2973: } else if ((LA(1) == 'l') && (_tokenSet_26.member(LA(2)))
2974: && (true)) {
2975: match('l');
2976: } else if ((LA(1) == '.')) {
2977: match('.');
2978: {
2979: _loop616: do {
2980: if (((LA(1) >= '0' && LA(1) <= '9'))
2981: && (_tokenSet_26.member(LA(2)))
2982: && (true)) {
2983: mDIGIT(false);
2984: } else {
2985: break _loop616;
2986: }
2987:
2988: } while (true);
2989: }
2990: } else if ((_tokenSet_26.member(LA(1))) && (true) && (true)) {
2991: } else {
2992: throw new NoViableAltForCharException((char) LA(1),
2993: getFilename(), getLine(), getColumn());
2994: }
2995:
2996: }
2997: if (_createToken && _token == null && _ttype != Token.SKIP) {
2998: _token = makeToken(_ttype);
2999: _token.setText(new String(text.getBuffer(), _begin, text
3000: .length()
3001: - _begin));
3002: }
3003: _returnToken = _token;
3004: }
3005:
3006: protected final void mSL_COMMENT(boolean _createToken)
3007: throws RecognitionException, CharStreamException,
3008: TokenStreamException {
3009: int _ttype;
3010: Token _token = null;
3011: int _begin = text.length();
3012: _ttype = SL_COMMENT;
3013: int _saveIndex;
3014:
3015: match("//");
3016: {
3017: _loop590: do {
3018: // nongreedy exit test
3019: if ((LA(1) == '\n' || LA(1) == '\r') && (true) && (true))
3020: break _loop590;
3021: if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff'))
3022: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
3023: && (true)) {
3024: matchNot(EOF_CHAR);
3025: } else {
3026: break _loop590;
3027: }
3028:
3029: } while (true);
3030: }
3031: {
3032: if ((LA(1) == '\r') && (LA(2) == '\n') && (true)) {
3033: match("\r\n");
3034: } else if ((LA(1) == '\n')) {
3035: match('\n');
3036: } else if ((LA(1) == '\r') && (true) && (true)) {
3037: match('\r');
3038: } else {
3039: throw new NoViableAltForCharException((char) LA(1),
3040: getFilename(), getLine(), getColumn());
3041: }
3042:
3043: }
3044: newline();
3045: if (_createToken && _token == null && _ttype != Token.SKIP) {
3046: _token = makeToken(_ttype);
3047: _token.setText(new String(text.getBuffer(), _begin, text
3048: .length()
3049: - _begin));
3050: }
3051: _returnToken = _token;
3052: }
3053:
3054: protected final void mML_COMMENT(boolean _createToken)
3055: throws RecognitionException, CharStreamException,
3056: TokenStreamException {
3057: int _ttype;
3058: Token _token = null;
3059: int _begin = text.length();
3060: _ttype = ML_COMMENT;
3061: int _saveIndex;
3062:
3063: match("/*");
3064: {
3065: _loop594: do {
3066: // nongreedy exit test
3067: if ((LA(1) == '*') && (LA(2) == '/') && (true))
3068: break _loop594;
3069: if ((LA(1) == '\r') && (LA(2) == '\n')
3070: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
3071: match('\r');
3072: match('\n');
3073: newline();
3074: } else if ((LA(1) == '\r')
3075: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
3076: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
3077: match('\r');
3078: newline();
3079: } else if ((LA(1) == '\n')
3080: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
3081: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
3082: match('\n');
3083: newline();
3084: } else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff'))
3085: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
3086: && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
3087: matchNot(EOF_CHAR);
3088: } else {
3089: break _loop594;
3090: }
3091:
3092: } while (true);
3093: }
3094: match("*/");
3095: if (_createToken && _token == null && _ttype != Token.SKIP) {
3096: _token = makeToken(_ttype);
3097: _token.setText(new String(text.getBuffer(), _begin, text
3098: .length()
3099: - _begin));
3100: }
3101: _returnToken = _token;
3102: }
3103:
3104: protected final void mESC(boolean _createToken)
3105: throws RecognitionException, CharStreamException,
3106: TokenStreamException {
3107: int _ttype;
3108: Token _token = null;
3109: int _begin = text.length();
3110: _ttype = ESC;
3111: int _saveIndex;
3112:
3113: match('\\');
3114: {
3115: switch (LA(1)) {
3116: case 'n': {
3117: match('n');
3118: break;
3119: }
3120: case 'r': {
3121: match('r');
3122: break;
3123: }
3124: case 't': {
3125: match('t');
3126: break;
3127: }
3128: case 'v': {
3129: match('v');
3130: break;
3131: }
3132: case 'b': {
3133: match('b');
3134: break;
3135: }
3136: case 'f': {
3137: match('f');
3138: break;
3139: }
3140: case '"': {
3141: match('"');
3142: break;
3143: }
3144: case '\'': {
3145: match('\'');
3146: break;
3147: }
3148: case '\\': {
3149: match('\\');
3150: break;
3151: }
3152: case '0':
3153: case '1':
3154: case '2':
3155: case '3': {
3156: {
3157: matchRange('0', '3');
3158: }
3159: {
3160: if (((LA(1) >= '0' && LA(1) <= '9'))
3161: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
3162: && (true)) {
3163: mDIGIT(false);
3164: {
3165: if (((LA(1) >= '0' && LA(1) <= '9'))
3166: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
3167: && (true)) {
3168: mDIGIT(false);
3169: } else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) {
3170: } else {
3171: throw new NoViableAltForCharException(
3172: (char) LA(1), getFilename(),
3173: getLine(), getColumn());
3174: }
3175:
3176: }
3177: } else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) {
3178: } else {
3179: throw new NoViableAltForCharException(
3180: (char) LA(1), getFilename(), getLine(),
3181: getColumn());
3182: }
3183:
3184: }
3185: break;
3186: }
3187: case '4':
3188: case '5':
3189: case '6':
3190: case '7': {
3191: {
3192: matchRange('4', '7');
3193: }
3194: {
3195: if (((LA(1) >= '0' && LA(1) <= '9'))
3196: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))
3197: && (true)) {
3198: mDIGIT(false);
3199: } else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true) && (true)) {
3200: } else {
3201: throw new NoViableAltForCharException(
3202: (char) LA(1), getFilename(), getLine(),
3203: getColumn());
3204: }
3205:
3206: }
3207: break;
3208: }
3209: default: {
3210: throw new NoViableAltForCharException((char) LA(1),
3211: getFilename(), getLine(), getColumn());
3212: }
3213: }
3214: }
3215: if (_createToken && _token == null && _ttype != Token.SKIP) {
3216: _token = makeToken(_ttype);
3217: _token.setText(new String(text.getBuffer(), _begin, text
3218: .length()
3219: - _begin));
3220: }
3221: _returnToken = _token;
3222: }
3223:
3224: protected final void mDIGIT(boolean _createToken)
3225: throws RecognitionException, CharStreamException,
3226: TokenStreamException {
3227: int _ttype;
3228: Token _token = null;
3229: int _begin = text.length();
3230: _ttype = DIGIT;
3231: int _saveIndex;
3232:
3233: matchRange('0', '9');
3234: if (_createToken && _token == null && _ttype != Token.SKIP) {
3235: _token = makeToken(_ttype);
3236: _token.setText(new String(text.getBuffer(), _begin, text
3237: .length()
3238: - _begin));
3239: }
3240: _returnToken = _token;
3241: }
3242:
3243: private static final long[] mk_tokenSet_0() {
3244: long[] data = new long[8];
3245: data[0] = -103079215112L;
3246: for (int i = 1; i <= 3; i++) {
3247: data[i] = -1L;
3248: }
3249: return data;
3250: }
3251:
3252: public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
3253:
3254: private static final long[] mk_tokenSet_1() {
3255: long[] data = new long[8];
3256: data[0] = -145135534866440L;
3257: for (int i = 1; i <= 3; i++) {
3258: data[i] = -1L;
3259: }
3260: return data;
3261: }
3262:
3263: public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
3264:
3265: private static final long[] mk_tokenSet_2() {
3266: long[] data = new long[8];
3267: data[0] = -141407503262728L;
3268: for (int i = 1; i <= 3; i++) {
3269: data[i] = -1L;
3270: }
3271: return data;
3272: }
3273:
3274: public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
3275:
3276: private static final long[] mk_tokenSet_3() {
3277: long[] data = { 288230380446688768L, 576460745995190270L, 0L,
3278: 0L, 0L };
3279: return data;
3280: }
3281:
3282: public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
3283:
3284: private static final long[] mk_tokenSet_4() {
3285: long[] data = { 4294977024L, 0L, 0L, 0L, 0L };
3286: return data;
3287: }
3288:
3289: public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
3290:
3291: private static final long[] mk_tokenSet_5() {
3292: long[] data = { 1103806604800L, 0L, 0L, 0L, 0L };
3293: return data;
3294: }
3295:
3296: public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
3297:
3298: private static final long[] mk_tokenSet_6() {
3299: long[] data = { 576189812881499648L, 576460745995190270L, 0L,
3300: 0L, 0L };
3301: return data;
3302: }
3303:
3304: public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
3305:
3306: private static final long[] mk_tokenSet_7() {
3307: long[] data = new long[8];
3308: data[0] = -17179869192L;
3309: data[1] = -268435457L;
3310: for (int i = 2; i <= 3; i++) {
3311: data[i] = -1L;
3312: }
3313: return data;
3314: }
3315:
3316: public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7());
3317:
3318: private static final long[] mk_tokenSet_8() {
3319: long[] data = new long[8];
3320: data[0] = -549755813896L;
3321: data[1] = -268435457L;
3322: for (int i = 2; i <= 3; i++) {
3323: data[i] = -1L;
3324: }
3325: return data;
3326: }
3327:
3328: public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8());
3329:
3330: private static final long[] mk_tokenSet_9() {
3331: long[] data = { 576179277326712832L, 576460745995190270L, 0L,
3332: 0L, 0L };
3333: return data;
3334: }
3335:
3336: public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9());
3337:
3338: private static final long[] mk_tokenSet_10() {
3339: long[] data = { 576188709074894848L, 576460745995190270L, 0L,
3340: 0L, 0L };
3341: return data;
3342: }
3343:
3344: public static final BitSet _tokenSet_10 = new BitSet(
3345: mk_tokenSet_10());
3346:
3347: private static final long[] mk_tokenSet_11() {
3348: long[] data = { 576208504579171840L, 576460746532061182L, 0L,
3349: 0L, 0L };
3350: return data;
3351: }
3352:
3353: public static final BitSet _tokenSet_11 = new BitSet(
3354: mk_tokenSet_11());
3355:
3356: private static final long[] mk_tokenSet_12() {
3357: long[] data = { 288230376151711744L, 576460745995190270L, 0L,
3358: 0L, 0L };
3359: return data;
3360: }
3361:
3362: public static final BitSet _tokenSet_12 = new BitSet(
3363: mk_tokenSet_12());
3364:
3365: private static final long[] mk_tokenSet_13() {
3366: long[] data = { 3747275269732312576L, 671088640L, 0L, 0L, 0L };
3367: return data;
3368: }
3369:
3370: public static final BitSet _tokenSet_13 = new BitSet(
3371: mk_tokenSet_13());
3372:
3373: private static final long[] mk_tokenSet_14() {
3374: long[] data = new long[8];
3375: data[0] = -4611686018427387912L;
3376: for (int i = 1; i <= 3; i++) {
3377: data[i] = -1L;
3378: }
3379: return data;
3380: }
3381:
3382: public static final BitSet _tokenSet_14 = new BitSet(
3383: mk_tokenSet_14());
3384:
3385: private static final long[] mk_tokenSet_15() {
3386: long[] data = { 576183181451994624L, 576460746129407998L, 0L,
3387: 0L, 0L };
3388: return data;
3389: }
3390:
3391: public static final BitSet _tokenSet_15 = new BitSet(
3392: mk_tokenSet_15());
3393:
3394: private static final long[] mk_tokenSet_16() {
3395: long[] data = { 2306051920717948416L, 536870912L, 0L, 0L, 0L };
3396: return data;
3397: }
3398:
3399: public static final BitSet _tokenSet_16 = new BitSet(
3400: mk_tokenSet_16());
3401:
3402: private static final long[] mk_tokenSet_17() {
3403: long[] data = { 2305843013508670976L, 0L, 0L, 0L, 0L };
3404: return data;
3405: }
3406:
3407: public static final BitSet _tokenSet_17 = new BitSet(
3408: mk_tokenSet_17());
3409:
3410: private static final long[] mk_tokenSet_18() {
3411: long[] data = { 208911504254464L, 536870912L, 0L, 0L, 0L };
3412: return data;
3413: }
3414:
3415: public static final BitSet _tokenSet_18 = new BitSet(
3416: mk_tokenSet_18());
3417:
3418: private static final long[] mk_tokenSet_19() {
3419: long[] data = { 288231527202947072L, 576460746129407998L, 0L,
3420: 0L, 0L };
3421: return data;
3422: }
3423:
3424: public static final BitSet _tokenSet_19 = new BitSet(
3425: mk_tokenSet_19());
3426:
3427: private static final long[] mk_tokenSet_20() {
3428: long[] data = { 189120294954496L, 0L, 0L, 0L, 0L };
3429: return data;
3430: }
3431:
3432: public static final BitSet _tokenSet_20 = new BitSet(
3433: mk_tokenSet_20());
3434:
3435: private static final long[] mk_tokenSet_21() {
3436: long[] data = { 576370098428716544L, 576460746129407998L, 0L,
3437: 0L, 0L };
3438: return data;
3439: }
3440:
3441: public static final BitSet _tokenSet_21 = new BitSet(
3442: mk_tokenSet_21());
3443:
3444: private static final long[] mk_tokenSet_22() {
3445: long[] data = { 576315157207066112L, 576460746666278910L, 0L,
3446: 0L, 0L };
3447: return data;
3448: }
3449:
3450: public static final BitSet _tokenSet_22 = new BitSet(
3451: mk_tokenSet_22());
3452:
3453: private static final long[] mk_tokenSet_23() {
3454: long[] data = { 576190912393127424L, 576460745995190270L, 0L,
3455: 0L, 0L };
3456: return data;
3457: }
3458:
3459: public static final BitSet _tokenSet_23 = new BitSet(
3460: mk_tokenSet_23());
3461:
3462: private static final long[] mk_tokenSet_24() {
3463: long[] data = { 576188713369871872L, 576460745995190270L, 0L,
3464: 0L, 0L };
3465: return data;
3466: }
3467:
3468: public static final BitSet _tokenSet_24 = new BitSet(
3469: mk_tokenSet_24());
3470:
3471: private static final long[] mk_tokenSet_25() {
3472: long[] data = { 576459193230304768L, 576460746532061182L, 0L,
3473: 0L, 0L };
3474: return data;
3475: }
3476:
3477: public static final BitSet _tokenSet_25 = new BitSet(
3478: mk_tokenSet_25());
3479:
3480: private static final long[] mk_tokenSet_26() {
3481: long[] data = { 576388824486127104L, 576460746532061182L, 0L,
3482: 0L, 0L };
3483: return data;
3484: }
3485:
3486: public static final BitSet _tokenSet_26 = new BitSet(
3487: mk_tokenSet_26());
3488:
3489: }
|