📄 extendedslparsertokenmanager.java
字号:
jjAddStates(28, 30);
break;
case 8:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 7;
break;
case 15:
case 16:
if (kind > 20)
kind = 20;
jjCheckNAdd(16);
break;
case 19:
case 20:
if (kind > 7)
kind = 7;
jjCheckNAdd(20);
break;
case 22:
jjAddStates(41, 43);
break;
case 24:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 23;
break;
case 29:
if ((0x100000001000L & l) != 0L && kind > 10)
kind = 10;
break;
case 32:
if ((0x2000000020L & l) != 0L)
jjAddStates(55, 56);
break;
case 36:
if ((0x2000000020L & l) != 0L)
jjAddStates(57, 58);
break;
case 41:
if ((0x4000000040L & l) != 0L && kind > 13)
kind = 13;
break;
case 60:
if ((0x10000000100000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 61;
break;
case 70:
if ((0x7fffffe07fffffeL & l) != 0L && kind > 18)
kind = 18;
break;
case 73:
case 74:
if (kind > 16)
kind = 16;
jjCheckNAdd(74);
break;
case 76:
jjAddStates(52, 54);
break;
case 78:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 77;
break;
default : break;
}
} while(i != startsAt);
}
else
{
int hiByte = (int)(curChar >> 8);
int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
MatchLoop: do
{
switch(jjstateSet[--i])
{
case 3:
case 4:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
if (kind > 14)
kind = 14;
jjCheckNAdd(4);
break;
case 6:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
jjAddStates(28, 30);
break;
case 15:
case 16:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
if (kind > 20)
kind = 20;
jjCheckNAdd(16);
break;
case 19:
case 20:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
if (kind > 7)
kind = 7;
jjCheckNAdd(20);
break;
case 22:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
jjAddStates(41, 43);
break;
case 73:
case 74:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
if (kind > 16)
kind = 16;
jjCheckNAdd(74);
break;
case 76:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
jjAddStates(52, 54);
break;
default : break;
}
} while(i != startsAt);
}
if (kind != 0x7fffffff)
{
jjmatchedKind = kind;
jjmatchedPos = curPos;
kind = 0x7fffffff;
}
++curPos;
if ((i = jjnewStateCnt) == (startsAt = 80 - (jjnewStateCnt = startsAt)))
return curPos;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { return curPos; }
}
}
static final int[] jjnextStates = { 14, 16, 17, 55, 60, 46, 48, 50, 38, 43, 25, 31, 27, 28, 29, 48, 49, 51, 30, 35, 36, 43, 44, 46, 39, 53, 73, 75, 6, 8, 9, 19, 21, 27, 0, 28, 30, 35, 39, 42, 47, 22, 24, 25, 43, 44, 46, 39, 48, 49, 51, 30, 76, 78, 79, 33, 34, 37, 38, };
private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
{
switch(hiByte)
{
case 0:
return ((jjbitVec2[i2] & l2) != 0L);
default :
if ((jjbitVec0[i1] & l1) != 0L)
return true;
return false;
}
}
public static final String[] jjstrLiteralImages = {
"", null, null, null, null, "\50", "\51", null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, "\50",
"\51", null, null, null, null, null, null, null, null, null, null, null, null, };
public static final String[] lexStateNames = {
"DEFAULT",
"OPERATORSTATE",
};
public static final int[] jjnewLexState = { -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
static final long[] jjtoToken = { 0x7ffe1fffe1L, };
static final long[] jjtoSkip = { 0x1e0001eL, };
protected SimpleCharStream input_stream;
private final int[] jjrounds = new int[80];
private final int[] jjstateSet = new int[160];
StringBuffer image;
int jjimageLen;
int lengthOfMatch;
protected char curChar;
public ExtendedSLParserTokenManager(SimpleCharStream stream){
if (SimpleCharStream.staticFlag)
throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
input_stream = stream;
}
public ExtendedSLParserTokenManager(SimpleCharStream stream, int lexState){
this(stream);
SwitchTo(lexState);
}
public void ReInit(SimpleCharStream stream)
{
jjmatchedPos = jjnewStateCnt = 0;
curLexState = defaultLexState;
input_stream = stream;
ReInitRounds();
}
private final void ReInitRounds()
{
int i;
jjround = 0x80000001;
for (i = 80; i-- > 0;)
jjrounds[i] = 0x80000000;
}
public void ReInit(SimpleCharStream stream, int lexState)
{
ReInit(stream);
SwitchTo(lexState);
}
public void SwitchTo(int lexState)
{
if (lexState >= 2 || lexState < 0)
throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
else
curLexState = lexState;
}
protected Token jjFillToken()
{
Token t = Token.newToken(jjmatchedKind);
t.kind = jjmatchedKind;
String im = jjstrLiteralImages[jjmatchedKind];
t.image = (im == null) ? input_stream.GetImage() : im;
t.beginLine = input_stream.getBeginLine();
t.beginColumn = input_stream.getBeginColumn();
t.endLine = input_stream.getEndLine();
t.endColumn = input_stream.getEndColumn();
return t;
}
int curLexState = 0;
int defaultLexState = 0;
int jjnewStateCnt;
int jjround;
int jjmatchedPos;
int jjmatchedKind;
public Token getNextToken()
{
int kind;
Token specialToken = null;
Token matchedToken;
int curPos = 0;
EOFLoop : for (;;)
{
try
{
curChar = input_stream.BeginToken();
}
catch(java.io.IOException e)
{
jjmatchedKind = 0;
matchedToken = jjFillToken();
return matchedToken;
}
image = null;
jjimageLen = 0;
switch(curLexState)
{
case 0:
try { input_stream.backup(0);
while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
curChar = input_stream.BeginToken();
}
catch (java.io.IOException e1) { continue EOFLoop; }
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_0();
break;
case 1:
try { input_stream.backup(0);
while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
curChar = input_stream.BeginToken();
}
catch (java.io.IOException e1) { continue EOFLoop; }
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_1();
break;
}
if (jjmatchedKind != 0x7fffffff)
{
if (jjmatchedPos + 1 < curPos)
input_stream.backup(curPos - jjmatchedPos - 1);
if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
TokenLexicalActions(matchedToken);
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
return matchedToken;
}
else
{
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
continue EOFLoop;
}
}
int error_line = input_stream.getEndLine();
int error_column = input_stream.getEndColumn();
String error_after = null;
boolean EOFSeen = false;
try { input_stream.readChar(); input_stream.backup(1); }
catch (java.io.IOException e1) {
EOFSeen = true;
error_after = curPos <= 1 ? "" : input_stream.GetImage();
if (curChar == '\n' || curChar == '\r') {
error_line++;
error_column = 0;
}
else
error_column++;
}
if (!EOFSeen) {
input_stream.backup(1);
error_after = curPos <= 1 ? "" : input_stream.GetImage();
}
throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
}
}
void TokenLexicalActions(Token matchedToken)
{
switch(jjmatchedKind)
{
case 19 :
if (image == null)
image = new StringBuffer();
image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
String tmp = matchedToken.image.substring(1,matchedToken.image.length()-1);
int numBytes = Integer.parseInt(tmp);
if (numBytes < 0) {
throw new TokenMgrError("ERROR: PrefixByteLengthEncodedString with length < 0",
TokenMgrError.STATIC_LEXER_ERROR);
}
char[] bytes = new char[numBytes];
int i = 0;
while (numBytes-- > 0)
try {
bytes[i++] = input_stream.readChar();
}
catch (IOException e) {
System.out.println("IOException during PREFIXBYTELENGTHENCODEDSTRING");
throw new TokenMgrError(true, curLexState, input_stream.getEndLine(),
input_stream.getEndColumn(),input_stream.GetImage(),
curChar, TokenMgrError.LEXICAL_ERROR);
}
// If you want, you can add bytes to matchedToken.image here.
matchedToken.image = new String(bytes);
break;
default :
break;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -