0001: // $ANTLR 2.7.5 (20050128): "oql-ojb.g" -> "OQLLexer.java"$
0002:
0003: /* Copyright 2003-2005 The Apache Software Foundation
0004: *
0005: * Licensed under the Apache License, Version 2.0 (the "License");
0006: * you may not use this file except in compliance with the License.
0007: * You may obtain a copy of the License at
0008: *
0009: * http://www.apache.org/licenses/LICENSE-2.0
0010: *
0011: * Unless required by applicable law or agreed to in writing, software
0012: * distributed under the License is distributed on an "AS IS" BASIS,
0013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014: * See the License for the specific language governing permissions and
0015: * limitations under the License.
0016: */
0017:
0018: package org.apache.ojb.odmg.oql;
0019:
0020: import java.io.InputStream;
0021: import java.io.Reader;
0022: import java.util.Hashtable;
0023:
0024: import antlr.ANTLRHashString;
0025: import antlr.ByteBuffer;
0026: import antlr.CharBuffer;
0027: import antlr.CharStreamException;
0028: import antlr.CharStreamIOException;
0029: import antlr.InputBuffer;
0030: import antlr.LexerSharedInputState;
0031: import antlr.NoViableAltForCharException;
0032: import antlr.RecognitionException;
0033: import antlr.Token;
0034: import antlr.TokenStream;
0035: import antlr.TokenStreamException;
0036: import antlr.TokenStreamIOException;
0037: import antlr.TokenStreamRecognitionException;
0038: import antlr.collections.impl.BitSet;
0039:
0040: /**
0041: * This OQL grammar has been derived from a OQL sample grammar from the ODMG
0042: * WebSite. The original grammar is copyright protected by MicroData Base
0043: * Systems: Copyright (c) 1999 Micro Data Base Systems, Inc. All rights
0044: * reserved.
0045: *
0046: * The original grammar has been modified to fit into the OJB
0047: * Persistence Managment System.
0048: *
0049: * Modifications done by Ch. Rath, Th. Mahler, S. Harris and many others.
0050: *
0051: * This grammar can be used to build an OQL Parser with the ANTLR Parser
0052: * construction set.
0053: * The grammar defines a Parser that translates valid OQL Strings
0054: * into ojb.broker.query.Query Objects. These query objects can be used
0055: * to perform database queries by means of the OJB PersistenceBroker.
0056: * @see org.apache.ojb.odmg.oql.OQLQueryImpl for implementation details.
0057: * @version $Id: OQLLexer.java,v 1.19.2.3 2005/08/17 13:54:35 aclute Exp $
0058: */
0059: public class OQLLexer extends antlr.CharScanner implements
0060: OQLLexerTokenTypes, TokenStream {
0061: public OQLLexer(InputStream in) {
0062: this (new ByteBuffer(in));
0063: }
0064:
0065: public OQLLexer(Reader in) {
0066: this (new CharBuffer(in));
0067: }
0068:
0069: public OQLLexer(InputBuffer ib) {
0070: this (new LexerSharedInputState(ib));
0071: }
0072:
0073: public OQLLexer(LexerSharedInputState state) {
0074: super (state);
0075: caseSensitiveLiterals = true;
0076: setCaseSensitive(true);
0077: literals = new Hashtable();
0078: literals.put(new ANTLRHashString("nil", this ), new Integer(52));
0079: literals.put(new ANTLRHashString("group", this ),
0080: new Integer(44));
0081: literals.put(new ANTLRHashString("between", this ), new Integer(
0082: 55));
0083: literals
0084: .put(new ANTLRHashString("date", this ), new Integer(61));
0085: literals.put(new ANTLRHashString("select", this ), new Integer(
0086: 38));
0087: literals.put(new ANTLRHashString("timestamp", this ),
0088: new Integer(63));
0089: literals
0090: .put(new ANTLRHashString("like", this ), new Integer(58));
0091: literals.put(new ANTLRHashString("is_undefined", this ),
0092: new Integer(56));
0093: literals.put(new ANTLRHashString("asc", this ), new Integer(48));
0094: literals.put(new ANTLRHashString("or", this ), new Integer(50));
0095: literals.put(new ANTLRHashString("in", this ), new Integer(47));
0096: literals
0097: .put(new ANTLRHashString("list", this ), new Integer(54));
0098: literals
0099: .put(new ANTLRHashString("from", this ), new Integer(40));
0100: literals
0101: .put(new ANTLRHashString("desc", this ), new Integer(49));
0102: literals
0103: .put(new ANTLRHashString("true", this ), new Integer(59));
0104: literals.put(new ANTLRHashString("by", this ), new Integer(43));
0105: literals.put(new ANTLRHashString("not", this ), new Integer(53));
0106: literals.put(new ANTLRHashString("and", this ), new Integer(51));
0107: literals.put(new ANTLRHashString("distinct", this ),
0108: new Integer(39));
0109: literals.put(new ANTLRHashString("prefetch", this ),
0110: new Integer(45));
0111: literals.put(new ANTLRHashString("false", this ),
0112: new Integer(60));
0113: literals
0114: .put(new ANTLRHashString("time", this ), new Integer(62));
0115: literals.put(new ANTLRHashString("order", this ),
0116: new Integer(42));
0117: literals.put(new ANTLRHashString("where", this ),
0118: new Integer(41));
0119: literals.put(new ANTLRHashString("exists", this ), new Integer(
0120: 46));
0121: literals.put(new ANTLRHashString("is_defined", this ),
0122: new Integer(57));
0123: }
0124:
0125: public Token nextToken() throws TokenStreamException {
0126: Token theRetToken = null;
0127: tryAgain: for (;;) {
0128: Token _token = null;
0129: int _ttype = Token.INVALID_TYPE;
0130: resetText();
0131: try { // for char stream error handling
0132: try { // for lexical error handling
0133: switch (LA(1)) {
0134: case ')': {
0135: mTOK_RPAREN(true);
0136: theRetToken = _returnToken;
0137: break;
0138: }
0139: case '(': {
0140: mTOK_LPAREN(true);
0141: theRetToken = _returnToken;
0142: break;
0143: }
0144: case ',': {
0145: mTOK_COMMA(true);
0146: theRetToken = _returnToken;
0147: break;
0148: }
0149: case ';': {
0150: mTOK_SEMIC(true);
0151: theRetToken = _returnToken;
0152: break;
0153: }
0154: case ':': {
0155: mTOK_COLON(true);
0156: theRetToken = _returnToken;
0157: break;
0158: }
0159: case '|': {
0160: mTOK_CONCAT(true);
0161: theRetToken = _returnToken;
0162: break;
0163: }
0164: case '=': {
0165: mTOK_EQ(true);
0166: theRetToken = _returnToken;
0167: break;
0168: }
0169: case '+': {
0170: mTOK_PLUS(true);
0171: theRetToken = _returnToken;
0172: break;
0173: }
0174: case '*': {
0175: mTOK_STAR(true);
0176: theRetToken = _returnToken;
0177: break;
0178: }
0179: case '!': {
0180: mTOK_NE2(true);
0181: theRetToken = _returnToken;
0182: break;
0183: }
0184: case '[': {
0185: mTOK_LBRACK(true);
0186: theRetToken = _returnToken;
0187: break;
0188: }
0189: case ']': {
0190: mTOK_RBRACK(true);
0191: theRetToken = _returnToken;
0192: break;
0193: }
0194: case '\'': {
0195: mCharLiteral(true);
0196: theRetToken = _returnToken;
0197: break;
0198: }
0199: case '"': {
0200: mStringLiteral(true);
0201: theRetToken = _returnToken;
0202: break;
0203: }
0204: case '\t':
0205: case '\r':
0206: case ' ': {
0207: mWhiteSpace(true);
0208: theRetToken = _returnToken;
0209: break;
0210: }
0211: case '\n': {
0212: mNewLine(true);
0213: theRetToken = _returnToken;
0214: break;
0215: }
0216: default:
0217: if ((LA(1) == '-') && (LA(2) == '>')) {
0218: mTOK_INDIRECT(true);
0219: theRetToken = _returnToken;
0220: } else if ((LA(1) == '<') && (LA(2) == '=')) {
0221: mTOK_LE(true);
0222: theRetToken = _returnToken;
0223: } else if ((LA(1) == '>') && (LA(2) == '=')) {
0224: mTOK_GE(true);
0225: theRetToken = _returnToken;
0226: } else if ((LA(1) == '<') && (LA(2) == '>')) {
0227: mTOK_NE(true);
0228: theRetToken = _returnToken;
0229: } else if ((LA(1) == '/') && (LA(2) == '/')) {
0230: mCommentLine(true);
0231: theRetToken = _returnToken;
0232: } else if ((LA(1) == '/') && (LA(2) == '*')) {
0233: mMultiLineComment(true);
0234: theRetToken = _returnToken;
0235: } else if ((LA(1) == '.') && (true)) {
0236: mTOK_DOT(true);
0237: theRetToken = _returnToken;
0238: } else if ((LA(1) == '-') && (true)) {
0239: mTOK_MINUS(true);
0240: theRetToken = _returnToken;
0241: } else if ((LA(1) == '/') && (true)) {
0242: mTOK_SLASH(true);
0243: theRetToken = _returnToken;
0244: } else if ((LA(1) == '<') && (true)) {
0245: mTOK_LT(true);
0246: theRetToken = _returnToken;
0247: } else if ((LA(1) == '>') && (true)) {
0248: mTOK_GT(true);
0249: theRetToken = _returnToken;
0250: } else if ((LA(1) == '$') && (true)) {
0251: mTOK_DOLLAR(true);
0252: theRetToken = _returnToken;
0253: } else if ((_tokenSet_0.member(LA(1))) && (true)) {
0254: mIdentifier(true);
0255: theRetToken = _returnToken;
0256: } else if ((_tokenSet_1.member(LA(1))) && (true)) {
0257: mTOK_EXACT_NUMERIC_LITERAL(true);
0258: theRetToken = _returnToken;
0259: } else {
0260: if (LA(1) == EOF_CHAR) {
0261: uponEOF();
0262: _returnToken = makeToken(Token.EOF_TYPE);
0263: } else {
0264: throw new NoViableAltForCharException(
0265: LA(1), getFilename(),
0266: getLine(), getColumn());
0267: }
0268: }
0269: }
0270: if (_returnToken == null)
0271: continue tryAgain; // found SKIP token
0272: _ttype = _returnToken.getType();
0273: _returnToken.setType(_ttype);
0274: return _returnToken;
0275: } catch (RecognitionException e) {
0276: throw new TokenStreamRecognitionException(e);
0277: }
0278: } catch (CharStreamException cse) {
0279: if (cse instanceof CharStreamIOException) {
0280: throw new TokenStreamIOException(
0281: ((CharStreamIOException) cse).io);
0282: } else {
0283: throw new TokenStreamException(cse.getMessage());
0284: }
0285: }
0286: }
0287: }
0288:
0289: public final void mTOK_RPAREN(boolean _createToken)
0290: throws RecognitionException, CharStreamException,
0291: TokenStreamException {
0292: int _ttype;
0293: Token _token = null;
0294: int _begin = text.length();
0295: _ttype = TOK_RPAREN;
0296: int _saveIndex;
0297:
0298: match(')');
0299: if (_createToken && _token == null && _ttype != Token.SKIP) {
0300: _token = makeToken(_ttype);
0301: _token.setText(new String(text.getBuffer(), _begin, text
0302: .length()
0303: - _begin));
0304: }
0305: _returnToken = _token;
0306: }
0307:
0308: public final void mTOK_LPAREN(boolean _createToken)
0309: throws RecognitionException, CharStreamException,
0310: TokenStreamException {
0311: int _ttype;
0312: Token _token = null;
0313: int _begin = text.length();
0314: _ttype = TOK_LPAREN;
0315: int _saveIndex;
0316:
0317: match('(');
0318: if (_createToken && _token == null && _ttype != Token.SKIP) {
0319: _token = makeToken(_ttype);
0320: _token.setText(new String(text.getBuffer(), _begin, text
0321: .length()
0322: - _begin));
0323: }
0324: _returnToken = _token;
0325: }
0326:
0327: public final void mTOK_COMMA(boolean _createToken)
0328: throws RecognitionException, CharStreamException,
0329: TokenStreamException {
0330: int _ttype;
0331: Token _token = null;
0332: int _begin = text.length();
0333: _ttype = TOK_COMMA;
0334: int _saveIndex;
0335:
0336: match(',');
0337: if (_createToken && _token == null && _ttype != Token.SKIP) {
0338: _token = makeToken(_ttype);
0339: _token.setText(new String(text.getBuffer(), _begin, text
0340: .length()
0341: - _begin));
0342: }
0343: _returnToken = _token;
0344: }
0345:
0346: public final void mTOK_SEMIC(boolean _createToken)
0347: throws RecognitionException, CharStreamException,
0348: TokenStreamException {
0349: int _ttype;
0350: Token _token = null;
0351: int _begin = text.length();
0352: _ttype = TOK_SEMIC;
0353: int _saveIndex;
0354:
0355: match(';');
0356: if (_createToken && _token == null && _ttype != Token.SKIP) {
0357: _token = makeToken(_ttype);
0358: _token.setText(new String(text.getBuffer(), _begin, text
0359: .length()
0360: - _begin));
0361: }
0362: _returnToken = _token;
0363: }
0364:
0365: public final void mTOK_COLON(boolean _createToken)
0366: throws RecognitionException, CharStreamException,
0367: TokenStreamException {
0368: int _ttype;
0369: Token _token = null;
0370: int _begin = text.length();
0371: _ttype = TOK_COLON;
0372: int _saveIndex;
0373:
0374: match(':');
0375: if (_createToken && _token == null && _ttype != Token.SKIP) {
0376: _token = makeToken(_ttype);
0377: _token.setText(new String(text.getBuffer(), _begin, text
0378: .length()
0379: - _begin));
0380: }
0381: _returnToken = _token;
0382: }
0383:
0384: public final void mTOK_DOT(boolean _createToken)
0385: throws RecognitionException, CharStreamException,
0386: TokenStreamException {
0387: int _ttype;
0388: Token _token = null;
0389: int _begin = text.length();
0390: _ttype = TOK_DOT;
0391: int _saveIndex;
0392:
0393: match('.');
0394: if (_createToken && _token == null && _ttype != Token.SKIP) {
0395: _token = makeToken(_ttype);
0396: _token.setText(new String(text.getBuffer(), _begin, text
0397: .length()
0398: - _begin));
0399: }
0400: _returnToken = _token;
0401: }
0402:
0403: public final void mTOK_INDIRECT(boolean _createToken)
0404: throws RecognitionException, CharStreamException,
0405: TokenStreamException {
0406: int _ttype;
0407: Token _token = null;
0408: int _begin = text.length();
0409: _ttype = TOK_INDIRECT;
0410: int _saveIndex;
0411:
0412: match('-');
0413: match('>');
0414: _ttype = TOK_DOT;
0415: if (_createToken && _token == null && _ttype != Token.SKIP) {
0416: _token = makeToken(_ttype);
0417: _token.setText(new String(text.getBuffer(), _begin, text
0418: .length()
0419: - _begin));
0420: }
0421: _returnToken = _token;
0422: }
0423:
0424: public final void mTOK_CONCAT(boolean _createToken)
0425: throws RecognitionException, CharStreamException,
0426: TokenStreamException {
0427: int _ttype;
0428: Token _token = null;
0429: int _begin = text.length();
0430: _ttype = TOK_CONCAT;
0431: int _saveIndex;
0432:
0433: match('|');
0434: match('|');
0435: if (_createToken && _token == null && _ttype != Token.SKIP) {
0436: _token = makeToken(_ttype);
0437: _token.setText(new String(text.getBuffer(), _begin, text
0438: .length()
0439: - _begin));
0440: }
0441: _returnToken = _token;
0442: }
0443:
0444: public final void mTOK_EQ(boolean _createToken)
0445: throws RecognitionException, CharStreamException,
0446: TokenStreamException {
0447: int _ttype;
0448: Token _token = null;
0449: int _begin = text.length();
0450: _ttype = TOK_EQ;
0451: int _saveIndex;
0452:
0453: match('=');
0454: if (_createToken && _token == null && _ttype != Token.SKIP) {
0455: _token = makeToken(_ttype);
0456: _token.setText(new String(text.getBuffer(), _begin, text
0457: .length()
0458: - _begin));
0459: }
0460: _returnToken = _token;
0461: }
0462:
0463: public final void mTOK_PLUS(boolean _createToken)
0464: throws RecognitionException, CharStreamException,
0465: TokenStreamException {
0466: int _ttype;
0467: Token _token = null;
0468: int _begin = text.length();
0469: _ttype = TOK_PLUS;
0470: int _saveIndex;
0471:
0472: match('+');
0473: if (_createToken && _token == null && _ttype != Token.SKIP) {
0474: _token = makeToken(_ttype);
0475: _token.setText(new String(text.getBuffer(), _begin, text
0476: .length()
0477: - _begin));
0478: }
0479: _returnToken = _token;
0480: }
0481:
0482: public final void mTOK_MINUS(boolean _createToken)
0483: throws RecognitionException, CharStreamException,
0484: TokenStreamException {
0485: int _ttype;
0486: Token _token = null;
0487: int _begin = text.length();
0488: _ttype = TOK_MINUS;
0489: int _saveIndex;
0490:
0491: match('-');
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 mTOK_SLASH(boolean _createToken)
0502: throws RecognitionException, CharStreamException,
0503: TokenStreamException {
0504: int _ttype;
0505: Token _token = null;
0506: int _begin = text.length();
0507: _ttype = TOK_SLASH;
0508: int _saveIndex;
0509:
0510: match('/');
0511: if (_createToken && _token == null && _ttype != Token.SKIP) {
0512: _token = makeToken(_ttype);
0513: _token.setText(new String(text.getBuffer(), _begin, text
0514: .length()
0515: - _begin));
0516: }
0517: _returnToken = _token;
0518: }
0519:
0520: public final void mTOK_STAR(boolean _createToken)
0521: throws RecognitionException, CharStreamException,
0522: TokenStreamException {
0523: int _ttype;
0524: Token _token = null;
0525: int _begin = text.length();
0526: _ttype = TOK_STAR;
0527: int _saveIndex;
0528:
0529: match('*');
0530: if (_createToken && _token == null && _ttype != Token.SKIP) {
0531: _token = makeToken(_ttype);
0532: _token.setText(new String(text.getBuffer(), _begin, text
0533: .length()
0534: - _begin));
0535: }
0536: _returnToken = _token;
0537: }
0538:
0539: public final void mTOK_LE(boolean _createToken)
0540: throws RecognitionException, CharStreamException,
0541: TokenStreamException {
0542: int _ttype;
0543: Token _token = null;
0544: int _begin = text.length();
0545: _ttype = TOK_LE;
0546: int _saveIndex;
0547:
0548: match('<');
0549: match('=');
0550: if (_createToken && _token == null && _ttype != Token.SKIP) {
0551: _token = makeToken(_ttype);
0552: _token.setText(new String(text.getBuffer(), _begin, text
0553: .length()
0554: - _begin));
0555: }
0556: _returnToken = _token;
0557: }
0558:
0559: public final void mTOK_GE(boolean _createToken)
0560: throws RecognitionException, CharStreamException,
0561: TokenStreamException {
0562: int _ttype;
0563: Token _token = null;
0564: int _begin = text.length();
0565: _ttype = TOK_GE;
0566: int _saveIndex;
0567:
0568: match('>');
0569: match('=');
0570: if (_createToken && _token == null && _ttype != Token.SKIP) {
0571: _token = makeToken(_ttype);
0572: _token.setText(new String(text.getBuffer(), _begin, text
0573: .length()
0574: - _begin));
0575: }
0576: _returnToken = _token;
0577: }
0578:
0579: public final void mTOK_NE(boolean _createToken)
0580: throws RecognitionException, CharStreamException,
0581: TokenStreamException {
0582: int _ttype;
0583: Token _token = null;
0584: int _begin = text.length();
0585: _ttype = TOK_NE;
0586: int _saveIndex;
0587:
0588: match('<');
0589: match('>');
0590: if (_createToken && _token == null && _ttype != Token.SKIP) {
0591: _token = makeToken(_ttype);
0592: _token.setText(new String(text.getBuffer(), _begin, text
0593: .length()
0594: - _begin));
0595: }
0596: _returnToken = _token;
0597: }
0598:
0599: public final void mTOK_NE2(boolean _createToken)
0600: throws RecognitionException, CharStreamException,
0601: TokenStreamException {
0602: int _ttype;
0603: Token _token = null;
0604: int _begin = text.length();
0605: _ttype = TOK_NE2;
0606: int _saveIndex;
0607:
0608: match('!');
0609: match('=');
0610: if (_createToken && _token == null && _ttype != Token.SKIP) {
0611: _token = makeToken(_ttype);
0612: _token.setText(new String(text.getBuffer(), _begin, text
0613: .length()
0614: - _begin));
0615: }
0616: _returnToken = _token;
0617: }
0618:
0619: public final void mTOK_LT(boolean _createToken)
0620: throws RecognitionException, CharStreamException,
0621: TokenStreamException {
0622: int _ttype;
0623: Token _token = null;
0624: int _begin = text.length();
0625: _ttype = TOK_LT;
0626: int _saveIndex;
0627:
0628: match('<');
0629: if (_createToken && _token == null && _ttype != Token.SKIP) {
0630: _token = makeToken(_ttype);
0631: _token.setText(new String(text.getBuffer(), _begin, text
0632: .length()
0633: - _begin));
0634: }
0635: _returnToken = _token;
0636: }
0637:
0638: public final void mTOK_GT(boolean _createToken)
0639: throws RecognitionException, CharStreamException,
0640: TokenStreamException {
0641: int _ttype;
0642: Token _token = null;
0643: int _begin = text.length();
0644: _ttype = TOK_GT;
0645: int _saveIndex;
0646:
0647: match('>');
0648: if (_createToken && _token == null && _ttype != Token.SKIP) {
0649: _token = makeToken(_ttype);
0650: _token.setText(new String(text.getBuffer(), _begin, text
0651: .length()
0652: - _begin));
0653: }
0654: _returnToken = _token;
0655: }
0656:
0657: public final void mTOK_LBRACK(boolean _createToken)
0658: throws RecognitionException, CharStreamException,
0659: TokenStreamException {
0660: int _ttype;
0661: Token _token = null;
0662: int _begin = text.length();
0663: _ttype = TOK_LBRACK;
0664: int _saveIndex;
0665:
0666: match('[');
0667: if (_createToken && _token == null && _ttype != Token.SKIP) {
0668: _token = makeToken(_ttype);
0669: _token.setText(new String(text.getBuffer(), _begin, text
0670: .length()
0671: - _begin));
0672: }
0673: _returnToken = _token;
0674: }
0675:
0676: public final void mTOK_RBRACK(boolean _createToken)
0677: throws RecognitionException, CharStreamException,
0678: TokenStreamException {
0679: int _ttype;
0680: Token _token = null;
0681: int _begin = text.length();
0682: _ttype = TOK_RBRACK;
0683: int _saveIndex;
0684:
0685: match(']');
0686: if (_createToken && _token == null && _ttype != Token.SKIP) {
0687: _token = makeToken(_ttype);
0688: _token.setText(new String(text.getBuffer(), _begin, text
0689: .length()
0690: - _begin));
0691: }
0692: _returnToken = _token;
0693: }
0694:
0695: public final void mTOK_DOLLAR(boolean _createToken)
0696: throws RecognitionException, CharStreamException,
0697: TokenStreamException {
0698: int _ttype;
0699: Token _token = null;
0700: int _begin = text.length();
0701: _ttype = TOK_DOLLAR;
0702: int _saveIndex;
0703:
0704: match('$');
0705: if (_createToken && _token == null && _ttype != Token.SKIP) {
0706: _token = makeToken(_ttype);
0707: _token.setText(new String(text.getBuffer(), _begin, text
0708: .length()
0709: - _begin));
0710: }
0711: _returnToken = _token;
0712: }
0713:
0714: protected final void mNameFirstCharacter(boolean _createToken)
0715: throws RecognitionException, CharStreamException,
0716: TokenStreamException {
0717: int _ttype;
0718: Token _token = null;
0719: int _begin = text.length();
0720: _ttype = NameFirstCharacter;
0721: int _saveIndex;
0722:
0723: {
0724: switch (LA(1)) {
0725: case 'A':
0726: case 'B':
0727: case 'C':
0728: case 'D':
0729: case 'E':
0730: case 'F':
0731: case 'G':
0732: case 'H':
0733: case 'I':
0734: case 'J':
0735: case 'K':
0736: case 'L':
0737: case 'M':
0738: case 'N':
0739: case 'O':
0740: case 'P':
0741: case 'Q':
0742: case 'R':
0743: case 'S':
0744: case 'T':
0745: case 'U':
0746: case 'V':
0747: case 'W':
0748: case 'X':
0749: case 'Y':
0750: case 'Z': {
0751: matchRange('A', 'Z');
0752: break;
0753: }
0754: case 'a':
0755: case 'b':
0756: case 'c':
0757: case 'd':
0758: case 'e':
0759: case 'f':
0760: case 'g':
0761: case 'h':
0762: case 'i':
0763: case 'j':
0764: case 'k':
0765: case 'l':
0766: case 'm':
0767: case 'n':
0768: case 'o':
0769: case 'p':
0770: case 'q':
0771: case 'r':
0772: case 's':
0773: case 't':
0774: case 'u':
0775: case 'v':
0776: case 'w':
0777: case 'x':
0778: case 'y':
0779: case 'z': {
0780: matchRange('a', 'z');
0781: break;
0782: }
0783: case '_': {
0784: match('_');
0785: break;
0786: }
0787: case '.': {
0788: mTOK_DOT(false);
0789: break;
0790: }
0791: case '-': {
0792: mTOK_INDIRECT(false);
0793: break;
0794: }
0795: case '$': {
0796: mTOK_DOLLAR(false);
0797: break;
0798: }
0799: default: {
0800: throw new NoViableAltForCharException(LA(1),
0801: getFilename(), getLine(), getColumn());
0802: }
0803: }
0804: }
0805: if (_createToken && _token == null && _ttype != Token.SKIP) {
0806: _token = makeToken(_ttype);
0807: _token.setText(new String(text.getBuffer(), _begin, text
0808: .length()
0809: - _begin));
0810: }
0811: _returnToken = _token;
0812: }
0813:
0814: protected final void mNameCharacter(boolean _createToken)
0815: throws RecognitionException, CharStreamException,
0816: TokenStreamException {
0817: int _ttype;
0818: Token _token = null;
0819: int _begin = text.length();
0820: _ttype = NameCharacter;
0821: int _saveIndex;
0822:
0823: {
0824: switch (LA(1)) {
0825: case '$':
0826: case '-':
0827: case '.':
0828: case 'A':
0829: case 'B':
0830: case 'C':
0831: case 'D':
0832: case 'E':
0833: case 'F':
0834: case 'G':
0835: case 'H':
0836: case 'I':
0837: case 'J':
0838: case 'K':
0839: case 'L':
0840: case 'M':
0841: case 'N':
0842: case 'O':
0843: case 'P':
0844: case 'Q':
0845: case 'R':
0846: case 'S':
0847: case 'T':
0848: case 'U':
0849: case 'V':
0850: case 'W':
0851: case 'X':
0852: case 'Y':
0853: case 'Z':
0854: case '_':
0855: case 'a':
0856: case 'b':
0857: case 'c':
0858: case 'd':
0859: case 'e':
0860: case 'f':
0861: case 'g':
0862: case 'h':
0863: case 'i':
0864: case 'j':
0865: case 'k':
0866: case 'l':
0867: case 'm':
0868: case 'n':
0869: case 'o':
0870: case 'p':
0871: case 'q':
0872: case 'r':
0873: case 's':
0874: case 't':
0875: case 'u':
0876: case 'v':
0877: case 'w':
0878: case 'x':
0879: case 'y':
0880: case 'z': {
0881: mNameFirstCharacter(false);
0882: break;
0883: }
0884: case '0':
0885: case '1':
0886: case '2':
0887: case '3':
0888: case '4':
0889: case '5':
0890: case '6':
0891: case '7':
0892: case '8':
0893: case '9': {
0894: matchRange('0', '9');
0895: break;
0896: }
0897: default: {
0898: throw new NoViableAltForCharException(LA(1),
0899: getFilename(), getLine(), getColumn());
0900: }
0901: }
0902: }
0903: if (_createToken && _token == null && _ttype != Token.SKIP) {
0904: _token = makeToken(_ttype);
0905: _token.setText(new String(text.getBuffer(), _begin, text
0906: .length()
0907: - _begin));
0908: }
0909: _returnToken = _token;
0910: }
0911:
0912: public final void mIdentifier(boolean _createToken)
0913: throws RecognitionException, CharStreamException,
0914: TokenStreamException {
0915: int _ttype;
0916: Token _token = null;
0917: int _begin = text.length();
0918: _ttype = Identifier;
0919: int _saveIndex;
0920:
0921: mNameFirstCharacter(false);
0922: {
0923: _loop29: do {
0924: if ((_tokenSet_2.member(LA(1)))) {
0925: mNameCharacter(false);
0926: } else {
0927: break _loop29;
0928: }
0929:
0930: } while (true);
0931: }
0932: _ttype = testLiteralsTable(_ttype);
0933: if (_createToken && _token == null && _ttype != Token.SKIP) {
0934: _token = makeToken(_ttype);
0935: _token.setText(new String(text.getBuffer(), _begin, text
0936: .length()
0937: - _begin));
0938: }
0939: _returnToken = _token;
0940: }
0941:
0942: protected final void mTOK_UNSIGNED_INTEGER(boolean _createToken)
0943: throws RecognitionException, CharStreamException,
0944: TokenStreamException {
0945: int _ttype;
0946: Token _token = null;
0947: int _begin = text.length();
0948: _ttype = TOK_UNSIGNED_INTEGER;
0949: int _saveIndex;
0950:
0951: matchRange('0', '9');
0952: if (_createToken && _token == null && _ttype != Token.SKIP) {
0953: _token = makeToken(_ttype);
0954: _token.setText(new String(text.getBuffer(), _begin, text
0955: .length()
0956: - _begin));
0957: }
0958: _returnToken = _token;
0959: }
0960:
0961: protected final void mTOK_APPROXIMATE_NUMERIC_LITERAL(
0962: boolean _createToken) throws RecognitionException,
0963: CharStreamException, TokenStreamException {
0964: int _ttype;
0965: Token _token = null;
0966: int _begin = text.length();
0967: _ttype = TOK_APPROXIMATE_NUMERIC_LITERAL;
0968: int _saveIndex;
0969:
0970: match('e');
0971: {
0972: switch (LA(1)) {
0973: case '+': {
0974: match('+');
0975: break;
0976: }
0977: case '-': {
0978: match('-');
0979: break;
0980: }
0981: case '0':
0982: case '1':
0983: case '2':
0984: case '3':
0985: case '4':
0986: case '5':
0987: case '6':
0988: case '7':
0989: case '8':
0990: case '9': {
0991: break;
0992: }
0993: default: {
0994: throw new NoViableAltForCharException(LA(1),
0995: getFilename(), getLine(), getColumn());
0996: }
0997: }
0998: }
0999: {
1000: int _cnt34 = 0;
1001: _loop34: do {
1002: if (((LA(1) >= '0' && LA(1) <= '9'))) {
1003: matchRange('0', '9');
1004: } else {
1005: if (_cnt34 >= 1) {
1006: break _loop34;
1007: } else {
1008: throw new NoViableAltForCharException(LA(1),
1009: getFilename(), getLine(), getColumn());
1010: }
1011: }
1012:
1013: _cnt34++;
1014: } while (true);
1015: }
1016: if (_createToken && _token == null && _ttype != Token.SKIP) {
1017: _token = makeToken(_ttype);
1018: _token.setText(new String(text.getBuffer(), _begin, text
1019: .length()
1020: - _begin));
1021: }
1022: _returnToken = _token;
1023: }
1024:
1025: public final void mTOK_EXACT_NUMERIC_LITERAL(boolean _createToken)
1026: throws RecognitionException, CharStreamException,
1027: TokenStreamException {
1028: int _ttype;
1029: Token _token = null;
1030: int _begin = text.length();
1031: _ttype = TOK_EXACT_NUMERIC_LITERAL;
1032: int _saveIndex;
1033:
1034: switch (LA(1)) {
1035: case '.': {
1036: match('.');
1037: {
1038: int _cnt37 = 0;
1039: _loop37: do {
1040: if (((LA(1) >= '0' && LA(1) <= '9'))) {
1041: mTOK_UNSIGNED_INTEGER(false);
1042: } else {
1043: if (_cnt37 >= 1) {
1044: break _loop37;
1045: } else {
1046: throw new NoViableAltForCharException(
1047: LA(1), getFilename(), getLine(),
1048: getColumn());
1049: }
1050: }
1051:
1052: _cnt37++;
1053: } while (true);
1054: }
1055: _ttype = TOK_EXACT_NUMERIC_LITERAL;
1056: {
1057: if ((LA(1) == 'e')) {
1058: mTOK_APPROXIMATE_NUMERIC_LITERAL(false);
1059: _ttype = TOK_APPROXIMATE_NUMERIC_LITERAL;
1060: } else {
1061: }
1062:
1063: }
1064: break;
1065: }
1066: case '0':
1067: case '1':
1068: case '2':
1069: case '3':
1070: case '4':
1071: case '5':
1072: case '6':
1073: case '7':
1074: case '8':
1075: case '9': {
1076: {
1077: int _cnt40 = 0;
1078: _loop40: do {
1079: if (((LA(1) >= '0' && LA(1) <= '9'))) {
1080: mTOK_UNSIGNED_INTEGER(false);
1081: } else {
1082: if (_cnt40 >= 1) {
1083: break _loop40;
1084: } else {
1085: throw new NoViableAltForCharException(
1086: LA(1), getFilename(), getLine(),
1087: getColumn());
1088: }
1089: }
1090:
1091: _cnt40++;
1092: } while (true);
1093: }
1094: _ttype = TOK_UNSIGNED_INTEGER;
1095: {
1096: switch (LA(1)) {
1097: case '.': {
1098: match('.');
1099: {
1100: _loop43: do {
1101: if (((LA(1) >= '0' && LA(1) <= '9'))) {
1102: mTOK_UNSIGNED_INTEGER(false);
1103: } else {
1104: break _loop43;
1105: }
1106:
1107: } while (true);
1108: }
1109: _ttype = TOK_EXACT_NUMERIC_LITERAL;
1110: {
1111: if ((LA(1) == 'e')) {
1112: mTOK_APPROXIMATE_NUMERIC_LITERAL(false);
1113: _ttype = TOK_APPROXIMATE_NUMERIC_LITERAL;
1114: } else {
1115: }
1116:
1117: }
1118: break;
1119: }
1120: case 'e': {
1121: mTOK_APPROXIMATE_NUMERIC_LITERAL(false);
1122: _ttype = TOK_APPROXIMATE_NUMERIC_LITERAL;
1123: break;
1124: }
1125: default: {
1126: }
1127: }
1128: }
1129: break;
1130: }
1131: default: {
1132: throw new NoViableAltForCharException(LA(1), getFilename(),
1133: getLine(), getColumn());
1134: }
1135: }
1136: if (_createToken && _token == null && _ttype != Token.SKIP) {
1137: _token = makeToken(_ttype);
1138: _token.setText(new String(text.getBuffer(), _begin, text
1139: .length()
1140: - _begin));
1141: }
1142: _returnToken = _token;
1143: }
1144:
1145: public final void mCharLiteral(boolean _createToken)
1146: throws RecognitionException, CharStreamException,
1147: TokenStreamException {
1148: int _ttype;
1149: Token _token = null;
1150: int _begin = text.length();
1151: _ttype = CharLiteral;
1152: int _saveIndex;
1153:
1154: _saveIndex = text.length();
1155: match('\'');
1156: text.setLength(_saveIndex);
1157: {
1158: _loop48: do {
1159: if ((LA(1) == '\'') && (LA(2) == '\'')) {
1160: match('\'');
1161: match('\'');
1162: text.setLength(_begin);
1163: text.append("'");
1164: } else if ((LA(1) == '\n')) {
1165: match('\n');
1166: newline();
1167: } else if ((_tokenSet_3.member(LA(1)))) {
1168: {
1169: match(_tokenSet_3);
1170: }
1171: } else {
1172: break _loop48;
1173: }
1174:
1175: } while (true);
1176: }
1177: _saveIndex = text.length();
1178: match('\'');
1179: text.setLength(_saveIndex);
1180: if (_createToken && _token == null && _ttype != Token.SKIP) {
1181: _token = makeToken(_ttype);
1182: _token.setText(new String(text.getBuffer(), _begin, text
1183: .length()
1184: - _begin));
1185: }
1186: _returnToken = _token;
1187: }
1188:
1189: public final void mStringLiteral(boolean _createToken)
1190: throws RecognitionException, CharStreamException,
1191: TokenStreamException {
1192: int _ttype;
1193: Token _token = null;
1194: int _begin = text.length();
1195: _ttype = StringLiteral;
1196: int _saveIndex;
1197:
1198: _saveIndex = text.length();
1199: match('"');
1200: text.setLength(_saveIndex);
1201: {
1202: _loop52: do {
1203: if ((LA(1) == '\\') && (LA(2) == '"')) {
1204: match('\\');
1205: match('"');
1206: text.setLength(_begin);
1207: text.append("\"");
1208: } else if ((_tokenSet_4.member(LA(1)))
1209: && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe'))) {
1210: {
1211: match(_tokenSet_4);
1212: }
1213: } else if ((LA(1) == '\n')) {
1214: match('\n');
1215: newline();
1216: } else {
1217: break _loop52;
1218: }
1219:
1220: } while (true);
1221: }
1222: _saveIndex = text.length();
1223: match('"');
1224: text.setLength(_saveIndex);
1225: if (_createToken && _token == null && _ttype != Token.SKIP) {
1226: _token = makeToken(_ttype);
1227: _token.setText(new String(text.getBuffer(), _begin, text
1228: .length()
1229: - _begin));
1230: }
1231: _returnToken = _token;
1232: }
1233:
1234: public final void mWhiteSpace(boolean _createToken)
1235: throws RecognitionException, CharStreamException,
1236: TokenStreamException {
1237: int _ttype;
1238: Token _token = null;
1239: int _begin = text.length();
1240: _ttype = WhiteSpace;
1241: int _saveIndex;
1242:
1243: {
1244: switch (LA(1)) {
1245: case ' ': {
1246: match(' ');
1247: break;
1248: }
1249: case '\t': {
1250: match('\t');
1251: break;
1252: }
1253: case '\r': {
1254: match('\r');
1255: break;
1256: }
1257: default: {
1258: throw new NoViableAltForCharException(LA(1),
1259: getFilename(), getLine(), getColumn());
1260: }
1261: }
1262: }
1263: _ttype = Token.SKIP;
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: public final void mNewLine(boolean _createToken)
1274: throws RecognitionException, CharStreamException,
1275: TokenStreamException {
1276: int _ttype;
1277: Token _token = null;
1278: int _begin = text.length();
1279: _ttype = NewLine;
1280: int _saveIndex;
1281:
1282: match('\n');
1283: newline();
1284: _ttype = Token.SKIP;
1285: if (_createToken && _token == null && _ttype != Token.SKIP) {
1286: _token = makeToken(_ttype);
1287: _token.setText(new String(text.getBuffer(), _begin, text
1288: .length()
1289: - _begin));
1290: }
1291: _returnToken = _token;
1292: }
1293:
1294: public final void mCommentLine(boolean _createToken)
1295: throws RecognitionException, CharStreamException,
1296: TokenStreamException {
1297: int _ttype;
1298: Token _token = null;
1299: int _begin = text.length();
1300: _ttype = CommentLine;
1301: int _saveIndex;
1302:
1303: _saveIndex = text.length();
1304: match('/');
1305: text.setLength(_saveIndex);
1306: _saveIndex = text.length();
1307: match('/');
1308: text.setLength(_saveIndex);
1309: {
1310: _loop58: do {
1311: if ((_tokenSet_5.member(LA(1)))) {
1312: _saveIndex = text.length();
1313: matchNot('\n');
1314: text.setLength(_saveIndex);
1315: } else {
1316: break _loop58;
1317: }
1318:
1319: } while (true);
1320: }
1321: _saveIndex = text.length();
1322: match('\n');
1323: text.setLength(_saveIndex);
1324: newline();
1325: _ttype = Token.SKIP;
1326: if (_createToken && _token == null && _ttype != Token.SKIP) {
1327: _token = makeToken(_ttype);
1328: _token.setText(new String(text.getBuffer(), _begin, text
1329: .length()
1330: - _begin));
1331: }
1332: _returnToken = _token;
1333: }
1334:
1335: public final void mMultiLineComment(boolean _createToken)
1336: throws RecognitionException, CharStreamException,
1337: TokenStreamException {
1338: int _ttype;
1339: Token _token = null;
1340: int _begin = text.length();
1341: _ttype = MultiLineComment;
1342: int _saveIndex;
1343:
1344: match("/*");
1345: {
1346: _loop62: do {
1347: if (((LA(1) == '*') && ((LA(2) >= '\u0003' && LA(2) <= '\ufffe')))
1348: && (LA(2) != '/')) {
1349: match('*');
1350: } else if ((LA(1) == '\n')) {
1351: match('\n');
1352: newline();
1353: } else if ((_tokenSet_6.member(LA(1)))) {
1354: {
1355: match(_tokenSet_6);
1356: }
1357: } else {
1358: break _loop62;
1359: }
1360:
1361: } while (true);
1362: }
1363: match("*/");
1364: _ttype = Token.SKIP;
1365: if (_createToken && _token == null && _ttype != Token.SKIP) {
1366: _token = makeToken(_ttype);
1367: _token.setText(new String(text.getBuffer(), _begin, text
1368: .length()
1369: - _begin));
1370: }
1371: _returnToken = _token;
1372: }
1373:
1374: private static final long[] mk_tokenSet_0() {
1375: long[] data = new long[1025];
1376: data[0] = 105621835743232L;
1377: data[1] = 576460745995190270L;
1378: return data;
1379: }
1380:
1381: public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
1382:
1383: private static final long[] mk_tokenSet_1() {
1384: long[] data = new long[1025];
1385: data[0] = 288019269919178752L;
1386: return data;
1387: }
1388:
1389: public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
1390:
1391: private static final long[] mk_tokenSet_2() {
1392: long[] data = new long[1025];
1393: data[0] = 288054523010744320L;
1394: data[1] = 576460745995190270L;
1395: return data;
1396: }
1397:
1398: public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
1399:
1400: private static final long[] mk_tokenSet_3() {
1401: long[] data = new long[2048];
1402: data[0] = -549755814920L;
1403: for (int i = 1; i <= 1022; i++) {
1404: data[i] = -1L;
1405: }
1406: data[1023] = 9223372036854775807L;
1407: return data;
1408: }
1409:
1410: public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
1411:
1412: private static final long[] mk_tokenSet_4() {
1413: long[] data = new long[2048];
1414: data[0] = -17179870216L;
1415: for (int i = 1; i <= 1022; i++) {
1416: data[i] = -1L;
1417: }
1418: data[1023] = 9223372036854775807L;
1419: return data;
1420: }
1421:
1422: public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
1423:
1424: private static final long[] mk_tokenSet_5() {
1425: long[] data = new long[2048];
1426: data[0] = -1032L;
1427: for (int i = 1; i <= 1022; i++) {
1428: data[i] = -1L;
1429: }
1430: data[1023] = 9223372036854775807L;
1431: return data;
1432: }
1433:
1434: public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
1435:
1436: private static final long[] mk_tokenSet_6() {
1437: long[] data = new long[2048];
1438: data[0] = -4398046512136L;
1439: for (int i = 1; i <= 1022; i++) {
1440: data[i] = -1L;
1441: }
1442: data[1023] = 9223372036854775807L;
1443: return data;
1444: }
1445:
1446: public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
1447:
1448: }
|