0001: // $ANTLR 2.7.5 (20050128): "expression.g" -> "ExpressionLexer.java"$
0002:
0003: package biz.hammurapi.eval;
0004:
0005: import java.io.InputStream;
0006: import antlr.TokenStreamException;
0007: import antlr.TokenStreamIOException;
0008: import antlr.TokenStreamRecognitionException;
0009: import antlr.CharStreamException;
0010: import antlr.CharStreamIOException;
0011: import antlr.ANTLRException;
0012: import java.io.Reader;
0013: import java.util.Hashtable;
0014: import antlr.CharScanner;
0015: import antlr.InputBuffer;
0016: import antlr.ByteBuffer;
0017: import antlr.CharBuffer;
0018: import antlr.Token;
0019: import antlr.CommonToken;
0020: import antlr.RecognitionException;
0021: import antlr.NoViableAltForCharException;
0022: import antlr.MismatchedCharException;
0023: import antlr.TokenStream;
0024: import antlr.ANTLRHashString;
0025: import antlr.LexerSharedInputState;
0026: import antlr.collections.impl.BitSet;
0027: import antlr.SemanticException;
0028:
0029: public class ExpressionLexer extends antlr.CharScanner implements
0030: ExpressionTokenTypes, TokenStream {
0031: public ExpressionLexer(InputStream in) {
0032: this (new ByteBuffer(in));
0033: }
0034:
0035: public ExpressionLexer(Reader in) {
0036: this (new CharBuffer(in));
0037: }
0038:
0039: public ExpressionLexer(InputBuffer ib) {
0040: this (new LexerSharedInputState(ib));
0041: }
0042:
0043: public ExpressionLexer(LexerSharedInputState state) {
0044: super (state);
0045: caseSensitiveLiterals = true;
0046: setCaseSensitive(true);
0047: literals = new Hashtable();
0048: literals.put(new ANTLRHashString("short", this ),
0049: new Integer(34));
0050: literals.put(new ANTLRHashString("boolean", this ), new Integer(
0051: 31));
0052: literals.put(new ANTLRHashString("float", this ),
0053: new Integer(36));
0054: literals
0055: .put(new ANTLRHashString("char", this ), new Integer(33));
0056: literals
0057: .put(new ANTLRHashString("null", this ), new Integer(23));
0058: literals.put(new ANTLRHashString("double", this ), new Integer(
0059: 38));
0060: literals
0061: .put(new ANTLRHashString("byte", this ), new Integer(32));
0062: literals
0063: .put(new ANTLRHashString("true", this ), new Integer(21));
0064: literals
0065: .put(new ANTLRHashString("long", this ), new Integer(37));
0066: literals.put(new ANTLRHashString("int", this ), new Integer(35));
0067: literals.put(new ANTLRHashString("false", this ),
0068: new Integer(22));
0069: }
0070:
0071: public Token nextToken() throws TokenStreamException {
0072: Token theRetToken = null;
0073: tryAgain: for (;;) {
0074: Token _token = null;
0075: int _ttype = Token.INVALID_TYPE;
0076: resetText();
0077: try { // for char stream error handling
0078: try { // for lexical error handling
0079: switch (LA(1)) {
0080: case '(': {
0081: mLPAREN(true);
0082: theRetToken = _returnToken;
0083: break;
0084: }
0085: case ')': {
0086: mRPAREN(true);
0087: theRetToken = _returnToken;
0088: break;
0089: }
0090: case '[': {
0091: mLBRACK(true);
0092: theRetToken = _returnToken;
0093: break;
0094: }
0095: case ']': {
0096: mRBRACK(true);
0097: theRetToken = _returnToken;
0098: break;
0099: }
0100: case ':': {
0101: mCOLON(true);
0102: theRetToken = _returnToken;
0103: break;
0104: }
0105: case ',': {
0106: mCOMMA(true);
0107: theRetToken = _returnToken;
0108: break;
0109: }
0110: case '!': {
0111: mLNOT(true);
0112: theRetToken = _returnToken;
0113: break;
0114: }
0115: case '+': {
0116: mPLUS(true);
0117: theRetToken = _returnToken;
0118: break;
0119: }
0120: case '-': {
0121: mMINUS(true);
0122: theRetToken = _returnToken;
0123: break;
0124: }
0125: case '\t':
0126: case '\n':
0127: case '\u000c':
0128: case '\r':
0129: case ' ': {
0130: mWS(true);
0131: theRetToken = _returnToken;
0132: break;
0133: }
0134: case '\'': {
0135: mCHAR_LITERAL(true);
0136: theRetToken = _returnToken;
0137: break;
0138: }
0139: case '"': {
0140: mSTRING_LITERAL(true);
0141: theRetToken = _returnToken;
0142: break;
0143: }
0144: case '$':
0145: case 'A':
0146: case 'B':
0147: case 'C':
0148: case 'D':
0149: case 'E':
0150: case 'F':
0151: case 'G':
0152: case 'H':
0153: case 'I':
0154: case 'J':
0155: case 'K':
0156: case 'L':
0157: case 'M':
0158: case 'N':
0159: case 'O':
0160: case 'P':
0161: case 'Q':
0162: case 'R':
0163: case 'S':
0164: case 'T':
0165: case 'U':
0166: case 'V':
0167: case 'W':
0168: case 'X':
0169: case 'Y':
0170: case 'Z':
0171: case '_':
0172: case 'a':
0173: case 'b':
0174: case 'c':
0175: case 'd':
0176: case 'e':
0177: case 'f':
0178: case 'g':
0179: case 'h':
0180: case 'i':
0181: case 'j':
0182: case 'k':
0183: case 'l':
0184: case 'm':
0185: case 'n':
0186: case 'o':
0187: case 'p':
0188: case 'q':
0189: case 'r':
0190: case 's':
0191: case 't':
0192: case 'u':
0193: case 'v':
0194: case 'w':
0195: case 'x':
0196: case 'y':
0197: case 'z': {
0198: mIDENT(true);
0199: theRetToken = _returnToken;
0200: break;
0201: }
0202: default:
0203: if ((LA(1) == '.') && (true) && (true) && (true)) {
0204: mDOT(true);
0205: theRetToken = _returnToken;
0206: } else if ((LA(1) == '.' || LA(1) == '0'
0207: || LA(1) == '1' || LA(1) == '2'
0208: || LA(1) == '3' || LA(1) == '4'
0209: || LA(1) == '5' || LA(1) == '6'
0210: || LA(1) == '7' || LA(1) == '8' || LA(1) == '9') && (true) && (true) && (true)) {
0211: mNUM_INT(true);
0212: theRetToken = _returnToken;
0213: } else {
0214: if (LA(1) == EOF_CHAR) {
0215: uponEOF();
0216: _returnToken = makeToken(Token.EOF_TYPE);
0217: } else {
0218: throw new NoViableAltForCharException(
0219: (char) LA(1), getFilename(),
0220: getLine(), getColumn());
0221: }
0222: }
0223: }
0224: if (_returnToken == null)
0225: continue tryAgain; // found SKIP token
0226: _ttype = _returnToken.getType();
0227: _returnToken.setType(_ttype);
0228: return _returnToken;
0229: } catch (RecognitionException e) {
0230: throw new TokenStreamRecognitionException(e);
0231: }
0232: } catch (CharStreamException cse) {
0233: if (cse instanceof CharStreamIOException) {
0234: throw new TokenStreamIOException(
0235: ((CharStreamIOException) cse).io);
0236: } else {
0237: throw new TokenStreamException(cse.getMessage());
0238: }
0239: }
0240: }
0241: }
0242:
0243: public final void mLPAREN(boolean _createToken)
0244: throws RecognitionException, CharStreamException,
0245: TokenStreamException {
0246: int _ttype;
0247: Token _token = null;
0248: int _begin = text.length();
0249: _ttype = LPAREN;
0250: int _saveIndex;
0251:
0252: match('(');
0253: if (_createToken && _token == null && _ttype != Token.SKIP) {
0254: _token = makeToken(_ttype);
0255: _token.setText(new String(text.getBuffer(), _begin, text
0256: .length()
0257: - _begin));
0258: }
0259: _returnToken = _token;
0260: }
0261:
0262: public final void mRPAREN(boolean _createToken)
0263: throws RecognitionException, CharStreamException,
0264: TokenStreamException {
0265: int _ttype;
0266: Token _token = null;
0267: int _begin = text.length();
0268: _ttype = RPAREN;
0269: int _saveIndex;
0270:
0271: match(')');
0272: if (_createToken && _token == null && _ttype != Token.SKIP) {
0273: _token = makeToken(_ttype);
0274: _token.setText(new String(text.getBuffer(), _begin, text
0275: .length()
0276: - _begin));
0277: }
0278: _returnToken = _token;
0279: }
0280:
0281: public final void mLBRACK(boolean _createToken)
0282: throws RecognitionException, CharStreamException,
0283: TokenStreamException {
0284: int _ttype;
0285: Token _token = null;
0286: int _begin = text.length();
0287: _ttype = LBRACK;
0288: int _saveIndex;
0289:
0290: match('[');
0291: if (_createToken && _token == null && _ttype != Token.SKIP) {
0292: _token = makeToken(_ttype);
0293: _token.setText(new String(text.getBuffer(), _begin, text
0294: .length()
0295: - _begin));
0296: }
0297: _returnToken = _token;
0298: }
0299:
0300: public final void mRBRACK(boolean _createToken)
0301: throws RecognitionException, CharStreamException,
0302: TokenStreamException {
0303: int _ttype;
0304: Token _token = null;
0305: int _begin = text.length();
0306: _ttype = RBRACK;
0307: int _saveIndex;
0308:
0309: match(']');
0310: if (_createToken && _token == null && _ttype != Token.SKIP) {
0311: _token = makeToken(_ttype);
0312: _token.setText(new String(text.getBuffer(), _begin, text
0313: .length()
0314: - _begin));
0315: }
0316: _returnToken = _token;
0317: }
0318:
0319: public final void mCOLON(boolean _createToken)
0320: throws RecognitionException, CharStreamException,
0321: TokenStreamException {
0322: int _ttype;
0323: Token _token = null;
0324: int _begin = text.length();
0325: _ttype = COLON;
0326: int _saveIndex;
0327:
0328: match(':');
0329: if (_createToken && _token == null && _ttype != Token.SKIP) {
0330: _token = makeToken(_ttype);
0331: _token.setText(new String(text.getBuffer(), _begin, text
0332: .length()
0333: - _begin));
0334: }
0335: _returnToken = _token;
0336: }
0337:
0338: public final void mCOMMA(boolean _createToken)
0339: throws RecognitionException, CharStreamException,
0340: TokenStreamException {
0341: int _ttype;
0342: Token _token = null;
0343: int _begin = text.length();
0344: _ttype = COMMA;
0345: int _saveIndex;
0346:
0347: match(',');
0348: if (_createToken && _token == null && _ttype != Token.SKIP) {
0349: _token = makeToken(_ttype);
0350: _token.setText(new String(text.getBuffer(), _begin, text
0351: .length()
0352: - _begin));
0353: }
0354: _returnToken = _token;
0355: }
0356:
0357: public final void mDOT(boolean _createToken)
0358: throws RecognitionException, CharStreamException,
0359: TokenStreamException {
0360: int _ttype;
0361: Token _token = null;
0362: int _begin = text.length();
0363: _ttype = DOT;
0364: int _saveIndex;
0365:
0366: match('.');
0367: if (_createToken && _token == null && _ttype != Token.SKIP) {
0368: _token = makeToken(_ttype);
0369: _token.setText(new String(text.getBuffer(), _begin, text
0370: .length()
0371: - _begin));
0372: }
0373: _returnToken = _token;
0374: }
0375:
0376: public final void mLNOT(boolean _createToken)
0377: throws RecognitionException, CharStreamException,
0378: TokenStreamException {
0379: int _ttype;
0380: Token _token = null;
0381: int _begin = text.length();
0382: _ttype = LNOT;
0383: int _saveIndex;
0384:
0385: match('!');
0386: if (_createToken && _token == null && _ttype != Token.SKIP) {
0387: _token = makeToken(_ttype);
0388: _token.setText(new String(text.getBuffer(), _begin, text
0389: .length()
0390: - _begin));
0391: }
0392: _returnToken = _token;
0393: }
0394:
0395: public final void mPLUS(boolean _createToken)
0396: throws RecognitionException, CharStreamException,
0397: TokenStreamException {
0398: int _ttype;
0399: Token _token = null;
0400: int _begin = text.length();
0401: _ttype = PLUS;
0402: int _saveIndex;
0403:
0404: match('+');
0405: if (_createToken && _token == null && _ttype != Token.SKIP) {
0406: _token = makeToken(_ttype);
0407: _token.setText(new String(text.getBuffer(), _begin, text
0408: .length()
0409: - _begin));
0410: }
0411: _returnToken = _token;
0412: }
0413:
0414: public final void mMINUS(boolean _createToken)
0415: throws RecognitionException, CharStreamException,
0416: TokenStreamException {
0417: int _ttype;
0418: Token _token = null;
0419: int _begin = text.length();
0420: _ttype = MINUS;
0421: int _saveIndex;
0422:
0423: match('-');
0424: if (_createToken && _token == null && _ttype != Token.SKIP) {
0425: _token = makeToken(_ttype);
0426: _token.setText(new String(text.getBuffer(), _begin, text
0427: .length()
0428: - _begin));
0429: }
0430: _returnToken = _token;
0431: }
0432:
0433: public final void mWS(boolean _createToken)
0434: throws RecognitionException, CharStreamException,
0435: TokenStreamException {
0436: int _ttype;
0437: Token _token = null;
0438: int _begin = text.length();
0439: _ttype = WS;
0440: int _saveIndex;
0441:
0442: {
0443: int _cnt53 = 0;
0444: _loop53: do {
0445: switch (LA(1)) {
0446: case ' ': {
0447: match(' ');
0448: break;
0449: }
0450: case '\t': {
0451: match('\t');
0452: break;
0453: }
0454: case '\u000c': {
0455: match('\f');
0456: break;
0457: }
0458: case '\n':
0459: case '\r': {
0460: {
0461: if ((LA(1) == '\r') && (LA(2) == '\n')
0462: && (true) && (true)) {
0463: match("\r\n");
0464: } else if ((LA(1) == '\r') && (true) && (true) && (true)) {
0465: match('\r');
0466: } else if ((LA(1) == '\n')) {
0467: match('\n');
0468: } else {
0469: throw new NoViableAltForCharException(
0470: (char) LA(1), getFilename(),
0471: getLine(), getColumn());
0472: }
0473:
0474: }
0475: newline();
0476: break;
0477: }
0478: default: {
0479: if (_cnt53 >= 1) {
0480: break _loop53;
0481: } else {
0482: throw new NoViableAltForCharException(
0483: (char) LA(1), getFilename(), getLine(),
0484: getColumn());
0485: }
0486: }
0487: }
0488: _cnt53++;
0489: } while (true);
0490: }
0491: _ttype = Token.SKIP;
0492: if (_createToken && _token == null && _ttype != Token.SKIP) {
0493: _token = makeToken(_ttype);
0494: _token.setText(new String(text.getBuffer(), _begin, text
0495: .length()
0496: - _begin));
0497: }
0498: _returnToken = _token;
0499: }
0500:
0501: public final void mCHAR_LITERAL(boolean _createToken)
0502: throws RecognitionException, CharStreamException,
0503: TokenStreamException {
0504: int _ttype;
0505: Token _token = null;
0506: int _begin = text.length();
0507: _ttype = CHAR_LITERAL;
0508: int _saveIndex;
0509:
0510: match('\'');
0511: {
0512: if ((LA(1) == '\\')) {
0513: mESC(false);
0514: } else if ((_tokenSet_0.member(LA(1)))) {
0515: matchNot('\'');
0516: } else {
0517: throw new NoViableAltForCharException((char) LA(1),
0518: getFilename(), getLine(), getColumn());
0519: }
0520:
0521: }
0522: match('\'');
0523: if (_createToken && _token == null && _ttype != Token.SKIP) {
0524: _token = makeToken(_ttype);
0525: _token.setText(new String(text.getBuffer(), _begin, text
0526: .length()
0527: - _begin));
0528: }
0529: _returnToken = _token;
0530: }
0531:
0532: protected final void mESC(boolean _createToken)
0533: throws RecognitionException, CharStreamException,
0534: TokenStreamException {
0535: int _ttype;
0536: Token _token = null;
0537: int _begin = text.length();
0538: _ttype = ESC;
0539: int _saveIndex;
0540:
0541: match('\\');
0542: {
0543: switch (LA(1)) {
0544: case 'n': {
0545: match('n');
0546: break;
0547: }
0548: case 'r': {
0549: match('r');
0550: break;
0551: }
0552: case 't': {
0553: match('t');
0554: break;
0555: }
0556: case 'b': {
0557: match('b');
0558: break;
0559: }
0560: case 'f': {
0561: match('f');
0562: break;
0563: }
0564: case '"': {
0565: match('"');
0566: break;
0567: }
0568: case '\'': {
0569: match('\'');
0570: break;
0571: }
0572: case '\\': {
0573: match('\\');
0574: break;
0575: }
0576: case 'u': {
0577: {
0578: int _cnt63 = 0;
0579: _loop63: do {
0580: if ((LA(1) == 'u')) {
0581: match('u');
0582: } else {
0583: if (_cnt63 >= 1) {
0584: break _loop63;
0585: } else {
0586: throw new NoViableAltForCharException(
0587: (char) LA(1), getFilename(),
0588: getLine(), getColumn());
0589: }
0590: }
0591:
0592: _cnt63++;
0593: } while (true);
0594: }
0595: mHEX_DIGIT(false);
0596: mHEX_DIGIT(false);
0597: mHEX_DIGIT(false);
0598: mHEX_DIGIT(false);
0599: break;
0600: }
0601: case '0':
0602: case '1':
0603: case '2':
0604: case '3': {
0605: matchRange('0', '3');
0606: {
0607: if (((LA(1) >= '0' && LA(1) <= '7'))
0608: && ((LA(2) >= '\u0003' && LA(2) <= '\uffff'))
0609: && (true) && (true)) {
0610: matchRange('0', '7');
0611: {
0612: if (((LA(1) >= '0' && LA(1) <= '7'))
0613: && ((LA(2) >= '\u0003' && LA(2) <= '\uffff'))
0614: && (true) && (true)) {
0615: matchRange('0', '7');
0616: } else if (((LA(1) >= '\u0003' && LA(1) <= '\uffff')) && (true) && (true) && (true)) {
0617: } else {
0618: throw new NoViableAltForCharException(
0619: (char) LA(1), getFilename(),
0620: getLine(), getColumn());
0621: }
0622:
0623: }
0624: } else if (((LA(1) >= '\u0003' && LA(1) <= '\uffff')) && (true) && (true) && (true)) {
0625: } else {
0626: throw new NoViableAltForCharException(
0627: (char) LA(1), getFilename(), getLine(),
0628: getColumn());
0629: }
0630:
0631: }
0632: break;
0633: }
0634: case '4':
0635: case '5':
0636: case '6':
0637: case '7': {
0638: matchRange('4', '7');
0639: {
0640: if (((LA(1) >= '0' && LA(1) <= '7'))
0641: && ((LA(2) >= '\u0003' && LA(2) <= '\uffff'))
0642: && (true) && (true)) {
0643: matchRange('0', '7');
0644: } else if (((LA(1) >= '\u0003' && LA(1) <= '\uffff')) && (true) && (true) && (true)) {
0645: } else {
0646: throw new NoViableAltForCharException(
0647: (char) LA(1), getFilename(), getLine(),
0648: getColumn());
0649: }
0650:
0651: }
0652: break;
0653: }
0654: default: {
0655: throw new NoViableAltForCharException((char) LA(1),
0656: getFilename(), getLine(), getColumn());
0657: }
0658: }
0659: }
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: public final void mSTRING_LITERAL(boolean _createToken)
0670: throws RecognitionException, CharStreamException,
0671: TokenStreamException {
0672: int _ttype;
0673: Token _token = null;
0674: int _begin = text.length();
0675: _ttype = STRING_LITERAL;
0676: int _saveIndex;
0677:
0678: match('"');
0679: {
0680: _loop59: do {
0681: if ((LA(1) == '\\')) {
0682: mESC(false);
0683: } else if ((_tokenSet_1.member(LA(1)))) {
0684: {
0685: match(_tokenSet_1);
0686: }
0687: } else {
0688: break _loop59;
0689: }
0690:
0691: } while (true);
0692: }
0693: match('"');
0694: if (_createToken && _token == null && _ttype != Token.SKIP) {
0695: _token = makeToken(_ttype);
0696: _token.setText(new String(text.getBuffer(), _begin, text
0697: .length()
0698: - _begin));
0699: }
0700: _returnToken = _token;
0701: }
0702:
0703: protected final void mHEX_DIGIT(boolean _createToken)
0704: throws RecognitionException, CharStreamException,
0705: TokenStreamException {
0706: int _ttype;
0707: Token _token = null;
0708: int _begin = text.length();
0709: _ttype = HEX_DIGIT;
0710: int _saveIndex;
0711:
0712: {
0713: switch (LA(1)) {
0714: case '0':
0715: case '1':
0716: case '2':
0717: case '3':
0718: case '4':
0719: case '5':
0720: case '6':
0721: case '7':
0722: case '8':
0723: case '9': {
0724: matchRange('0', '9');
0725: break;
0726: }
0727: case 'A':
0728: case 'B':
0729: case 'C':
0730: case 'D':
0731: case 'E':
0732: case 'F': {
0733: matchRange('A', 'F');
0734: break;
0735: }
0736: case 'a':
0737: case 'b':
0738: case 'c':
0739: case 'd':
0740: case 'e':
0741: case 'f': {
0742: matchRange('a', 'f');
0743: break;
0744: }
0745: default: {
0746: throw new NoViableAltForCharException((char) LA(1),
0747: getFilename(), getLine(), getColumn());
0748: }
0749: }
0750: }
0751: if (_createToken && _token == null && _ttype != Token.SKIP) {
0752: _token = makeToken(_ttype);
0753: _token.setText(new String(text.getBuffer(), _begin, text
0754: .length()
0755: - _begin));
0756: }
0757: _returnToken = _token;
0758: }
0759:
0760: protected final void mVOCAB(boolean _createToken)
0761: throws RecognitionException, CharStreamException,
0762: TokenStreamException {
0763: int _ttype;
0764: Token _token = null;
0765: int _begin = text.length();
0766: _ttype = VOCAB;
0767: int _saveIndex;
0768:
0769: matchRange('\u0003', '\uFFFF');
0770: if (_createToken && _token == null && _ttype != Token.SKIP) {
0771: _token = makeToken(_ttype);
0772: _token.setText(new String(text.getBuffer(), _begin, text
0773: .length()
0774: - _begin));
0775: }
0776: _returnToken = _token;
0777: }
0778:
0779: public final void mIDENT(boolean _createToken)
0780: throws RecognitionException, CharStreamException,
0781: TokenStreamException {
0782: int _ttype;
0783: Token _token = null;
0784: int _begin = text.length();
0785: _ttype = IDENT;
0786: int _saveIndex;
0787:
0788: {
0789: switch (LA(1)) {
0790: case 'a':
0791: case 'b':
0792: case 'c':
0793: case 'd':
0794: case 'e':
0795: case 'f':
0796: case 'g':
0797: case 'h':
0798: case 'i':
0799: case 'j':
0800: case 'k':
0801: case 'l':
0802: case 'm':
0803: case 'n':
0804: case 'o':
0805: case 'p':
0806: case 'q':
0807: case 'r':
0808: case 's':
0809: case 't':
0810: case 'u':
0811: case 'v':
0812: case 'w':
0813: case 'x':
0814: case 'y':
0815: case 'z': {
0816: matchRange('a', 'z');
0817: break;
0818: }
0819: case 'A':
0820: case 'B':
0821: case 'C':
0822: case 'D':
0823: case 'E':
0824: case 'F':
0825: case 'G':
0826: case 'H':
0827: case 'I':
0828: case 'J':
0829: case 'K':
0830: case 'L':
0831: case 'M':
0832: case 'N':
0833: case 'O':
0834: case 'P':
0835: case 'Q':
0836: case 'R':
0837: case 'S':
0838: case 'T':
0839: case 'U':
0840: case 'V':
0841: case 'W':
0842: case 'X':
0843: case 'Y':
0844: case 'Z': {
0845: matchRange('A', 'Z');
0846: break;
0847: }
0848: case '_': {
0849: match('_');
0850: break;
0851: }
0852: case '$': {
0853: match('$');
0854: break;
0855: }
0856: default: {
0857: throw new NoViableAltForCharException((char) LA(1),
0858: getFilename(), getLine(), getColumn());
0859: }
0860: }
0861: }
0862: {
0863: _loop73: do {
0864: switch (LA(1)) {
0865: case 'a':
0866: case 'b':
0867: case 'c':
0868: case 'd':
0869: case 'e':
0870: case 'f':
0871: case 'g':
0872: case 'h':
0873: case 'i':
0874: case 'j':
0875: case 'k':
0876: case 'l':
0877: case 'm':
0878: case 'n':
0879: case 'o':
0880: case 'p':
0881: case 'q':
0882: case 'r':
0883: case 's':
0884: case 't':
0885: case 'u':
0886: case 'v':
0887: case 'w':
0888: case 'x':
0889: case 'y':
0890: case 'z': {
0891: matchRange('a', 'z');
0892: break;
0893: }
0894: case 'A':
0895: case 'B':
0896: case 'C':
0897: case 'D':
0898: case 'E':
0899: case 'F':
0900: case 'G':
0901: case 'H':
0902: case 'I':
0903: case 'J':
0904: case 'K':
0905: case 'L':
0906: case 'M':
0907: case 'N':
0908: case 'O':
0909: case 'P':
0910: case 'Q':
0911: case 'R':
0912: case 'S':
0913: case 'T':
0914: case 'U':
0915: case 'V':
0916: case 'W':
0917: case 'X':
0918: case 'Y':
0919: case 'Z': {
0920: matchRange('A', 'Z');
0921: break;
0922: }
0923: case '_': {
0924: match('_');
0925: break;
0926: }
0927: case '0':
0928: case '1':
0929: case '2':
0930: case '3':
0931: case '4':
0932: case '5':
0933: case '6':
0934: case '7':
0935: case '8':
0936: case '9': {
0937: matchRange('0', '9');
0938: break;
0939: }
0940: case '$': {
0941: match('$');
0942: break;
0943: }
0944: default: {
0945: break _loop73;
0946: }
0947: }
0948: } while (true);
0949: }
0950: _ttype = testLiteralsTable(_ttype);
0951: if (_createToken && _token == null && _ttype != Token.SKIP) {
0952: _token = makeToken(_ttype);
0953: _token.setText(new String(text.getBuffer(), _begin, text
0954: .length()
0955: - _begin));
0956: }
0957: _returnToken = _token;
0958: }
0959:
0960: public final void mNUM_INT(boolean _createToken)
0961: throws RecognitionException, CharStreamException,
0962: TokenStreamException {
0963: int _ttype;
0964: Token _token = null;
0965: int _begin = text.length();
0966: _ttype = NUM_INT;
0967: int _saveIndex;
0968: Token f1 = null;
0969: Token f2 = null;
0970: Token f3 = null;
0971: Token f4 = null;
0972: boolean isDecimal = false;
0973: Token t = null;
0974:
0975: switch (LA(1)) {
0976: case '.': {
0977: match('.');
0978: _ttype = DOT;
0979: {
0980: if (((LA(1) >= '0' && LA(1) <= '9'))) {
0981: {
0982: int _cnt77 = 0;
0983: _loop77: do {
0984: if (((LA(1) >= '0' && LA(1) <= '9'))) {
0985: matchRange('0', '9');
0986: } else {
0987: if (_cnt77 >= 1) {
0988: break _loop77;
0989: } else {
0990: throw new NoViableAltForCharException(
0991: (char) LA(1),
0992: getFilename(), getLine(),
0993: getColumn());
0994: }
0995: }
0996:
0997: _cnt77++;
0998: } while (true);
0999: }
1000: {
1001: if ((LA(1) == 'E' || LA(1) == 'e')) {
1002: mEXPONENT(false);
1003: } else {
1004: }
1005:
1006: }
1007: {
1008: if ((LA(1) == 'D' || LA(1) == 'F'
1009: || LA(1) == 'd' || LA(1) == 'f')) {
1010: mFLOAT_SUFFIX(true);
1011: f1 = _returnToken;
1012: t = f1;
1013: } else {
1014: }
1015:
1016: }
1017:
1018: if (t != null
1019: && t.getText().toUpperCase().indexOf('F') >= 0) {
1020: _ttype = NUM_FLOAT;
1021: } else {
1022: _ttype = NUM_DOUBLE; // assume double
1023: }
1024:
1025: } else {
1026: }
1027:
1028: }
1029: break;
1030: }
1031: case '0':
1032: case '1':
1033: case '2':
1034: case '3':
1035: case '4':
1036: case '5':
1037: case '6':
1038: case '7':
1039: case '8':
1040: case '9': {
1041: {
1042: switch (LA(1)) {
1043: case '0': {
1044: match('0');
1045: isDecimal = true;
1046: {
1047: switch (LA(1)) {
1048: case 'X':
1049: case 'x': {
1050: {
1051: switch (LA(1)) {
1052: case 'x': {
1053: match('x');
1054: break;
1055: }
1056: case 'X': {
1057: match('X');
1058: break;
1059: }
1060: default: {
1061: throw new NoViableAltForCharException(
1062: (char) LA(1),
1063: getFilename(), getLine(),
1064: getColumn());
1065: }
1066: }
1067: }
1068: {
1069: int _cnt84 = 0;
1070: _loop84: do {
1071: if ((_tokenSet_2.member(LA(1))) && (true) && (true) && (true)) {
1072: mHEX_DIGIT(false);
1073: } else {
1074: if (_cnt84 >= 1) {
1075: break _loop84;
1076: } else {
1077: throw new NoViableAltForCharException(
1078: (char) LA(1),
1079: getFilename(),
1080: getLine(),
1081: getColumn());
1082: }
1083: }
1084:
1085: _cnt84++;
1086: } while (true);
1087: }
1088: break;
1089: }
1090: case '0':
1091: case '1':
1092: case '2':
1093: case '3':
1094: case '4':
1095: case '5':
1096: case '6':
1097: case '7': {
1098: {
1099: int _cnt86 = 0;
1100: _loop86: do {
1101: if (((LA(1) >= '0' && LA(1) <= '7'))) {
1102: matchRange('0', '7');
1103: } else {
1104: if (_cnt86 >= 1) {
1105: break _loop86;
1106: } else {
1107: throw new NoViableAltForCharException(
1108: (char) LA(1),
1109: getFilename(),
1110: getLine(),
1111: getColumn());
1112: }
1113: }
1114:
1115: _cnt86++;
1116: } while (true);
1117: }
1118: break;
1119: }
1120: default: {
1121: }
1122: }
1123: }
1124: break;
1125: }
1126: case '1':
1127: case '2':
1128: case '3':
1129: case '4':
1130: case '5':
1131: case '6':
1132: case '7':
1133: case '8':
1134: case '9': {
1135: {
1136: matchRange('1', '9');
1137: }
1138: {
1139: _loop89: do {
1140: if (((LA(1) >= '0' && LA(1) <= '9'))) {
1141: matchRange('0', '9');
1142: } else {
1143: break _loop89;
1144: }
1145:
1146: } while (true);
1147: }
1148: isDecimal = true;
1149: break;
1150: }
1151: default: {
1152: throw new NoViableAltForCharException((char) LA(1),
1153: getFilename(), getLine(), getColumn());
1154: }
1155: }
1156: }
1157: {
1158: if ((LA(1) == 'L' || LA(1) == 'l')) {
1159: {
1160: switch (LA(1)) {
1161: case 'l': {
1162: match('l');
1163: break;
1164: }
1165: case 'L': {
1166: match('L');
1167: break;
1168: }
1169: default: {
1170: throw new NoViableAltForCharException(
1171: (char) LA(1), getFilename(),
1172: getLine(), getColumn());
1173: }
1174: }
1175: }
1176: _ttype = NUM_LONG;
1177: } else if (((LA(1) == '.' || LA(1) == 'D'
1178: || LA(1) == 'E' || LA(1) == 'F' || LA(1) == 'd'
1179: || LA(1) == 'e' || LA(1) == 'f'))
1180: && (isDecimal)) {
1181: {
1182: switch (LA(1)) {
1183: case '.': {
1184: match('.');
1185: {
1186: _loop94: do {
1187: if (((LA(1) >= '0' && LA(1) <= '9'))) {
1188: matchRange('0', '9');
1189: } else {
1190: break _loop94;
1191: }
1192:
1193: } while (true);
1194: }
1195: {
1196: if ((LA(1) == 'E' || LA(1) == 'e')) {
1197: mEXPONENT(false);
1198: } else {
1199: }
1200:
1201: }
1202: {
1203: if ((LA(1) == 'D' || LA(1) == 'F'
1204: || LA(1) == 'd' || LA(1) == 'f')) {
1205: mFLOAT_SUFFIX(true);
1206: f2 = _returnToken;
1207: t = f2;
1208: } else {
1209: }
1210:
1211: }
1212: break;
1213: }
1214: case 'E':
1215: case 'e': {
1216: mEXPONENT(false);
1217: {
1218: if ((LA(1) == 'D' || LA(1) == 'F'
1219: || LA(1) == 'd' || LA(1) == 'f')) {
1220: mFLOAT_SUFFIX(true);
1221: f3 = _returnToken;
1222: t = f3;
1223: } else {
1224: }
1225:
1226: }
1227: break;
1228: }
1229: case 'D':
1230: case 'F':
1231: case 'd':
1232: case 'f': {
1233: mFLOAT_SUFFIX(true);
1234: f4 = _returnToken;
1235: t = f4;
1236: break;
1237: }
1238: default: {
1239: throw new NoViableAltForCharException(
1240: (char) LA(1), getFilename(),
1241: getLine(), getColumn());
1242: }
1243: }
1244: }
1245:
1246: if (t != null
1247: && t.getText().toUpperCase().indexOf('F') >= 0) {
1248: _ttype = NUM_FLOAT;
1249: } else {
1250: _ttype = NUM_DOUBLE; // assume double
1251: }
1252:
1253: } else {
1254: }
1255:
1256: }
1257: break;
1258: }
1259: default: {
1260: throw new NoViableAltForCharException((char) LA(1),
1261: getFilename(), getLine(), getColumn());
1262: }
1263: }
1264: if (_createToken && _token == null && _ttype != Token.SKIP) {
1265: _token = makeToken(_ttype);
1266: _token.setText(new String(text.getBuffer(), _begin, text
1267: .length()
1268: - _begin));
1269: }
1270: _returnToken = _token;
1271: }
1272:
1273: protected final void mEXPONENT(boolean _createToken)
1274: throws RecognitionException, CharStreamException,
1275: TokenStreamException {
1276: int _ttype;
1277: Token _token = null;
1278: int _begin = text.length();
1279: _ttype = EXPONENT;
1280: int _saveIndex;
1281:
1282: {
1283: switch (LA(1)) {
1284: case 'e': {
1285: match('e');
1286: break;
1287: }
1288: case 'E': {
1289: match('E');
1290: break;
1291: }
1292: default: {
1293: throw new NoViableAltForCharException((char) LA(1),
1294: getFilename(), getLine(), getColumn());
1295: }
1296: }
1297: }
1298: {
1299: switch (LA(1)) {
1300: case '+': {
1301: match('+');
1302: break;
1303: }
1304: case '-': {
1305: match('-');
1306: break;
1307: }
1308: case '0':
1309: case '1':
1310: case '2':
1311: case '3':
1312: case '4':
1313: case '5':
1314: case '6':
1315: case '7':
1316: case '8':
1317: case '9': {
1318: break;
1319: }
1320: default: {
1321: throw new NoViableAltForCharException((char) LA(1),
1322: getFilename(), getLine(), getColumn());
1323: }
1324: }
1325: }
1326: {
1327: int _cnt102 = 0;
1328: _loop102: do {
1329: if (((LA(1) >= '0' && LA(1) <= '9'))) {
1330: matchRange('0', '9');
1331: } else {
1332: if (_cnt102 >= 1) {
1333: break _loop102;
1334: } else {
1335: throw new NoViableAltForCharException(
1336: (char) LA(1), getFilename(), getLine(),
1337: getColumn());
1338: }
1339: }
1340:
1341: _cnt102++;
1342: } while (true);
1343: }
1344: if (_createToken && _token == null && _ttype != Token.SKIP) {
1345: _token = makeToken(_ttype);
1346: _token.setText(new String(text.getBuffer(), _begin, text
1347: .length()
1348: - _begin));
1349: }
1350: _returnToken = _token;
1351: }
1352:
1353: protected final void mFLOAT_SUFFIX(boolean _createToken)
1354: throws RecognitionException, CharStreamException,
1355: TokenStreamException {
1356: int _ttype;
1357: Token _token = null;
1358: int _begin = text.length();
1359: _ttype = FLOAT_SUFFIX;
1360: int _saveIndex;
1361:
1362: switch (LA(1)) {
1363: case 'f': {
1364: match('f');
1365: break;
1366: }
1367: case 'F': {
1368: match('F');
1369: break;
1370: }
1371: case 'd': {
1372: match('d');
1373: break;
1374: }
1375: case 'D': {
1376: match('D');
1377: break;
1378: }
1379: default: {
1380: throw new NoViableAltForCharException((char) LA(1),
1381: getFilename(), getLine(), getColumn());
1382: }
1383: }
1384: if (_createToken && _token == null && _ttype != Token.SKIP) {
1385: _token = makeToken(_ttype);
1386: _token.setText(new String(text.getBuffer(), _begin, text
1387: .length()
1388: - _begin));
1389: }
1390: _returnToken = _token;
1391: }
1392:
1393: private static final long[] mk_tokenSet_0() {
1394: long[] data = new long[2048];
1395: data[0] = -549755813896L;
1396: data[1] = -268435457L;
1397: for (int i = 2; i <= 1023; i++) {
1398: data[i] = -1L;
1399: }
1400: return data;
1401: }
1402:
1403: public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
1404:
1405: private static final long[] mk_tokenSet_1() {
1406: long[] data = new long[2048];
1407: data[0] = -17179869192L;
1408: data[1] = -268435457L;
1409: for (int i = 2; i <= 1023; i++) {
1410: data[i] = -1L;
1411: }
1412: return data;
1413: }
1414:
1415: public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
1416:
1417: private static final long[] mk_tokenSet_2() {
1418: long[] data = new long[1025];
1419: data[0] = 287948901175001088L;
1420: data[1] = 541165879422L;
1421: return data;
1422: }
1423:
1424: public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
1425:
1426: }
|