0001: // $ANTLR 2.7.7 (2006-01-29): "antlr.g" -> "ANTLRLexer.java"$
0002:
0003: /*
0004: [The "BSD licence"]
0005: Copyright (c) 2005-2006 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.tool;
0031:
0032: import java.util.*;
0033: import java.io.*;
0034: import org.antlr.analysis.*;
0035: import org.antlr.misc.*;
0036: import antlr.*;
0037:
0038: import java.io.InputStream;
0039: import antlr.TokenStreamException;
0040: import antlr.TokenStreamIOException;
0041: import antlr.TokenStreamRecognitionException;
0042: import antlr.CharStreamException;
0043: import antlr.CharStreamIOException;
0044: import antlr.ANTLRException;
0045: import java.io.Reader;
0046: import java.util.Hashtable;
0047: import antlr.CharScanner;
0048: import antlr.InputBuffer;
0049: import antlr.ByteBuffer;
0050: import antlr.CharBuffer;
0051: import antlr.Token;
0052: import antlr.CommonToken;
0053: import antlr.RecognitionException;
0054: import antlr.NoViableAltForCharException;
0055: import antlr.MismatchedCharException;
0056: import antlr.TokenStream;
0057: import antlr.ANTLRHashString;
0058: import antlr.LexerSharedInputState;
0059: import antlr.collections.impl.BitSet;
0060: import antlr.SemanticException;
0061:
0062: public class ANTLRLexer extends antlr.CharScanner implements
0063: ANTLRTokenTypes, TokenStream {
0064:
0065: /** advance the current column number by one; don't do tabs.
0066: * we want char position in line to be sent to AntlrWorks.
0067: */
0068: public void tab() {
0069: setColumn(getColumn() + 1);
0070: }
0071:
0072: public ANTLRLexer(InputStream in) {
0073: this (new ByteBuffer(in));
0074: }
0075:
0076: public ANTLRLexer(Reader in) {
0077: this (new CharBuffer(in));
0078: }
0079:
0080: public ANTLRLexer(InputBuffer ib) {
0081: this (new LexerSharedInputState(ib));
0082: }
0083:
0084: public ANTLRLexer(LexerSharedInputState state) {
0085: super (state);
0086: caseSensitiveLiterals = true;
0087: setCaseSensitive(true);
0088: literals = new Hashtable();
0089: literals.put(new ANTLRHashString("lexer", this ),
0090: new Integer(40));
0091: literals.put(new ANTLRHashString("scope", this ),
0092: new Integer(32));
0093: literals.put(new ANTLRHashString("finally", this ), new Integer(
0094: 64));
0095: literals.put(new ANTLRHashString("throws", this ), new Integer(
0096: 58));
0097: literals.put(new ANTLRHashString("fragment", this ),
0098: new Integer(36));
0099: literals.put(new ANTLRHashString("private", this ), new Integer(
0100: 54));
0101: literals.put(new ANTLRHashString("grammar", this ), new Integer(
0102: 42));
0103: literals.put(new ANTLRHashString("tokens", this ),
0104: new Integer(5));
0105: literals.put(new ANTLRHashString("options", this ), new Integer(
0106: 4));
0107: literals.put(new ANTLRHashString("parser", this ),
0108: new Integer(6));
0109: literals
0110: .put(new ANTLRHashString("tree", this ), new Integer(41));
0111: literals.put(new ANTLRHashString("protected", this ),
0112: new Integer(52));
0113: literals.put(new ANTLRHashString("returns", this ), new Integer(
0114: 57));
0115: literals.put(new ANTLRHashString("public", this ), new Integer(
0116: 53));
0117: literals.put(new ANTLRHashString("catch", this ),
0118: new Integer(63));
0119: }
0120:
0121: public Token nextToken() throws TokenStreamException {
0122: Token theRetToken = null;
0123: tryAgain: for (;;) {
0124: Token _token = null;
0125: int _ttype = Token.INVALID_TYPE;
0126: resetText();
0127: try { // for char stream error handling
0128: try { // for lexical error handling
0129: switch (LA(1)) {
0130: case '\t':
0131: case '\n':
0132: case '\r':
0133: case ' ': {
0134: mWS(true);
0135: theRetToken = _returnToken;
0136: break;
0137: }
0138: case '/': {
0139: mCOMMENT(true);
0140: theRetToken = _returnToken;
0141: break;
0142: }
0143: case '>': {
0144: mCLOSE_ELEMENT_OPTION(true);
0145: theRetToken = _returnToken;
0146: break;
0147: }
0148: case '@': {
0149: mAMPERSAND(true);
0150: theRetToken = _returnToken;
0151: break;
0152: }
0153: case ',': {
0154: mCOMMA(true);
0155: theRetToken = _returnToken;
0156: break;
0157: }
0158: case '?': {
0159: mQUESTION(true);
0160: theRetToken = _returnToken;
0161: break;
0162: }
0163: case '(': {
0164: mLPAREN(true);
0165: theRetToken = _returnToken;
0166: break;
0167: }
0168: case ')': {
0169: mRPAREN(true);
0170: theRetToken = _returnToken;
0171: break;
0172: }
0173: case ':': {
0174: mCOLON(true);
0175: theRetToken = _returnToken;
0176: break;
0177: }
0178: case '*': {
0179: mSTAR(true);
0180: theRetToken = _returnToken;
0181: break;
0182: }
0183: case '-': {
0184: mREWRITE(true);
0185: theRetToken = _returnToken;
0186: break;
0187: }
0188: case ';': {
0189: mSEMI(true);
0190: theRetToken = _returnToken;
0191: break;
0192: }
0193: case '!': {
0194: mBANG(true);
0195: theRetToken = _returnToken;
0196: break;
0197: }
0198: case '|': {
0199: mOR(true);
0200: theRetToken = _returnToken;
0201: break;
0202: }
0203: case '~': {
0204: mNOT(true);
0205: theRetToken = _returnToken;
0206: break;
0207: }
0208: case '}': {
0209: mRCURLY(true);
0210: theRetToken = _returnToken;
0211: break;
0212: }
0213: case '$': {
0214: mDOLLAR(true);
0215: theRetToken = _returnToken;
0216: break;
0217: }
0218: case '\'': {
0219: mCHAR_LITERAL(true);
0220: theRetToken = _returnToken;
0221: break;
0222: }
0223: case '"': {
0224: mDOUBLE_QUOTE_STRING_LITERAL(true);
0225: theRetToken = _returnToken;
0226: break;
0227: }
0228: case '0':
0229: case '1':
0230: case '2':
0231: case '3':
0232: case '4':
0233: case '5':
0234: case '6':
0235: case '7':
0236: case '8':
0237: case '9': {
0238: mINT(true);
0239: theRetToken = _returnToken;
0240: break;
0241: }
0242: case '[': {
0243: mARG_ACTION(true);
0244: theRetToken = _returnToken;
0245: break;
0246: }
0247: case '{': {
0248: mACTION(true);
0249: theRetToken = _returnToken;
0250: break;
0251: }
0252: case 'A':
0253: case 'B':
0254: case 'C':
0255: case 'D':
0256: case 'E':
0257: case 'F':
0258: case 'G':
0259: case 'H':
0260: case 'I':
0261: case 'J':
0262: case 'K':
0263: case 'L':
0264: case 'M':
0265: case 'N':
0266: case 'O':
0267: case 'P':
0268: case 'Q':
0269: case 'R':
0270: case 'S':
0271: case 'T':
0272: case 'U':
0273: case 'V':
0274: case 'W':
0275: case 'X':
0276: case 'Y':
0277: case 'Z': {
0278: mTOKEN_REF(true);
0279: theRetToken = _returnToken;
0280: break;
0281: }
0282: case 'a':
0283: case 'b':
0284: case 'c':
0285: case 'd':
0286: case 'e':
0287: case 'f':
0288: case 'g':
0289: case 'h':
0290: case 'i':
0291: case 'j':
0292: case 'k':
0293: case 'l':
0294: case 'm':
0295: case 'n':
0296: case 'o':
0297: case 'p':
0298: case 'q':
0299: case 'r':
0300: case 's':
0301: case 't':
0302: case 'u':
0303: case 'v':
0304: case 'w':
0305: case 'x':
0306: case 'y':
0307: case 'z': {
0308: mRULE_REF(true);
0309: theRetToken = _returnToken;
0310: break;
0311: }
0312: default:
0313: if ((LA(1) == '^') && (LA(2) == '(')) {
0314: mTREE_BEGIN(true);
0315: theRetToken = _returnToken;
0316: } else if ((LA(1) == '+') && (LA(2) == '=')) {
0317: mPLUS_ASSIGN(true);
0318: theRetToken = _returnToken;
0319: } else if ((LA(1) == '=') && (LA(2) == '>')) {
0320: mIMPLIES(true);
0321: theRetToken = _returnToken;
0322: } else if ((LA(1) == '.') && (LA(2) == '.')) {
0323: mRANGE(true);
0324: theRetToken = _returnToken;
0325: } else if ((LA(1) == '<') && (LA(2) == '<')) {
0326: mDOUBLE_ANGLE_STRING_LITERAL(true);
0327: theRetToken = _returnToken;
0328: } else if ((LA(1) == '<') && (true)) {
0329: mOPEN_ELEMENT_OPTION(true);
0330: theRetToken = _returnToken;
0331: } else if ((LA(1) == '+') && (true)) {
0332: mPLUS(true);
0333: theRetToken = _returnToken;
0334: } else if ((LA(1) == '=') && (true)) {
0335: mASSIGN(true);
0336: theRetToken = _returnToken;
0337: } else if ((LA(1) == '^') && (true)) {
0338: mROOT(true);
0339: theRetToken = _returnToken;
0340: } else if ((LA(1) == '.') && (true)) {
0341: mWILDCARD(true);
0342: theRetToken = _returnToken;
0343: } else {
0344: if (LA(1) == EOF_CHAR) {
0345: uponEOF();
0346: _returnToken = makeToken(Token.EOF_TYPE);
0347: } else {
0348: throw new NoViableAltForCharException(
0349: (char) LA(1), getFilename(),
0350: getLine(), getColumn());
0351: }
0352: }
0353: }
0354: if (_returnToken == null)
0355: continue tryAgain; // found SKIP token
0356: _ttype = _returnToken.getType();
0357: _returnToken.setType(_ttype);
0358: return _returnToken;
0359: } catch (RecognitionException e) {
0360: throw new TokenStreamRecognitionException(e);
0361: }
0362: } catch (CharStreamException cse) {
0363: if (cse instanceof CharStreamIOException) {
0364: throw new TokenStreamIOException(
0365: ((CharStreamIOException) cse).io);
0366: } else {
0367: throw new TokenStreamException(cse.getMessage());
0368: }
0369: }
0370: }
0371: }
0372:
0373: public final void mWS(boolean _createToken)
0374: throws RecognitionException, CharStreamException,
0375: TokenStreamException {
0376: int _ttype;
0377: Token _token = null;
0378: int _begin = text.length();
0379: _ttype = WS;
0380: int _saveIndex;
0381:
0382: {
0383: switch (LA(1)) {
0384: case ' ': {
0385: match(' ');
0386: break;
0387: }
0388: case '\t': {
0389: match('\t');
0390: break;
0391: }
0392: case '\n':
0393: case '\r': {
0394: {
0395: switch (LA(1)) {
0396: case '\r': {
0397: match('\r');
0398: break;
0399: }
0400: case '\n': {
0401: break;
0402: }
0403: default: {
0404: throw new NoViableAltForCharException(
0405: (char) LA(1), getFilename(), getLine(),
0406: getColumn());
0407: }
0408: }
0409: }
0410: match('\n');
0411: if (inputState.guessing == 0) {
0412: newline();
0413: }
0414: break;
0415: }
0416: default: {
0417: throw new NoViableAltForCharException((char) LA(1),
0418: getFilename(), getLine(), getColumn());
0419: }
0420: }
0421: }
0422: if (_createToken && _token == null && _ttype != Token.SKIP) {
0423: _token = makeToken(_ttype);
0424: _token.setText(new String(text.getBuffer(), _begin, text
0425: .length()
0426: - _begin));
0427: }
0428: _returnToken = _token;
0429: }
0430:
0431: public final void mCOMMENT(boolean _createToken)
0432: throws RecognitionException, CharStreamException,
0433: TokenStreamException {
0434: int _ttype;
0435: Token _token = null;
0436: int _begin = text.length();
0437: _ttype = COMMENT;
0438: int _saveIndex;
0439: Token t = null;
0440:
0441: {
0442: if ((LA(1) == '/') && (LA(2) == '/')) {
0443: mSL_COMMENT(false);
0444: } else if ((LA(1) == '/') && (LA(2) == '*')) {
0445: mML_COMMENT(true);
0446: t = _returnToken;
0447: if (inputState.guessing == 0) {
0448: _ttype = t.getType();
0449: }
0450: } else {
0451: throw new NoViableAltForCharException((char) LA(1),
0452: getFilename(), getLine(), getColumn());
0453: }
0454:
0455: }
0456: if (_createToken && _token == null && _ttype != Token.SKIP) {
0457: _token = makeToken(_ttype);
0458: _token.setText(new String(text.getBuffer(), _begin, text
0459: .length()
0460: - _begin));
0461: }
0462: _returnToken = _token;
0463: }
0464:
0465: protected final void mSL_COMMENT(boolean _createToken)
0466: throws RecognitionException, CharStreamException,
0467: TokenStreamException {
0468: int _ttype;
0469: Token _token = null;
0470: int _begin = text.length();
0471: _ttype = SL_COMMENT;
0472: int _saveIndex;
0473:
0474: match("//");
0475: {
0476: boolean synPredMatched139 = false;
0477: if (((LA(1) == ' ') && (LA(2) == '$'))) {
0478: int _m139 = mark();
0479: synPredMatched139 = true;
0480: inputState.guessing++;
0481: try {
0482: {
0483: match(" $ANTLR");
0484: }
0485: } catch (RecognitionException pe) {
0486: synPredMatched139 = false;
0487: }
0488: rewind(_m139);
0489: inputState.guessing--;
0490: }
0491: if (synPredMatched139) {
0492: match(" $ANTLR ");
0493: mSRC(false);
0494: {
0495: switch (LA(1)) {
0496: case '\r': {
0497: match('\r');
0498: break;
0499: }
0500: case '\n': {
0501: break;
0502: }
0503: default: {
0504: throw new NoViableAltForCharException(
0505: (char) LA(1), getFilename(), getLine(),
0506: getColumn());
0507: }
0508: }
0509: }
0510: match('\n');
0511: } else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true)) {
0512: {
0513: _loop142: do {
0514: // nongreedy exit test
0515: if ((LA(1) == '\n' || LA(1) == '\r') && (true))
0516: break _loop142;
0517: if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff'))
0518: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
0519: matchNot(EOF_CHAR);
0520: } else {
0521: break _loop142;
0522: }
0523:
0524: } while (true);
0525: }
0526: {
0527: switch (LA(1)) {
0528: case '\r': {
0529: match('\r');
0530: break;
0531: }
0532: case '\n': {
0533: break;
0534: }
0535: default: {
0536: throw new NoViableAltForCharException(
0537: (char) LA(1), getFilename(), getLine(),
0538: getColumn());
0539: }
0540: }
0541: }
0542: match('\n');
0543: } else {
0544: throw new NoViableAltForCharException((char) LA(1),
0545: getFilename(), getLine(), getColumn());
0546: }
0547:
0548: }
0549: if (inputState.guessing == 0) {
0550: newline();
0551: }
0552: if (_createToken && _token == null && _ttype != Token.SKIP) {
0553: _token = makeToken(_ttype);
0554: _token.setText(new String(text.getBuffer(), _begin, text
0555: .length()
0556: - _begin));
0557: }
0558: _returnToken = _token;
0559: }
0560:
0561: protected final void mML_COMMENT(boolean _createToken)
0562: throws RecognitionException, CharStreamException,
0563: TokenStreamException {
0564: int _ttype;
0565: Token _token = null;
0566: int _begin = text.length();
0567: _ttype = ML_COMMENT;
0568: int _saveIndex;
0569:
0570: match("/*");
0571: {
0572: if (((LA(1) == '*') && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff')))
0573: && (LA(2) != '/')) {
0574: match('*');
0575: if (inputState.guessing == 0) {
0576: _ttype = DOC_COMMENT;
0577: }
0578: } else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff'))
0579: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
0580: } else {
0581: throw new NoViableAltForCharException((char) LA(1),
0582: getFilename(), getLine(), getColumn());
0583: }
0584:
0585: }
0586: {
0587: _loop148: do {
0588: // nongreedy exit test
0589: if ((LA(1) == '*') && (LA(2) == '/'))
0590: break _loop148;
0591: switch (LA(1)) {
0592: case '\r': {
0593: match('\r');
0594: match('\n');
0595: if (inputState.guessing == 0) {
0596: newline();
0597: }
0598: break;
0599: }
0600: case '\n': {
0601: match('\n');
0602: if (inputState.guessing == 0) {
0603: newline();
0604: }
0605: break;
0606: }
0607: default:
0608: if ((_tokenSet_0.member(LA(1)))
0609: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
0610: {
0611: match(_tokenSet_0);
0612: }
0613: } else {
0614: break _loop148;
0615: }
0616: }
0617: } while (true);
0618: }
0619: match("*/");
0620: if (_createToken && _token == null && _ttype != Token.SKIP) {
0621: _token = makeToken(_ttype);
0622: _token.setText(new String(text.getBuffer(), _begin, text
0623: .length()
0624: - _begin));
0625: }
0626: _returnToken = _token;
0627: }
0628:
0629: /** Reset the file and line information; useful when the grammar
0630: * has been generated so that errors are shown relative to the
0631: * original file like the old C preprocessor used to do.
0632: */
0633: protected final void mSRC(boolean _createToken)
0634: throws RecognitionException, CharStreamException,
0635: TokenStreamException {
0636: int _ttype;
0637: Token _token = null;
0638: int _begin = text.length();
0639: _ttype = SRC;
0640: int _saveIndex;
0641: Token file = null;
0642: Token line = null;
0643:
0644: match("src");
0645: match(' ');
0646: mACTION_STRING_LITERAL(true);
0647: file = _returnToken;
0648: match(' ');
0649: mINT(true);
0650: line = _returnToken;
0651: if (inputState.guessing == 0) {
0652:
0653: newline();
0654: setFilename(file.getText().substring(1,
0655: file.getText().length() - 1));
0656: setLine(Integer.parseInt(line.getText()) - 1); // -1 because SL_COMMENT will increment the line no. KR
0657: _ttype = Token.SKIP; // don't let this go to the parser
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 mOPEN_ELEMENT_OPTION(boolean _createToken)
0670: throws RecognitionException, CharStreamException,
0671: TokenStreamException {
0672: int _ttype;
0673: Token _token = null;
0674: int _begin = text.length();
0675: _ttype = OPEN_ELEMENT_OPTION;
0676: int _saveIndex;
0677:
0678: match('<');
0679: if (_createToken && _token == null && _ttype != Token.SKIP) {
0680: _token = makeToken(_ttype);
0681: _token.setText(new String(text.getBuffer(), _begin, text
0682: .length()
0683: - _begin));
0684: }
0685: _returnToken = _token;
0686: }
0687:
0688: public final void mCLOSE_ELEMENT_OPTION(boolean _createToken)
0689: throws RecognitionException, CharStreamException,
0690: TokenStreamException {
0691: int _ttype;
0692: Token _token = null;
0693: int _begin = text.length();
0694: _ttype = CLOSE_ELEMENT_OPTION;
0695: int _saveIndex;
0696:
0697: match('>');
0698: if (_createToken && _token == null && _ttype != Token.SKIP) {
0699: _token = makeToken(_ttype);
0700: _token.setText(new String(text.getBuffer(), _begin, text
0701: .length()
0702: - _begin));
0703: }
0704: _returnToken = _token;
0705: }
0706:
0707: public final void mAMPERSAND(boolean _createToken)
0708: throws RecognitionException, CharStreamException,
0709: TokenStreamException {
0710: int _ttype;
0711: Token _token = null;
0712: int _begin = text.length();
0713: _ttype = AMPERSAND;
0714: int _saveIndex;
0715:
0716: match('@');
0717: if (_createToken && _token == null && _ttype != Token.SKIP) {
0718: _token = makeToken(_ttype);
0719: _token.setText(new String(text.getBuffer(), _begin, text
0720: .length()
0721: - _begin));
0722: }
0723: _returnToken = _token;
0724: }
0725:
0726: public final void mCOMMA(boolean _createToken)
0727: throws RecognitionException, CharStreamException,
0728: TokenStreamException {
0729: int _ttype;
0730: Token _token = null;
0731: int _begin = text.length();
0732: _ttype = COMMA;
0733: int _saveIndex;
0734:
0735: match(',');
0736: if (_createToken && _token == null && _ttype != Token.SKIP) {
0737: _token = makeToken(_ttype);
0738: _token.setText(new String(text.getBuffer(), _begin, text
0739: .length()
0740: - _begin));
0741: }
0742: _returnToken = _token;
0743: }
0744:
0745: public final void mQUESTION(boolean _createToken)
0746: throws RecognitionException, CharStreamException,
0747: TokenStreamException {
0748: int _ttype;
0749: Token _token = null;
0750: int _begin = text.length();
0751: _ttype = QUESTION;
0752: int _saveIndex;
0753:
0754: match('?');
0755: if (_createToken && _token == null && _ttype != Token.SKIP) {
0756: _token = makeToken(_ttype);
0757: _token.setText(new String(text.getBuffer(), _begin, text
0758: .length()
0759: - _begin));
0760: }
0761: _returnToken = _token;
0762: }
0763:
0764: public final void mTREE_BEGIN(boolean _createToken)
0765: throws RecognitionException, CharStreamException,
0766: TokenStreamException {
0767: int _ttype;
0768: Token _token = null;
0769: int _begin = text.length();
0770: _ttype = TREE_BEGIN;
0771: int _saveIndex;
0772:
0773: match("^(");
0774: if (_createToken && _token == null && _ttype != Token.SKIP) {
0775: _token = makeToken(_ttype);
0776: _token.setText(new String(text.getBuffer(), _begin, text
0777: .length()
0778: - _begin));
0779: }
0780: _returnToken = _token;
0781: }
0782:
0783: public final void mLPAREN(boolean _createToken)
0784: throws RecognitionException, CharStreamException,
0785: TokenStreamException {
0786: int _ttype;
0787: Token _token = null;
0788: int _begin = text.length();
0789: _ttype = LPAREN;
0790: int _saveIndex;
0791:
0792: match('(');
0793: if (_createToken && _token == null && _ttype != Token.SKIP) {
0794: _token = makeToken(_ttype);
0795: _token.setText(new String(text.getBuffer(), _begin, text
0796: .length()
0797: - _begin));
0798: }
0799: _returnToken = _token;
0800: }
0801:
0802: public final void mRPAREN(boolean _createToken)
0803: throws RecognitionException, CharStreamException,
0804: TokenStreamException {
0805: int _ttype;
0806: Token _token = null;
0807: int _begin = text.length();
0808: _ttype = RPAREN;
0809: int _saveIndex;
0810:
0811: match(')');
0812: if (_createToken && _token == null && _ttype != Token.SKIP) {
0813: _token = makeToken(_ttype);
0814: _token.setText(new String(text.getBuffer(), _begin, text
0815: .length()
0816: - _begin));
0817: }
0818: _returnToken = _token;
0819: }
0820:
0821: public final void mCOLON(boolean _createToken)
0822: throws RecognitionException, CharStreamException,
0823: TokenStreamException {
0824: int _ttype;
0825: Token _token = null;
0826: int _begin = text.length();
0827: _ttype = COLON;
0828: int _saveIndex;
0829:
0830: match(':');
0831: if (_createToken && _token == null && _ttype != Token.SKIP) {
0832: _token = makeToken(_ttype);
0833: _token.setText(new String(text.getBuffer(), _begin, text
0834: .length()
0835: - _begin));
0836: }
0837: _returnToken = _token;
0838: }
0839:
0840: public final void mSTAR(boolean _createToken)
0841: throws RecognitionException, CharStreamException,
0842: TokenStreamException {
0843: int _ttype;
0844: Token _token = null;
0845: int _begin = text.length();
0846: _ttype = STAR;
0847: int _saveIndex;
0848:
0849: match('*');
0850: if (_createToken && _token == null && _ttype != Token.SKIP) {
0851: _token = makeToken(_ttype);
0852: _token.setText(new String(text.getBuffer(), _begin, text
0853: .length()
0854: - _begin));
0855: }
0856: _returnToken = _token;
0857: }
0858:
0859: public final void mPLUS(boolean _createToken)
0860: throws RecognitionException, CharStreamException,
0861: TokenStreamException {
0862: int _ttype;
0863: Token _token = null;
0864: int _begin = text.length();
0865: _ttype = PLUS;
0866: int _saveIndex;
0867:
0868: match('+');
0869: if (_createToken && _token == null && _ttype != Token.SKIP) {
0870: _token = makeToken(_ttype);
0871: _token.setText(new String(text.getBuffer(), _begin, text
0872: .length()
0873: - _begin));
0874: }
0875: _returnToken = _token;
0876: }
0877:
0878: public final void mASSIGN(boolean _createToken)
0879: throws RecognitionException, CharStreamException,
0880: TokenStreamException {
0881: int _ttype;
0882: Token _token = null;
0883: int _begin = text.length();
0884: _ttype = ASSIGN;
0885: int _saveIndex;
0886:
0887: match('=');
0888: if (_createToken && _token == null && _ttype != Token.SKIP) {
0889: _token = makeToken(_ttype);
0890: _token.setText(new String(text.getBuffer(), _begin, text
0891: .length()
0892: - _begin));
0893: }
0894: _returnToken = _token;
0895: }
0896:
0897: public final void mPLUS_ASSIGN(boolean _createToken)
0898: throws RecognitionException, CharStreamException,
0899: TokenStreamException {
0900: int _ttype;
0901: Token _token = null;
0902: int _begin = text.length();
0903: _ttype = PLUS_ASSIGN;
0904: int _saveIndex;
0905:
0906: match("+=");
0907: if (_createToken && _token == null && _ttype != Token.SKIP) {
0908: _token = makeToken(_ttype);
0909: _token.setText(new String(text.getBuffer(), _begin, text
0910: .length()
0911: - _begin));
0912: }
0913: _returnToken = _token;
0914: }
0915:
0916: public final void mIMPLIES(boolean _createToken)
0917: throws RecognitionException, CharStreamException,
0918: TokenStreamException {
0919: int _ttype;
0920: Token _token = null;
0921: int _begin = text.length();
0922: _ttype = IMPLIES;
0923: int _saveIndex;
0924:
0925: match("=>");
0926: if (_createToken && _token == null && _ttype != Token.SKIP) {
0927: _token = makeToken(_ttype);
0928: _token.setText(new String(text.getBuffer(), _begin, text
0929: .length()
0930: - _begin));
0931: }
0932: _returnToken = _token;
0933: }
0934:
0935: public final void mREWRITE(boolean _createToken)
0936: throws RecognitionException, CharStreamException,
0937: TokenStreamException {
0938: int _ttype;
0939: Token _token = null;
0940: int _begin = text.length();
0941: _ttype = REWRITE;
0942: int _saveIndex;
0943:
0944: match("->");
0945: if (_createToken && _token == null && _ttype != Token.SKIP) {
0946: _token = makeToken(_ttype);
0947: _token.setText(new String(text.getBuffer(), _begin, text
0948: .length()
0949: - _begin));
0950: }
0951: _returnToken = _token;
0952: }
0953:
0954: public final void mSEMI(boolean _createToken)
0955: throws RecognitionException, CharStreamException,
0956: TokenStreamException {
0957: int _ttype;
0958: Token _token = null;
0959: int _begin = text.length();
0960: _ttype = SEMI;
0961: int _saveIndex;
0962:
0963: match(';');
0964: if (_createToken && _token == null && _ttype != Token.SKIP) {
0965: _token = makeToken(_ttype);
0966: _token.setText(new String(text.getBuffer(), _begin, text
0967: .length()
0968: - _begin));
0969: }
0970: _returnToken = _token;
0971: }
0972:
0973: public final void mROOT(boolean _createToken)
0974: throws RecognitionException, CharStreamException,
0975: TokenStreamException {
0976: int _ttype;
0977: Token _token = null;
0978: int _begin = text.length();
0979: _ttype = ROOT;
0980: int _saveIndex;
0981:
0982: match('^');
0983: if (_createToken && _token == null && _ttype != Token.SKIP) {
0984: _token = makeToken(_ttype);
0985: _token.setText(new String(text.getBuffer(), _begin, text
0986: .length()
0987: - _begin));
0988: }
0989: _returnToken = _token;
0990: }
0991:
0992: public final void mBANG(boolean _createToken)
0993: throws RecognitionException, CharStreamException,
0994: TokenStreamException {
0995: int _ttype;
0996: Token _token = null;
0997: int _begin = text.length();
0998: _ttype = BANG;
0999: int _saveIndex;
1000:
1001: match('!');
1002: if (_createToken && _token == null && _ttype != Token.SKIP) {
1003: _token = makeToken(_ttype);
1004: _token.setText(new String(text.getBuffer(), _begin, text
1005: .length()
1006: - _begin));
1007: }
1008: _returnToken = _token;
1009: }
1010:
1011: public final void mOR(boolean _createToken)
1012: throws RecognitionException, CharStreamException,
1013: TokenStreamException {
1014: int _ttype;
1015: Token _token = null;
1016: int _begin = text.length();
1017: _ttype = OR;
1018: int _saveIndex;
1019:
1020: match('|');
1021: if (_createToken && _token == null && _ttype != Token.SKIP) {
1022: _token = makeToken(_ttype);
1023: _token.setText(new String(text.getBuffer(), _begin, text
1024: .length()
1025: - _begin));
1026: }
1027: _returnToken = _token;
1028: }
1029:
1030: public final void mWILDCARD(boolean _createToken)
1031: throws RecognitionException, CharStreamException,
1032: TokenStreamException {
1033: int _ttype;
1034: Token _token = null;
1035: int _begin = text.length();
1036: _ttype = WILDCARD;
1037: int _saveIndex;
1038:
1039: match('.');
1040: if (_createToken && _token == null && _ttype != Token.SKIP) {
1041: _token = makeToken(_ttype);
1042: _token.setText(new String(text.getBuffer(), _begin, text
1043: .length()
1044: - _begin));
1045: }
1046: _returnToken = _token;
1047: }
1048:
1049: public final void mRANGE(boolean _createToken)
1050: throws RecognitionException, CharStreamException,
1051: TokenStreamException {
1052: int _ttype;
1053: Token _token = null;
1054: int _begin = text.length();
1055: _ttype = RANGE;
1056: int _saveIndex;
1057:
1058: match("..");
1059: if (_createToken && _token == null && _ttype != Token.SKIP) {
1060: _token = makeToken(_ttype);
1061: _token.setText(new String(text.getBuffer(), _begin, text
1062: .length()
1063: - _begin));
1064: }
1065: _returnToken = _token;
1066: }
1067:
1068: public final void mNOT(boolean _createToken)
1069: throws RecognitionException, CharStreamException,
1070: TokenStreamException {
1071: int _ttype;
1072: Token _token = null;
1073: int _begin = text.length();
1074: _ttype = NOT;
1075: int _saveIndex;
1076:
1077: match('~');
1078: if (_createToken && _token == null && _ttype != Token.SKIP) {
1079: _token = makeToken(_ttype);
1080: _token.setText(new String(text.getBuffer(), _begin, text
1081: .length()
1082: - _begin));
1083: }
1084: _returnToken = _token;
1085: }
1086:
1087: public final void mRCURLY(boolean _createToken)
1088: throws RecognitionException, CharStreamException,
1089: TokenStreamException {
1090: int _ttype;
1091: Token _token = null;
1092: int _begin = text.length();
1093: _ttype = RCURLY;
1094: int _saveIndex;
1095:
1096: match('}');
1097: if (_createToken && _token == null && _ttype != Token.SKIP) {
1098: _token = makeToken(_ttype);
1099: _token.setText(new String(text.getBuffer(), _begin, text
1100: .length()
1101: - _begin));
1102: }
1103: _returnToken = _token;
1104: }
1105:
1106: public final void mDOLLAR(boolean _createToken)
1107: throws RecognitionException, CharStreamException,
1108: TokenStreamException {
1109: int _ttype;
1110: Token _token = null;
1111: int _begin = text.length();
1112: _ttype = DOLLAR;
1113: int _saveIndex;
1114:
1115: match('$');
1116: if (_createToken && _token == null && _ttype != Token.SKIP) {
1117: _token = makeToken(_ttype);
1118: _token.setText(new String(text.getBuffer(), _begin, text
1119: .length()
1120: - _begin));
1121: }
1122: _returnToken = _token;
1123: }
1124:
1125: public final void mCHAR_LITERAL(boolean _createToken)
1126: throws RecognitionException, CharStreamException,
1127: TokenStreamException {
1128: int _ttype;
1129: Token _token = null;
1130: int _begin = text.length();
1131: _ttype = CHAR_LITERAL;
1132: int _saveIndex;
1133:
1134: match('\'');
1135: {
1136: _loop175: do {
1137: switch (LA(1)) {
1138: case '\\': {
1139: mESC(false);
1140: break;
1141: }
1142: case '\n': {
1143: match('\n');
1144: if (inputState.guessing == 0) {
1145: newline();
1146: }
1147: break;
1148: }
1149: default:
1150: if ((_tokenSet_1.member(LA(1)))) {
1151: matchNot('\'');
1152: } else {
1153: break _loop175;
1154: }
1155: }
1156: } while (true);
1157: }
1158: match('\'');
1159: if (inputState.guessing == 0) {
1160:
1161: StringBuffer s = Grammar
1162: .getUnescapedStringFromGrammarStringLiteral(new String(
1163: text.getBuffer(), _begin, text.length()
1164: - _begin));
1165: if (s.length() > 1) {
1166: _ttype = STRING_LITERAL;
1167: }
1168:
1169: }
1170: if (_createToken && _token == null && _ttype != Token.SKIP) {
1171: _token = makeToken(_ttype);
1172: _token.setText(new String(text.getBuffer(), _begin, text
1173: .length()
1174: - _begin));
1175: }
1176: _returnToken = _token;
1177: }
1178:
1179: protected final void mESC(boolean _createToken)
1180: throws RecognitionException, CharStreamException,
1181: TokenStreamException {
1182: int _ttype;
1183: Token _token = null;
1184: int _begin = text.length();
1185: _ttype = ESC;
1186: int _saveIndex;
1187:
1188: match('\\');
1189: {
1190: if ((LA(1) == 'n')
1191: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1192: match('n');
1193: } else if ((LA(1) == 'r')
1194: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1195: match('r');
1196: } else if ((LA(1) == 't')
1197: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1198: match('t');
1199: } else if ((LA(1) == 'b')
1200: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1201: match('b');
1202: } else if ((LA(1) == 'f')
1203: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1204: match('f');
1205: } else if ((LA(1) == '"')
1206: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1207: match('"');
1208: } else if ((LA(1) == '\'')
1209: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1210: match('\'');
1211: } else if ((LA(1) == '\\')
1212: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1213: match('\\');
1214: } else if ((LA(1) == '>')
1215: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1216: match('>');
1217: } else if (((LA(1) >= '0' && LA(1) <= '3'))
1218: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1219: {
1220: matchRange('0', '3');
1221: }
1222: {
1223: if (((LA(1) >= '0' && LA(1) <= '9'))
1224: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1225: {
1226: matchRange('0', '9');
1227: }
1228: {
1229: if (((LA(1) >= '0' && LA(1) <= '9'))
1230: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1231: matchRange('0', '9');
1232: } else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true)) {
1233: } else {
1234: throw new NoViableAltForCharException(
1235: (char) LA(1), getFilename(),
1236: getLine(), getColumn());
1237: }
1238:
1239: }
1240: } else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true)) {
1241: } else {
1242: throw new NoViableAltForCharException(
1243: (char) LA(1), getFilename(), getLine(),
1244: getColumn());
1245: }
1246:
1247: }
1248: } else if (((LA(1) >= '4' && LA(1) <= '7'))
1249: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1250: {
1251: matchRange('4', '7');
1252: }
1253: {
1254: if (((LA(1) >= '0' && LA(1) <= '9'))
1255: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1256: {
1257: matchRange('0', '9');
1258: }
1259: } else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff')) && (true)) {
1260: } else {
1261: throw new NoViableAltForCharException(
1262: (char) LA(1), getFilename(), getLine(),
1263: getColumn());
1264: }
1265:
1266: }
1267: } else if ((LA(1) == 'u') && (_tokenSet_2.member(LA(2)))) {
1268: match('u');
1269: mXDIGIT(false);
1270: mXDIGIT(false);
1271: mXDIGIT(false);
1272: mXDIGIT(false);
1273: } else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff'))
1274: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1275: matchNot(EOF_CHAR);
1276: } else {
1277: throw new NoViableAltForCharException((char) LA(1),
1278: getFilename(), getLine(), getColumn());
1279: }
1280:
1281: }
1282: if (_createToken && _token == null && _ttype != Token.SKIP) {
1283: _token = makeToken(_ttype);
1284: _token.setText(new String(text.getBuffer(), _begin, text
1285: .length()
1286: - _begin));
1287: }
1288: _returnToken = _token;
1289: }
1290:
1291: public final void mDOUBLE_QUOTE_STRING_LITERAL(boolean _createToken)
1292: throws RecognitionException, CharStreamException,
1293: TokenStreamException {
1294: int _ttype;
1295: Token _token = null;
1296: int _begin = text.length();
1297: _ttype = DOUBLE_QUOTE_STRING_LITERAL;
1298: int _saveIndex;
1299:
1300: match('"');
1301: {
1302: _loop178: do {
1303: switch (LA(1)) {
1304: case '\\': {
1305: _saveIndex = text.length();
1306: match('\\');
1307: text.setLength(_saveIndex);
1308: match('"');
1309: break;
1310: }
1311: case '\n': {
1312: match('\n');
1313: if (inputState.guessing == 0) {
1314: newline();
1315: }
1316: break;
1317: }
1318: default:
1319: if ((_tokenSet_3.member(LA(1)))) {
1320: matchNot('"');
1321: } else {
1322: break _loop178;
1323: }
1324: }
1325: } while (true);
1326: }
1327: match('"');
1328: if (_createToken && _token == null && _ttype != Token.SKIP) {
1329: _token = makeToken(_ttype);
1330: _token.setText(new String(text.getBuffer(), _begin, text
1331: .length()
1332: - _begin));
1333: }
1334: _returnToken = _token;
1335: }
1336:
1337: public final void mDOUBLE_ANGLE_STRING_LITERAL(boolean _createToken)
1338: throws RecognitionException, CharStreamException,
1339: TokenStreamException {
1340: int _ttype;
1341: Token _token = null;
1342: int _begin = text.length();
1343: _ttype = DOUBLE_ANGLE_STRING_LITERAL;
1344: int _saveIndex;
1345:
1346: match("<<");
1347: {
1348: _loop181: do {
1349: // nongreedy exit test
1350: if ((LA(1) == '>') && (LA(2) == '>'))
1351: break _loop181;
1352: if ((LA(1) == '\n')
1353: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1354: match('\n');
1355: if (inputState.guessing == 0) {
1356: newline();
1357: }
1358: } else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff'))
1359: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1360: matchNot(EOF_CHAR);
1361: } else {
1362: break _loop181;
1363: }
1364:
1365: } while (true);
1366: }
1367: match(">>");
1368: if (_createToken && _token == null && _ttype != Token.SKIP) {
1369: _token = makeToken(_ttype);
1370: _token.setText(new String(text.getBuffer(), _begin, text
1371: .length()
1372: - _begin));
1373: }
1374: _returnToken = _token;
1375: }
1376:
1377: protected final void mXDIGIT(boolean _createToken)
1378: throws RecognitionException, CharStreamException,
1379: TokenStreamException {
1380: int _ttype;
1381: Token _token = null;
1382: int _begin = text.length();
1383: _ttype = XDIGIT;
1384: int _saveIndex;
1385:
1386: switch (LA(1)) {
1387: case '0':
1388: case '1':
1389: case '2':
1390: case '3':
1391: case '4':
1392: case '5':
1393: case '6':
1394: case '7':
1395: case '8':
1396: case '9': {
1397: matchRange('0', '9');
1398: break;
1399: }
1400: case 'a':
1401: case 'b':
1402: case 'c':
1403: case 'd':
1404: case 'e':
1405: case 'f': {
1406: matchRange('a', 'f');
1407: break;
1408: }
1409: case 'A':
1410: case 'B':
1411: case 'C':
1412: case 'D':
1413: case 'E':
1414: case 'F': {
1415: matchRange('A', 'F');
1416: break;
1417: }
1418: default: {
1419: throw new NoViableAltForCharException((char) LA(1),
1420: getFilename(), getLine(), getColumn());
1421: }
1422: }
1423: if (_createToken && _token == null && _ttype != Token.SKIP) {
1424: _token = makeToken(_ttype);
1425: _token.setText(new String(text.getBuffer(), _begin, text
1426: .length()
1427: - _begin));
1428: }
1429: _returnToken = _token;
1430: }
1431:
1432: protected final void mDIGIT(boolean _createToken)
1433: throws RecognitionException, CharStreamException,
1434: TokenStreamException {
1435: int _ttype;
1436: Token _token = null;
1437: int _begin = text.length();
1438: _ttype = DIGIT;
1439: int _saveIndex;
1440:
1441: matchRange('0', '9');
1442: if (_createToken && _token == null && _ttype != Token.SKIP) {
1443: _token = makeToken(_ttype);
1444: _token.setText(new String(text.getBuffer(), _begin, text
1445: .length()
1446: - _begin));
1447: }
1448: _returnToken = _token;
1449: }
1450:
1451: public final void mINT(boolean _createToken)
1452: throws RecognitionException, CharStreamException,
1453: TokenStreamException {
1454: int _ttype;
1455: Token _token = null;
1456: int _begin = text.length();
1457: _ttype = INT;
1458: int _saveIndex;
1459:
1460: {
1461: int _cnt195 = 0;
1462: _loop195: do {
1463: if (((LA(1) >= '0' && LA(1) <= '9'))) {
1464: matchRange('0', '9');
1465: } else {
1466: if (_cnt195 >= 1) {
1467: break _loop195;
1468: } else {
1469: throw new NoViableAltForCharException(
1470: (char) LA(1), getFilename(), getLine(),
1471: getColumn());
1472: }
1473: }
1474:
1475: _cnt195++;
1476: } while (true);
1477: }
1478: if (_createToken && _token == null && _ttype != Token.SKIP) {
1479: _token = makeToken(_ttype);
1480: _token.setText(new String(text.getBuffer(), _begin, text
1481: .length()
1482: - _begin));
1483: }
1484: _returnToken = _token;
1485: }
1486:
1487: public final void mARG_ACTION(boolean _createToken)
1488: throws RecognitionException, CharStreamException,
1489: TokenStreamException {
1490: int _ttype;
1491: Token _token = null;
1492: int _begin = text.length();
1493: _ttype = ARG_ACTION;
1494: int _saveIndex;
1495:
1496: mNESTED_ARG_ACTION(false);
1497: if (_createToken && _token == null && _ttype != Token.SKIP) {
1498: _token = makeToken(_ttype);
1499: _token.setText(new String(text.getBuffer(), _begin, text
1500: .length()
1501: - _begin));
1502: }
1503: _returnToken = _token;
1504: }
1505:
1506: protected final void mNESTED_ARG_ACTION(boolean _createToken)
1507: throws RecognitionException, CharStreamException,
1508: TokenStreamException {
1509: int _ttype;
1510: Token _token = null;
1511: int _begin = text.length();
1512: _ttype = NESTED_ARG_ACTION;
1513: int _saveIndex;
1514:
1515: _saveIndex = text.length();
1516: match('[');
1517: text.setLength(_saveIndex);
1518: {
1519: _loop199: do {
1520: switch (LA(1)) {
1521: case '[': {
1522: mNESTED_ARG_ACTION(false);
1523: break;
1524: }
1525: case '\r': {
1526: match('\r');
1527: match('\n');
1528: if (inputState.guessing == 0) {
1529: newline();
1530: }
1531: break;
1532: }
1533: case '\n': {
1534: match('\n');
1535: if (inputState.guessing == 0) {
1536: newline();
1537: }
1538: break;
1539: }
1540: case '"': {
1541: mACTION_STRING_LITERAL(false);
1542: break;
1543: }
1544: default:
1545: if ((_tokenSet_4.member(LA(1)))) {
1546: matchNot(']');
1547: } else {
1548: break _loop199;
1549: }
1550: }
1551: } while (true);
1552: }
1553: _saveIndex = text.length();
1554: match(']');
1555: text.setLength(_saveIndex);
1556: if (_createToken && _token == null && _ttype != Token.SKIP) {
1557: _token = makeToken(_ttype);
1558: _token.setText(new String(text.getBuffer(), _begin, text
1559: .length()
1560: - _begin));
1561: }
1562: _returnToken = _token;
1563: }
1564:
1565: protected final void mACTION_STRING_LITERAL(boolean _createToken)
1566: throws RecognitionException, CharStreamException,
1567: TokenStreamException {
1568: int _ttype;
1569: Token _token = null;
1570: int _begin = text.length();
1571: _ttype = ACTION_STRING_LITERAL;
1572: int _saveIndex;
1573:
1574: match('"');
1575: {
1576: _loop211: do {
1577: switch (LA(1)) {
1578: case '\\': {
1579: mACTION_ESC(false);
1580: break;
1581: }
1582: case '\n': {
1583: match('\n');
1584: if (inputState.guessing == 0) {
1585: newline();
1586: }
1587: break;
1588: }
1589: default:
1590: if ((_tokenSet_3.member(LA(1)))) {
1591: matchNot('"');
1592: } else {
1593: break _loop211;
1594: }
1595: }
1596: } while (true);
1597: }
1598: match('"');
1599: if (_createToken && _token == null && _ttype != Token.SKIP) {
1600: _token = makeToken(_ttype);
1601: _token.setText(new String(text.getBuffer(), _begin, text
1602: .length()
1603: - _begin));
1604: }
1605: _returnToken = _token;
1606: }
1607:
1608: public final void mACTION(boolean _createToken)
1609: throws RecognitionException, CharStreamException,
1610: TokenStreamException {
1611: int _ttype;
1612: Token _token = null;
1613: int _begin = text.length();
1614: _ttype = ACTION;
1615: int _saveIndex;
1616: int actionLine = getLine();
1617: int actionColumn = getColumn();
1618:
1619: mNESTED_ACTION(false);
1620: {
1621: if ((LA(1) == '?')) {
1622: _saveIndex = text.length();
1623: match('?');
1624: text.setLength(_saveIndex);
1625: if (inputState.guessing == 0) {
1626: _ttype = SEMPRED;
1627: }
1628: } else {
1629: }
1630:
1631: }
1632: if (inputState.guessing == 0) {
1633:
1634: Token t = makeToken(_ttype);
1635: String action = new String(text.getBuffer(), _begin, text
1636: .length()
1637: - _begin);
1638: action = action.substring(1, action.length() - 1);
1639: t.setText(action);
1640: t.setLine(actionLine); // set action line to start
1641: t.setColumn(actionColumn);
1642: _token = t;
1643:
1644: }
1645: if (_createToken && _token == null && _ttype != Token.SKIP) {
1646: _token = makeToken(_ttype);
1647: _token.setText(new String(text.getBuffer(), _begin, text
1648: .length()
1649: - _begin));
1650: }
1651: _returnToken = _token;
1652: }
1653:
1654: protected final void mNESTED_ACTION(boolean _createToken)
1655: throws RecognitionException, CharStreamException,
1656: TokenStreamException {
1657: int _ttype;
1658: Token _token = null;
1659: int _begin = text.length();
1660: _ttype = NESTED_ACTION;
1661: int _saveIndex;
1662:
1663: match('{');
1664: {
1665: _loop205: do {
1666: // nongreedy exit test
1667: if ((LA(1) == '}') && (true))
1668: break _loop205;
1669: if ((LA(1) == '\n' || LA(1) == '\r')
1670: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1671: {
1672: switch (LA(1)) {
1673: case '\r': {
1674: match('\r');
1675: match('\n');
1676: if (inputState.guessing == 0) {
1677: newline();
1678: }
1679: break;
1680: }
1681: case '\n': {
1682: match('\n');
1683: if (inputState.guessing == 0) {
1684: newline();
1685: }
1686: break;
1687: }
1688: default: {
1689: throw new NoViableAltForCharException(
1690: (char) LA(1), getFilename(),
1691: getLine(), getColumn());
1692: }
1693: }
1694: }
1695: } else if ((LA(1) == '{')
1696: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1697: mNESTED_ACTION(false);
1698: } else if ((LA(1) == '\'')
1699: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1700: mACTION_CHAR_LITERAL(false);
1701: } else if ((LA(1) == '/')
1702: && (LA(2) == '*' || LA(2) == '/')) {
1703: mCOMMENT(false);
1704: } else if ((LA(1) == '"')
1705: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1706: mACTION_STRING_LITERAL(false);
1707: } else if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff'))
1708: && ((LA(2) >= '\u0003' && LA(2) <= '\u00ff'))) {
1709: matchNot(EOF_CHAR);
1710: } else {
1711: break _loop205;
1712: }
1713:
1714: } while (true);
1715: }
1716: match('}');
1717: if (_createToken && _token == null && _ttype != Token.SKIP) {
1718: _token = makeToken(_ttype);
1719: _token.setText(new String(text.getBuffer(), _begin, text
1720: .length()
1721: - _begin));
1722: }
1723: _returnToken = _token;
1724: }
1725:
1726: protected final void mACTION_CHAR_LITERAL(boolean _createToken)
1727: throws RecognitionException, CharStreamException,
1728: TokenStreamException {
1729: int _ttype;
1730: Token _token = null;
1731: int _begin = text.length();
1732: _ttype = ACTION_CHAR_LITERAL;
1733: int _saveIndex;
1734:
1735: match('\'');
1736: {
1737: _loop208: do {
1738: switch (LA(1)) {
1739: case '\\': {
1740: mACTION_ESC(false);
1741: break;
1742: }
1743: case '\n': {
1744: match('\n');
1745: if (inputState.guessing == 0) {
1746: newline();
1747: }
1748: break;
1749: }
1750: default:
1751: if ((_tokenSet_1.member(LA(1)))) {
1752: matchNot('\'');
1753: } else {
1754: break _loop208;
1755: }
1756: }
1757: } while (true);
1758: }
1759: match('\'');
1760: if (_createToken && _token == null && _ttype != Token.SKIP) {
1761: _token = makeToken(_ttype);
1762: _token.setText(new String(text.getBuffer(), _begin, text
1763: .length()
1764: - _begin));
1765: }
1766: _returnToken = _token;
1767: }
1768:
1769: protected final void mACTION_ESC(boolean _createToken)
1770: throws RecognitionException, CharStreamException,
1771: TokenStreamException {
1772: int _ttype;
1773: Token _token = null;
1774: int _begin = text.length();
1775: _ttype = ACTION_ESC;
1776: int _saveIndex;
1777:
1778: if ((LA(1) == '\\') && (LA(2) == '\'')) {
1779: match("\\'");
1780: } else if ((LA(1) == '\\') && (LA(2) == '"')) {
1781: match("\\\"");
1782: } else if ((LA(1) == '\\') && (_tokenSet_5.member(LA(2)))) {
1783: match('\\');
1784: {
1785: match(_tokenSet_5);
1786: }
1787: } else {
1788: throw new NoViableAltForCharException((char) LA(1),
1789: getFilename(), getLine(), getColumn());
1790: }
1791:
1792: if (_createToken && _token == null && _ttype != Token.SKIP) {
1793: _token = makeToken(_ttype);
1794: _token.setText(new String(text.getBuffer(), _begin, text
1795: .length()
1796: - _begin));
1797: }
1798: _returnToken = _token;
1799: }
1800:
1801: public final void mTOKEN_REF(boolean _createToken)
1802: throws RecognitionException, CharStreamException,
1803: TokenStreamException {
1804: int _ttype;
1805: Token _token = null;
1806: int _begin = text.length();
1807: _ttype = TOKEN_REF;
1808: int _saveIndex;
1809:
1810: matchRange('A', 'Z');
1811: {
1812: _loop216: do {
1813: switch (LA(1)) {
1814: case 'a':
1815: case 'b':
1816: case 'c':
1817: case 'd':
1818: case 'e':
1819: case 'f':
1820: case 'g':
1821: case 'h':
1822: case 'i':
1823: case 'j':
1824: case 'k':
1825: case 'l':
1826: case 'm':
1827: case 'n':
1828: case 'o':
1829: case 'p':
1830: case 'q':
1831: case 'r':
1832: case 's':
1833: case 't':
1834: case 'u':
1835: case 'v':
1836: case 'w':
1837: case 'x':
1838: case 'y':
1839: case 'z': {
1840: matchRange('a', 'z');
1841: break;
1842: }
1843: case 'A':
1844: case 'B':
1845: case 'C':
1846: case 'D':
1847: case 'E':
1848: case 'F':
1849: case 'G':
1850: case 'H':
1851: case 'I':
1852: case 'J':
1853: case 'K':
1854: case 'L':
1855: case 'M':
1856: case 'N':
1857: case 'O':
1858: case 'P':
1859: case 'Q':
1860: case 'R':
1861: case 'S':
1862: case 'T':
1863: case 'U':
1864: case 'V':
1865: case 'W':
1866: case 'X':
1867: case 'Y':
1868: case 'Z': {
1869: matchRange('A', 'Z');
1870: break;
1871: }
1872: case '_': {
1873: match('_');
1874: break;
1875: }
1876: case '0':
1877: case '1':
1878: case '2':
1879: case '3':
1880: case '4':
1881: case '5':
1882: case '6':
1883: case '7':
1884: case '8':
1885: case '9': {
1886: matchRange('0', '9');
1887: break;
1888: }
1889: default: {
1890: break _loop216;
1891: }
1892: }
1893: } while (true);
1894: }
1895: _ttype = testLiteralsTable(_ttype);
1896: if (_createToken && _token == null && _ttype != Token.SKIP) {
1897: _token = makeToken(_ttype);
1898: _token.setText(new String(text.getBuffer(), _begin, text
1899: .length()
1900: - _begin));
1901: }
1902: _returnToken = _token;
1903: }
1904:
1905: public final void mRULE_REF(boolean _createToken)
1906: throws RecognitionException, CharStreamException,
1907: TokenStreamException {
1908: int _ttype;
1909: Token _token = null;
1910: int _begin = text.length();
1911: _ttype = RULE_REF;
1912: int _saveIndex;
1913:
1914: int t = 0;
1915:
1916: t = mINTERNAL_RULE_REF(false);
1917: if (inputState.guessing == 0) {
1918: _ttype = t;
1919: }
1920: {
1921: if ((true) && (t == OPTIONS)) {
1922: mWS_LOOP(false);
1923: {
1924: if ((LA(1) == '{')) {
1925: match('{');
1926: if (inputState.guessing == 0) {
1927: _ttype = OPTIONS;
1928: }
1929: } else {
1930: }
1931:
1932: }
1933: } else if ((true) && (t == TOKENS)) {
1934: mWS_LOOP(false);
1935: {
1936: if ((LA(1) == '{')) {
1937: match('{');
1938: if (inputState.guessing == 0) {
1939: _ttype = TOKENS;
1940: }
1941: } else {
1942: }
1943:
1944: }
1945: } else {
1946: }
1947:
1948: }
1949: if (_createToken && _token == null && _ttype != Token.SKIP) {
1950: _token = makeToken(_ttype);
1951: _token.setText(new String(text.getBuffer(), _begin, text
1952: .length()
1953: - _begin));
1954: }
1955: _returnToken = _token;
1956: }
1957:
1958: protected final int mINTERNAL_RULE_REF(boolean _createToken)
1959: throws RecognitionException, CharStreamException,
1960: TokenStreamException {
1961: int t;
1962: int _ttype;
1963: Token _token = null;
1964: int _begin = text.length();
1965: _ttype = INTERNAL_RULE_REF;
1966: int _saveIndex;
1967:
1968: t = RULE_REF;
1969:
1970: matchRange('a', 'z');
1971: {
1972: _loop226: do {
1973: switch (LA(1)) {
1974: case 'a':
1975: case 'b':
1976: case 'c':
1977: case 'd':
1978: case 'e':
1979: case 'f':
1980: case 'g':
1981: case 'h':
1982: case 'i':
1983: case 'j':
1984: case 'k':
1985: case 'l':
1986: case 'm':
1987: case 'n':
1988: case 'o':
1989: case 'p':
1990: case 'q':
1991: case 'r':
1992: case 's':
1993: case 't':
1994: case 'u':
1995: case 'v':
1996: case 'w':
1997: case 'x':
1998: case 'y':
1999: case 'z': {
2000: matchRange('a', 'z');
2001: break;
2002: }
2003: case 'A':
2004: case 'B':
2005: case 'C':
2006: case 'D':
2007: case 'E':
2008: case 'F':
2009: case 'G':
2010: case 'H':
2011: case 'I':
2012: case 'J':
2013: case 'K':
2014: case 'L':
2015: case 'M':
2016: case 'N':
2017: case 'O':
2018: case 'P':
2019: case 'Q':
2020: case 'R':
2021: case 'S':
2022: case 'T':
2023: case 'U':
2024: case 'V':
2025: case 'W':
2026: case 'X':
2027: case 'Y':
2028: case 'Z': {
2029: matchRange('A', 'Z');
2030: break;
2031: }
2032: case '_': {
2033: match('_');
2034: break;
2035: }
2036: case '0':
2037: case '1':
2038: case '2':
2039: case '3':
2040: case '4':
2041: case '5':
2042: case '6':
2043: case '7':
2044: case '8':
2045: case '9': {
2046: matchRange('0', '9');
2047: break;
2048: }
2049: default: {
2050: break _loop226;
2051: }
2052: }
2053: } while (true);
2054: }
2055: if (inputState.guessing == 0) {
2056: t = testLiteralsTable(t);
2057: }
2058: if (_createToken && _token == null && _ttype != Token.SKIP) {
2059: _token = makeToken(_ttype);
2060: _token.setText(new String(text.getBuffer(), _begin, text
2061: .length()
2062: - _begin));
2063: }
2064: _returnToken = _token;
2065: return t;
2066: }
2067:
2068: protected final void mWS_LOOP(boolean _createToken)
2069: throws RecognitionException, CharStreamException,
2070: TokenStreamException {
2071: int _ttype;
2072: Token _token = null;
2073: int _begin = text.length();
2074: _ttype = WS_LOOP;
2075: int _saveIndex;
2076:
2077: {
2078: _loop223: do {
2079: switch (LA(1)) {
2080: case '\t':
2081: case '\n':
2082: case '\r':
2083: case ' ': {
2084: mWS(false);
2085: break;
2086: }
2087: case '/': {
2088: mCOMMENT(false);
2089: break;
2090: }
2091: default: {
2092: break _loop223;
2093: }
2094: }
2095: } while (true);
2096: }
2097: if (_createToken && _token == null && _ttype != Token.SKIP) {
2098: _token = makeToken(_ttype);
2099: _token.setText(new String(text.getBuffer(), _begin, text
2100: .length()
2101: - _begin));
2102: }
2103: _returnToken = _token;
2104: }
2105:
2106: protected final void mWS_OPT(boolean _createToken)
2107: throws RecognitionException, CharStreamException,
2108: TokenStreamException {
2109: int _ttype;
2110: Token _token = null;
2111: int _begin = text.length();
2112: _ttype = WS_OPT;
2113: int _saveIndex;
2114:
2115: {
2116: if ((_tokenSet_6.member(LA(1)))) {
2117: mWS(false);
2118: } else {
2119: }
2120:
2121: }
2122: if (_createToken && _token == null && _ttype != Token.SKIP) {
2123: _token = makeToken(_ttype);
2124: _token.setText(new String(text.getBuffer(), _begin, text
2125: .length()
2126: - _begin));
2127: }
2128: _returnToken = _token;
2129: }
2130:
2131: private static final long[] mk_tokenSet_0() {
2132: long[] data = new long[8];
2133: data[0] = -9224L;
2134: for (int i = 1; i <= 3; i++) {
2135: data[i] = -1L;
2136: }
2137: return data;
2138: }
2139:
2140: public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
2141:
2142: private static final long[] mk_tokenSet_1() {
2143: long[] data = new long[8];
2144: data[0] = -549755814920L;
2145: data[1] = -268435457L;
2146: for (int i = 2; i <= 3; i++) {
2147: data[i] = -1L;
2148: }
2149: return data;
2150: }
2151:
2152: public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
2153:
2154: private static final long[] mk_tokenSet_2() {
2155: long[] data = { 287948901175001088L, 541165879422L, 0L, 0L, 0L };
2156: return data;
2157: }
2158:
2159: public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
2160:
2161: private static final long[] mk_tokenSet_3() {
2162: long[] data = new long[8];
2163: data[0] = -17179870216L;
2164: data[1] = -268435457L;
2165: for (int i = 2; i <= 3; i++) {
2166: data[i] = -1L;
2167: }
2168: return data;
2169: }
2170:
2171: public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
2172:
2173: private static final long[] mk_tokenSet_4() {
2174: long[] data = new long[8];
2175: data[0] = -17179878408L;
2176: data[1] = -671088641L;
2177: for (int i = 2; i <= 3; i++) {
2178: data[i] = -1L;
2179: }
2180: return data;
2181: }
2182:
2183: public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
2184:
2185: private static final long[] mk_tokenSet_5() {
2186: long[] data = new long[8];
2187: data[0] = -566935683080L;
2188: for (int i = 1; i <= 3; i++) {
2189: data[i] = -1L;
2190: }
2191: return data;
2192: }
2193:
2194: public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
2195:
2196: private static final long[] mk_tokenSet_6() {
2197: long[] data = { 4294977024L, 0L, 0L, 0L, 0L };
2198: return data;
2199: }
2200:
2201: public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
2202:
2203: }
|