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