/*
* Copyright 1997-2000 Reto Kramer
* Copyright 2006 John Swapceinski
* Copyright 2006, 2008 Johan Stuyts
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sf.jcontracts.codeparser;
import java.io.Reader;
import java.util.Hashtable;
import net.sf.jcontracts.antlr.ANTLRHashString;
import net.sf.jcontracts.antlr.CharBufferNoBacktrackingNoInteractive;
import net.sf.jcontracts.antlr.CharScannerNoBacktrackingNoInteractive;
import net.sf.jcontracts.antlr.ScannerException;
import net.sf.jcontracts.antlr.Token;
import net.sf.jcontracts.antlr.Tokenizer;
import net.sf.jcontracts.antlr.collections.impl.BitSet;
public class JavaLexer extends CharScannerNoBacktrackingNoInteractive implements JavaTokenTypes, Tokenizer
{
private Object data_;
private int position_;
private int suspectedTokenStartPosition_;
private int lastNewlinePosition_;
private static final long TOKEN_SET_0_DATA[] =
{
0xfffffbfffffffff8L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
};
private static final BitSet TOKEN_SET_0 = new BitSet(TOKEN_SET_0_DATA);
private static final long TOKEN_SET_1_DATA[] =
{
0x3ff400000000000L, 0L, 0L, 0L, 0L
};
private static final BitSet TOKEN_SET_1 = new BitSet(TOKEN_SET_1_DATA);
private static final long TOKEN_SET_2_DATA[] =
{
-1032L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
};
private static final BitSet TOKEN_SET_2 = new BitSet(TOKEN_SET_2_DATA);
private static final long TOKEN_SET_3_DATA[] =
{
0xfffffbfffffffbf8L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
};
private static final BitSet TOKEN_SET_3 = new BitSet(TOKEN_SET_3_DATA);
private static final long TOKEN_SET_4_DATA[] =
{
0xfffffffefffffdf8L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
};
private static final BitSet TOKEN_SET_4 = new BitSet(TOKEN_SET_4_DATA);
private static final long TOKEN_SET_5_DATA[] =
{
0L, 0x5000000050L, 0L, 0L, 0L
};
private static final BitSet TOKEN_SET_5 = new BitSet(TOKEN_SET_5_DATA);
private static final long TOKEN_SET_6_DATA[] =
{
0x3ff000000000000L, 0x7e0000007eL, 0L, 0L, 0L
};
private static final BitSet TOKEN_SET_6 = new BitSet(TOKEN_SET_6_DATA);
private static final long TOKEN_SET_7_DATA[] =
{
0x400000000000L, 0x7000000070L, 0L, 0L, 0L
};
private static final BitSet TOKEN_SET_7 = new BitSet(TOKEN_SET_7_DATA);
public JavaLexer(CharBufferNoBacktrackingNoInteractive characterBuffer)
{
super(characterBuffer);
literals_ = new Hashtable();
literals_.put(new ANTLRHashString("synchronized", this), new Integer(32));
literals_.put(new ANTLRHashString("throws", this), new Integer(44));
literals_.put(new ANTLRHashString("long", this), new Integer(17));
literals_.put(new ANTLRHashString("true", this), new Integer(99));
literals_.put(new ANTLRHashString("transient", this), new Integer(26));
literals_.put(new ANTLRHashString("protected", this), new Integer(24));
literals_.put(new ANTLRHashString("false", this), new Integer(100));
literals_.put(new ANTLRHashString("void", this), new Integer(10));
literals_.put(new ANTLRHashString("instanceof", this), new Integer(96));
literals_.put(new ANTLRHashString("int", this), new Integer(15));
literals_.put(new ANTLRHashString("package", this), new Integer(5));
literals_.put(new ANTLRHashString("class", this), new Integer(34));
literals_.put(new ANTLRHashString("static", this), new Integer(25));
literals_.put(new ANTLRHashString("const", this), new Integer(33));
literals_.put(new ANTLRHashString("while", this), new Integer(49));
literals_.put(new ANTLRHashString("char", this), new Integer(13));
literals_.put(new ANTLRHashString("short", this), new Integer(14));
literals_.put(new ANTLRHashString("abstract", this), new Integer(28));
literals_.put(new ANTLRHashString("for", this), new Integer(48));
literals_.put(new ANTLRHashString("if", this), new Integer(46));
literals_.put(new ANTLRHashString("extends", this), new Integer(38));
literals_.put(new ANTLRHashString("native", this), new Integer(29));
literals_.put(new ANTLRHashString("volatile", this), new Integer(30));
literals_.put(new ANTLRHashString("import", this), new Integer(6));
literals_.put(new ANTLRHashString("do", this), new Integer(50));
literals_.put(new ANTLRHashString("interface", this), new Integer(35));
literals_.put(new ANTLRHashString("try", this), new Integer(59));
literals_.put(new ANTLRHashString("else", this), new Integer(47));
literals_.put(new ANTLRHashString("public", this), new Integer(23));
literals_.put(new ANTLRHashString("continue", this), new Integer(52));
literals_.put(new ANTLRHashString("throw", this), new Integer(57));
literals_.put(new ANTLRHashString("return", this), new Integer(53));
literals_.put(new ANTLRHashString("final", this), new Integer(27));
literals_.put(new ANTLRHashString("switch", this), new Integer(54));
literals_.put(new ANTLRHashString("super", this), new Integer(98));
literals_.put(new ANTLRHashString("catch", this), new Integer(61));
literals_.put(new ANTLRHashString("new", this), new Integer(102));
literals_.put(new ANTLRHashString("this", this), new Integer(97));
literals_.put(new ANTLRHashString("float", this), new Integer(16));
literals_.put(new ANTLRHashString("goto", this), new Integer(58));
literals_.put(new ANTLRHashString("private", this), new Integer(22));
literals_.put(new ANTLRHashString("double", this), new Integer(18));
literals_.put(new ANTLRHashString("finally", this), new Integer(60));
literals_.put(new ANTLRHashString("implements", this), new Integer(40));
literals_.put(new ANTLRHashString("break", this), new Integer(51));
literals_.put(new ANTLRHashString("null", this), new Integer(101));
literals_.put(new ANTLRHashString("case", this), new Integer(55));
literals_.put(new ANTLRHashString("default", this), new Integer(56));
literals_.put(new ANTLRHashString("byte", this), new Integer(12));
literals_.put(new ANTLRHashString("boolean", this), new Integer(11));
literals_.put(new ANTLRHashString("threadsafe", this), new Integer(31));
caseSensitiveLiterals_ = true;
}
public JavaLexer(Reader reader)
{
this(new CharBufferNoBacktrackingNoInteractive(reader));
}
public void consume()
{
super.consume();
position_++;
}
protected Object getData()
{
return data_;
}
int getDistanceToLastNewline()
{
return suspectedTokenStartPosition_ - lastNewlinePosition_;
}
int getPosition()
{
return position_;
}
public Token makeToken(int typeId)
{
ExtendedToken result = (ExtendedToken) super.makeToken(typeId);
result.setStartEnd(suspectedTokenStartPosition_, getPosition());
result.setCharDistanceToLastNewline(getDistanceToLastNewline());
result.setData(getData());
return result;
}
public final void mASSIGN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('=');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.ASSIGN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mBAND(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('&');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.BAND);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mBAND_ASSIGN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("&=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.BAND_ASSIGN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mBNOT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('~');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.BNOT);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mBOR(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('|');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.BOR);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mBOR_ASSIGN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("|=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.BOR_ASSIGN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mBSR(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match(">>>");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.BSR);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mBSR_ASSIGN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match(">>>=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.BSR_ASSIGN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mBXOR(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('^');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.BXOR);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mBXOR_ASSIGN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("^=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.BXOR_ASSIGN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mCHAR_LITERAL(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('\'');
switch (la_1)
{
case 92: // '\\'
mESC(false);
break;
case 3: // '\003'
case 4: // '\004'
case 5: // '\005'
case 6: // '\006'
case 7: // '\007'
case 8: // '\b'
case 9: // '\t'
case 10: // '\n'
case 11: // '\013'
case 12: // '\f'
case 13: // '\r'
case 14: // '\016'
case 15: // '\017'
case 16: // '\020'
case 17: // '\021'
case 18: // '\022'
case 19: // '\023'
case 20: // '\024'
case 21: // '\025'
case 22: // '\026'
case 23: // '\027'
case 24: // '\030'
case 25: // '\031'
case 26: // '\032'
case 27: // '\033'
case 28: // '\034'
case 29: // '\035'
case 30: // '\036'
case 31: // '\037'
case 32: // ' '
case 33: // '!'
case 34: // '"'
case 35: // '#'
case 36: // '$'
case 37: // '%'
case 38: // '&'
case 40: // '('
case 41: // ')'
case 42: // '*'
case 43: // '+'
case 44: // ','
case 45: // '-'
case 46: // '.'
case 47: // '/'
case 48: // '0'
case 49: // '1'
case 50: // '2'
case 51: // '3'
case 52: // '4'
case 53: // '5'
case 54: // '6'
case 55: // '7'
case 56: // '8'
case 57: // '9'
case 58: // ':'
case 59: // ';'
case 60: // '<'
case 61: // '='
case 62: // '>'
case 63: // '?'
case 64: // '@'
case 65: // 'A'
case 66: // 'B'
case 67: // 'C'
case 68: // 'D'
case 69: // 'E'
case 70: // 'F'
case 71: // 'G'
case 72: // 'H'
case 73: // 'I'
case 74: // 'J'
case 75: // 'K'
case 76: // 'L'
case 77: // 'M'
case 78: // 'N'
case 79: // 'O'
case 80: // 'P'
case 81: // 'Q'
case 82: // 'R'
case 83: // 'S'
case 84: // 'T'
case 85: // 'U'
case 86: // 'V'
case 87: // 'W'
case 88: // 'X'
case 89: // 'Y'
case 90: // 'Z'
case 91: // '['
case 93: // ']'
case 94: // '^'
case 95: // '_'
case 96: // '`'
case 97: // 'a'
case 98: // 'b'
case 99: // 'c'
case 100: // 'd'
case 101: // 'e'
case 102: // 'f'
case 103: // 'g'
case 104: // 'h'
case 105: // 'i'
case 106: // 'j'
case 107: // 'k'
case 108: // 'l'
case 109: // 'm'
case 110: // 'n'
case 111: // 'o'
case 112: // 'p'
case 113: // 'q'
case 114: // 'r'
case 115: // 's'
case 116: // 't'
case 117: // 'u'
case 118: // 'v'
case 119: // 'w'
case 120: // 'x'
case 121: // 'y'
case 122: // 'z'
case 123: // '{'
case 124: // '|'
case 125: // '}'
case 126: // '~'
case 127: // '\177'
case 128:
case 129:
case 130:
case 131:
case 132:
case 133:
case 134:
case 135:
case 136:
case 137:
case 138:
case 139:
case 140:
case 141:
case 142:
case 143:
case 144:
case 145:
case 146:
case 147:
case 148:
case 149:
case 150:
case 151:
case 152:
case 153:
case 154:
case 155:
case 156:
case 157:
case 158:
case 159:
case 160:
case 161:
case 162:
case 163:
case 164:
case 165:
case 166:
case 167:
case 168:
case 169:
case 170:
case 171:
case 172:
case 173:
case 174:
case 175:
case 176:
case 177:
case 178:
case 179:
case 180:
case 181:
case 182:
case 183:
case 184:
case 185:
case 186:
case 187:
case 188:
case 189:
case 190:
case 191:
case 192:
case 193:
case 194:
case 195:
case 196:
case 197:
case 198:
case 199:
case 200:
case 201:
case 202:
case 203:
case 204:
case 205:
case 206:
case 207:
case 208:
case 209:
case 210:
case 211:
case 212:
case 213:
case 214:
case 215:
case 216:
case 217:
case 218:
case 219:
case 220:
case 221:
case 222:
case 223:
case 224:
case 225:
case 226:
case 227:
case 228:
case 229:
case 230:
case 231:
case 232:
case 233:
case 234:
case 235:
case 236:
case 237:
case 238:
case 239:
case 240:
case 241:
case 242:
case 243:
case 244:
case 245:
case 246:
case 247:
case 248:
case 249:
case 250:
case 251:
case 252:
case 253:
case 254:
case 255:
matchNot('\'');
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
match('\'');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.CHAR_LITERAL);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mCODE_COMMENT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
char character = '\0';
CodeComment codeComment = new CodeComment();
match("/**");
String title = mCODE_COMMENT_STRING(false, false);
codeComment.setTitle(title);
do
{
switch (la_1)
{
case 10: // '\n'
match('\n');
newline();
continue;
case 3: // '\003'
case 4: // '\004'
case 5: // '\005'
case 6: // '\006'
case 7: // '\007'
case 8: // '\b'
case 9: // '\t'
case 11: // '\013'
case 12: // '\f'
case 13: // '\r'
case 14: // '\016'
case 15: // '\017'
case 16: // '\020'
case 17: // '\021'
case 18: // '\022'
case 19: // '\023'
case 20: // '\024'
case 21: // '\025'
case 22: // '\026'
case 23: // '\027'
case 24: // '\030'
case 25: // '\031'
case 26: // '\032'
case 27: // '\033'
case 28: // '\034'
case 29: // '\035'
case 30: // '\036'
case 31: // '\037'
case 32: // ' '
case 33: // '!'
case 34: // '"'
case 35: // '#'
case 36: // '$'
case 37: // '%'
case 38: // '&'
case 39: // '\''
case 40: // '('
case 41: // ')'
case 43: // '+'
case 44: // ','
case 45: // '-'
case 46: // '.'
case 47: // '/'
case 48: // '0'
case 49: // '1'
case 50: // '2'
case 51: // '3'
case 52: // '4'
case 53: // '5'
case 54: // '6'
case 55: // '7'
case 56: // '8'
case 57: // '9'
case 58: // ':'
case 59: // ';'
case 60: // '<'
case 61: // '='
case 62: // '>'
case 63: // '?'
case 64: // '@'
case 65: // 'A'
case 66: // 'B'
case 67: // 'C'
case 68: // 'D'
case 69: // 'E'
case 70: // 'F'
case 71: // 'G'
case 72: // 'H'
case 73: // 'I'
case 74: // 'J'
case 75: // 'K'
case 76: // 'L'
case 77: // 'M'
case 78: // 'N'
case 79: // 'O'
case 80: // 'P'
case 81: // 'Q'
case 82: // 'R'
case 83: // 'S'
case 84: // 'T'
case 85: // 'U'
case 86: // 'V'
case 87: // 'W'
case 88: // 'X'
case 89: // 'Y'
case 90: // 'Z'
case 91: // '['
case 92: // '\\'
case 93: // ']'
case 94: // '^'
case 95: // '_'
case 96: // '`'
case 97: // 'a'
case 98: // 'b'
case 99: // 'c'
case 100: // 'd'
case 101: // 'e'
case 102: // 'f'
case 103: // 'g'
case 104: // 'h'
case 105: // 'i'
case 106: // 'j'
case 107: // 'k'
case 108: // 'l'
case 109: // 'm'
case 110: // 'n'
case 111: // 'o'
case 112: // 'p'
case 113: // 'q'
case 114: // 'r'
case 115: // 's'
case 116: // 't'
case 117: // 'u'
case 118: // 'v'
case 119: // 'w'
case 120: // 'x'
case 121: // 'y'
case 122: // 'z'
case 123: // '{'
case 124: // '|'
case 125: // '}'
case 126: // '~'
case 127: // '\177'
case 128:
case 129:
case 130:
case 131:
case 132:
case 133:
case 134:
case 135:
case 136:
case 137:
case 138:
case 139:
case 140:
case 141:
case 142:
case 143:
case 144:
case 145:
case 146:
case 147:
case 148:
case 149:
case 150:
case 151:
case 152:
case 153:
case 154:
case 155:
case 156:
case 157:
case 158:
case 159:
case 160:
case 161:
case 162:
case 163:
case 164:
case 165:
case 166:
case 167:
case 168:
case 169:
case 170:
case 171:
case 172:
case 173:
case 174:
case 175:
case 176:
case 177:
case 178:
case 179:
case 180:
case 181:
case 182:
case 183:
case 184:
case 185:
case 186:
case 187:
case 188:
case 189:
case 190:
case 191:
case 192:
case 193:
case 194:
case 195:
case 196:
case 197:
case 198:
case 199:
case 200:
case 201:
case 202:
case 203:
case 204:
case 205:
case 206:
case 207:
case 208:
case 209:
case 210:
case 211:
case 212:
case 213:
case 214:
case 215:
case 216:
case 217:
case 218:
case 219:
case 220:
case 221:
case 222:
case 223:
case 224:
case 225:
case 226:
case 227:
case 228:
case 229:
case 230:
case 231:
case 232:
case 233:
case 234:
case 235:
case 236:
case 237:
case 238:
case 239:
case 240:
case 241:
case 242:
case 243:
case 244:
case 245:
case 246:
case 247:
case 248:
case 249:
case 250:
case 251:
case 252:
case 253:
case 254:
case 255:
match(TOKEN_SET_3);
continue;
}
if (la_1 == '*' && la_2 == ' ' && LA(3) == '@' && LA(4) >= '\003' && LA(4) <= '\377')
{
match("* @");
if (la_1 >= '\003' && la_1 <= '\377' && la_2 >= '\003' && la_2 <= '\377' && LA(3) >= '\003'
&& LA(3) <= '\377')
{
StringBuffer strbuf = new StringBuffer();
while (TOKEN_SET_4.member(la_1))
{
character = la_1;
match(TOKEN_SET_4);
strbuf.append(character);
}
switch (la_1)
{
case 32: // ' '
match(' ');
break;
case 9: // '\t'
match('\t');
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
String entry = mCODE_COMMENT_STRING(false, false);
codeComment.addTagEntry(strbuf.toString(), entry);
}
else if (la_1 < '\003' || la_1 > '\377' || la_2 < '\003' || la_2 > '\377')
{
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
continue;
}
if (la_1 == '*' && la_2 >= '\003' && la_2 <= '\377' && LA(3) >= '\003' && LA(3) <= '\377' && LA(2) != ' '
&& LA(2) != '/')
{
match('*');
continue;
}
if (la_1 != '*' || la_2 < '\003' || la_2 > '\377' || LA(3) < '\003' || LA(3) > '\377' || LA(2) != ' '
|| LA(3) == '@')
{
break;
}
match('*');
}
while (true);
match("*/");
setData(codeComment);
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.CODE_COMMENT);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
protected final String mCODE_COMMENT_STRING(boolean mustCreateToken, boolean preserveCRs) throws ScannerException
{
Token token = null;
int begin = text.length();
String str = null;
StringBuffer strbuf = new StringBuffer();
boolean spaceAdded = false;
label0: do
{
label1:
{
if (la_1 != '\n' && la_1 != '\r' || la_2 < '\003' || la_2 > '\377' || LA(3) < '\003' || LA(3) > '\377')
{
break label1;
}
int _cnt = 0;
do
{
if ((la_1 == '\n' || la_1 == '\r') && la_2 >= '\003' && la_2 <= '\377' && LA(3) >= '\003'
&& LA(3) <= '\377')
{
while (la_1 == '\r')
{
match('\r');
}
match('\n');
newline();
if (preserveCRs)
{
strbuf.append("\r\n");
}
}
else
{
if (_cnt < 1)
{
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
break;
}
_cnt++;
}
while (true);
if (!preserveCRs && !spaceAdded)
{
strbuf.append(' ');
}
spaceAdded = true;
while (TOKEN_SET_0.member(la_1) && la_2 >= '\003' && la_2 <= '\377' && LA(3) >= '\003'
&& LA(3) <= '\377')
{
matchNot('*');
}
do
{
if (la_1 != '*' || la_2 < '\003' || la_2 > '\377' || LA(3) < '\003' || LA(3) > '\377'
|| (LA(2) == ' ' || LA(2) == '/') && (LA(2) != ' ' || LA(3) == '@'))
{
continue label0;
}
match('*');
do
{
while (la_1 == ' ' && la_2 >= '\003' && la_2 <= '\377' && LA(3) >= '\003' && LA(3) <= '\377')
{
match(' ');
}
if (la_1 != '\t' || la_2 < '\003' || la_2 > '\377' || LA(3) < '\003' || LA(3) > '\377')
{
break;
}
match('\t');
}
while (true);
}
while (true);
}
if (la_1 == '*' && la_2 >= '\003' && la_2 <= '\377' && LA(3) >= '\003' && LA(3) <= '\377' && LA(2) != ' '
&& LA(2) != '/')
{
char ct0 = la_1;
match('*');
strbuf.append(ct0);
spaceAdded = false;
continue;
}
if (la_1 == '*' && la_2 >= '\003' && la_2 <= '\377' && LA(3) >= '\003' && LA(3) <= '\377' && LA(2) == ' '
&& LA(3) != '@')
{
char ct1 = la_1;
match('*');
strbuf.append(ct1);
spaceAdded = false;
continue;
}
if (la_1 < '\003' || la_1 > '\376' || la_2 < '\003' || la_2 > '\377' || LA(3) < '\003' || LA(3) > '\377'
|| (LA(2) == ' ' || LA(2) == '/') && (LA(2) != ' ' || LA(3) == '@'))
{
break;
}
char ct2 = la_1;
matchNot('\377');
strbuf.append(ct2);
spaceAdded = false;
}
while (true);
str = strbuf.toString().trim();
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.CODE_COMMENT_STRING);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
return str;
}
public final void mCOLON(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match(':');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.COLON);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mCOMMA(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match(',');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.COMMA);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mDEC(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("--");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.DEC);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
protected final void mDIGIT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
matchRange('0', '9');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.DIGIT);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mDIV(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('/');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.DIV);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mDIV_ASSIGN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("/=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.DIV_ASSIGN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mDOT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('.');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.DOT);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mEQUAL(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("==");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.EQUAL);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
protected final void mESC(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('\\');
switch (la_1)
{
case 110: // 'n'
match('n');
break;
case 114: // 'r'
match('r');
break;
case 116: // 't'
match('t');
break;
case 98: // 'b'
match('b');
break;
case 102: // 'f'
match('f');
break;
case 117: // 'u'
match('u');
mHEX_DIGIT(false);
mHEX_DIGIT(false);
mHEX_DIGIT(false);
mHEX_DIGIT(false);
break;
case 34: // '"'
match('"');
break;
case 39: // '\''
match('\'');
break;
case 92: // '\\'
match('\\');
break;
case 48: // '0'
case 49: // '1'
case 50: // '2'
case 51: // '3'
matchRange('0', '3');
if (la_1 >= '0' && la_1 <= '9' && la_2 >= '\003' && la_2 <= '\377')
{
mDIGIT(false);
if (la_1 >= '0' && la_1 <= '9' && la_2 >= '\003' && la_2 <= '\377')
{
mDIGIT(false);
}
}
break;
case 52: // '4'
case 53: // '5'
case 54: // '6'
case 55: // '7'
matchRange('4', '7');
if (la_1 >= '0' && la_1 <= '9' && la_2 >= '\003' && la_2 <= '\377')
{
mDIGIT(false);
}
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.ESC);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
protected final void mEXPONENT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
switch (la_1)
{
case 101: // 'e'
match('e');
break;
case 69: // 'E'
match('E');
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
switch (la_1)
{
case 43: // '+'
match('+');
break;
case 45: // '-'
match('-');
break;
}
int _cnt = 0;
do
{
if (la_1 >= '0' && la_1 <= '9')
{
matchRange('0', '9');
}
else
{
if (_cnt < 1)
{
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
break;
}
_cnt++;
}
while (true);
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.EXPONENT);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
protected final void mFLOAT_SUFFIX(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
switch (la_1)
{
case 102: // 'f'
match('f');
break;
case 70: // 'F'
match('F');
break;
case 100: // 'd'
match('d');
break;
case 68: // 'D'
match('D');
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.FLOAT_SUFFIX);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mGE(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match(">=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.GE);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mGT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match(">");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.GT);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
protected final void mHEX_DIGIT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
switch (la_1)
{
case 48: // '0'
case 49: // '1'
case 50: // '2'
case 51: // '3'
case 52: // '4'
case 53: // '5'
case 54: // '6'
case 55: // '7'
case 56: // '8'
case 57: // '9'
mDIGIT(false);
break;
case 97: // 'a'
case 98: // 'b'
case 99: // 'c'
case 100: // 'd'
case 101: // 'e'
case 102: // 'f'
matchRange('a', 'f');
break;
case 65: // 'A'
case 66: // 'B'
case 67: // 'C'
case 68: // 'D'
case 69: // 'E'
case 70: // 'F'
matchRange('A', 'F');
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.HEX_DIGIT);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mIDENT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
int tokenTypeId = JavaTokenTypes.IDENT;
switch (la_1)
{
case 97: // 'a'
case 98: // 'b'
case 99: // 'c'
case 100: // 'd'
case 101: // 'e'
case 102: // 'f'
case 103: // 'g'
case 104: // 'h'
case 105: // 'i'
case 106: // 'j'
case 107: // 'k'
case 108: // 'l'
case 109: // 'm'
case 110: // 'n'
case 111: // 'o'
case 112: // 'p'
case 113: // 'q'
case 114: // 'r'
case 115: // 's'
case 116: // 't'
case 117: // 'u'
case 118: // 'v'
case 119: // 'w'
case 120: // 'x'
case 121: // 'y'
case 122: // 'z'
matchRange('a', 'z');
break;
case 65: // 'A'
case 66: // 'B'
case 67: // 'C'
case 68: // 'D'
case 69: // 'E'
case 70: // 'F'
case 71: // 'G'
case 72: // 'H'
case 73: // 'I'
case 74: // 'J'
case 75: // 'K'
case 76: // 'L'
case 77: // 'M'
case 78: // 'N'
case 79: // 'O'
case 80: // 'P'
case 81: // 'Q'
case 82: // 'R'
case 83: // 'S'
case 84: // 'T'
case 85: // 'U'
case 86: // 'V'
case 87: // 'W'
case 88: // 'X'
case 89: // 'Y'
case 90: // 'Z'
matchRange('A', 'Z');
break;
case 95: // '_'
match('_');
break;
case 36: // '$'
match('$');
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
label0: do
{
switch (la_1)
{
case 97: // 'a'
case 98: // 'b'
case 99: // 'c'
case 100: // 'd'
case 101: // 'e'
case 102: // 'f'
case 103: // 'g'
case 104: // 'h'
case 105: // 'i'
case 106: // 'j'
case 107: // 'k'
case 108: // 'l'
case 109: // 'm'
case 110: // 'n'
case 111: // 'o'
case 112: // 'p'
case 113: // 'q'
case 114: // 'r'
case 115: // 's'
case 116: // 't'
case 117: // 'u'
case 118: // 'v'
case 119: // 'w'
case 120: // 'x'
case 121: // 'y'
case 122: // 'z'
matchRange('a', 'z');
break;
case 65: // 'A'
case 66: // 'B'
case 67: // 'C'
case 68: // 'D'
case 69: // 'E'
case 70: // 'F'
case 71: // 'G'
case 72: // 'H'
case 73: // 'I'
case 74: // 'J'
case 75: // 'K'
case 76: // 'L'
case 77: // 'M'
case 78: // 'N'
case 79: // 'O'
case 80: // 'P'
case 81: // 'Q'
case 82: // 'R'
case 83: // 'S'
case 84: // 'T'
case 85: // 'U'
case 86: // 'V'
case 87: // 'W'
case 88: // 'X'
case 89: // 'Y'
case 90: // 'Z'
matchRange('A', 'Z');
break;
case 95: // '_'
match('_');
break;
case 48: // '0'
case 49: // '1'
case 50: // '2'
case 51: // '3'
case 52: // '4'
case 53: // '5'
case 54: // '6'
case 55: // '7'
case 56: // '8'
case 57: // '9'
matchRange('0', '9');
break;
case 36: // '$'
match('$');
break;
default:
tokenTypeId = testLiteralsTable(tokenTypeId);
break label0;
}
}
while (true);
if (mustCreateToken)
{
token = makeToken(tokenTypeId);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mINC(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("++");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.INC);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mLAND(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("&&");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.LAND);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mLBRACK(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('[');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.LBRACK);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mLCURLY(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('{');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.LCURLY);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mLE(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("<=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.LE);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mLNOT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('!');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.LNOT);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mLOR(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("||");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.LOR);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mLPAREN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('(');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.LPAREN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mLT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('<');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.LT);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mMINUS(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('-');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.MINUS);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mMINUS_ASSIGN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("-=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.MINUS_ASSIGN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mML_COMMENT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("/*");
matchNot('*');
do
{
switch (la_1)
{
case 10: // '\n'
match('\n');
newline();
continue;
case 3: // '\003'
case 4: // '\004'
case 5: // '\005'
case 6: // '\006'
case 7: // '\007'
case 8: // '\b'
case 9: // '\t'
case 11: // '\013'
case 12: // '\f'
case 13: // '\r'
case 14: // '\016'
case 15: // '\017'
case 16: // '\020'
case 17: // '\021'
case 18: // '\022'
case 19: // '\023'
case 20: // '\024'
case 21: // '\025'
case 22: // '\026'
case 23: // '\027'
case 24: // '\030'
case 25: // '\031'
case 26: // '\032'
case 27: // '\033'
case 28: // '\034'
case 29: // '\035'
case 30: // '\036'
case 31: // '\037'
case 32: // ' '
case 33: // '!'
case 34: // '"'
case 35: // '#'
case 36: // '$'
case 37: // '%'
case 38: // '&'
case 39: // '\''
case 40: // '('
case 41: // ')'
case 43: // '+'
case 44: // ','
case 45: // '-'
case 46: // '.'
case 47: // '/'
case 48: // '0'
case 49: // '1'
case 50: // '2'
case 51: // '3'
case 52: // '4'
case 53: // '5'
case 54: // '6'
case 55: // '7'
case 56: // '8'
case 57: // '9'
case 58: // ':'
case 59: // ';'
case 60: // '<'
case 61: // '='
case 62: // '>'
case 63: // '?'
case 64: // '@'
case 65: // 'A'
case 66: // 'B'
case 67: // 'C'
case 68: // 'D'
case 69: // 'E'
case 70: // 'F'
case 71: // 'G'
case 72: // 'H'
case 73: // 'I'
case 74: // 'J'
case 75: // 'K'
case 76: // 'L'
case 77: // 'M'
case 78: // 'N'
case 79: // 'O'
case 80: // 'P'
case 81: // 'Q'
case 82: // 'R'
case 83: // 'S'
case 84: // 'T'
case 85: // 'U'
case 86: // 'V'
case 87: // 'W'
case 88: // 'X'
case 89: // 'Y'
case 90: // 'Z'
case 91: // '['
case 92: // '\\'
case 93: // ']'
case 94: // '^'
case 95: // '_'
case 96: // '`'
case 97: // 'a'
case 98: // 'b'
case 99: // 'c'
case 100: // 'd'
case 101: // 'e'
case 102: // 'f'
case 103: // 'g'
case 104: // 'h'
case 105: // 'i'
case 106: // 'j'
case 107: // 'k'
case 108: // 'l'
case 109: // 'm'
case 110: // 'n'
case 111: // 'o'
case 112: // 'p'
case 113: // 'q'
case 114: // 'r'
case 115: // 's'
case 116: // 't'
case 117: // 'u'
case 118: // 'v'
case 119: // 'w'
case 120: // 'x'
case 121: // 'y'
case 122: // 'z'
case 123: // '{'
case 124: // '|'
case 125: // '}'
case 126: // '~'
case 127: // '\177'
case 128:
case 129:
case 130:
case 131:
case 132:
case 133:
case 134:
case 135:
case 136:
case 137:
case 138:
case 139:
case 140:
case 141:
case 142:
case 143:
case 144:
case 145:
case 146:
case 147:
case 148:
case 149:
case 150:
case 151:
case 152:
case 153:
case 154:
case 155:
case 156:
case 157:
case 158:
case 159:
case 160:
case 161:
case 162:
case 163:
case 164:
case 165:
case 166:
case 167:
case 168:
case 169:
case 170:
case 171:
case 172:
case 173:
case 174:
case 175:
case 176:
case 177:
case 178:
case 179:
case 180:
case 181:
case 182:
case 183:
case 184:
case 185:
case 186:
case 187:
case 188:
case 189:
case 190:
case 191:
case 192:
case 193:
case 194:
case 195:
case 196:
case 197:
case 198:
case 199:
case 200:
case 201:
case 202:
case 203:
case 204:
case 205:
case 206:
case 207:
case 208:
case 209:
case 210:
case 211:
case 212:
case 213:
case 214:
case 215:
case 216:
case 217:
case 218:
case 219:
case 220:
case 221:
case 222:
case 223:
case 224:
case 225:
case 226:
case 227:
case 228:
case 229:
case 230:
case 231:
case 232:
case 233:
case 234:
case 235:
case 236:
case 237:
case 238:
case 239:
case 240:
case 241:
case 242:
case 243:
case 244:
case 245:
case 246:
case 247:
case 248:
case 249:
case 250:
case 251:
case 252:
case 253:
case 254:
case 255:
match(TOKEN_SET_3);
continue;
}
if (la_1 != '*' || la_2 < '\003' || la_2 > '\377' || LA(3) < '\003' || LA(3) > '\377' || LA(2) == '/')
{
break;
}
match('*');
}
while (true);
match("*/");
if (mustCreateToken)
{
token = makeToken(-1);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mMOD(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('%');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.MOD);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mMOD_ASSIGN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("%=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.MOD_ASSIGN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mNOT_EQUAL(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("!=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.NOT_EQUAL);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mNUM_INT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
int tokenTypeId = JavaTokenTypes.NUM_INT;
boolean isDecimal = false;
switch (la_1)
{
case 46: // '.'
match('.');
tokenTypeId = JavaTokenTypes.DOT;
if (la_1 >= '0' && la_1 <= '9')
{
int _cnt = 0;
do
{
if (la_1 >= '0' && la_1 <= '9')
{
matchRange('0', '9');
}
else
{
if (_cnt < 1)
{
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
break;
}
_cnt++;
}
while (true);
if (la_1 == 'E' || la_1 == 'e')
{
mEXPONENT(false);
}
if (TOKEN_SET_5.member(la_1))
{
mFLOAT_SUFFIX(false);
}
tokenTypeId = JavaTokenTypes.NUM_FLOAT;
}
break;
case 48: // '0'
case 49: // '1'
case 50: // '2'
case 51: // '3'
case 52: // '4'
case 53: // '5'
case 54: // '6'
case 55: // '7'
case 56: // '8'
case 57: // '9'
switch (la_1)
{
case 48: // '0'
match('0');
isDecimal = true;
switch (la_1)
{
case 88: // 'X'
case 120: // 'x'
{
switch (la_1)
{
case 120: // 'x'
match('x');
break;
case 88: // 'X'
match('X');
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
int _cnt = 0;
do
{
if (TOKEN_SET_6.member(la_1))
{
mHEX_DIGIT(false);
}
else
{
if (_cnt < 1)
{
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
break;
}
_cnt++;
}
while (true);
break;
}
case 48: // '0'
case 49: // '1'
case 50: // '2'
case 51: // '3'
case 52: // '4'
case 53: // '5'
case 54: // '6'
case 55: // '7'
{
int _cnt = 0;
do
{
if (la_1 >= '0' && la_1 <= '7')
{
matchRange('0', '7');
}
else
{
if (_cnt < 1)
{
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
break;
}
_cnt++;
}
while (true);
break;
}
}
break;
case 49: // '1'
case 50: // '2'
case 51: // '3'
case 52: // '4'
case 53: // '5'
case 54: // '6'
case 55: // '7'
case 56: // '8'
case 57: // '9'
matchRange('1', '9');
while (la_1 >= '0' && la_1 <= '9')
{
matchRange('0', '9');
}
isDecimal = true;
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
if (la_1 == 'L' || la_1 == 'l')
{
switch (la_1)
{
case 108: // 'l'
match('l');
break;
case 76: // 'L'
match('L');
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
}
else if (TOKEN_SET_7.member(la_1) && isDecimal)
{
switch (la_1)
{
case 46: // '.'
match('.');
while (la_1 >= '0' && la_1 <= '9')
{
matchRange('0', '9');
}
if (la_1 == 'E' || la_1 == 'e')
{
mEXPONENT(false);
}
if (TOKEN_SET_5.member(la_1))
{
mFLOAT_SUFFIX(false);
}
break;
case 69: // 'E'
case 101: // 'e'
mEXPONENT(false);
if (TOKEN_SET_5.member(la_1))
{
mFLOAT_SUFFIX(false);
}
break;
case 68: // 'D'
case 70: // 'F'
case 100: // 'd'
case 102: // 'f'
mFLOAT_SUFFIX(false);
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
tokenTypeId = JavaTokenTypes.NUM_FLOAT;
}
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
if (mustCreateToken)
{
token = makeToken(tokenTypeId);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mPLUS(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('+');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.PLUS);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mPLUS_ASSIGN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("+=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.PLUS_ASSIGN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mPREPROC_LINE(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("#");
while (TOKEN_SET_2.member(la_1))
{
matchNot('\n');
}
match('\n');
newline();
if (mustCreateToken)
{
token = makeToken(-1);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mQUESTION(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('?');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.QUESTION);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mRBRACK(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match(']');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.RBRACK);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mRCURLY(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('}');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.RCURLY);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mRPAREN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match(')');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.RPAREN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mSEMI(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match(';');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.SEMI);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mSL(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("<<");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.SL);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mSL_ASSIGN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("<<=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.SL_ASSIGN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mSL_COMMENT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("//");
while (TOKEN_SET_2.member(la_1))
{
matchNot('\n');
}
match('\n');
newline();
if (mustCreateToken)
{
token = makeToken(-1);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mSR(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match(">>");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.SR);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mSR_ASSIGN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match(">>=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.SR_ASSIGN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mSTAR(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('*');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.STAR);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mSTAR_ASSIGN(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("*=");
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.STAR_ASSIGN);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mSTRING_LITERAL(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match('"');
label0: do
{
switch (la_1)
{
case 92: // '\\'
mESC(false);
break;
case 3: // '\003'
case 4: // '\004'
case 5: // '\005'
case 6: // '\006'
case 7: // '\007'
case 8: // '\b'
case 9: // '\t'
case 10: // '\n'
case 11: // '\013'
case 12: // '\f'
case 13: // '\r'
case 14: // '\016'
case 15: // '\017'
case 16: // '\020'
case 17: // '\021'
case 18: // '\022'
case 19: // '\023'
case 20: // '\024'
case 21: // '\025'
case 22: // '\026'
case 23: // '\027'
case 24: // '\030'
case 25: // '\031'
case 26: // '\032'
case 27: // '\033'
case 28: // '\034'
case 29: // '\035'
case 30: // '\036'
case 31: // '\037'
case 32: // ' '
case 33: // '!'
case 35: // '#'
case 36: // '$'
case 37: // '%'
case 38: // '&'
case 39: // '\''
case 40: // '('
case 41: // ')'
case 42: // '*'
case 43: // '+'
case 44: // ','
case 45: // '-'
case 46: // '.'
case 47: // '/'
case 48: // '0'
case 49: // '1'
case 50: // '2'
case 51: // '3'
case 52: // '4'
case 53: // '5'
case 54: // '6'
case 55: // '7'
case 56: // '8'
case 57: // '9'
case 58: // ':'
case 59: // ';'
case 60: // '<'
case 61: // '='
case 62: // '>'
case 63: // '?'
case 64: // '@'
case 65: // 'A'
case 66: // 'B'
case 67: // 'C'
case 68: // 'D'
case 69: // 'E'
case 70: // 'F'
case 71: // 'G'
case 72: // 'H'
case 73: // 'I'
case 74: // 'J'
case 75: // 'K'
case 76: // 'L'
case 77: // 'M'
case 78: // 'N'
case 79: // 'O'
case 80: // 'P'
case 81: // 'Q'
case 82: // 'R'
case 83: // 'S'
case 84: // 'T'
case 85: // 'U'
case 86: // 'V'
case 87: // 'W'
case 88: // 'X'
case 89: // 'Y'
case 90: // 'Z'
case 91: // '['
case 93: // ']'
case 94: // '^'
case 95: // '_'
case 96: // '`'
case 97: // 'a'
case 98: // 'b'
case 99: // 'c'
case 100: // 'd'
case 101: // 'e'
case 102: // 'f'
case 103: // 'g'
case 104: // 'h'
case 105: // 'i'
case 106: // 'j'
case 107: // 'k'
case 108: // 'l'
case 109: // 'm'
case 110: // 'n'
case 111: // 'o'
case 112: // 'p'
case 113: // 'q'
case 114: // 'r'
case 115: // 's'
case 116: // 't'
case 117: // 'u'
case 118: // 'v'
case 119: // 'w'
case 120: // 'x'
case 121: // 'y'
case 122: // 'z'
case 123: // '{'
case 124: // '|'
case 125: // '}'
case 126: // '~'
case 127: // '\177'
case 128:
case 129:
case 130:
case 131:
case 132:
case 133:
case 134:
case 135:
case 136:
case 137:
case 138:
case 139:
case 140:
case 141:
case 142:
case 143:
case 144:
case 145:
case 146:
case 147:
case 148:
case 149:
case 150:
case 151:
case 152:
case 153:
case 154:
case 155:
case 156:
case 157:
case 158:
case 159:
case 160:
case 161:
case 162:
case 163:
case 164:
case 165:
case 166:
case 167:
case 168:
case 169:
case 170:
case 171:
case 172:
case 173:
case 174:
case 175:
case 176:
case 177:
case 178:
case 179:
case 180:
case 181:
case 182:
case 183:
case 184:
case 185:
case 186:
case 187:
case 188:
case 189:
case 190:
case 191:
case 192:
case 193:
case 194:
case 195:
case 196:
case 197:
case 198:
case 199:
case 200:
case 201:
case 202:
case 203:
case 204:
case 205:
case 206:
case 207:
case 208:
case 209:
case 210:
case 211:
case 212:
case 213:
case 214:
case 215:
case 216:
case 217:
case 218:
case 219:
case 220:
case 221:
case 222:
case 223:
case 224:
case 225:
case 226:
case 227:
case 228:
case 229:
case 230:
case 231:
case 232:
case 233:
case 234:
case 235:
case 236:
case 237:
case 238:
case 239:
case 240:
case 241:
case 242:
case 243:
case 244:
case 245:
case 246:
case 247:
case 248:
case 249:
case 250:
case 251:
case 252:
case 253:
case 254:
case 255:
matchNot('"');
break;
default:
match('"');
break label0;
}
}
while (true);
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.STRING_LITERAL);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mTRIV_COMMENT(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
match("/**/");
if (mustCreateToken)
{
token = makeToken(-1);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
protected final void mVOCAB(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
matchRange('\003', '\377');
if (mustCreateToken)
{
token = makeToken(JavaTokenTypes.VOCAB);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public final void mWS(boolean mustCreateToken) throws ScannerException
{
Token token = null;
int begin = text.length();
switch (la_1)
{
case 32: // ' '
match(' ');
break;
case 9: // '\t'
match('\t');
break;
case 12: // '\f'
match('\f');
break;
case 10: // '\n'
case 13: // '\r'
if (la_1 == '\r' && la_2 == '\n')
{
match("\r\n");
}
else if (la_1 == '\r')
{
match('\r');
}
else if (la_1 == '\n')
{
match('\n');
}
else
{
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
newline();
break;
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
if (mustCreateToken)
{
token = makeToken(-1);
token.setText(new String(text.getBuffer(), begin, text.length() - begin));
}
returnToken_ = token;
}
public void newline()
{
super.newline();
lastNewlinePosition_ = getPosition();
}
public Token nextToken()
{
do
{
int tokenTypeId = 0;
resetText();
try
{
switch (la_1)
{
case 63: // '?'
mQUESTION(true);
break;
case 40: // '('
mLPAREN(true);
break;
case 41: // ')'
mRPAREN(true);
break;
case 91: // '['
mLBRACK(true);
break;
case 93: // ']'
mRBRACK(true);
break;
case 123: // '{'
mLCURLY(true);
break;
case 125: // '}'
mRCURLY(true);
break;
case 58: // ':'
mCOLON(true);
break;
case 44: // ','
mCOMMA(true);
break;
case 126: // '~'
mBNOT(true);
break;
case 59: // ';'
mSEMI(true);
break;
case 9: // '\t'
case 10: // '\n'
case 12: // '\f'
case 13: // '\r'
case 32: // ' '
mWS(true);
break;
case 35: // '#'
mPREPROC_LINE(true);
break;
case 39: // '\''
mCHAR_LITERAL(true);
break;
case 34: // '"'
mSTRING_LITERAL(true);
break;
case 36: // '$'
case 65: // 'A'
case 66: // 'B'
case 67: // 'C'
case 68: // 'D'
case 69: // 'E'
case 70: // 'F'
case 71: // 'G'
case 72: // 'H'
case 73: // 'I'
case 74: // 'J'
case 75: // 'K'
case 76: // 'L'
case 77: // 'M'
case 78: // 'N'
case 79: // 'O'
case 80: // 'P'
case 81: // 'Q'
case 82: // 'R'
case 83: // 'S'
case 84: // 'T'
case 85: // 'U'
case 86: // 'V'
case 87: // 'W'
case 88: // 'X'
case 89: // 'Y'
case 90: // 'Z'
case 95: // '_'
case 97: // 'a'
case 98: // 'b'
case 99: // 'c'
case 100: // 'd'
case 101: // 'e'
case 102: // 'f'
case 103: // 'g'
case 104: // 'h'
case 105: // 'i'
case 106: // 'j'
case 107: // 'k'
case 108: // 'l'
case 109: // 'm'
case 110: // 'n'
case 111: // 'o'
case 112: // 'p'
case 113: // 'q'
case 114: // 'r'
case 115: // 's'
case 116: // 't'
case 117: // 'u'
case 118: // 'v'
case 119: // 'w'
case 120: // 'x'
case 121: // 'y'
case 122: // 'z'
mIDENT(true);
break;
default:
if (la_1 == '>' && la_2 == '>' && LA(3) == '>' && LA(4) == '=')
{
mBSR_ASSIGN(true);
break;
}
if (la_1 == '/' && la_2 == '*' && LA(3) == '*' && LA(4) == '/')
{
mTRIV_COMMENT(true);
break;
}
if (la_1 == '/' && la_2 == '*' && LA(3) == '*' && LA(4) >= '\003' && LA(4) <= '\377')
{
mCODE_COMMENT(true);
break;
}
if (la_1 == '>' && la_2 == '>' && LA(3) == '=')
{
mSR_ASSIGN(true);
break;
}
if (la_1 == '>' && la_2 == '>' && LA(3) == '>')
{
mBSR(true);
break;
}
if (la_1 == '<' && la_2 == '<' && LA(3) == '=')
{
mSL_ASSIGN(true);
break;
}
if (la_1 == '/' && la_2 == '*' && TOKEN_SET_0.member(LA(3)))
{
mML_COMMENT(true);
break;
}
if (la_1 == '=' && la_2 == '=')
{
mEQUAL(true);
break;
}
if (la_1 == '!' && la_2 == '=')
{
mNOT_EQUAL(true);
break;
}
if (la_1 == '/' && la_2 == '=')
{
mDIV_ASSIGN(true);
break;
}
if (la_1 == '+' && la_2 == '=')
{
mPLUS_ASSIGN(true);
break;
}
if (la_1 == '+' && la_2 == '+')
{
mINC(true);
break;
}
if (la_1 == '-' && la_2 == '=')
{
mMINUS_ASSIGN(true);
break;
}
if (la_1 == '-' && la_2 == '-')
{
mDEC(true);
break;
}
if (la_1 == '*' && la_2 == '=')
{
mSTAR_ASSIGN(true);
break;
}
if (la_1 == '%' && la_2 == '=')
{
mMOD_ASSIGN(true);
break;
}
if (la_1 == '>' && la_2 == '>')
{
mSR(true);
break;
}
if (la_1 == '>' && la_2 == '=')
{
mGE(true);
break;
}
if (la_1 == '<' && la_2 == '<')
{
mSL(true);
break;
}
if (la_1 == '<' && la_2 == '=')
{
mLE(true);
break;
}
if (la_1 == '^' && la_2 == '=')
{
mBXOR_ASSIGN(true);
break;
}
if (la_1 == '|' && la_2 == '=')
{
mBOR_ASSIGN(true);
break;
}
if (la_1 == '|' && la_2 == '|')
{
mLOR(true);
break;
}
if (la_1 == '&' && la_2 == '=')
{
mBAND_ASSIGN(true);
break;
}
if (la_1 == '&' && la_2 == '&')
{
mLAND(true);
break;
}
if (la_1 == '/' && la_2 == '/')
{
mSL_COMMENT(true);
break;
}
if (la_1 == '.')
{
mDOT(true);
break;
}
if (la_1 == '=')
{
mASSIGN(true);
break;
}
if (la_1 == '!')
{
mLNOT(true);
break;
}
if (la_1 == '/')
{
mDIV(true);
break;
}
if (la_1 == '+')
{
mPLUS(true);
break;
}
if (la_1 == '-')
{
mMINUS(true);
break;
}
if (la_1 == '*')
{
mSTAR(true);
break;
}
if (la_1 == '%')
{
mMOD(true);
break;
}
if (la_1 == '>')
{
mGT(true);
break;
}
if (la_1 == '<')
{
mLT(true);
break;
}
if (la_1 == '^')
{
mBXOR(true);
break;
}
if (la_1 == '|')
{
mBOR(true);
break;
}
if (la_1 == '&')
{
mBAND(true);
break;
}
if (TOKEN_SET_1.member(la_1))
{
mNUM_INT(true);
break;
}
if (LA(1) != '\uFFFF')
{
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
returnToken_ = makeToken(1);
break;
}
tokenTypeId = returnToken_.getType();
if (tokenTypeId != -1)
{
return returnToken_;
}
}
catch (ScannerException e)
{
consume();
reportError(e);
}
}
while (true);
}
public void resetText()
{
super.resetText();
setData(null);
suspectedTokenStartPosition_ = getPosition();
}
protected void setData(Object object)
{
data_ = object;
}
}