0001: // $ANTLR 2.7.7 (2006-01-29): "group.g" -> "GroupLexer.java"$
0002:
0003: /*
0004: [The "BSD licence"]
0005: Copyright (c) 2003-2004 Terence Parr
0006: All rights reserved.
0007:
0008: Redistribution and use in source and binary forms, with or without
0009: modification, are permitted provided that the following conditions
0010: are met:
0011: 1. Redistributions of source code must retain the above copyright
0012: notice, this list of conditions and the following disclaimer.
0013: 2. Redistributions in binary form must reproduce the above copyright
0014: notice, this list of conditions and the following disclaimer in the
0015: documentation and/or other materials provided with the distribution.
0016: 3. The name of the author may not be used to endorse or promote products
0017: derived from this software without specific prior written permission.
0018:
0019: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
0020: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0021: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0022: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0023: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0024: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0025: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0026: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0027: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0028: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0029: */
0030: package org.antlr.stringtemplate.language;
0031:
0032: import org.antlr.stringtemplate.*;
0033: import java.util.*;
0034:
0035: import java.io.InputStream;
0036: import antlr.TokenStreamException;
0037: import antlr.TokenStreamIOException;
0038: import antlr.TokenStreamRecognitionException;
0039: import antlr.CharStreamException;
0040: import antlr.CharStreamIOException;
0041: import antlr.ANTLRException;
0042: import java.io.Reader;
0043: import java.util.Hashtable;
0044: import antlr.CharScanner;
0045: import antlr.InputBuffer;
0046: import antlr.ByteBuffer;
0047: import antlr.CharBuffer;
0048: import antlr.Token;
0049: import antlr.CommonToken;
0050: import antlr.RecognitionException;
0051: import antlr.NoViableAltForCharException;
0052: import antlr.MismatchedCharException;
0053: import antlr.TokenStream;
0054: import antlr.ANTLRHashString;
0055: import antlr.LexerSharedInputState;
0056: import antlr.collections.impl.BitSet;
0057: import antlr.SemanticException;
0058:
0059: public class GroupLexer extends antlr.CharScanner implements
0060: GroupParserTokenTypes, TokenStream {
0061: public GroupLexer(InputStream in) {
0062: this (new ByteBuffer(in));
0063: }
0064:
0065: public GroupLexer(Reader in) {
0066: this (new CharBuffer(in));
0067: }
0068:
0069: public GroupLexer(InputBuffer ib) {
0070: this (new LexerSharedInputState(ib));
0071: }
0072:
0073: public GroupLexer(LexerSharedInputState state) {
0074: super (state);
0075: caseSensitiveLiterals = true;
0076: setCaseSensitive(true);
0077: literals = new Hashtable();
0078: literals.put(new ANTLRHashString("default", this ), new Integer(
0079: 21));
0080: literals
0081: .put(new ANTLRHashString("group", this ), new Integer(4));
0082: literals.put(new ANTLRHashString("implements", this ),
0083: new Integer(7));
0084: }
0085:
0086: public Token nextToken() throws TokenStreamException {
0087: Token theRetToken = null;
0088: tryAgain: for (;;) {
0089: Token _token = null;
0090: int _ttype = Token.INVALID_TYPE;
0091: resetText();
0092: try { // for char stream error handling
0093: try { // for lexical error handling
0094: switch (LA(1)) {
0095: case 'A':
0096: case 'B':
0097: case 'C':
0098: case 'D':
0099: case 'E':
0100: case 'F':
0101: case 'G':
0102: case 'H':
0103: case 'I':
0104: case 'J':
0105: case 'K':
0106: case 'L':
0107: case 'M':
0108: case 'N':
0109: case 'O':
0110: case 'P':
0111: case 'Q':
0112: case 'R':
0113: case 'S':
0114: case 'T':
0115: case 'U':
0116: case 'V':
0117: case 'W':
0118: case 'X':
0119: case 'Y':
0120: case 'Z':
0121: case '_':
0122: case 'a':
0123: case 'b':
0124: case 'c':
0125: case 'd':
0126: case 'e':
0127: case 'f':
0128: case 'g':
0129: case 'h':
0130: case 'i':
0131: case 'j':
0132: case 'k':
0133: case 'l':
0134: case 'm':
0135: case 'n':
0136: case 'o':
0137: case 'p':
0138: case 'q':
0139: case 'r':
0140: case 's':
0141: case 't':
0142: case 'u':
0143: case 'v':
0144: case 'w':
0145: case 'x':
0146: case 'y':
0147: case 'z': {
0148: mID(true);
0149: theRetToken = _returnToken;
0150: break;
0151: }
0152: case '"': {
0153: mSTRING(true);
0154: theRetToken = _returnToken;
0155: break;
0156: }
0157: case '<': {
0158: mBIGSTRING(true);
0159: theRetToken = _returnToken;
0160: break;
0161: }
0162: case '{': {
0163: mANONYMOUS_TEMPLATE(true);
0164: theRetToken = _returnToken;
0165: break;
0166: }
0167: case '@': {
0168: mAT(true);
0169: theRetToken = _returnToken;
0170: break;
0171: }
0172: case '(': {
0173: mLPAREN(true);
0174: theRetToken = _returnToken;
0175: break;
0176: }
0177: case ')': {
0178: mRPAREN(true);
0179: theRetToken = _returnToken;
0180: break;
0181: }
0182: case '[': {
0183: mLBRACK(true);
0184: theRetToken = _returnToken;
0185: break;
0186: }
0187: case ']': {
0188: mRBRACK(true);
0189: theRetToken = _returnToken;
0190: break;
0191: }
0192: case ',': {
0193: mCOMMA(true);
0194: theRetToken = _returnToken;
0195: break;
0196: }
0197: case '.': {
0198: mDOT(true);
0199: theRetToken = _returnToken;
0200: break;
0201: }
0202: case ';': {
0203: mSEMI(true);
0204: theRetToken = _returnToken;
0205: break;
0206: }
0207: case '*': {
0208: mSTAR(true);
0209: theRetToken = _returnToken;
0210: break;
0211: }
0212: case '+': {
0213: mPLUS(true);
0214: theRetToken = _returnToken;
0215: break;
0216: }
0217: case '=': {
0218: mASSIGN(true);
0219: theRetToken = _returnToken;
0220: break;
0221: }
0222: case '?': {
0223: mOPTIONAL(true);
0224: theRetToken = _returnToken;
0225: break;
0226: }
0227: case '\t':
0228: case '\n':
0229: case '\u000c':
0230: case '\r':
0231: case ' ': {
0232: mWS(true);
0233: theRetToken = _returnToken;
0234: break;
0235: }
0236: default:
0237: if ((LA(1) == ':') && (LA(2) == ':')) {
0238: mDEFINED_TO_BE(true);
0239: theRetToken = _returnToken;
0240: } else if ((LA(1) == '/') && (LA(2) == '/')) {
0241: mSL_COMMENT(true);
0242: theRetToken = _returnToken;
0243: } else if ((LA(1) == '/') && (LA(2) == '*')) {
0244: mML_COMMENT(true);
0245: theRetToken = _returnToken;
0246: } else if ((LA(1) == ':') && (true)) {
0247: mCOLON(true);
0248: theRetToken = _returnToken;
0249: } else {
0250: if (LA(1) == EOF_CHAR) {
0251: uponEOF();
0252: _returnToken = makeToken(Token.EOF_TYPE);
0253: } else {
0254: throw new NoViableAltForCharException(
0255: (char) LA(1), getFilename(),
0256: getLine(), getColumn());
0257: }
0258: }
0259: }
0260: if (_returnToken == null)
0261: continue tryAgain; // found SKIP token
0262: _ttype = _returnToken.getType();
0263: _returnToken.setType(_ttype);
0264: return _returnToken;
0265: } catch (RecognitionException e) {
0266: throw new TokenStreamRecognitionException(e);
0267: }
0268: } catch (CharStreamException cse) {
0269: if (cse instanceof CharStreamIOException) {
0270: throw new TokenStreamIOException(
0271: ((CharStreamIOException) cse).io);
0272: } else {
0273: throw new TokenStreamException(cse.getMessage());
0274: }
0275: }
0276: }
0277: }
0278:
0279: public final void mID(boolean _createToken)
0280: throws RecognitionException, CharStreamException,
0281: TokenStreamException {
0282: int _ttype;
0283: Token _token = null;
0284: int _begin = text.length();
0285: _ttype = ID;
0286: int _saveIndex;
0287:
0288: {
0289: switch (LA(1)) {
0290: case 'a':
0291: case 'b':
0292: case 'c':
0293: case 'd':
0294: case 'e':
0295: case 'f':
0296: case 'g':
0297: case 'h':
0298: case 'i':
0299: case 'j':
0300: case 'k':
0301: case 'l':
0302: case 'm':
0303: case 'n':
0304: case 'o':
0305: case 'p':
0306: case 'q':
0307: case 'r':
0308: case 's':
0309: case 't':
0310: case 'u':
0311: case 'v':
0312: case 'w':
0313: case 'x':
0314: case 'y':
0315: case 'z': {
0316: matchRange('a', 'z');
0317: break;
0318: }
0319: case 'A':
0320: case 'B':
0321: case 'C':
0322: case 'D':
0323: case 'E':
0324: case 'F':
0325: case 'G':
0326: case 'H':
0327: case 'I':
0328: case 'J':
0329: case 'K':
0330: case 'L':
0331: case 'M':
0332: case 'N':
0333: case 'O':
0334: case 'P':
0335: case 'Q':
0336: case 'R':
0337: case 'S':
0338: case 'T':
0339: case 'U':
0340: case 'V':
0341: case 'W':
0342: case 'X':
0343: case 'Y':
0344: case 'Z': {
0345: matchRange('A', 'Z');
0346: break;
0347: }
0348: case '_': {
0349: match('_');
0350: break;
0351: }
0352: default: {
0353: throw new NoViableAltForCharException((char) LA(1),
0354: getFilename(), getLine(), getColumn());
0355: }
0356: }
0357: }
0358: {
0359: _loop29: do {
0360: switch (LA(1)) {
0361: case 'a':
0362: case 'b':
0363: case 'c':
0364: case 'd':
0365: case 'e':
0366: case 'f':
0367: case 'g':
0368: case 'h':
0369: case 'i':
0370: case 'j':
0371: case 'k':
0372: case 'l':
0373: case 'm':
0374: case 'n':
0375: case 'o':
0376: case 'p':
0377: case 'q':
0378: case 'r':
0379: case 's':
0380: case 't':
0381: case 'u':
0382: case 'v':
0383: case 'w':
0384: case 'x':
0385: case 'y':
0386: case 'z': {
0387: matchRange('a', 'z');
0388: break;
0389: }
0390: case 'A':
0391: case 'B':
0392: case 'C':
0393: case 'D':
0394: case 'E':
0395: case 'F':
0396: case 'G':
0397: case 'H':
0398: case 'I':
0399: case 'J':
0400: case 'K':
0401: case 'L':
0402: case 'M':
0403: case 'N':
0404: case 'O':
0405: case 'P':
0406: case 'Q':
0407: case 'R':
0408: case 'S':
0409: case 'T':
0410: case 'U':
0411: case 'V':
0412: case 'W':
0413: case 'X':
0414: case 'Y':
0415: case 'Z': {
0416: matchRange('A', 'Z');
0417: break;
0418: }
0419: case '0':
0420: case '1':
0421: case '2':
0422: case '3':
0423: case '4':
0424: case '5':
0425: case '6':
0426: case '7':
0427: case '8':
0428: case '9': {
0429: matchRange('0', '9');
0430: break;
0431: }
0432: case '-': {
0433: match('-');
0434: break;
0435: }
0436: case '_': {
0437: match('_');
0438: break;
0439: }
0440: default: {
0441: break _loop29;
0442: }
0443: }
0444: } while (true);
0445: }
0446: _ttype = testLiteralsTable(_ttype);
0447: if (_createToken && _token == null && _ttype != Token.SKIP) {
0448: _token = makeToken(_ttype);
0449: _token.setText(new String(text.getBuffer(), _begin, text
0450: .length()
0451: - _begin));
0452: }
0453: _returnToken = _token;
0454: }
0455:
0456: public final void mSTRING(boolean _createToken)
0457: throws RecognitionException, CharStreamException,
0458: TokenStreamException {
0459: int _ttype;
0460: Token _token = null;
0461: int _begin = text.length();
0462: _ttype = STRING;
0463: int _saveIndex;
0464:
0465: _saveIndex = text.length();
0466: match('"');
0467: text.setLength(_saveIndex);
0468: {
0469: _loop32: do {
0470: if ((LA(1) == '\\') && (LA(2) == '"')) {
0471: _saveIndex = text.length();
0472: match('\\');
0473: text.setLength(_saveIndex);
0474: match('"');
0475: } else if ((LA(1) == '\\')
0476: && (_tokenSet_0.member(LA(2)))) {
0477: match('\\');
0478: matchNot('"');
0479: } else if ((_tokenSet_1.member(LA(1)))) {
0480: matchNot('"');
0481: } else {
0482: break _loop32;
0483: }
0484:
0485: } while (true);
0486: }
0487: _saveIndex = text.length();
0488: match('"');
0489: text.setLength(_saveIndex);
0490: if (_createToken && _token == null && _ttype != Token.SKIP) {
0491: _token = makeToken(_ttype);
0492: _token.setText(new String(text.getBuffer(), _begin, text
0493: .length()
0494: - _begin));
0495: }
0496: _returnToken = _token;
0497: }
0498:
0499: public final void mBIGSTRING(boolean _createToken)
0500: throws RecognitionException, CharStreamException,
0501: TokenStreamException {
0502: int _ttype;
0503: Token _token = null;
0504: int _begin = text.length();
0505: _ttype = BIGSTRING;
0506: int _saveIndex;
0507:
0508: _saveIndex = text.length();
0509: match("<<");
0510: text.setLength(_saveIndex);
0511: {
0512: if ((LA(1) == '\n' || LA(1) == '\r')
0513: && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
0514: {
0515: switch (LA(1)) {
0516: case '\r': {
0517: _saveIndex = text.length();
0518: match('\r');
0519: text.setLength(_saveIndex);
0520: break;
0521: }
0522: case '\n': {
0523: break;
0524: }
0525: default: {
0526: throw new NoViableAltForCharException(
0527: (char) LA(1), getFilename(), getLine(),
0528: getColumn());
0529: }
0530: }
0531: }
0532: _saveIndex = text.length();
0533: match('\n');
0534: text.setLength(_saveIndex);
0535: newline();
0536: } else if (((LA(1) >= '\u0000' && LA(1) <= '\ufffe'))
0537: && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
0538: } else {
0539: throw new NoViableAltForCharException((char) LA(1),
0540: getFilename(), getLine(), getColumn());
0541: }
0542:
0543: }
0544: {
0545: _loop38: do {
0546: // nongreedy exit test
0547: if ((LA(1) == '>') && (LA(2) == '>'))
0548: break _loop38;
0549: if (((LA(1) == '\r') && (LA(2) == '\n'))
0550: && (LA(3) == '>' && LA(4) == '>')) {
0551: _saveIndex = text.length();
0552: match('\r');
0553: text.setLength(_saveIndex);
0554: _saveIndex = text.length();
0555: match('\n');
0556: text.setLength(_saveIndex);
0557: newline();
0558: } else if (((LA(1) == '\n') && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe')))
0559: && (LA(2) == '>' && LA(3) == '>')) {
0560: _saveIndex = text.length();
0561: match('\n');
0562: text.setLength(_saveIndex);
0563: newline();
0564: } else if ((LA(1) == '\n' || LA(1) == '\r')
0565: && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
0566: {
0567: switch (LA(1)) {
0568: case '\r': {
0569: match('\r');
0570: break;
0571: }
0572: case '\n': {
0573: break;
0574: }
0575: default: {
0576: throw new NoViableAltForCharException(
0577: (char) LA(1), getFilename(),
0578: getLine(), getColumn());
0579: }
0580: }
0581: }
0582: match('\n');
0583: newline();
0584: } else if ((LA(1) == '\\') && (LA(2) == '>')) {
0585: _saveIndex = text.length();
0586: match('\\');
0587: text.setLength(_saveIndex);
0588: match('>');
0589: } else if (((LA(1) >= '\u0000' && LA(1) <= '\ufffe'))
0590: && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
0591: matchNot(EOF_CHAR);
0592: } else {
0593: break _loop38;
0594: }
0595:
0596: } while (true);
0597: }
0598: _saveIndex = text.length();
0599: match(">>");
0600: text.setLength(_saveIndex);
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: public final void mANONYMOUS_TEMPLATE(boolean _createToken)
0611: throws RecognitionException, CharStreamException,
0612: TokenStreamException {
0613: int _ttype;
0614: Token _token = null;
0615: int _begin = text.length();
0616: _ttype = ANONYMOUS_TEMPLATE;
0617: int _saveIndex;
0618:
0619: List args = null;
0620: StringTemplateToken t = null;
0621:
0622: _saveIndex = text.length();
0623: match('{');
0624: text.setLength(_saveIndex);
0625: {
0626: _loop42: do {
0627: // nongreedy exit test
0628: if ((LA(1) == '}') && (true))
0629: break _loop42;
0630: if ((LA(1) == '\n' || LA(1) == '\r')
0631: && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
0632: {
0633: switch (LA(1)) {
0634: case '\r': {
0635: match('\r');
0636: break;
0637: }
0638: case '\n': {
0639: break;
0640: }
0641: default: {
0642: throw new NoViableAltForCharException(
0643: (char) LA(1), getFilename(),
0644: getLine(), getColumn());
0645: }
0646: }
0647: }
0648: match('\n');
0649: newline();
0650: } else if ((LA(1) == '\\') && (LA(2) == '}')) {
0651: _saveIndex = text.length();
0652: match('\\');
0653: text.setLength(_saveIndex);
0654: match('}');
0655: } else if (((LA(1) >= '\u0000' && LA(1) <= '\ufffe'))
0656: && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
0657: matchNot(EOF_CHAR);
0658: } else {
0659: break _loop42;
0660: }
0661:
0662: } while (true);
0663: }
0664: _saveIndex = text.length();
0665: match('}');
0666: text.setLength(_saveIndex);
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 mAT(boolean _createToken)
0677: throws RecognitionException, CharStreamException,
0678: TokenStreamException {
0679: int _ttype;
0680: Token _token = null;
0681: int _begin = text.length();
0682: _ttype = AT;
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 mLPAREN(boolean _createToken)
0696: throws RecognitionException, CharStreamException,
0697: TokenStreamException {
0698: int _ttype;
0699: Token _token = null;
0700: int _begin = text.length();
0701: _ttype = LPAREN;
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: public final void mRPAREN(boolean _createToken)
0715: throws RecognitionException, CharStreamException,
0716: TokenStreamException {
0717: int _ttype;
0718: Token _token = null;
0719: int _begin = text.length();
0720: _ttype = RPAREN;
0721: int _saveIndex;
0722:
0723: match(')');
0724: if (_createToken && _token == null && _ttype != Token.SKIP) {
0725: _token = makeToken(_ttype);
0726: _token.setText(new String(text.getBuffer(), _begin, text
0727: .length()
0728: - _begin));
0729: }
0730: _returnToken = _token;
0731: }
0732:
0733: public final void mLBRACK(boolean _createToken)
0734: throws RecognitionException, CharStreamException,
0735: TokenStreamException {
0736: int _ttype;
0737: Token _token = null;
0738: int _begin = text.length();
0739: _ttype = LBRACK;
0740: int _saveIndex;
0741:
0742: match('[');
0743: if (_createToken && _token == null && _ttype != Token.SKIP) {
0744: _token = makeToken(_ttype);
0745: _token.setText(new String(text.getBuffer(), _begin, text
0746: .length()
0747: - _begin));
0748: }
0749: _returnToken = _token;
0750: }
0751:
0752: public final void mRBRACK(boolean _createToken)
0753: throws RecognitionException, CharStreamException,
0754: TokenStreamException {
0755: int _ttype;
0756: Token _token = null;
0757: int _begin = text.length();
0758: _ttype = RBRACK;
0759: int _saveIndex;
0760:
0761: match(']');
0762: if (_createToken && _token == null && _ttype != Token.SKIP) {
0763: _token = makeToken(_ttype);
0764: _token.setText(new String(text.getBuffer(), _begin, text
0765: .length()
0766: - _begin));
0767: }
0768: _returnToken = _token;
0769: }
0770:
0771: public final void mCOMMA(boolean _createToken)
0772: throws RecognitionException, CharStreamException,
0773: TokenStreamException {
0774: int _ttype;
0775: Token _token = null;
0776: int _begin = text.length();
0777: _ttype = COMMA;
0778: int _saveIndex;
0779:
0780: match(',');
0781: if (_createToken && _token == null && _ttype != Token.SKIP) {
0782: _token = makeToken(_ttype);
0783: _token.setText(new String(text.getBuffer(), _begin, text
0784: .length()
0785: - _begin));
0786: }
0787: _returnToken = _token;
0788: }
0789:
0790: public final void mDOT(boolean _createToken)
0791: throws RecognitionException, CharStreamException,
0792: TokenStreamException {
0793: int _ttype;
0794: Token _token = null;
0795: int _begin = text.length();
0796: _ttype = DOT;
0797: int _saveIndex;
0798:
0799: match('.');
0800: if (_createToken && _token == null && _ttype != Token.SKIP) {
0801: _token = makeToken(_ttype);
0802: _token.setText(new String(text.getBuffer(), _begin, text
0803: .length()
0804: - _begin));
0805: }
0806: _returnToken = _token;
0807: }
0808:
0809: public final void mDEFINED_TO_BE(boolean _createToken)
0810: throws RecognitionException, CharStreamException,
0811: TokenStreamException {
0812: int _ttype;
0813: Token _token = null;
0814: int _begin = text.length();
0815: _ttype = DEFINED_TO_BE;
0816: int _saveIndex;
0817:
0818: match("::=");
0819: if (_createToken && _token == null && _ttype != Token.SKIP) {
0820: _token = makeToken(_ttype);
0821: _token.setText(new String(text.getBuffer(), _begin, text
0822: .length()
0823: - _begin));
0824: }
0825: _returnToken = _token;
0826: }
0827:
0828: public final void mSEMI(boolean _createToken)
0829: throws RecognitionException, CharStreamException,
0830: TokenStreamException {
0831: int _ttype;
0832: Token _token = null;
0833: int _begin = text.length();
0834: _ttype = SEMI;
0835: int _saveIndex;
0836:
0837: match(';');
0838: if (_createToken && _token == null && _ttype != Token.SKIP) {
0839: _token = makeToken(_ttype);
0840: _token.setText(new String(text.getBuffer(), _begin, text
0841: .length()
0842: - _begin));
0843: }
0844: _returnToken = _token;
0845: }
0846:
0847: public final void mCOLON(boolean _createToken)
0848: throws RecognitionException, CharStreamException,
0849: TokenStreamException {
0850: int _ttype;
0851: Token _token = null;
0852: int _begin = text.length();
0853: _ttype = COLON;
0854: int _saveIndex;
0855:
0856: match(':');
0857: if (_createToken && _token == null && _ttype != Token.SKIP) {
0858: _token = makeToken(_ttype);
0859: _token.setText(new String(text.getBuffer(), _begin, text
0860: .length()
0861: - _begin));
0862: }
0863: _returnToken = _token;
0864: }
0865:
0866: public final void mSTAR(boolean _createToken)
0867: throws RecognitionException, CharStreamException,
0868: TokenStreamException {
0869: int _ttype;
0870: Token _token = null;
0871: int _begin = text.length();
0872: _ttype = STAR;
0873: int _saveIndex;
0874:
0875: match('*');
0876: if (_createToken && _token == null && _ttype != Token.SKIP) {
0877: _token = makeToken(_ttype);
0878: _token.setText(new String(text.getBuffer(), _begin, text
0879: .length()
0880: - _begin));
0881: }
0882: _returnToken = _token;
0883: }
0884:
0885: public final void mPLUS(boolean _createToken)
0886: throws RecognitionException, CharStreamException,
0887: TokenStreamException {
0888: int _ttype;
0889: Token _token = null;
0890: int _begin = text.length();
0891: _ttype = PLUS;
0892: int _saveIndex;
0893:
0894: match('+');
0895: if (_createToken && _token == null && _ttype != Token.SKIP) {
0896: _token = makeToken(_ttype);
0897: _token.setText(new String(text.getBuffer(), _begin, text
0898: .length()
0899: - _begin));
0900: }
0901: _returnToken = _token;
0902: }
0903:
0904: public final void mASSIGN(boolean _createToken)
0905: throws RecognitionException, CharStreamException,
0906: TokenStreamException {
0907: int _ttype;
0908: Token _token = null;
0909: int _begin = text.length();
0910: _ttype = ASSIGN;
0911: int _saveIndex;
0912:
0913: match('=');
0914: if (_createToken && _token == null && _ttype != Token.SKIP) {
0915: _token = makeToken(_ttype);
0916: _token.setText(new String(text.getBuffer(), _begin, text
0917: .length()
0918: - _begin));
0919: }
0920: _returnToken = _token;
0921: }
0922:
0923: public final void mOPTIONAL(boolean _createToken)
0924: throws RecognitionException, CharStreamException,
0925: TokenStreamException {
0926: int _ttype;
0927: Token _token = null;
0928: int _begin = text.length();
0929: _ttype = OPTIONAL;
0930: int _saveIndex;
0931:
0932: match('?');
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: public final void mSL_COMMENT(boolean _createToken)
0943: throws RecognitionException, CharStreamException,
0944: TokenStreamException {
0945: int _ttype;
0946: Token _token = null;
0947: int _begin = text.length();
0948: _ttype = SL_COMMENT;
0949: int _saveIndex;
0950:
0951: match("//");
0952: {
0953: _loop60: do {
0954: if ((_tokenSet_2.member(LA(1)))) {
0955: {
0956: match(_tokenSet_2);
0957: }
0958: } else {
0959: break _loop60;
0960: }
0961:
0962: } while (true);
0963: }
0964: {
0965: if ((LA(1) == '\n' || LA(1) == '\r')) {
0966: {
0967: switch (LA(1)) {
0968: case '\r': {
0969: match('\r');
0970: break;
0971: }
0972: case '\n': {
0973: break;
0974: }
0975: default: {
0976: throw new NoViableAltForCharException(
0977: (char) LA(1), getFilename(), getLine(),
0978: getColumn());
0979: }
0980: }
0981: }
0982: match('\n');
0983: } else {
0984: }
0985:
0986: }
0987: _ttype = Token.SKIP;
0988: newline();
0989: if (_createToken && _token == null && _ttype != Token.SKIP) {
0990: _token = makeToken(_ttype);
0991: _token.setText(new String(text.getBuffer(), _begin, text
0992: .length()
0993: - _begin));
0994: }
0995: _returnToken = _token;
0996: }
0997:
0998: public final void mML_COMMENT(boolean _createToken)
0999: throws RecognitionException, CharStreamException,
1000: TokenStreamException {
1001: int _ttype;
1002: Token _token = null;
1003: int _begin = text.length();
1004: _ttype = ML_COMMENT;
1005: int _saveIndex;
1006:
1007: match("/*");
1008: {
1009: _loop66: do {
1010: // nongreedy exit test
1011: if ((LA(1) == '*') && (LA(2) == '/'))
1012: break _loop66;
1013: if ((LA(1) == '\n' || LA(1) == '\r')
1014: && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
1015: {
1016: switch (LA(1)) {
1017: case '\r': {
1018: match('\r');
1019: break;
1020: }
1021: case '\n': {
1022: break;
1023: }
1024: default: {
1025: throw new NoViableAltForCharException(
1026: (char) LA(1), getFilename(),
1027: getLine(), getColumn());
1028: }
1029: }
1030: }
1031: match('\n');
1032: newline();
1033: } else if (((LA(1) >= '\u0000' && LA(1) <= '\ufffe'))
1034: && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
1035: matchNot(EOF_CHAR);
1036: } else {
1037: break _loop66;
1038: }
1039:
1040: } while (true);
1041: }
1042: match("*/");
1043: _ttype = Token.SKIP;
1044: if (_createToken && _token == null && _ttype != Token.SKIP) {
1045: _token = makeToken(_ttype);
1046: _token.setText(new String(text.getBuffer(), _begin, text
1047: .length()
1048: - _begin));
1049: }
1050: _returnToken = _token;
1051: }
1052:
1053: public final void mWS(boolean _createToken)
1054: throws RecognitionException, CharStreamException,
1055: TokenStreamException {
1056: int _ttype;
1057: Token _token = null;
1058: int _begin = text.length();
1059: _ttype = WS;
1060: int _saveIndex;
1061:
1062: {
1063: int _cnt70 = 0;
1064: _loop70: do {
1065: switch (LA(1)) {
1066: case ' ': {
1067: match(' ');
1068: break;
1069: }
1070: case '\t': {
1071: match('\t');
1072: break;
1073: }
1074: case '\u000c': {
1075: match('\f');
1076: break;
1077: }
1078: case '\n':
1079: case '\r': {
1080: {
1081: switch (LA(1)) {
1082: case '\r': {
1083: match('\r');
1084: break;
1085: }
1086: case '\n': {
1087: break;
1088: }
1089: default: {
1090: throw new NoViableAltForCharException(
1091: (char) LA(1), getFilename(),
1092: getLine(), getColumn());
1093: }
1094: }
1095: }
1096: match('\n');
1097: newline();
1098: break;
1099: }
1100: default: {
1101: if (_cnt70 >= 1) {
1102: break _loop70;
1103: } else {
1104: throw new NoViableAltForCharException(
1105: (char) LA(1), getFilename(), getLine(),
1106: getColumn());
1107: }
1108: }
1109: }
1110: _cnt70++;
1111: } while (true);
1112: }
1113: _ttype = Token.SKIP;
1114: if (_createToken && _token == null && _ttype != Token.SKIP) {
1115: _token = makeToken(_ttype);
1116: _token.setText(new String(text.getBuffer(), _begin, text
1117: .length()
1118: - _begin));
1119: }
1120: _returnToken = _token;
1121: }
1122:
1123: private static final long[] mk_tokenSet_0() {
1124: long[] data = new long[2048];
1125: data[0] = -17179869185L;
1126: for (int i = 1; i <= 1022; i++) {
1127: data[i] = -1L;
1128: }
1129: data[1023] = 9223372036854775807L;
1130: return data;
1131: }
1132:
1133: public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
1134:
1135: private static final long[] mk_tokenSet_1() {
1136: long[] data = new long[2048];
1137: data[0] = -17179869185L;
1138: data[1] = -268435457L;
1139: for (int i = 2; i <= 1022; i++) {
1140: data[i] = -1L;
1141: }
1142: data[1023] = 9223372036854775807L;
1143: return data;
1144: }
1145:
1146: public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
1147:
1148: private static final long[] mk_tokenSet_2() {
1149: long[] data = new long[2048];
1150: data[0] = -9217L;
1151: for (int i = 1; i <= 1022; i++) {
1152: data[i] = -1L;
1153: }
1154: data[1023] = 9223372036854775807L;
1155: return data;
1156: }
1157:
1158: public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
1159:
1160: }
|